text
stringlengths 20
1.01M
| url
stringlengths 14
1.25k
| dump
stringlengths 9
15
⌀ | lang
stringclasses 4
values | source
stringclasses 4
values |
|---|---|---|---|---|
writing.
The stdlib has an obscure module bdb (basic debugger) that is used in both pdb (python debugger) and idlelib.Debugger. The latter can display global and local variable names. I do not know if it does anything other than rereading globals() and locals(). It only works with a file loaded in the editor, so it potentially could read source lines to looks for name binding statements (=, def, class, import) and determine the names just bound. On the other hand, re-reading is probably fast enough for human interaction.
My impression from another issue is that traceing causes the locals dict to be updated with each line, so you do not actually have to have to call locals() with each line. However, that would mean you have to make copies to compare.
My code has this structure:
class Example(wx.Frame,listmix.ColumnSorterMixin):
def __init__(self,parent):
wx.Frame.__init__(self,parent)
self.InitUI()
def InitUI(self):
.....
when a button is clicked this function is called and i take the self.id_number which is a number
def OnB(self, event):
self.id_number = self.text_ctrl_number.GetValue()
aa = latitude[int(self.id_number)]
bb = longitude[int(self.id_number)]
I want to pass the variables aa and bb to a different script called application. This script by calling it with import, automatically pop up a window. I need by clicking the button that is linked with OnB definition to pop up the window from the other script as it does when i am running it alone and display lets say for example the variables aa and bb, how can I do it
I've been using the settrace function to write a tracer for my program, which is working great except that it doesn't seem to work for built-in functions, like open('filename.txt'). This doesn't seem to be documented, so I'm not sure if I'm doing something wrong or that's the expected behavior.
If settrace's behavior in this regard is fixed, is there any way to trace calls to open()? I don't want to use Linux's strace, as it'll run for whole program (not just the part I want) and won't show my python line numbers/file names, etc. The other option I considered was monkey-patching the open function through a wrapper, like:
def wrapped_open(*arg,**kw):
print 'open called'
traceback.print_stack()
f = __builtin__.open(*arg,**kw)
return f
open = wrapped_open
but that seemed very brittle to me. Could someone suggest a better way of doing this?
To loop though an iterator one usually uses a higher-level construct such as a 'for' loop. However, if you want to step through it manually you can do so with next(iter).
I expected the same functionality with the new 'asynchronous iterator' in Python 3.5, but I cannot find it.
I can achieve the desired result by calling 'await aiter.__anext__()', but this is clunky.
Am I missing something?
I know basic of python and I have an xml file created from csv which has three attributes "category", "definition" and "definition description". I want to parse through xml file and identify actors, constraints, principal from the text.
However, I am not sure what is the best way to go. Any suggestion?)
Forgot Your Password?
2018 © Queryhome
|
https://tech.queryhome.com/4209/collecting-variable-assignments-through-settrace
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
This might be a something simple here, but I'm still learning python.
Basically I'm trying to pull an IP address from a hostname, which works fine, but if the host does not resolve it errors. I have it now so that once it resolves the IP address it populates it to a text box, so what i'm trying to do here is if it fails to resolve... To put a message in that text box saying no host found or whatever. I get an error: "socket.gaierror: [Errno 11004] getaddrinfo failed" when it does not resolve.
This is the code i have:
def findip():
host = hname.get() # Pulls host from text box1
ip = gethostbyname(host)
ipaddress.set(ip) #exports to text box2
return
if "gethostbyname fails"
ipaddress.set("Host does not resolve")
else
ipaddress.set(ip)
You have to try and catch the exception, this way:
def findip(): host = hname.get() try: ip = gethostbyname(host) except socket.gaierror: ip = "Host does not resolve" ipaddress.set(ip)
Just make sure you have the
socket module imported or it won't work, if you have no need for the
socket module you can import the the exception only, so you need to do either of these:
import socket import socket.gaierror
|
https://codedump.io/share/YGUWHXiqDpJ9/1/how-to-return-quothost-is-not-resolvablequot-message-after-gethostbyname-failiure
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
Id like to request that plugins have access to the text someone inputs into the quickpanel. Im specifically interested in addressing this issue:
but in general, it seems like a natural feature for plugins to have (unless Im missing something)
a quickpanel textbox is a view widget and is accessible via plugins, though the API doesn't make it as easy as it could... maybe I will put together a poof of concept when I get time
Thanks @kingkeith!
It's pretty ugly, using global variables, because ST doesn't seem to offer an easy way to tie a TextCommand in with an EventListener:
import sublime
import sublime_plugin
def get_view_content(view_id):
view = sublime.View(view_id)
return view.substr(sublime.Region(0, view.size()))
quick_panel_view_id = 0
capture_quick_panel = False
last_known_quick_panel_text = ''
class ExampleQuickPanelCommand(sublime_plugin.TextCommand):
def run(self, edit):
global capture_quick_panel
capture_quick_panel = True
show_text = lambda index: sublime.message_dialog(get_view_content(quick_panel_view_id) or last_known_quick_panel_text)
self.view.window().show_quick_panel(['item1', 'item2'], show_text)
class ExampleQuickPanelListener(sublime_plugin.EventListener):
def on_activated(self, view):
global capture_quick_panel
global quick_panel_view_id
if capture_quick_panel:
quick_panel_view_id = view.id()
capture_quick_panel = False
def on_deactivated(self, view):
if view.id() == quick_panel_view_id:
global last_known_quick_panel_text
last_known_quick_panel_text = get_view_content(quick_panel_view_id)
Sadly it's not possible hide it when you press enter, only when focus changed
|
https://forum.sublimetext.com/t/feature-request-plugins-access-quickpanel-text/26804/3
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
Devise MailChimp
Devise MailChimp adds a MailChimp option to devise that easily enables users to join your mailing list when they create an account.
Delayed Job is used automatically if your project uses it, and the mapping between list names and list ids is cached automatically.
Getting started
In your Gemfile, add devise_mailchimp after devise:
gem "devise" gem "devise_mailchimp" # Last officially released gem
In your User model, add :mailchimp to the devise call and make :join_mailing_list accessible:
devise :database_authenticatable, ..., :mailchimp attr_accessible :join_mailing_list
In your devise initializer (config/initializers/devise.rb), set your API key and mailing list name:
Devise.mailchimp_api_key = 'your_api_key' Devise.mailing_list_name = 'List Name' Devise.double_opt_in = false Devise.send_welcome_email = false
If you are using the default Devise registration views, the Join Mailing List checkbox is added automatically, if not, either include the form partial in your new registration form:
<%= render :partial => "devise/shared/mailchimp/form", :locals => {:form => f} %>
Or manually add a “Join Mailing List” checkbox to your new registration form:
<%= form.check_box :join_mailing_list %>
If you are using Simple Form, you can use:
<%= f.input :join_mailing_list, :as => :boolean %>
Configuration
Create an initializer, and set your MailChimp API key. To generate a new API key, go to the account tab in your MailChimp account and select API Keys & Authorized Apps, then add a key.
Devise.mailchimp_api_key = 'your_api_key'
Create a mailing list, and set the mailing list name in the initializer. To create a MailChimp list, from your account go to the Lists tab, then hit create list.
Devise.mailing_list_name = 'List Name'
Add options from the MailChimp API Docs using the following code in user.rb model. For GROUPINGS, you can get the Group ID by clicking “import to” and looking at the URL us6.admin.mailchimp.com/lists/members/import?id=1234&grp=9999&int=1
def {'FNAME' => self.first_name, 'LNAME' => self.last_name, 'GROUPINGS'=> { 0 => {'id' => 9999, 'groups' => "Signed Up" } } } end
For all the configuration settings, take a look at the model documenation.
Documentation
Full documentation is available at rdoc.info.
Demo Application
A demo application is available at github.
Example Usage
Users will join the default mailing list if join_mailing_list is set to true when the user is created. To manually add a user:
User.find(1).add_to_mailchimp_list('Site Administrators List')
To manually remove a user:
User.find(1).remove_from_mailchimp_list('Site Administrators List')
NOTE: You MUST have the users permission to add them to a mailing list.
Customization
To have the user join more than one list, or to override the lists that the user will join, override mailchimp_lists_to_join in your model. Your method should return a single list, or an array of lists.
def mailchimp_lists_to_join lists = ["Site Users List"] lists << "Site Admins List" if admin? return lists end
If all users will join the same list or lists, just set the mailing_list_name configuration option.
Contributions
Please help this software improve by submitting pull requests, preferably with tests.
View our contributors.
|
https://www.rubydoc.info/github/jcnnghm/devise_mailchimp/master
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
Type not found : FlxText
Hi All!
I just got started with Flixel, and I'm already encountering an issue with the "Hello World!" tutorial. ()
So I followed the steps (using sublime text on Mac OS X) by adding the line with FlxText, but when I tried to compile the project with flash/neko/html5 I got this error:
source/PlayState.hx:9: characters 10-17 : Type not found : FlxText
I installed everything, and tried downgrading lime to 2.9.1 and openfl to 3.6.1.
Any insight on why the library doesn't seem to be working?
- DleanJeans
Did you import
FlxText?
import flixel.text.FlxText;
How about other platforms? Do they work?
@DleanJeans
I didn't import FlxText (I thought it was included in the package).
Thank you so much for the help!
- Gama11 administrators
This should work fine with the fully qualified path as the tutorial instructs?
var text = new flixel.text.FlxText(0, 0, 0, "Hello World", 64);
|
http://forum.haxeflixel.com/topic/544/type-not-found-flxtext
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
reason why I bring this up, is that I am answering a question on the CCL mailing list on how to convert a XYZ file into an adjacency matrix, and my Groovy Cheminformatics did not have a section on graph matrices yet. And I just ran into the issue that the CDK XYZReader only accepts an IChemFile. Then I realized the book doesn't explain yet why that is either.
It basically comes down that chemical files can contain a wide variety of chemistry. MDL molfiles can contain a single Molecule, but also a set of molecules. Chemical documents in general, think Jmol, can also contain trajectories for cyclohexane (see this nice animation by Bob), etc, etc. And because the CDK is a general chemistry development toolkit, it has to support all. So, we have the IChemFile concept which corresponds to a chemical file, containing a sequence of one or more models, which may be if a single molecules (e.g. geometry optimizations), or multiple models (e.g. MDL SD files). Similarly, each model can contain a variety of objects: reactions, set of molecules, and crystals. Well, you get the point.
Now, at some point, it was decided that being able to convert file formats from one into another might in fact be interesting (think OpenBabel). That's where it went wrong (and if you start git blaming it would not surprise me if I am the center of all evil here). Just to keep it simple, it made sense to have all IO classes at least support ChemFile, because whatever the content, it could always be wrapped in an ChemFile.
So, the answer to the question on the CCL mailing list is a bit more involved than I wanted:
import org.openscience.cdk.*; import org.openscience.cdk.config.*; import org.openscience.cdk.interfaces.*; import org.openscience.cdk.io.*; import org.openscience.cdk.graph.matrix.*; import org.openscience.cdk.tools.manipulator.*; import org.openscience.cdk.graph.rebond.*; import java.io.File; reader = new XYZReader( new File("data/ethanoicacid.xyz").newReader() ); allContent = ChemFileManipulator.getAllAtomContainers( reader.read(new ChemFile()) ) ethanoicAcid = allContent.get(0) factory = AtomTypeFactory.getInstance( "org/openscience/cdk/config/data/jmol_atomtypes.txt", ethanoicAcid.getBuilder() ); for (IAtom atom : ethanoicAcid.atoms()) { factory.configure(atom); } RebondTool rebonder = new RebondTool(2.0, 0.5, 0.5); rebonder.rebond(ethanoicAcid); int[][] matrix = AdjacencyMatrix.getMatrix(ethanoicAcid) println "The adjaceny matrix:" for (row=0;row<ethanoicAcid.getAtomCount();row++) { for (col=0;col<ethanoicAcid.getAtomCount();col++) { print matrix[row][col] + " " } println "" }This code gives this output:
The adjaceny matrix: 0 1 1 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0
Note that the RebondTool didn't pick up the bond order, but that's not needed for the adjacency matrix anyway.
Getting back on the unfortunate design decision: what would things have looked liked if we had typed our IChemObject reading and writing classes, allowing us to differentiate IChemObjectReader<IAtomContaienr> from IChemObjectReader<IChemFile>. It would have greatly reduced the size of simple programs, or something like the wished-for 50k JChemPaint applet. Right now, pulling in a single reader, will automatically pull in all IChemObject classes. Rather, I would just pull in IAtomContainer, which in itself is too large too. But that's for another blog post.
The key thing to remember is: don't be afraid to add some complexity if that allows you to make other things optional..
|
https://chem-bla-ics.blogspot.nl/2011/03/
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
I think I have a quite simple question. I'm working on a web app with java and glassfish server where users can register and after they do, I want to send them an email with an activation link.
Is it possible to send mails with the java mail API without an external smtp server?
Since it is not necessary for users to answer to that mail. It seems I'm lacking basic knowledge of how sending emails works. I just want to invent some sender adress like "registration@onlineshop.com". Its obvious to me, that I would need a mail server for that domain so that one could send a message TO that adress. But if I'm just sending a mail FROM that adress, why can't I just invent the adress?
I don't want to use an external service like google or yahoo. If it's not possible can you suggest me an open source mail server that goes along with glassfish? I mean, is it possible to use glassfish as an email server? If not, what else could I use?
Thank you!
Yes you can do that. Simply use the javax mail library.
If you use Maven, you'd do something like this
<dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.7</version> </dependency>
Then you could do something like this
import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class SendEmail { public static void main(String [] args) { // Recipient's email ID needs to be mentioned. String to = "abcd@gmail.com"; String from = "registration@onlineshop.com"; Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", "localhost"); Session session = Session.getDefaultInstance(properties); try{ MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject("Registration from me :)"); message.setText("You got yourself an account. congrats"); Transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.printStackTrace(); } } }
|
https://codedump.io/share/jjsfwzj0jm3i/1/java-sending-email-with-activation-link
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
Is there any possibility to create custom action in admin page for django UserModel? I want automatize adding user to group (like adding him to staff, set some extra values, etc.), and of course create actions that take these changes back.
Thanks for your help.
Import
User in your admin.py unregister it, create new
ModelAdmin for it (or subclass the default one) and go wild.
It would look something like this I guess:
from django.contrib.auth.models import User class UserAdmin(admin.ModelAdmin): actions = ['some_action'] def some_action(self, request, queryset): #do something ... some_action.short_description = "blabla" admin.site.unregister(User) admin.site.register(User, UserAdmin)
|
https://codedump.io/share/owu5278cQsnB/1/adding-custom-action-to-usermodel39s-admin-page
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
At my current job, one big topic of conversation lately has been how we are passing in our configuration values to our Integration tests. I want to show you how you can use the
*.runsettings file to inject in configuration values to our NUnit tests, make your tests more configurable, and make handling configuration values in your tests easier to manage.
Our current solution is not easy to manage and not scalable with the numerous new developers coming onboard and increasing number of tests that we are writing. We have a static configuration class that uses the
System.Configuration library to access
app.settings section inside the
app.config for our test assembly. The idea of this is great, you have central authority for getting configuration values that your tests need. The implementation and execution of this idea is what is holding us back.
In our implementation, we use a python script on our build server in our CI pipeline, that takes in the parameters, such as: The name of dynamically spun up Server Under Test, the WebAPIUrl of our application, the name of the Database, etc. The script then dynamically sets these values by building up the
*.dll.config file for the test assembly on the fly based off a template. In order to add a new value to our tests, that are a lot of pieces and components that have to be updated. This makes this solution not scalable and causes numerous headaches when things like binding redirects or other settings in your
app.configs for specific Integration tests come up.
How can we change our implementation to make it more configurable and easier to manage? That is where the
*.runsettings comes into play. In my previous post about the
TestContext, I had briefly mentioned the Parameters member. In this post, I want to dig in a little deeper into this class and how you can best use it in your tests.
First thing we want to do is create our
local.runsettings for our local development. All we need to do is add a new file to our project, call it
local.runsettings, and add our first parameter. It will end up looking like this:
<RunSettings> <TestRunParameters> <Parameter name="WebAppUrl" value="" /> </TestRunParameters> </RunSettings>
Now we can add a test that uses this variable. We can make a simple test that just asserts that the value we pull from the Parameters is equal to the value we expect it to be.
[TestFixture] public class Runsettings { [Test] public void VerifyWebAppUrlParameter() { string webAppUrl = TestContext.Parameters["WebAppUrl"]; Assert.That(webAppUrl.Equals("")); } }
Now we can run this test to verify that we are pulling back the value from our
local.runsettings in our test. Some of you might be ahead of me and saying that this won't pass, and you are right! We still need to do one of two things, depending on where we are running our test, before we can get the value from the
local.runsettings and get this test to pass.
If we are running our test in Visual Studio, we need to specify a settings file that the NUnit3 adapter will use when running tests.
On your toolbar, go to
Test -> Test Settings -> Select Test Settings File. It will open a file browser, where you can then choose the
local.runsettings file that we created earlier.
If we are running our test using the NUnit3-Console, we need to pass in the parameter and value in as an argument in the command line.
Without sending in the
WebAppUrl value into our command
Command:
D:\SourceCode\nunit-console\bin\Release\nunit3-console.exe .\bin\Debug\BlogSamples.NUnit.dll --test=BlogSamples.NUnit.Runsettings
Output:
D:\SourceCode\BlogSamples\BlogSamples.NUnit> D:\SourceCode\nunit-console\bin\Release\nunit3-console.exe .\bin\Debug\BlogSamples.NUnit.dll --test=BlogSamples.NUnit.Runsettings Errors, Failures and Warnings 1) Error : BlogSamples.NUnit.Runsettings.VerifyWebAppUrlParameter System.NullReferenceException : Object reference not set to an instance of an object. at BlogSamples.NUnit.Runsettings.VerifyWebAppUrlParameter() in D:\SourceCode\BlogSamples\BlogSamples.NUnit\Runsettings.cs:line 29 Run Settings DisposeRunners: True WorkDirectory: D:\SourceCode\BlogSamples\BlogSamples.NUnit ImageRuntimeVersion: 4.0.30319 ImageTargetFrameworkName: .NETFramework,Version=v4.6.2 ImageRequiresX86: False ImageRequiresDefaultAppDomainAssemblyResolver: False NumberOfTestWorkers: 12 Test Run Summary Overall result: Failed Test Count: 1, Passed: 0, Failed: 1, Warnings: 0, Inconclusive: 0, Skipped: 0 Failed Tests - Failures: 0, Errors: 1, Invalid: 0 Start time: 2017-12-07 17:55:14Z End time: 2017-12-07 17:55:14Z Duration: 0.634 seconds
With sending in
WebAppUrl into our command
Command:
D:\SourceCode\nunit-console\bin\Release\nunit3-console.exe .\bin\Debug\BlogSamples.NUnit.dll --test=BlogSamples.NUnit.Runsettings --params WebAppUrl=
Output:
D:\SourceCode\BlogSamples\BlogSamples.NUnit> D:\SourceCode\nunit-console\bin\Release\nunit3-console.exe .\bin\Debug\BlogSamples.NUnit.dll --test=BlogSamples.NUnit.Runsettings --params WebAppUrl= Run Settings DisposeRunners: True WorkDirectory: D:\SourceCode\BlogSamples\BlogSamples.NUnit TestParametersDictionary: [WebAppUrl,] TestParameters: WebAppUrl= ImageRuntimeVersion: 4.0.30319 ImageTargetFrameworkName: .NETFramework,Version=v4.6.2 ImageRequiresX86: False ImageRequiresDefaultAppDomainAssemblyResolver: False NumberOfTestWorkers: 12 Test Run Summary Overall result: Passed Test Count: 1, Passed: 1, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0 Start time: 2017-12-07 17:55:18Z End time: 2017-12-07 17:55:19Z Duration: 0.622 seconds
It's important to note the behavior when you try accessing the
Parameter member and asking for a key that isn't in the
*.runsettings file specified or passed into the commandline.
It will throw everyone's favorite NullReferenceException:
Object reference not set to an instance of an object. Which is not helpful to us when we are trying to figure out why our tests are failing.
This is where having that separate static configuration class comes in handy. Instead of accessing our parameters directly from the TestContext every time, we can use our configuration class which gives us the ability to check the existence of the parameters before we access them.
This might look something like this.
public class Configuration { private static string _webAppUrl; public static string WebAppUrl { get { if (_webAppUrl == null && TestContext.Parameters.Exists("WebAppUrl")) { _webAppUrl = TestContext.Parameters["WebAppUrl"]; } else { throw new System.ArgumentException($"The parameter 'WebAppUrl' was not found, please provide a value for this parameter."); } return _webAppUrl; } } }
If we move the accessor into our configuration class, we can then update our test to look like this instead.
[Test] public void VerifyWebAppUrlParameter() { Assert.That(Configuration.WebAppUrl.Equals("")); }
Now tooled with this implementation, we can:
- Remove the need for dynamically creating these
*.dll.configfiles on the fly.
- Allow people to add new configuration values with more ease.
- Pull out our configuration values from our tests for more dynamic execution.
For us, our solution becomes extremely simplified. We can still use our static configuration class, and how we access our configuration values does not change. The big change for us is completely removing the need for building up the
*.dll.config and just pass those parameters into the NUnit3-Console when executing our tests making our process much simpler and easier to manage!
I am curious to hear how you all pass in your configuration values to your tests. Maybe there is a better way yet, but for now, this is the best solution that I have found!
|
https://get-testy.com/nunit-runsettings-file/
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
Error Handling Strategies
Error Handling Strategies
Learn about the four main error handling strategies- try/catch, explicit returns, either, and supervising crashes- and how they work in various languages.
Join the DZone community and get the full member experience.Join For Free
Maintain Application Performance with real-time monitoring and instrumentation for any application. Learn More!
Introduction.
Contents
When programs crash, log/print/trace statements and errors aren't always helpful to quickly know what went wrong. Logs, if there are at all, tell a story you have to decipher. Errors, if there, sometimes give you a long stack trace, which often isn't long enough. Asynchronous code can make this harder. Worse, both are often completely unrelated to the root cause, or lie and point you in the completely wrong debugging direction. Overall, most crashes aren't always helpful in debugging why your code broke.
Various error handling strategies can prevent these problems.
The original way to implement an error handling strategy is to throw your own errors.
// a type example validNumber = n => _.isNumber(n) && _.isNaN(n) === false; add = (a, b) => { if (validNumber(a) === false) { throw new Error(`a is an invalid number, you sent: ${a}`); } if (validNumber(b) === false) { throw new Error(`b is an invalid number, you sent: ${b}`); } return a + b; }; add('cow', new Date()); // throws
They have helpful and negative effects that take pages of text to explain. The reason you shouldn't use them is they can crash your program. While often this is often intentional by the developer, you could negatively affect things outside your code base like a user's data, logs, and this often trickles down to user experience. It also makes it more difficult for the developer debugging to pinpoint exactly where it failed and why.
I jokingly call them explosions because they accidentally can affect completely unrelated parts of the code when they go off. Compilers and runtime errors in sync and async code still haven't gotten good enough (except maybe Elm) to help us immediately diagnose what we, or someone else, did wrong.
We don't want to crash a piece of code or entire programs.
We want to correctly identify what went wrong, give enough information for the developer to debug and/or react, and ensure that error is testable. Intentional developer throws attempt to tell you what went wrong and where, but they don't play nice together, often mask the real issue in cascading failures, and while sometimes testable in isolation, they are harder to test in larger composed programs.
The second option is what Go, Lua, and sometimes Elixir do, where you handle the possible error on a per function basis. They return information if the function worked or not along with the regular return value. Basically they return 2 values instead of 1. These are different for asynchronous calls per language so let's focus on synchronous for now.
Various Language Examples of Explicit Returns
Lua functions will throw errors just like Python and JavaScript. However, using a function called protected call,
pcall it will capture the exception as part of a 2nd return value:
function datBoom() error({ reason = 'kapow' }) end ok, error = pcall(datBoom) print("did it work?", ok, "error reason:", error.reason) --did it work ? false, error : kapow
Go has this functionality natively built in:
func datBoom()(err error) ok, err: = datBoom() if err != nil { log.Fatal(err) }
... and so does Elixir (with the ability to opt out using a ! at the end of a function invocation):
def datBoom do {:error, "kapow"} end {:error, reason} = datBoom() IO.puts "Error: #{reason}" ## kapow
While Python and JavaScript do not have these capabilities built into the language, you can easily add them.
Python can do the same using tuples:
def datBoom(): return (False, 'kapow') ok, error = datBoom() print("ok:", ok, "error:", error) # ('ok:', False, 'error:', 'kapow')
JavaScript can do the same using Object destructuring:
const datBoom = () => ({ ok: false, error: 'kapow' }); const { ok, error } = datBoom(); console.log("ok:", ok, "error:", error); // ok: false error: kapow
Effects on Coding
This causes a couple of interesting things to happen. First, developers are forced to handle errors when and where they occur. In the throw scenario, you run a lot of code, and sprinkle throws where you think it'll break. Here, even if the functions aren't pure, every single one could possibly fail. There is no point continuing to the next line of code because you already failed at the point of running the function and seeing it failed (
ok is false) an error was returned telling you why. You start to really think how to architect things differently.
Second, you know WHERE the error occurred (mostly). The "why" is still always up for debate.
Third, and most important, if the functions are pure, they become easier to unit test. Instead of "I get my data, else it possibly blows up", it immediately tells you: "I worked, and here's your data", or "I broke, and here's what could be why".
Fourth, these errors DO NOT (in most cases if your functions are pure) negatively affect the rest of the application. Instead of a throw which could take other functions down with it, you're not throwing, you're simply returning a different value from a function call. The function "worked" and reported its "results". You're not crashing applications just because a function didn't work.
Cons on Explicit Returns
Excluding language specifics (i.e. Go panics, JavaScript's async/await), you have to look in 2 to 3 places to see what went wrong. It's one of the arguments against Node callbacks. People say not to use
throw for control flow, yet all you've done is create a dependable
ok variable. A positive step for sure, but still not a hugely helpful leap. Errors, if detected to be there, mold your code's flow.
For example, let's attempt to parse some JSON in JavaScript. You'll see the absence of a
try/catch replaced with an
if(ok === false):
const parseJSON = string => { try { const data = JSON.parse(string); return { ok: true, data }; } catch (error) { return { ok: false, error }; } }; const { ok, error, data } = parseJSON(new Date()); if (ok === false) { console.log("failed:", error); } else { console.log("worked:", data); }
The Either Type
Functions that can return 2 types of values are solved in functional programming by using the
Either type, aka a disjoint union. Typescript (strongly typed language & compiler for JavaScript) supports a psuedo Either as an Algebraic Data Type (aka ADT).
For example, this TypeScript
getPerson function will return
Error or
Person and your compiler helps you with that:
// Notice TypeScript allows you to say 2 possible return values function getPerson(): Error | Person
The
getPerson will return either
Error, or
Person, but never both.
However, we'll assume, regardless of language, you're concerned with runtime, not compile time. You could be an API developer dealing with JSON from some unknown source, or a front end engineer dealing with user input. In functional programming, they have the concept of a "left or right" in an Either type, or an object depending on your language of choice.
The convention is "Right is Correct" and "Left is Incorrect" (Right is right, Left is wrong).
Many languages already support this in one form or another:
JavaScript through Promises as values:
.then is right,
.catch is left) and Python via deferred values via the Twisted networking engine:
addCallback is right,
addErrback is left.
Either Examples
You can do this using a class or object in Python and JavaScript. We've already shown you the Object version above using
{ok: true, data} for the right, and
{ok: false, error} for the left.
Here's a JavaScript Object Oriented example:
class Either { constructor(right = undefined, left = undefined) { this._right = right; this._left = left; } isLeft() { return this.left !== undefined; } isRight() { return this.right !== undefined; } get left() { return this._left; } get right() { return this._right; } } const datBoom = () => new Either(undefined, new Error('kapow')); const result = datBoom(); if (result.isLeft()) { console.log("error:", result.left); } else { console.log("data:", result.right); }
... but you can probably already see how a
Promise is a much better data type (despite it implying async). It's an immutable value, and the methods
then and
catch are already natively there for you. Also, no matter how many
then's or "rights", 1 left can mess up the whole bunch, and it allllll flows down the single
catch function for you. This is where composing Eithers (Promises in this case) is so powerful and helpful.
const datBoom = () => Promise.reject('kapow'); const result = datBoom(); result.then(data => console.log("data:", data)).catch(error => console.log("error:", error));
Pattern Matching
Whether synchronous or not, though, there's a more powerful way to match the Either 'esque types through pattern matching. If you're an OOP developer, think of replacing your:
if ( thingA instanceof ClassA ) {
with:
ClassA: ()=> "it's ClassA",.
ClassB: ()=> "it's ClassB"
It's like a
switch and
case for types.
Elixir does it with almost all of their functions (the _ being the traditional
default keyword):
case datBoom do {:ok, data} -> IO.puts "Success: #{data}" {:error, reason} -> IO.puts "Error: #{reason}" _ -> IO.puts "No clue, brah..." end
In JavaScript, you can use the Folktale library.
const datBoom = () => Result.Error('kapow'); const result = datBoom(); const weGood = result.matchWith({ Error: ({ value }) => "negative...", Ok: ({ value }) => "OH YEAH!" }); console.log("weGood:", weGood); // negative...
Python has pattern matching with Hask (although it's dead project, Coconut is an alternative):
def datBoom(): return Left('kapow') def weGood(value): return ~(caseof(value) | m(Left(m.n)) >> "negative..." | m(Right(m.n)) >> "OH YEAH!") result = datBoom() print("weGood:", weGood(result)) # negative...
Scala does it as well, looking more like a traditional switch statement:
def weGood(value: Either): String = value match { case Left => "negative..." case Right => "OH YEAH!" case _ => "no clue, brah..." } weGood(Left('kapow')) // negative...
The Mathematicians came up with Either. Three cool cats at Ericsson in 1986 came up with a different strategy in Erlang: let it crash. Later in 2009, Akka took the same idea for the Java Virtual Machine in Scala and Java.
This flies in the face of the overall narrative of this article: don't intentionally cause crashes. Technically it's a supervised crash. The Erlang / Akka developers know errors are a part of life, so embrace they will happen, and give you a safe environment to react to them happening without bringing down the rest of your application.
It also only becomes relatable if you do the kind of work where uptime with lots of traffic is the number one goal. Erlang (or Elixir) create processes to manage your code. If you know Redux or Elm, the concept of a store to keep your (mostly) immutable data, then you'll understand the concept of a Process in Elixir, and an Actor in Akka. You create a process, and it runs your code.
Except, the framework developers knew that if you find a bug, you'll fix it and upload new code to the server. If the server needs to keep running to serve a lot of customers, then it needs to immediately restart if something crashes. If you upload new code, it needs to restart your new code as the older code processes shut down when they are done (or crash).
So, they created supervisors Elixir| Scala. Instead of creating 1 process that runs your code, it creates 2: one to run your code, and another to supervise it if it crashes, to restart a new one. These processes are uber lightweight (0.5kb of memory in Elixir, 0.3kb in Akka).
While Elixir has support for try, catch, and raise, error handling in Erlang/Elixir is a code smell. Let it crash, the supervisor will restart the process, you can debug the code, upload new code to a running server, and the processes spawned from that point forward will use your new code. This is similar to the immutable infrastructure movement around Docker in Amazon's EC2 Container Service and Kubernetes.
Intentionally crashing programs is a bad programming practice. Using
throw is not the most effective way to isolate program problems, they aren't easy to test, and can break other unrelated things.
Next time you think of using
throw, instead, try doing an explicit return or an Either. Then unit test it. Make it return an error in a larger program and see if it's easier for you to find it given you are the one who caused it. I think you'll find explicit returns or Eithers are easier to debug, easier to unit test, and can lead to better thought out applications.
Collect, analyze, and visualize performance data from mobile to mainframe with AutoPilot APM. Learn More!
Published at DZone with permission of Jesse Warden , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}{{ parent.urlSource.name }}
|
https://dzone.com/articles/error-handling-strategies
|
CC-MAIN-2018-22
|
en
|
refinedweb
|
-- 7 April 2004 -- Leading the Web to its full potential, the World Wide Web Consortium (W3C) today released the Document Object Model Level 3 Core and Load and Save specifications as W3C Recommendations. The.
Loading a DOM implementation becomes easier with DOM Level 3, and applications can load them according to their requirements. For example, to deploy a Web service on a Web site, one needs to use a WSDL processor, as services themselves are described using WSDL. DOM Level 3 makes it easier for processors to use and manipulate WSDL descriptions through its enhanced ability to work with XML namespaces.
DOM modules now include a feature called "bootstrapping," which allows a DOM application to find and load a DOM implementation that will provide access to the DOM API. It makes it possible to request a DOM implementation for specific needs, such as XHTML, SVG, CSS, or even XML Events. This makes it easier for developers to handle systems with multiple XML-application-specific DOM implementations, such as a browser combined with an SVG plug-in. Both the browser and the plug-in may include DOM support, but for very specific languages; the browser may support HTML and/or XHTML, and the SVG plug-in may only support SVG. A DOM developer would want to be able to have access to each specific DOM implementation; bootstrapping makes that possible.
DOM Level 3 has been tuned to simplify the work of Web developers in their day-to-day tasks by adding common and useful functions, such as extracting the text content from XML documents or the ability to attach application specific information to a DOM node. This is referred to as the user data system. With a system of keys, a developer can associate information to a DOM node for future use. If a developer wants to annotate a document with non-XML information, the user data mechanism may also be used.
Loading and saving XML documents and data are now possible in a platform- and language-neutral way with the DOM Level 3 Load and Save Recommendation. Both simple and advanced filtering mechanisms are provided for Web applications. DOM Level 3 Load and Save allows applications to move between a complete XML document, or an XML fragment, to a DOM tree. With DOM Level 3 Load and Save, it is also possible to use filtering to load a specific fragment rather than an entire document, and be able to work with only the required data fragment.
Developers now may also take advantage of the updated DOM Conformance Test Suites, which now include current tests for Level 1 Core, Level 2 Core, Level 2 HTML, as well as tests that conform to the new Level 3 Core, Level 3 Load and Save, and Level 3 Validation Recommendations.
With the successful completion of the three DOM Level 3 specifications (Core, Load and Save, and Validation), the DOM efforts are complete. Since the inception of the DOM Activity in 1997, over 20 organizations as well as invited experts have contributed to the evolution of 10 DOM standards including AOL; Apple Computer; Arbortext; IBM; Lucent; Macromedia; Merrill Lynch; Microsoft; NIST; Novell; Object Management Group; Oracle; SoftQuad, Inc.; Software AG; Sun Microsystems; Web3D Consortium; and X-Hive
|
http://www.w3.org/2004/03/dom-level-3-pr.html.en
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
So I am creating a Netflix based application for a school assignment. So yes this is homework. I created a userinterface that looks like the following
Code :
import java.io.IOException; import java.util.Queue; import java.util.Scanner; public class UserInterface extends Users { public UserInterface(String userName, double accountNumber, Queue<Movie> playList, Queue<Movie> lastMovies) { super(userName, accountNumber, playList, lastMovies); } public static void main(String[] args){ Scanner keyboard = new Scanner(System.in); while(true){ System.out.println("X) Exit"); System.out.println("0) Create a new movie"); System.out.println("1) Add Movie to your playlist"); System.out.println("2) Upgrade your account"); char c = keyboard.next().charAt(0); switch(c){ case 'X': System.exit(0); case '0': createMovies; case '1': for(int i= 0; i < playList.size(); i++) System.out.println(playList); break; case '2': System.out.println("Small one time free of $10,000,000!"); break; } } } }
so now what I am running into is the "case '0'" selection, where I am trying to just call "createMovies;" which is a method inside another class which looks like the following
Code :
import java.util.Date; import java.util.Scanner; public class createMovie { public Scanner keyboard = new Scanner(System.in); public static void main(String args[]) { } public void createMovies() { String password = "adminpassword"; boolean isAdmin = false; double inputPrice = 0; String inputMovie; String inputGenre; Date inputDate = new Date(); String inputPassword; System.out.println("Enter Movie Title:"); inputMovie = keyboard.nextLine(); System.out.println("Enter Movie Genre:"); inputGenre = keyboard.nextLine(); System.out.println("Enter Admin Password:"); inputPassword = keyboard.nextLine(); passCheck(inputPassword, password, isAdmin); adminPower(isAdmin, inputPrice); Movie movies = new Movie(inputMovie, inputDate, inputGenre, inputPrice); } public void passCheck(String inputPassword, String password, boolean isAdmin) { if(inputPassword == password) { isAdmin = true; } else System.out.println("Sorry wrong password"); } public void adminPower(boolean isAdmin, double inputPrice) { if (isAdmin == true) System.out.println("Enter Movie Price:"); inputPrice = keyboard.nextDouble(); } }
and without adding more code to this post I will just say this creates a Movie object, that I will later have saved to a Movie selection linked list, and then allow the user to select movies out of that list.
So the problem is I can't get the function to call properly inside my interface class. How would I go about doing this? I tried creating a "createMovie movies = null;" and then passing it through the function like so "movies.createMovies(); but apparently that doesn't actually do anything because it is null.
|
http://www.javaprogrammingforums.com/%20object-oriented-programming/19493-call-class-method-another-class-printingthethread.html
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
Skip navigation links
java.lang.Object
com.bea.wli.config.resource.BaseQuery
com.bea.wli.config.resource.DependencyQuery
public class DependencyQuery
Class for making a query to get the Parents/Childs based on the dependency graph established by the references from one resource to another.
public static final long serialVersionUID
public DependencyQuery(java.util.Collection<Ref> refs, boolean dependents)
refs- list of resources/projects/folders for which the dependencies or dependent need to be returned as a result of this query
dependents- if true, as a result of this query dependents/parents are returned. else, dependencies/Childs are returned.
public java.util.Set<Ref> getRefs()
public boolean isDependents()
Skip navigation links
|
http://docs.oracle.com/cd/E23943_01/apirefs.1111/e15033/com/bea/wli/config/resource/DependencyQuery.html
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
This chapter describes the schema objects that you use in the Oracle Database Java environment and:
Unlike a conventional Java virtual machine (JVM), which compiles and loads Java files, the the Oracle JVM, you must use the
loadjava tool to create a Java class schema object from the class file or the source file and load it into a schema. To make a resource file accessible to the Oracle JVM, you must use
loadjava to create and load a Java resource schema object from the resource file.
The
dropjava tool deletes schema objects that correspond to Java files. You should always use
dropjava to delete a Java schema object that was created with
loadjava. Dropping schema objects using SQL data definition language (DDL) commands will not update auxiliary data maintained by
loadjava and
dropjava.
You must load resource files using
loadjava. If you create
.class files outside the database with a conventional compiler, then you must load them with
loadjava. The alternative to loading class files is to load source files and let Oracle Database compile and manage the resulting class schema objects. In Oracle Database 10g, the most productive approach is to compile and debug most of your code outside the database, and then load the
.class files. For a particular Java class, you can load either its
.class file or the corresponding
.java file, but not both.
The
loadjava tool accepts Java Archive (JAR) files that contain either source and resource files or class and resource files. When you pass a JAR or ZIP file to
loadjava, it opens the archive and loads its members individually. There are no JAR or ZIP schema objects. A file whose content has not changed since the last time it was loaded is not reloaded. As a result, there is little performance penalty for loading JAR files. Loading JAR files is a simple, fool-proof way to use
loadjava.
It is illegal for two schema objects in the same schema to define the same class. For example, assume that
a.java defines class
x and you want to move the definition of
x to
b.java. If
a.java has already been loaded, then
loadjava will reject an attempt to load
b.java. Instead, do either of the following:
Drop
a.java, load
b.java, and then load the new
a.java, which does not define
x.
Load the new
a.java, which does not define
x, and then load
b.java.
All Java classes contain references to other classes. A conventional JVM searches for classes in the directories, ZIP files, and JAR files named in the
CLASSPATH. In contrast, the Oracle JVM searches schemas for class schema objects. Each class in the database has a resolver specification, which is
An.
ANot,
loadjavaresolves references to classes but not to resources. Ensure that you correctly load the resource files that your classes need.
If you can, defer resolution until all classes have been loaded. This avoids call
loadjava for collections of files,,
loadjava computes a digest of the content of the file and then looks up the file name in the digest table. If the digest table contains an entry for the file name that has an identical digest, then
loadjava does not load the file, because a corresponding schema object exists and is up to date. If you call, then use the
loadjava -force option to bypass the digest table lookup or delete all rows from the table
JAVA$CLASS$MD5$TABLE.
Loading a source file creates or updates a Java source schema object and invalidates the class schema objects previously derived from the source. If the class schema objects do not exist, then
loadjava
loadjava -resolve.
The compiler writes error messages to the predefined
USER_ERRORS view. The
loadjava tool retrieves and displays the messages produced by its compiler invocations.
The compiler recognizes some options. There are two ways to specify options to the compiler. If you run
loadjava with the
-resolve option, then you can specify compiler options on the command line. You can additionally specify persistent compiler options in a per-schema database table,
JAVA$OPTIONS. You can use the
JAVA$OPTIONS table for default compiler options, which you can override selectively using a
loadjava command-line
loadjava tool creates schema objects from files and loads them into a schema. Schema objects can be created from Java source, class, and data files.
loadjava
loadjava to terminate prematurely. These errors are printed with the following syntax:
exiting: error_reason
This section covers the following:
The syntax of the
loadjava command is as follows:]...] [ 11-1 summarizes the
loadjava arguments. If you run
loadjava multiple times specifying the same files and different options, then the options specified in the most recent invocation hold. However, there are two exceptions to this, as follows:
If
loadjava does not load a file because it matches a digest table entry, then most options on the command line have no effect on the schema object. The exceptions are
-grant and
-resolve, which always take effect. You must use the
-force option to direct
loadjava to skip the digest table lookup.
The
-grant option is cumulative. Every user specified in every
loadjava invocation for a given class in a given schema has the
EXECUTE privilege.
This section describes the details of some of the
loadjava arguments whose behavior is more complex than the summary descriptions contained in Table 11-1.
You can specify as many
.class,
.java,
.sqlj,
.jar,
.zip, and resource files as you want and in any order. If you specify a JAR or ZIP file, then
loadjava processes the files in the JAR or ZIP. There is no JAR or ZIP schema object. If a JAR or ZIP contains another JAR or ZIP,
loadjava
loadjava will also work, without having to learn anything about resource schema object naming.
Schema object names are different from file names, and
loadjava names different types of schema objects differently. Because class files are self-identifying, the mapping of class file names to schema object names done by
loadjava. Because classes use resource schema objects and the correct specification of resources is not always intuitive, it is important that you specify resource file names correctly on the command line.
The perfect way to load individual resource files correctly is to run
loadjava,
loadjava,
alpha/beta/x.properties and
ROOT/home/scott/javastuff/alpha/beta/x.properties. The name of the resource schema object is generated from the file name as entered.
Classes can refer to resource files relatively or absolutely. To ensure that
loadjava and the class loader use the same name for a schema object, enter the name on the command line, which alpharesources.jar
To simplify the process further, place both the class and resource files in a JAR, which makes the following invocations equivalent:
% loadjava options alpha.jar % loadjava options /home/scott/javastuff/alpha.jar
The preceding
loadjava commands imply that you can use any path name to load the contents of a JAR file. Even if you run the redundant commands,
loadjava would realize from the digest table that it need not load the files twice. This implies that reloading JAR files is not as time-consuming as it might seem, even when few files have changed between
loadjava invocations.
{
loadjava process. Some Oracle Database-specific optimizations for interpreted performance are put in place during the verification process. Therefore, the interpreted performance of your application may be adversely affected by using this option.
[-optionfile <file>]
This option enables you to specify a file with
loadjava options. This file is read and processed by
loadjava before any other
loadjava options are processed. The file can is checked against the patterns. Patterns can end in a wildcard (
*) to indicate an arbitrary sequence of characters, or.
You can use Java comments in this file. A line comment begins with a
#. Empty lines are ignored. The quote character is a double quote (
"). That is, options containing spaces should be surrounded by double quotes. Certain options, such as
-user and
-verbose, affect the overall processing of
loadjava and not the actions performed for individual Java schema objects. Such options are ignored if they appear in an option file.
To help package applications,
loadjava looks for the
META-INF/loadjava-options entry in each JAR it processes. If it finds such an entry, then it treats it as an options file that is applied for all other entries in the option file. However,
loadjava does some processing on entries in the order in which they occur in the JAR.
If
loadjava has partially processed entities before it processes
META-INF/loadjava-options, then
loadjava will attempt to patch up the schema object to conform to the applicable options. For example,
loadjava alters classes that were created with invoker rights when they should have been created with definer rights. The fix for
-noaction will be to drop the created schema object. This will yield the correct effect, except that if a schema object existed before
loadjava started, then:
loadjava to compile and resolve a class that has previously been loaded. It is not necessary to specify
-force, because resolution is performed after, and independent of, loading.
{-resolver | -R} resolver_specification
This option associates an explicit resolver specification with the class schema objects that
loadjava,
loadjava
loadjava uses the user's default database. If specified,
loadjava commands:
Connect to the default database with the default OCI driver, load the files in a JAR into the
TEST schema, and then resolve them:
loadjava -u joe/shmoe -resolve -schema TEST ServerObjects.jar
Connect with the JDBC Thin driver, load a class and a resource file, and resolve each class:
loadjava -thin -u SCOTT/TIGER@dbhost:5521:orcl \ -resolve alpha.class beta.props
Add Betty and Bob to the users who can run
alpha.class:
loadjava -thin -schema test -u SCOTT/TIGER@localhost:5521:orcl \ -grant BETTY,BOB alpha.class
The
dropjava tool is the converse of
loadjava.
dropjava.
dropjavaon the same source file. If you translate on a client and load classes and resources directly, then run
dropjavaon the same classes and resources.
You can run
dropjava either from the command line or by using the
dropjava method in the
DBMS_JAVA class. To run
dropjava
loadjava. The output is directed to
stderr. Set
serveroutput on and call
dbms_java.set_output, as appropriate.
This section covers the following topics:
The syntax of the
dropjava command is: 11-2 summarizes the
dropjava arguments.
This section describes few of the
dropjava argument, which are complex
dropjava interprets most file names as
loadjava
dropjava interprets the file name as a schema object name and drops all source, class, and resource objects that match the name.
If
dropjava
dropjava uses the user's default database. If specified, then
database can be a TNS name or an Oracle Net Services name-value list.
-thin:@
database
dropjava.
Drop all schema objects in the
TEST schema in the default database that were loaded from
ServerObjects.jar:
dropjava -u SCOTT/TIGER -schema TEST ServerObjects.jar
Connect with the JDBC Thin driver, then drop a class and a resource file from the user's schema:
dropjava -thin -u SCOTT/TIGER@dbhost:5521:orcl alpha.class beta.props
dropjava to remove the resources.
The
ojvmjava tool is an interactive interface to the session namespace of a database instance..
This section covers the following topics:
The syntax of the
ojvmjava command is:
ojvmjava {-user user[/password@database ] [options] [@filename] [-batch] [-c | -command command args] [-debug] [-d | -database conn_string] [-fileout filename] [-o | -oci | -oci8] [-oschema schema] [-t | -thin] [-version | -v]
Table 11-3 summarizes the
ojvmjava arguments.
Open a shell on the session namespace of the database
orcl on listener port
2481 on the host
dbserver, as follows.
ojvmjava -thin -user SCOTT/TIGER@dbserver:2481:orcl
The
ojvmjava commands span several different types of functionality, which are grouped as follows:
This section describes the options for the
ojvmjava command-line tool ojvmjava Commands in the @filename Option
This
@
filename option designates a script file that contains one or more
ojvmjava
ojvmjava to run another script file, then this file must exist in
$ORACLE_HOME on the server.
Enter the
ojvmjava command followed by any options and any expected input arguments.
The script file contains the
ojvmjava command followed by options and input parameters. The input parameters can be passed to
ojvmjava on the command line.
ojvmjava processes all known options and passes on any other options and arguments to the script file.
To access arguments within the commands in the script file, use
&1...&
n to denote the arguments. If all input parameters are passed to a single command, then you can type
&*
Note:You can also supply arguments to the
-commandoption in the same manner. The following shows an example:
ojvmjava ... -command "cd &1" contexts
After processing all other options,
ojvmjava passes
contexts as argument to the
cd command.
To run this file, do the following:
ojvmjava -user SCOTT -password TIGER -thin -database dbserver:2481:orcl \ @execShell alpha beta
ojvmjava testhello alpha beta
You can add any comments in your script file using hash (
ojvmjava. For example:
#this whole line is ignored by ojvmjava
Running sess_sh Within Applications
You can run
sess_sh commands from within a Java or PL/SQL application using the following commands:
This section describes the commands used for manipulating and viewing contexts and objects in the namespace.
The following shell commands function similar to their UNIX counterparts:
Each of these shell commands have some options in common, which are summarized in Table 11-4:
This commnad prints prints the class. The class must be loaded with
loadjava. this command is:
java [-schema schema] class [arg1 ... argn]
Table 11-5 summarizes the arguments of this command.
Consider the following Java file,
World.java: prints the user name of the user who logged in to the current session. The syntax of the command is:
whoami
|
http://docs.oracle.com/cd/B19306_01/java.102/b14187/cheleven.htm
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
FWIW you only need to construct a ConnectionFactory instance. So you don't
need to mess around creating Topic/QueueSessions or Topic/QueueConnections
or any of that stuff.
Literally alll you need to do is something like...
import org.exolab.jms.client.JmsTopicConnectionFactory;
import org.apache.commons.messenger.SessionFactory;
public OpenJMSTopicSessionFactory extends SessionFactory {
protected ConnectionFactory createConnectionFactory() throws
JMSException {
return new JmsTopicConnectionFactory();
}
}
And it should just work irrespective of JNDI.
Though I'm sure there's a way to get OpenJMS working with Caucho's JNDI
provider since the connection factories implement java.io.Externalizable and
javax.naming.Referenceable
James
-------
----- Original Message -----
From: "Ryan Vanderwerf" <rvanderwerf@metrowerks.com>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Thursday, January 09, 2003 5:04 PM
Subject: RE: messenger: running on caucho resin
Thanks for the response! Yes I've used OpenJMS with Caucho Resin the
past without a problem, however I did write my own session management
class - it was very messy though - which is the reason messenger looks
so appealing :)
I'll look into writing my own SessionFactory implementation which at
least gives me a more organized structure to do it in.
What is weird is it's talking to OpenJMS in some way now, if my OpenJMS
isn't running it tells me so in the debug log. I'm not sure how to get a
better stack trace out of the debug stuff. It doesn't look hard to make
my own session factory anyways.
Ryan
-----Original Message-----
From: James Strachan [mailto:james_strachan@yahoo.co.uk]
Sent: Thursday, January 09, 2003 8:35 AM
To: Jakarta Commons Users List
Subject: Re: messenger: running on caucho resin
Knowing the stack trace of the underlying NotSerializableException would
help some. From what you've given it looks like Messenger is trying to
lookup a JMS TopicConnectionFactory from JNDI and failing with a
Resin-generated NotSerializableException message.
First off; can you get OpenJMS to work with Resin at all? i.e. lookup an
OpenJMS TopicConnectionFactory in Resin's JNDI?
What could well be easier for you is to write a plugin for Messenger, a
SessionFactory implementation...
ommons/messenger/SessionFactory.html
which explicitly creates OpenJMS connections. Then you don't need to
worry about JNDI. All you need to do is implement the
createConnectionFactory() method to create an OpenJMS specific
ConnectionFactory and you're away.
FWIW SpiritWave comes with its own Messenger factory to avoid the need
to use JNDI to create JMS connections with Messenger; I'm sure the same
could be done for OpenJMS.
James
-------
----- Original Message -----
From: Ryan Vanderwerf
To: commons-user@jakarta.apache.org
Sent: Wednesday, January 08, 2003 10:20 PM
Subject: messenger: running on caucho resin
Hi, I'm a newbie to the messenger sandbox project, and had a couple
questions on getting it running with Cacho Resin 2.1.6. I'm running the
latest OpenJMS server, running with the default queue in rmi_jms.xml and
the pre-packaged Messenger.xml that comes with messenger for OpenJMS.
My problem is when I start the managerServlet everything seems to run
fine except for an NotSerializable error I get on startup - this is the
debug info it spits out:
[2003-01-08 16:05:32,739] DEBUG [main] [digester.Digester]
[SetNextRule]{manager
/messenger} Call
org.apache.commons.messenger.MessengerManager.addMessenger(org.
apache.commons.messenger.DefaultMessenger@7fc686 session:
javax.jms.JMSException
: Failed to lookup: JmsTopicConnectionFactory using JNDI.
javax.naming.NamingExc
eption: error marshalling arguments; nested exception is:
java.io.NotSerializableException:
com.caucho.util.ClassLoaderLocal [Root
exception is java.rmi.MarshalException: error marshalling arguments;
nested exc
eption is:
java.io.NotSerializableException:
com.caucho.util.ClassLoaderLocal])
Does anyone that uses messenger lead me in the right direction? It
looks like a very slick app, in the past I've had to write all the
connection management stuff for JMS manually which was plenty of work -
messenger seems to take care of all that. I'm just wondering what I am
missing here, or if it just doesn't work on resin (I don't see why it
wouldn't) especially if I am using the build in JNDI server in OpenJMS.
Ryan
More debug info that it spat out attached:
------------------------------------------------------------------------
------
--
To unsubscribe, e-mail:
<mailto:commons-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:commons-user-help@jakarta.apache.org>
--
|
http://mail-archives.apache.org/mod_mbox/commons-user/200301.mbox/%3C034001c2b80c$1040dd80$9865fea9@spiritsoft.com%3E
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
As described in Wikipedia
the BruteForce algorithm consist of
Briefly, a brute force program would solve a puzzle by placing the digit "1" in the first cell and checking if it is allowed to be there. If there are no violations (checking row, column, and box constraints) then the algorithm advances to the next cell, and places a "1" in that cell. When checking for violations, it is discovered that the "1" is not allowed, so the value is advanced to a "2". If a cell is discovered where none of the 9 digits is allowed, then the algorithm leaves that cell blank and moves back to the previous cell. The value in that cell is then incremented by one. The algorithm is repeated until the allowed value in the 81st cell is discovered. The construction of 81 numbers is parsed to form the 9 x 9 solution matrix.
In this turorial we will show how an optimized Brute Force algorithm can work
You will need the classes posted in Sudoku-I to run the following programs.
But first we will introduce a new class Problems.java
this class contains, for the moment, 2 different Sudoku problems. One intermediate one, and one which, according to internet research is a very nice canditate to be a worst case to be solved with the Brute ALgorithm.
This Problems class will probably grow as we will study other problems. It contains static methods to fill your Sudoku Grid with already registered problems. It also contains a main() method for unit tests.
Here is the Problems.java class
/** * A class that contains, for test purpose, the setters for different * Sudoku problems */ public class Problems { /* * private method called by the others to load a problem */ private static void load(Grid grid, int[][] val) { // clear grid because if it already contains something // the setOriginalProblemValue might reject to set a cell to a value already there for(int i = 0; i < val.length; i++) { for(int j = 0; j < val[i].length; j++) { grid.setCellValue(i, j, 0); } } // load with new problem for(int i = 0; i < val.length; i++) { for(int j = 0; j < val[i].length; j++) { grid.setOriginalProblemValue(i, j, val[i][j]); } } } // preregistered problem 1 public static void setProblem1(Grid grid) { int[][] val = { {0, 0, 0, 0, 0, 7, 0, 0, 0}, {3, 0, 0, 0, 6, 0, 0, 5, 0}, {7, 0, 0, 9, 2, 0, 0, 1, 0}, {0, 8, 0, 0, 3, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 5, 0, 6}, {9, 0, 0, 6, 0, 8, 0, 0, 0}, {0, 0, 0, 0, 1, 3, 6, 0, 0}, {0, 0, 0, 5, 0, 0, 1, 2, 0}, {0, 9, 0, 0, 0, 0, 7, 0, 3} }; // loat it with my values load(grid, val); } // preregisterd problem 2 // this is kind of worst case for brute force // no clue on top row where the only solution is 987654321 // so a huge amount of iterations will be required // this a good problem to test in the brute force with reverse in BruteForceGui.java // (may be not with the GUI version it would take a while :-)) public static void setProblem2(Grid grid) { int[][] val = { , 4, 0, 0, 0, 0, 9} }; // loat it with my values load(grid, val); } // and almost done Sudoku problem to see the BruteForce GUI in action // the top part if almost done so the reversed method should be slower // on that one public static void setProblem3(Grid grid) { int[][] val = { {6, 1, 9, 2, 8, 4, 5, 7, 3}, {3, 7, 0, 5, 1, 6, 4, 0, 9}, {4, 5, 2, 0, 7, 0, 8, 0, 0}, {7, 4, 5, 9, 0, 3, 1, 0, 0}, {2, 0, 0, 8, 5, 1, 7, 9, 0}, {8, 9, 1, 0, 2, 0, 3, 6, 0}, {5, 0, 0, 6, 3, 0, 9, 0, 1}, {0, 0, 3, 0, 0, 2, 6, 0, 7}, {1, 0, 4, 0, 9, 0, 0, 0, 0} }; // loat it with my values load(grid, val); } /* * To unit test the whole thing */ public static void main(String[] args) { // create a Grid Grid grid = new Grid(9); // fill and print it setProblem1(grid); grid.printGrid(); // fill and print it setProblem2(grid); grid.printGrid(); // fill and print it setProblem3(grid); grid.printGrid(); } }
Now the BruteForce class. It has a console mode and a GUI mode. For now jjust use the console mode.
It uses a Grid fill with data and solves using the BruteForce algorithm a Sudoku problem.
Right now it's main methot uses setProblem1() method to load a standard Sudoku problem
Try it with that set up and then, try with the setProble2() method. You will see that it will take much longer to found the solution.
import java.util.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; /* * Contains methods to solve by brute force a Sudoku Grid * It implements an ActionListener for whn run in GUI mode */ public class BruteForce implements ActionListener { // the Grid I will have to work on private Grid grid; // the ArrayList containing the cells that have to be fixed private ArrayList<Point> al; // the number of cells to fix (the ArrayList size) private int nbTodo; // the index we are at private int index; // the SwingTimer use when do in GUI mode private Timer timer; /* * Constructor */ public BruteForce(Grid grid) { this.grid = grid; } /* * To solve the Grid in console mode will throw an exception if the problem is not feasible */ public void solve; // for the console method we just loop until we are done while(index < nbTodo) { // common method performFill(); } return; } /* * To solve the Grid with GUI will throw an exception if the problem is not feasible */ public void solveWithGui; // create the Timer timer = new Timer(100, this); timer.start(); return; } /* * The common method used by both the Console mode and the GUI mode * The console mode method solve() just call it in a while * the GUI mode calls it through a SwingTimer */ private void performFill() { // process next cell if index = -1 it means the solution is not feasible // it is in invalid Sudoku problem (you havent fill the cells with the GUI) if(index < 0) throw new IllegalStateException("Trying to solve an invalid Sudoku problem"); Point p = al.get(index); // get its possible values int[] guess = grid.getAllAvailableValues(p.x, p.y); // if no possible values fall back to previous cell at next call if(guess.length == 0) { --index; // use previous one return; } // get its value (will be 0 at first trial) int value = grid.getValue(p); // if it is first trial use the first one in the array if(value == 0) { grid.setCellValue(p.x, p.y, guess[0]); ++index; // go check next one at next call return; } // test if the value used is the last of the list if(value == guess[guess.length - 1]) { // reset this cell value to 0 to start all the process again grid.setCellValue(p.x, p.y, 0); // and go back to the previous one --index; return; } // OK we will have to try the next available one for(int lastUsed = 0; lastUsed < guess.length; ++lastUsed) { // when we found the last one we have tried if(value == guess[lastUsed]) { // use +1 to check the next one grid.setCellValue(p.x, p.y, guess[lastUsed+1]); ++index; break; // no need to continue the loop } } } /* * Called by the SwingTimer when in GUI mode to update * the search and the GUI */ @Override public void actionPerformed(ActionEvent e) { // if we are done if(index == nbTodo) { timer.stop(); return; } // not done we have to update one batch performFill(); } /* * Reverse and ArrayList of Point to test the solution in reverse * this is used to find if the the solution is unique */ private ArrayList<Point> reverse(ArrayList<Point> order) { // create new ArrayList ArrayList<Point> al = new ArrayList<Point>(); int size = order.size(); // loop in reverse for(int i = size-1; i >= 0; i--) al.add(order.get(i)); // return it return al; } /* * To Unit test the whole thing */ public static void main(String[] args) { // Build a Grid Grid grid = new Grid(9); // load it with one of our prepared model Problems.setProblem1(grid); grid.printGrid(); BruteForce bf = new BruteForce(grid); bf.solve(false); grid.printGrid(); } }
The next tutorial will introduce 2 GUIs that you will be able to play with.
This post has been edited by pbl: 21 October 2010 - 04:44 PM
|
http://www.dreamincode.net/forums/topic/195836-sudoku-ii-the-brute-force/page__pid__1145093__st__0
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
App::Netdisco::Manual::Developing - Notes for contributors
This document aims to help developers understand the intent and design of the code within Netdisco. Patches and feedback are always welcome :-)
First do a normal App::Netdisco install into a dedicated user's home, as per the documentation. Then:
su - netdisco && cd $HOME mkdir git && cd git git clone git://git.code.sf.net/p/netdisco/netdisco-ng netdisco-ng cd netdisco-ng/Netdisco DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ~/bin/localenv plackup -R share,lib -p 5001 bin/netdisco-web-fg
The above creates you a git clone (change the URL if you're a Netdisco Developer) and runs the web server:
shareor
libdirectory
You might also want to set
check_userlog to
true in your config to quieten some of the web client callbacks.
For the daemon, it's very similar:
DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ~/bin/localenv bin/netdisco-daemon-fg
Don't be alarmed by the high rate of database queries in the daemon - most of them are communicating only with a local in-memory SQLite database.
Happy hacking! "significant" release to CPAN will increment the first three digits of the minor version. Each "trivial" release will increment the second three digits of the minor version.
Beta releases will have a a suffix with an underscore, to prevent CPAN indexing the distribution. Some examples:
2.002002 - "significant" release 2, second "trivial" release 2.002003 - a bug was found and fixed, hence "trivial" release 3 2.003000_001 - first beta for the next "significant" release 2.003000_002 - second beta 2.004000 - the next "significant" release
The words "significant" and "trivial" are entirely subjective, of course.".
In fact, many sections of the web application have been factored out into separate Plugin modules. For more information see the App::Netdisco::Web::Plugin manual page. actually ships with a fast, preforking web server engine.). See App::Netdisco::Manual::Configuration for further details.
Every Dancer route handler must have proper role based access control enabled, to prevent unauthorized access to Netdisco's data, or admin features. This is done with the Dancer::Plugin::Auth::Extensible module. It handles both the authentication using Netdisco's database, and then protects each route handler. See App::Netdisco::Manual::WritingPlugins for details. four fourth kind of worker is called the Scheduler and takes care of adding discover, macsuck, arpnip, and nbtstat jobs to the queue (which are in turn handled by the Poller worker). This worker is automatically started only if the user has enabled the "
housekeeping" section of their
deployment.yml site config.
The daemon obviously needs to use SNMP::Info for device control. All the code for this has been factored out into the App::Netdisco::Util namespace.
The App::Netdisco::Util::SNMP..
|
http://search.cpan.org/~oliver/App-Netdisco-2.024004/lib/App/Netdisco/Manual/Developing.pod
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
This article discusses how to create a 3D tab control for WPF. It will go through 3D rotation and camera calculations as well as show how to maintain a large set of controls in a smaller set of UI visualisers. Although a fair portion of the code for this article relates to the creation of 3D meshes, I'll not go into details around that, but rather try to focus the article around other areas more specific to this article.
There's a YouTube video displaying some of the implemented features available here;
This article has grown from a made-to-order solution I've implemented for Sacha. I initially knocked up a simple prototype, and Sacha wanted it to do some other things (like sliding window for example, discussed below) while I thought other things would be cool. In the end, it turned out to be a pretty neat control.
Dead simple, download the source project and build it, the Bornander.UI.TabCarousel project contains a user control called Carousel that takes care of just about everything.
Carousel
For example purposes, the file MainWindow.xaml.cs has two sections in its constructor that are to be used one at a time to test different aspects of the control.
When implementing this control, I started out with a set of requirements:
FrameworkElement
The solution is split into three projects:
This is as simple as it sounds. I implemented a class called Tab to encapsulate the tab page, and this has a property called Element which can be used to set any FrameworkElement as the visual for that Tab.
Tab
Element
public FrameworkElement Element
{
get { return element; }
set
{
element = value;
front.Visual = element;
}
}
The front private member is a Viewport2DVisual3D.
front
Viewport2DVisual3D
I wanted the tab pages to be blocks where the front side holds the FrameworkElement; this is easy to achieve using the Viewport2DVisual3D class, but as I also wanted the block to have depth, I had to create two meshes, each mesh with its own material.
First, I created a lid-less box, all in one mesh and using a simple DiffuseMaterial.
DiffuseMaterial
This is done by creating a Box from Bornander.Wpf.Meshes, specifying that all sides except the front should be included:
Box
Bornander.Wpf.Meshes
boxMesh = Box.CreateBoxMesh(1, 1, depth,
Box.Side.Right |
Box.Side.Left |
Box.Side.Top |
Box.Side.Bottom |
Box.Side.Back);
Note that the width and height of the box is set to 1.0, that's because the correct aspect ratio (that is, the ratio that the UI element was designed with) is not actually calculated until the assignment of a FrameworkElement, and then a scale transform is calculated to achieve this.
The "lid" of the box is then created the same way, but this time, only the front is included:
visualHostMaterial = new DiffuseMaterial(Brushes.White);
visualHostMaterial.SetValue(
Viewport2DVisual3D.IsVisualHostMaterialProperty, true);
visualMesh = Box.CreateBoxMesh(1, 1, depth, Box.Side.Front);
front = new Viewport2DVisual3D
{
Geometry = visualMesh,
Visual = element,
Material = visualHostMaterial
};
The visual host material is required to display a UIElement as an interactive material on a 3D surface. These two meshes are then added into a model of type ModelVisual3D; that way, whenever I need to move, rotate, or scale the meshes, I can simply apply the transformations to that group of meshes and not have to do it separately for each mesh.
UIElement
ModelVisual3D
The whole Tab class looks like this:
class Tab
{
private readonly Material visualHostMaterial;
private readonly MeshGeometry3D boxMesh;
private readonly MeshGeometry3D visualMesh;
private Viewport2DVisual3D front;
private ModelVisual3D back;
private FrameworkElement element;
private double depth;
public ModelVisual3D Model { get; private set; }
public Tab(FrameworkElement element, Color color, double depth)
{
this.element = element;
this.depth = depth;
visualHostMaterial = new DiffuseMaterial(Brushes.White);
visualHostMaterial.SetValue(
Viewport2DVisual3D.IsVisualHostMaterialProperty, true);
boxMesh = Box.CreateBoxMesh(1, 1, depth,
Box.Side.Right |
Box.Side.Left |
Box.Side.Top |
Box.Side.Bottom |
Box.Side.Back);
visualMesh = Box.CreateBoxMesh(1, 1, depth, Box.Side.Front);
front = new Viewport2DVisual3D
{
Geometry = visualMesh,
Visual = element,
Material = visualHostMaterial
};
back = new ModelVisual3D
{
Content = new GeometryModel3D
{
Geometry = boxMesh,
Material = new DiffuseMaterial(Brushes.CadetBlue),
}
};
Model = new ModelVisual3D();
Model.Children.Add(back);
Model.Children.Add(front);
}
public void UpdateTransform(int index, double angle, double radius)
{
TranslateTransform3D translaslation = new TranslateTransform3D(
0, 0, radius - depth / 2.0);
RotateTransform3D rotation = new RotateTransform3D(
new AxisAngleRotation3D(new Vector3D(0, 1, 0), -index * angle));
ScaleTransform3D scale = element != null ?
new ScaleTransform3D(1.0, double.IsNaN(element.Height)
? 1.0 :
element.Height / element.Width, 1.0)
: new ScaleTransform3D(1, 1, 1);
Transform3DGroup transform = new Transform3DGroup();
transform.Children.Add(scale);
transform.Children.Add(translaslation);
transform.Children.Add(rotation);
Model.Transform = transform;
}
public FrameworkElement Element
{
get { return element; }
set
{
element = value;
front.Visual = element;
}
}
}
In order to place the Tabs in a "carousel", several things have to be calculated: the angle between the different 3D panels, the specific location for a panel and the radius, and the distance from an imaginary center to the center of the panel. All these things are dynamic, and change as the number of panels change.
The first thing, the angle is easy; simply divide 360 degrees by the number of tab panels; that means that if there are three panels, they should be separated by 120 degrees each. The second thing, the specific angle for one tab is calculated using an index; the Carousel user control keeps a IList<Tab> and the angle is calculated using the index in this list. The Tab classes can calculate this themselves, and that's what the UpdateTransform method above does. It creates a rotation transform based on the angle and the index (simply multiply the angle by the index), and that transform rotates the panel to the correct slot on the carousel. The last bit is the radius; this needs to get larger and larger as the number of panels increase so that they won't overlap. As one needs to know the number of panels, this has to be calculated by the Carousel:
IList<Tab>
UpdateTransform
private static double DegreesToRadians(double degrees)
{
return (degrees / 180.0) * Math.PI;
}
private double CalculateRadius()
{
double splitAngle = 360.0 / tabs.Count;
switch (tabs.Count)
{
case 1: return 0.0;
case 2: return 0.25;
default:
return 1.0 / Math.Abs(Math.Sin(DegreesToRadians(splitAngle)));
}
}
Since all panels are 1.0 wide (this never changes; regardless of the aspect ratio, I only modify the height), I calculate the radius as 1.0 / sin(angle between panels). This isn't the optimal distance (i.e., not the smallest distance possible without overlapping), but it's guaranteed to be larger than that, plus, I think it generates a suitable distance.
In order to actually rotate from one panel to the other, I had to come up with a lot of weird calculations (mostly due to Sacha's unreasonable requirements of sliding windows and wrapping collections); it's not that much code, but it's still fairly confusing. Sacha wanted a go-to function, allowing the user to directly jump from one tab page to another, something which is easy enough to implement, but he wanted it so that it never had to rotate more than one step. That is, in the standard setting, jumping from tab 1 to 4 will rotate past 2 and 3 before getting to 4, but Sacha wanted this to directly find 4. Completely unreasonable, if you ask me.
Below is the code that handles this, but first, it's worth noting that I request rotations by queuing up SpinInstructions that tell the Animate method from where and where to go.
SpinInstruction
Animate
private class SpinInstruction
{
public int From { get; private set; }
public int To { get; private set; }
public SpinInstruction(int from, int to)
{
From = from;
To = to;
}
}
In the standard setting, whenever a multi-step rotation is requested by the user, it's queued up as all the steps making up that rotation.
private void Animate()
{
// If no instructions are queue up
// or if we're already animating, ignore request
if (instructions.Count == 0 || isAnimating)
return;
// Grab the next spin instruction
SpinInstruction instruction = instructions.Peek();
bool wrapIt = false;
// If the spin To target is outside the elements list,
// this is going to be a wrapping sping
if (instruction.To < 0 || instruction.To >= elements.Count)
{
// If WrapAtEnd is enabled and if the instruction
// target is a valid one accept it
if (WrapAtEnd && (instruction.To == -1 ||
instruction.To == elements.Count))
{
// Set wrapIt to true to indicate that this
// is a wrapping spin and then adjust the instruction to
// fit the standard logic
wrapIt = true;
instruction = new SpinInstruction(
instruction.From,
instruction.To < 0 ? elements.Count - 1 : 0);
}
else // Done animating for now, remove instruction and return
{
instructions.Dequeue();
isAnimating = false;
return;
}
}
// Angle between panels
double angle = 360.0 / tabs.Count;
// Figure out the target index in the tabs list
int tabToIndex = AlwaysOnlyOneStep ?
GetSafeIndex(currentTabIndex +
Math.Sign(instruction.To - instruction.From))
: GetSafeIndex(instruction.To);
// If this is a wrapping spin, the tabToIndex can
// be set to either the first or last index
if (wrapIt)
{
if (instruction.To == 0)
tabToIndex = 0;
if (instruction.To == elements.Count - 1)
tabToIndex = tabs.Count - 1;
}
// Unhook from visual tree if required because
// a Visual cannot have to parents
foreach (Tab owner in (from tab in tabs
where tab.Element == elements[instruction.To]
|| tab.Element == elements[instruction.From] select tab))
owner.Element = null;
// Make sure the current tab contains the From element
tabs[currentTabIndex].Element = elements[instruction.From];
tabs[currentTabIndex].UpdateTransform(currentTabIndex,
angle, CalculateRadius());
// Make sure the target tab contains the To element,
// this is what allows less tab panels than elements
tabs[tabToIndex].Element = elements[instruction.To];
tabs[tabToIndex].UpdateTransform(tabToIndex, angle, CalculateRadius());
isAnimating = true;
// The angles of the carousel for the from and to tabs
double fromAngle = currentTabIndex * angle;
double toAngle = tabToIndex * angle;
// If this is a wrapping spin add/remove
// a full lap otherwise the animation
// would run backwards for these cases
if (wrapIt)
{
if (instruction.To == 0)
toAngle += 360;
if (instruction.To == elements.Count - 1)
toAngle -= 360;
}
// If this is spinning to a later element,
// but the tab index is less than the current tab index, add a lap
if (instruction.To - instruction.From > 0 &&
tabToIndex < currentTabIndex)
toAngle += 360;
// If this is spinning to a earlier element,
// but the tab index is greater than the
// current tab index, subtract a lap
if (instruction.To - instruction.From < 0 &&
tabToIndex > currentTabIndex)
toAngle -= 360;
CreateSpinAnimation(instruction, tabToIndex, fromAngle, toAngle);
}
The CreateSpinAnimation is responsible for creating the actual animations and calling Animate again when the spin animation has completed.
CreateSpinAnimation
In the code above, the camera distance is calculated on a tab-per-tab basis. This is because although the tabs themselves will scale to the correct aspect ratio, there's also the issue with size on screen. If, for example, a user control was designed to be displayed in 300x400, it's not enough to create a 3D box 300 wide and 400 tall, because one set of units (the first) are in pixels and the second is unit less. It's just distance in 3D, not pixels. Therefore, the Carousel has to calculate the distance from the panel that the camera has to be at in order for the UI element to be rendered correctly. This also depends on the size of the Viewport3D containing all the elements.
Viewport3D
Basically, it looks something like this:
And, in math terms: solve the distance y, where y is one leg of a square triangle made up of y itself, 0.5 (half the 3D panel width), and the hypotenuse is formed by extending the camera's field of view (or half field of view). Since we don't know the length of the hypotenuse but can figure out the angle (as it's half the field of view), we can use tan(field of view / 2.0), or in code terms:
private double CalculateCameraDistance(int index, int tabIndex)
{
Tab tab = tabs[tabIndex];
double y = 0.5 / Math.Tan(DegreesToRadians(MainCamera.FieldOfView / 2.0));
double panelWidth = tab.Element != null ? tab.Element.Width : 1.0;
double ratio = Grid3D.ActualWidth / panelWidth;
return CalculateRadius() + Math.Max(ratio, 1.0) * y;
}
When y is found, multiply it with the ratio between the designed UI element width and the Viewport3D current width to compensate for the size of the Viewport3D. And lastly, offset it by the distance of the radius of the carousel. By taking the max of 1.0 and the calculated ratio, Math.Max(ratio, 1.0), the distance will make sure the entire width of the panel is always visible, even if the Viewport3D is smaller than the designed size of the panel.
Math.Max(ratio, 1.0)
Since most WPF user controls are designed to be used inside a window or another control, their width and height cannot always be determined (hence the need for both Width and ActualWidth properties found on some WPF UI elements). In order for a user control to play nice with this tab control, it's therefore important to set the MinWidth, MaxWidth, and Width at design time.
Width
ActualWidth
MinWidth
MaxWidth
The WPF user control that implements the carousel is called Carousel, intuitive, eh? And, as this control is mostly about rotation and camera position calculations, the XAML for it is quite simple:
<UserControl x:Class="Bornander.UI.TabCarousel.Carousel"
xmlns=""
xmlns:
<Grid x:
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera x:
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight x:
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D>
<ModelVisual3D.Content>
<DirectionalLight x:
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D x:
</Viewport3D>
</Grid>
</UserControl>
The user control sets up a few things:
(0, 0, 0)
CarouselContainer
I could have had the definitions for the meshes in XAML as well, but I find it easier and more flexible to use code for this. The most complicated part was getting the wrapping rotation right, especially when there's less tab than there are elements in the carousel. This is because the way the rotation animation works, animating from 270 degrees to 360 is different than going from 270 to 0, which kind of makes sense, but still caused me some head aches as 360 and 0 are really the same.
As always, any comments on the code or the article are most welcome.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Color
Material = new DiffuseMaterial(Brushes.CadetBlue),
Material = new DiffuseMaterial(new SolidColorBrush(color)),
public void AddTab(FrameworkElement element)
{
element.PreviewMouseDown += ElementPreviewMouseDown;
elements.Add(element);
Organize(NumberOfTabs);
}
void ElementPreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (navigateOnSelect)
{
int i = elements.IndexOf((FrameworkElement)sender);
if (i == currentIndex) return;
Point p1 = Mouse.GetPosition(elements[currentTabIndex]); // are we left or right of the selected item.
if (p1.X > 0)
SpinToPrevious();
else
SpinToNext();
//SpinToIndex(i);
}
}
Fredrik Bornander wrote:Don't forget to vote for it over here[^] and here[^] Smile
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.
|
http://www.codeproject.com/Articles/49949/WPF-3D-Tab-Carousel
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
If you look at a lot of flash games they have something where whenever you hit something to get points a flash of points pops up. This is an excellent effect and really adds some flair to your flash games. I use this a lot and decided to make it into a reusable class.
A great example of it in use is bejeweled 2, when you connect some gems a burst of points is created check it out.
So after doing this I thought I'd share it with all you budding flash game developers
So here it is
This class will create the text and sprite needed and then remove itself once done, very efficient and very cool.
This is quite a small class but we still need some imports so we'll do that now, create your PointFlash.as and add this code:
package { import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.Timer;
The effect itself will animate but it is still classed as a sprite because it doesn't use multiple frames, instead the class will increase the size and alpha of the sprite each time step.
now we will add some static constants to set the font,size and colour:
public class PointFlash extends sprite { static const fontFace:String = "Arial"; static const fontSize:int = 20; static const fontBold:Boolean = true; static const fontColour:Number = 0xFFFFFF;
We can now create some constants that control the animation, first we will create animSteps this is the amount of steps during the animation time so it controls the smoothness of the animation. Then we will create animStepTime which controls the time between steps, for example 10 steps with 50 milliseconds between them takes 500 milliseconds, 20 steps at 25 milliseconds also takes 500 milliseconds but has twice as many steps for smoother animation.
static const animSteps:int = 10; static const animStepTime = 50;
The size of the sprite changes during the animation, we will set a few more constants for these.
static startScale:Number = 0; static endScale:Number = 2.0;
Next we will create some veriables to hold the references to the items in the class, we need a textField, Sprite, a reference to the stage or movie clip where the pointFlash will be placed and also a timer object.
private var tField:TextField; private var flashSprite:Sprite; private var parentMC:MovieClip; private var animTimer:Timer;
Ok then, not too difficult so far then. Next we will write the function for the PointFlash, the function will create the PointFlash and accept some parameters, these parameters will be the location of the effect and the text to display.
So the first parameter will be a movieclip, this will be a reference to the stage or another movieclip that you want to place the effect.
public function PointFlash(mc:MovieClip, pts:Object, x,y:Number) {
OK now lets write the innards of the function, its pretty self explanatory to start with, we will initialize some values using our previously set constants and some new values.
var tFormat:TextFormat = new TextFormat(); tFormat.font = fontFace; tFormat.size = fontSize; tFormat.bold = fontBold; tFormat.color = fontColour; tFormat.align = "center";
No explanation needed there I don't think, so lets create the textField itself. We will set selectable to false and also use embedded fonts instead of system fonts, this is because we want to play with the transparency. To center the text we will set the autoSize of the field to textFieldAutoSize.CENTER. also we will set the x and y properties to negative half of the height and width. THis puts the center at 0,0.
tField = new TextField(); tField.embedFonts = true; tFIeld.selectable = false; tField.defaultTextFormat = tFormat; tFIeld.autoSize = textFIeldAutoSize.CENTER; tFIeld.text = String(pts); tField.x = -(tField.width/2); tFIeld.y = -(tFIeld.height/2);
Again nothing to difficult there, now we are going to create the sprite itself, the sprite holds the text and is the main display object. We will set the location to the x and y values that are passed in as parameters, set scale to the startScale constant, set alpha to 0 and then add the sprite to the movieclip.
fSprite = new Sprite(); fSprite.x = x; fSprite.y = y; fSprite.scaleX = startScale; fSprite.scaleY = startScale; fSprite.alpha = 0; fSprite.addChild(tFIeld); parentMC = mc; parentMC.addChild(fSprite);
Ok so that is basically it for the creation of the sprite, now we need to animate it to make it do something and look cool. All we will basically do is create a timer passing in out animSteps and animStepTIme values, then each step we will call a new function we are about to create called rescaleObj. Once the timer is complete we will use another function we are about to create called removeObj.
animTimer = new Timer(animStepTime,animSteps); animTimer.addEventListener(TimerEvent.TIMER, rescaleObj); animTimer.addEventLIstener(TimerEvent.TIMER_COMPLETE, removeObj); animTimer.start(); }
now lets create the rescaleObj function:
public function rescaleObj(event:TimerEvent) { var percentDone:Number = event.target.currentCount/animSteps; fSprite.scaleX = (1.0 - percentDone)*startScale + percentDone*endScale; fSprite.scaleY = (1.0 - percentDone)*startScale + percentDone*endScale; fSprite.alpha = 1.0 - percentDone; }
Ok there's our animation done now we need the object to remove itself, we will create the removeObj function now:
public function removeBurst(event:TimerEvent) { fSprite.removeChild(tField); parentMC.removeChild(fSprite); tField = null; fSprite = null; delete this; }
Ok thats basically it, the class is finished, one thing you will need to do is to adda font to the library, this is because we are using embedded fonts, To do this simply click the library's drop down menu and choose new font, choose your font and name it whatever you like, then right click your new font and choose linkage then export for actionscript.
Now you can add the class to your project, I won't go into detail about how to add files to your project, I'm sure you already know that.
A PointFlash can be used with one line of code now, for example
var pf:PointFlash = new PointFlash(this,100,50,75)
This uses the object as the movieclip to draw to, it displays the number 100 and it is at locations 50 and 75.
I am currently making a C++ SDL version of this class and I will definitely share it once finished
Thanks for reading and feel free to ask me any questions about the tutorial.
|
http://www.dreamincode.net/forums/topic/109988-creating-a-point-flash-like-bejeweled-2/page__pid__1123410__st__0
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
Issues
ZF-2850: CLONE -namespace changed to inputNamespace (see trackers 2280 and 2460) - Documentation not up to date
Description
I had options in zend_filter_input which contained more default namespaces. Upgrading to 1.0.4 broke my unit tests because of namespace becoming inputNamespace. I've changed the problem in my code. The docs should be changed or backwards compatibility should be kept.
Posted by Burkhard Ritter (burkhard) on 2008-03-10T18:24:28.000+0000
The real problem is, that the documentation is not up to date:… It still uses "namespace", but it should be "inputNamespace".
Posted by Darby Felton (darby) on 2008-03-14T13:40:10.000+0000
Resolving as duplicate; will commit documentation update shortly.
|
http://framework.zend.com/issues/browse/ZF-2850?focusedCommentId=19820&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
in reply to Difference between use Module::Name and use Module::Name qw /method1 method2/
@EXPORT = qw//;
@EXPORT_OK = qw/check_digit is_valid valid_chars/;
[download]
so if you wanna import is_valid you need to tell explicitly.
see also How to Export
> Is it somehow better to use the second statement if I use only "is_valid" method in my code? Maybe, memory issues or something?
No! No significant memory problems, importing is a kind of aliasing between namespaces.
But you have to care about potential namespace polution, see Selecting What To Export.
Please note that you don't necessarily need to import is_valid, otherwise can also address Algorithm::LUHN::is_valid directly..
|
http://www.perlmonks.org/index.pl?node_id=1015841
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
Except for the function names and arguments, thread specific data is the same for Solaris as it is for POSIX. The synopses for the Solaris functions are given in this section.
thr_keycreate(3T) allocates a key that is used to identify thread-specific data in a process. (For POSIX threads, see "pthread_key_create(3T)".)
#include <thread.h> int thr_keycreate(thread_key_t *keyp, void (*destructor) (void *value));
|
http://docs.oracle.com/cd/E19620-01/805-5080/sthreads-86486/index.html
|
CC-MAIN-2016-18
|
en
|
refinedweb
|
I'd like to use mc as a search shortcut for metacritic.com from Google Chrome. I set up the following search URL for the shortcut:
Unfortunately, when I search for patrician iii as follows
mc patrcian iii
Chrome produces this query, which metacritic misinterprets to produce a useless set of unrelated results:
Metacritic likes this query, giving me exactly the result I was looking for:
How can I force Chrome to use plus symbols instead of URL encoded spaces?
:-|
Though a bit crude, you can create a simple Chrome extensions that adjusts the URL for metacritic (or other sites if you want)
Here's the code I've used for a Metacritic Search URL Replace extension:
manifest.json:
{
"content_scripts": [ {
"include_globs": [ "*%20*" ],
"js": [ "script.js" ],
"matches": [ "http://*/*", "https://*/*" ],
"run_at": "document_start"
} ],
"converted_from_user_script": true,
"description": "Replaces '%20' in metacritic search request to '+'",
"name": "Metacritic search replacer",
"version": "0.1"
}
script.js:
window.location = window.location.href.replace(/%20/g, "+");
Since I don't really have a reliable spot to upload my extension, here are the instructions to create a Chrome extension using these two files:
First, put the two files in a folder somehwere and browse to chrome://extensions. Make sure the developer mode is active (look at the top right of the page to enable this). Here you can select 'Pack extension..' which asks you for the folder where your script resides. Once you have selected this folder, the extension will be created and you can just drag & drop it into Chrome to install. If everything went according to plan, the script will rewrite the URL for a Metacritic search request from the '%20' to the '+' characters.
Now, you can use as a search engine url in Chrome itself to use a shortcut to this search.
Hope this helps.. ;)
You don't need to use the REST style of searching, but can instead use normal HTTP GET parameters like this:
So in your case that would be:
Unfortunately, this doesn't work with Metacricic (?).
The best I could get is the following search function, however it doesn't really redirect for some reason:
data:text/html;charset=utf-8,<script>var s = "%s"; s = s.replace("%20", "+"); var url = "" + s + "/results"; window.location = url;</script>
Background info:
Chrome encodes the sent parameters depending on the position, i.e. if its within an URL or as a GET parameter. Within an URL it makes sense to convert a space to %20, whereas in a parameter the + is used.
%20
+
Unfortunately, they're not up to changing this behavior, so my guess would be that a simple line of Javascript could fix this. I'll look into it.
As pointed out by slhck in his answer, Chrome only supports %s, and insists on "intelligently" determining whether to use plus symbols or %20 to escape spaces (see Chromium bug 78429).
The particular test case I'm dealing with (metacritic.com) imposes too many hoops to leap through concurrently with their RESTful search interface.
Therefore, as a work-around, I elected to simply use app.metacritic.com's legacy interface:
If that hadn't been available, I would have contacted metacritic.com, referred them to the Chromium bug, and begged for mercy. :-)
I couldn't get neither the .crx or the .js to install properly (maybe it is my fault).
I managed to get it working by relying on a greasemonkey script (I do personnaly use the Tampermonkey google chrome extension to handle greasemonkey scripts).
Once in Tampermonkey I create a new script and paste the following (and it works! once again, a BIG THANKS to JiriB, as I just copy/pasted his findings):
// ==UserScript==
// @name Google-Chrome-URL-Replacer-Extension (Metacritic)
// @namespace
// @version 1.0
// @description Replaces %20 with + in URLs in order to build valid URLS for search engine shortcuts
// @include*%20*
// ==/UserScript==
//
window.location = window.location.href.replace(/%20/g, "+");
I was having difficulty with this same thing, and found this page. Unfortunately the answers were either too complex or, like the legacy search idea, didn't work, and then I suddenly remembered what I used to do with metacritic, which was to search it with google because metacritics search engine was so poor (still is, actually). So what I did was create a google search and make that my metacritic search:
Obviously it's not ideal, in that you don't get metacritic's nice search result page, but it does give useful results. I also created channel specific versions; for example, if I want to search for TV shows I use the same engine with "/tv/" added to it.
Edit: I've added this basic extension to the Chrome Store, I also added icons but didn't otherwise change the code. Yay now Chrome can just do its thing and I can delete it from my download folder! Link is: Metacritic search fixer.
Original post: I've updated JiriB's extension code so it works in Chrome again! It really just needed one extra line. I've never used github before, but I forked his project and submitted a pull request.
{
"content_scripts": [ {
"include_globs": [ "*%20*" ],
"js": [ "script.js" ],
"matches": [ "http://*/*", "https://*/*" ],
"run_at": "document_start"
} ],
"converted_from_user_script": true,
"description": "Replaces '%20' in metacritic search request to '+'",
"name": "Metacritic search fixer",
"manifest_version": 2,
"version": "0.2.2"
}
By posting your answer, you agree to the privacy policy and terms of service.
tagged
asked
2 years ago
viewed
2331 times
active
3 months ago
|
http://superuser.com/questions/281934/forcing-s-to-escape-spaces-with-plus-instead-of-percent-twenty
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Modularization makes programming possible. Throughout the history of computing, a parade of organizational devices—the high-level language, the subroutine, the object—has allowed us to write increasingly more expressive and powerful code. But, just as with computer hardware, when our abilities improve, we raise the bar again, and here in the twenty-first century, we still struggle to quickly and cheaply produce large programs. What is the next step, the new way to structure our programs that will take our abilities to the next level?
Aspect-oriented programming (AOP) is one attempt at an answer. Conceived at Xerox PARC (an auspicious pedigree!) in the late 1990s, AOP intends to modularize cross-cutting concerns: lines of code that would have to be repeated throughout an ordinary program. AOP gathers all of these cross-cutting concerns into a single place, an AOP construct similar to a class, known as advice.
AspectJ, also originally from Xerox PARC and now developed by the Eclipse Foundation, is an implementation of AOP for the Java platform. It is a mature and solid framework that has gone through several significant releases and is even supported by some third-party tools. Recently, however, application server designers have realized that while—just as AOP proponents have been saying for years—AOP seems a natural way to implement many kinds of application server functionality such as remoting, persistence, and transactions, AOP would be much easier to use in the dynamic environment of the Java platform if its implementation were equally dynamic.
For a thorough introduction to AOP concepts and the AspectJ implementation, see Ramnivas Laddad's three-part JavaWorld series, "I Want My AOP!". For this discussion, I assume you're up to speed on AOP basics and briefly present classic AOP examples so we can get on to the new stuff.
Here's an example of how aspect-oriented programming might be used in a middleware framework: Imagine that in our framework, a client accesses services via proxies. The services might be in another VM and might be reached by any remoting technology; hiding these things from the client is the framework's reason for being. One of our framework's features is its ability to propagate any context that a developer wishes from the client to the services it calls transparently to the client. For example, an application might log a user into a security service and put an authentication token in the context. From then on, any services called by that application would be able to retrieve the authentication token from the context—on the server side—and use it to control the functionality to which the client has access.
First, let's write a simple test to show that context is propagated:
public class ContextPassingTest extends TestCase { public void test() { ClientSideContext.instance().put("userID", "dave"); ContextRetriever proxy = (ContextRetriever) ProxyFactory.instance().getProxy("ContextRetriever"); assertEquals("dave", proxy.get("userID")); } }
In our test, we first put an authentication token into the context. Next, we get a proxy to our service from a singleton
ProxyFactory. (This is an example of the Service Locator pattern, in which a factory hides from the client the complexity of constructing a proxy to a remote service.) The service, an instance
of
ContextRetriever, simply returns the requested value from its context. In the test's last line, we ask for our authentication token back and
test to see whether it has the value it should. That's it!
Archived Discussions (Read only)
|
http://www.javaworld.com/javaworld/jw-07-2004/jw-0705-aop.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
and lib/site-python.
import sys import os import platform import site if 'Windows' in platform.platform(): SUFFIXES = [ '', 'lib/site-packages', ] else: SUFFIXES = [ 'lib/python%s/site-packages' % sys.version[:3], 'lib/site-python', ] print 'Path prefixes:' for p in site.PREFIXES: print ' ', p for prefix in sorted(set(site.PREFIXES)): print for suffix in SUFFIXES: path = os.path.join(prefix, suffix).rstrip(os.sep) print path print ' exists:', os.path.exists(path) print ' in path:', path in sys.path
Each of the paths resulting from the combinations is tested, and those that exist are added to sys.path.
$ python site_import_path.py Path prefixes: /Library/Frameworks/Python.framework/Versions/2.7 /Library/Frameworks/Python.framework/Versions/2.7 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages exists: True in path: True /Library/Frameworks/Python.framework/Versions/2.7 filesystem owned (and writable) by the current user. Inside the USER_BASE is a site-packages directory, with the path accessible as USER_SITE.
import site print 'Base:', site.USER_BASE print 'Site:', site.USER_SITE
The USER_SITE path name is created using the same platform-specific values described above.
$ python site_user_base.py Base: /Users/dhellmann/.local Site: /Users/dhellmann/.local/lib/python2.7/site-packages
The user base directory can be set through the PYTHONUSERBASE environment variable, and has platform-specific defaults (~/Python$version/site-packages for Windows and ~/.local for non-Windows).
You can check the USER_BASE value from outside of your Python program by running site from the command line. site will give you the name of the directory whether or not it exists, but it is only added to the import path when it does.
$ python -m site --user-base $ python -m site --user-site $ PYTHONUSERBASE=/tmp/$USER python -m site --user-base $ PYTHONUSERBASE=/tmp/$USER python -m site --user-site
The user directory is disabled under some circumstances that would pose security issues. For example, if the process is running with a different effective user or group id than the actual user that started it. Your site_enable_user_site.py Flag : True Meaning: Enabled $ python statement.
- Blank lines are ignored.
- A line starting with # is treated as a comment and ignored.
Path configuration files can be used to extend the import path to look in locations that would not have been added automatically. For example, Distribute adds a path to easy-install.pth when it installs a package in “develop” mode using python setup.py develop.
The function for extending sys.path is public, so we can use it in example programs to show how the path configuration files work. Given a directory with_modules containing the file mymodule.py with this print statement showing how the module was imported:
import os print 'Loaded', __name__, 'from', _, err: print 'Could not import mymodule:', err print before_len = len(sys.path) site.addsitedir(module_directory) print 'New paths:' for p in sys.path[before_len:]: print ' ', p print import mymodule
After the directory containing the module is added to sys.path, the script can import mymodule without issue.
$ python site_addsitedir.py with_modules Could not import mymodule: No module named mymodule New paths: /Users/dhellmann/Documents/PyMOTW/src/PyMOTW/site/with_modules Loaded mymodule from with_modules/mymodule.py
If the directory given to addsitedir() includes any files matching the pattern *.pth, they are loaded as path configuration files. For example, if we create with_pth/pymotw.pth containing:
# Add a single subdirectory to the path. ./subdir
and copy mymodule.py to with_pth/subdir/mymodule.py, then we can import it by adding with_pth as a site directory, even though the module is not in that directory.
$ python site_addsitedir.py with_pth Could not import mymodule: No module named mymodule New paths: /Users/dhellmann/Documents/PyMOTW/src/PyMOTW/site/with_pth /Users/dhellmann/Documents/PyMOTW/src/PyMOTW/site/with_pth/subdir Loaded mymodule from with_pth/subdir/mymodule.py
If a site directory contains multiple .pth files, they are processed in alphabetical order.
$ ls -F with_multiple_pth a.pth b.pth from_a/ from_b/ $ cat with_multiple_pth/a.pth ./from_a $ cat with_multiple_pth/b.pth ./from_b
In this case, the module is found in with_multiple_pth/from_a because a.pth is read before b.pth.
$ python site_addsitedir.py with_multiple_pth Could not import mymodule: No module named mymodule New paths: /Users/dhellmann/Documents/PyMOTW/src/PyMOTW/site/with_multiple_pth /Users/dhellmann/Documents/PyMOTW/src/PyMOTW/site/with_multiple_pth/from_a /Users/dhellmann/Documents/PyMOTW/src/PyMOTW/site/with_multiple_pth/from_b Loaded mymodule from with_multiple_pth/from_a/mymodule.py
sitecustomize filesystem.' print 'End of path:', sys.path[-1]
Since sitecustomize is meant for system-wide configuration, it should be installed somewere in the default path (usally in the site-packages directory). This example sets PYTHONPATH explicitly to ensure the module is picked up.
$ PYTHONPATH=with_sitecustomize python with_sitecustomize/site_sitecusto\ mize.py Loading sitecustomize.py Adding new path /opt/python/2.7/Darwin-11.4.2-x86_64-i386-64bit Running main program End of path: /opt/python/2.7/Darwin-11.4.2-x86_64-i386-64bit
usercustomize your own code.
import sys print 'Running main program' with_usercustomize/site_usercusto\ mize.py Loading usercustomize.py Adding new path /Users/dhellmann/python/2.7/Darwin-11.4.2-x86_64-i386-64bit Running main program End of path: /Users/dhellmann/python/2.7/Darwin-11.4.2-x86_64-i386-64bit
When the user site directory feature is disabled, usercustomize is not imported, whether it is located in the user site directory or elsewhere.
$ PYTHONPATH=with_usercustomize python -s with_usercustomize/site_usercu\ stomize.py Running main program End of path: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Disabling site¶
To maintain backwards-compatibility with versions of Python from before the automatic import was added, the interpreter accepts an -S option.
$ python -S site_import_path.py Path prefixes: sys.prefix : /Library/Frameworks/Python.framework/Versions/2.7 sys.exec_prefix: /Library/Frameworks/Python.framework/Versions/2.7 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages exists: True in path: False /Library/Frameworks/Python.framework/Versions/2.7/lib/site-python exists: False in path: False
See also
- site
- The standard library documentation for this module.
- Modules and Imports
- Description of how the import path defined in sys works.
- Running code at Python startup
- Post from Ned Batchelder discussing ways to cause the Python interpreter to run your custom initialization code before starting the main program execution.
|
http://pymotw.com/2/site/index.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
23 July 2010 17:33 [Source: ICIS news]
TORONTO (ICIS news)--German business confidence marked its largest monthly increase in July since the country’s reunification in 1990, largely driven by improved export prospects, a research institute said on Friday.
Munich-based Ifo institute said its monthly business climate index rose to 106.2 points in July, up by 5.6 points from June. The index is based on a survey of 7,000 businesses across ?xml:namespace>
Ifo president Hans-Werner Sinn said the latest survey showed that producers were optimistic about export prospects. Also, industry capacity utilisation was increasing, he said.
Manufacturers were especially upbeat, with many indicating they may boost staff levels, the survey found.
The increase in the Ifo index contrasts with July’s decline in another key indicator that measures economic sentiment based on a survey of analysts. Mannheim-based ZEW centre for European economic research said earlier its economic sentiment index marked its third monthly decline in a row in July amid continued worries over the euro zone debt crisis.
As for
However, Frankfurt-based chemical trade group VCI has said it expected production to grow at a slower pace in the second half of 2010, partly due to lower growth in the EU, which is the largest export market for
Full-year 2010 chemical production growth is forecast at 8.5%, after a 10% decline in 2009 from 2008.
Meanwhile,
|
http://www.icis.com/Articles/2010/07/23/9379005/german-business-confidence-jumps-on-export-prospects-survey.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
#include <Thyra_MultiVectorFileIOBase.hpp>
Inheritance diagram for Thyra::MultiVectorFileIOBase< Scalar >:
The concept of a file is every general and really can be implemented as any type of object data base that is keyed on a string name (i.e.
fileNameBase). In that sense, this interface is really an interface to a general multi-vector serialization/deserialization implementation, but file-based implementations are expected to be the most common.
This interface currently requires the client to know the correct vector space and to pre-create the multi-vectors with the right number of columns before they can be read in. In all current use cases where this interface is used, the client knows what it needs to read so this is fine.
ToDo: Add a form of readMultiFromFile(...) that will accept just a vector space and will create a multi-vector with as many columns as is specified in the file. Right now I don't know this functionality so I am not going to implement this. However, if an important use case is found where this functionality is needed, then we can add this implementation without much trouble.
ToDo: Derive this interface from Teuchos::ParameterListAcceptor so that we can set some options on how the reading and writing gets done (e.g. use binary or ASCII formating).
Definition at line.
mv!=NULL
this->isCompatible(*mv)==true.
Implemented in Thyra::DefaultSpmdMultiVectorFileIO< Scalar >.
Write a (multi)vector to a file given the file base name..
|
http://trilinos.sandia.gov/packages/docs/r10.2/packages/thyra/doc/html/classThyra_1_1MultiVectorFileIOBase.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
Type: Posts; User: rbmazter
I am new programmer. In the first place I really like my job because they gave me project and then when I finished it they give me a new task that was fixing a bugs of others work. The programmer who...
I separate my interface. I am using MVC 3 .
So far I already solve the problem in sending emails.
Thanks so much. :)
Uhm are you the one develop this website?
Programmers: Need Help!
using System.Net.Mail;
namespace MvcMembership
{
public interface ISmtpClient
{
void Send(MailMessage mailMessage);
}
}
Thanks so much ssystems.....
Please help customizing user management system using MembershipUserCollection in asp.net/C#....
>List of all users
>Search,edit,delete user
>Change user roles
>Password recovery
......thanks
Hello guys,
Can you give a project. I am newly hired .Net Developer in the company and I don't have a project yet I want to make myself busy. Anyone could give me a simple website...
|
http://www.webdeveloper.com/forum/search.php?s=751780639422b29f83c10d974581c1ba&searchid=2426589
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
When working with from a Java environment, one can choose between the Thrift client or using the Hive JDBC-like driver. Both have their pros and cons but no matter the choice, Spring and SHDP supports both of them.
SHDP provides a dedicated namespace element for starting a Hive server as a Thrift service (only when using Hive 0.8 or higher). Simply specify the host, the port
(the defaults are
localhost and
10000 respectively) and you're good to go:
<!-- by default, the definition name is 'hive-server' --> <hdp:hive-server
If needed the Hadoop configuration can be passed in or additional properties specified. In fact
hiver-server provides the same properties configuration
knobs
as hadoop configuration:
<hdp:hive-server someproperty=somevalue hive.exec.scratchdir=/tmp/mydir </hdp:hive-server>
The Hive server is bound to the enclosing application context life-cycle, that is it will automatically startup and shutdown along-side the application context.
Similar to the server, SHDP provides a dedicated namespace element for configuring a Hive client (that is Hive accessing a server node through the Thrift). Likewise, simply specify the host, the port
(the defaults are
localhost and
10000 respectively) and you're done:
<!-- by default, the definition name is 'hiveClientFactory' --> <hdp:hive-client-factory
Note that since Thrift clients are not thread-safe,
hive-client-factory returns a factory (named
org.springframework.data.hadoop.hive.HiveClientFactory)
for creating
HiveClient new instances for each invocation. Further more, the client definition
also allows Hive scripts (either declared inlined or externally) to be executed during initialization, once the client connects; considering using a tasklet) by the factory. The first executed a script defined inlined while the second read the script from the classpath and passed one parameter to it. For more information on using parameter (or variables) in Hive scripts, see this section in the Hive manual.
Another attractive option for accessing Hive is through its JDBC driver. This exposes Hive through the JDBC API meaning one can use the standard API or its derived utilities to interact with Hive, such as the rich JDBC support in Spring Framework.
SHDP does not offer any dedicated support for the JDBC integration - Spring Framework itself provides the needed tools; simply configure Hive as you would with any other JDBC
Driver:
<beans xmlns="" xmlns: <!-- basic Hive driver bean --> <bean id="hive-driver" class="org.apache.hadoop.hive.jdbc.HiveDriver"/> <!-- wrapping a basic datasource around the driver --> <!-- notice the 'c:' namespace (available in Spring 3.1+) for inlining constructor arguments, in this case the url (default is 'jdbc:hive://localhost:10000/default') --> <bean id="hive-ds" class="org.springframework.jdbc.datasource.SimpleDriverDataSource" c: <!-- standard JdbcTemplate declaration --> <bean id="template" class="org.springframework.jdbc.core.JdbcTemplate" c: <context:property-placeholder </beans>
And that is it! Following the example above, one can use the
hive-ds
DataSource bean to manually get a hold of
Connections
or better yet, use Spring's
JdbcTemplate as in the example above. straight forward:
<hdp:hive-tasklet <hdp:script> DROP TABLE IF EXITS testHiveBatchTable; CREATE TABLE testHiveBatchTable (key int, value string); </hdp:script> <hdp:script </hdp:hive-tasklet>
The tasklet above executes two scripts - one declared as part of the bean definition followed by another located on the classpath..
|
http://docs.spring.io/spring-data/hadoop/docs/1.0.0.RELEASE/reference/html/hive.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
CDI Dependency Injection - An Introductory Tutorial Part 1 - Java EE
By default, CDI would look for a class that implements the ATMTransport interface, once it finds this it creates an instance and injects this instance of ATMTransport using the setter method setTransport. If we only had one possible instance of ATMTransport in our classpath, we would not need to annotate any of the ATMTransport implementations. Since we have three, namely, StandardAtmTransport, SoapAtmTransport, and JsonAtmTransport, we need to mark two of them as @Alternative's and one as @Default.
Step 3: Use the @Default annotation to annotate the StandardAtmTransport
At this stage of the example, we would like our default transport to be StandardAtmTransport; thus, we mark it as @Default as follows:
Code Listing: StandardAtmTransport using @Default
package org.cdi.advocacy; import javax.enterprise.inject.Default; @Default public class StandardAtmTransport implements ATMTransport { ...
It should be noted that a class is @Default by default. Thus marking it so is redundant; and not only that its redundant.
Step 4: Use the @Alternative to annotate the SoapAtmTransport, and JsonRestAtmTransport.
If we don't mark the others as @Alternative, they are by default as far as CDI is concerned, marked as @Default. Let's mark JsonRestAtmTransport and SoapRestAtmTransport @Alternative so CDI does not get confused.
Code Listing: JsonRestAtmTransport using @Alternative
package org.cdi.advocacy; import javax.enterprise.inject.Alternative; @Alternative public class JsonRestAtmTransport implements ATMTransport { ... }
Code Listing: SoapAtmTransport using @Alternative
package org.cdi.advocacy; import javax.enterprise.inject.Alternative; @Alternative public class SoapAtmTransport implements ATMTransport { ... }
Step 5: Use the @Named annotation to make the AutomatedTellerMachineImpl easy to look up; give it the name "atm"
Since we are not using AutomatedTellerMachineImpl from a Java EE 6 application, let's just use the beanContainer to look it up. Let's give it an easy logical name like "atm". To give it a name, use the @Named annotation. The @Named annotation is also used by JEE 6 application to make the bean accessible via the Unified EL (EL stands for Expression language and it gets used by JSPs and JSF components).
Here is an example of using @Named to give the AutomatedTellerMachineImpl the name "atm"as follows:
Code Listing: AutomatedTellerMachineImpl using @Named
package org.cdi.advocacy; import java.math.BigDecimal; import javax.inject.Inject; import javax.inject.Named; @Named("atm") public class AutomatedTellerMachineImpl implements AutomatedTellerMachine { ... }
It should be noted that if you use the @Named annotations and don't provide a name, then the name is the name of the class with the first letter lower case so this:
@Named public class AutomatedTellerMachineImpl implements AutomatedTellerMachine { ... }
makes the name automatedTellerMachineImpl.
Step 6: Use the CDI beanContainer to look up the atm, makes some deposits and withdraws.
Lastly we want to look up the atm using the beanContainer and make some deposits.
Code Listing: AtmMain looking up the atm by name
package org.cdi.advocacy; ... public class AtmMain { ... ... public static void main(String[] args) throws Exception { AutomatedTellerMachine atm = (AutomatedTellerMachine) beanContainer .getBeanByName("atm"); atm.deposit(new BigDecimal("1.00")); } }
When you run it from the command line, you should get the following:Output
deposit called communicating with bank via Standard transport
You can also lookup the AtmMain by type and an optional list of Annotations as the name is really to support the Unified EL (JSPs, JSF, etc.).
Code Listing: AtmMain looking up the atm by type
package org.cdi.advocacy; ... public class AtmMain { ... ... public static void main(String[] args) throws Exception { AutomatedTellerMachine atm = beanContainer.getBeanByType(AutomatedTellerMachine.class); atm.deposit(new BigDecimal("1.00")); } }
Since a big part of CDI is its type safe injection, looking up things by name is probably discouraged. Notice we have one less cast due to Java Generics.
If you remove the @Default from the StandardATMTransport, you will get the same output. If you remove the @Alternative from both of the other transports, namely, JsonATMTransport, and SoapATMTransport, CDI will croak as follows:Output
Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: javax.enterprise.inject.AmbiguousResolutionException: org.cdi.advocacy.AutomatedTellerMachineImpl.setTransport: Too many beans match, because they all have equal precedence. See the @Stereotype and <enable> tags to choose a precedence. Beans: ManagedBeanImpl[JsonRestAtmTransport, {@Default(), @Any()}] ManagedBeanImpl[SoapAtmTransport, {@Default(), @Any()}] ManagedBeanImpl[StandardAtmTransport, {@javax.enterprise.inject.Default(), @Any()}] ...
CDI expects to find one and only one qualified injection. Later we will discuss how to use an alternative.
Using @Inject to inject via constructor args and fields
You can inject into fields,constructor arguments and setter methods (or any method really).
Here is an example of field injections:
Code Listing: AutomatedTellerMachineImpl.transport using @Inject to do field injection.
... public class AutomatedTellerMachineImpl implements AutomatedTellerMachine { @Inject private ATMTransport.
|
http://java.dzone.com/articles/cdi-di-p1?page=0,1&%24Version=1&%24Path=%2F
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
Construct a preconditioner using a LDU dcomposition of a block 2x2 matrix. More...
#include <Teko_LU2x2PreconditionerFactory.hpp>
Construct a preconditioner using a LDU dcomposition of a block 2x2 matrix.
This produces a preconditioner using the block-LDU decomposition of the matrix. The general assumption made is that the matrix is 2x2 and the block factorization can be constructed (i.e. assumptions about the invertability of some blocks). The pattern used, and the one you should follow if you want to use this software is
where the Schur complement is
.
To use an LDU approximation 2 evaluations of
and a single evalution of
are needed. For increased flexibility both evaluations of
can be specified independently. For righthand side vector
and solution vector
the two inverses (
-hat and
-tilde) are needed to evaluate
,
where
is an intermediate step.
In order to facilate using this class in a nonlinear solve (or for a time-dependent problem) the additional abstraction of a ``Strategy'' has been added. This strategy, abstractly represented as the LU2x2Strategy, provides the
and
operators. Typical usage for this class is to build a LU2x2Strategy and pass it into the primary constructor. Additional constructors are provided both for convenience and to ease adoption. Underneath the hood all these constructors do is invoke the corresponding strategy object.
For example, assume that you have the particularly nice case that your approximations of
and
are independent of the source operator. Then, one way to instantiate a LU2x2PreconditionerFactory is
RCP<LinearOpBase<double> > invA00 = buildInvA00(...);
RCP<LinearOpBase<double> > invS = buildInvS(...);
RCP<LU2x2PreconditionerFactory> precFact = rcp(new LU2x2PreconditionerFactory(invA00,invS));
Now using the strategy constructor, an entirely equivalent factory object can be constructed by
RCP<LinearOpBase<double> > invA00 = buildInvA00(...);
RCP<LinearOpBase<double> > invS = buildInvS(...);
RCP<LU2x2Strateghy> precStrat = rcp(new StaticLU2x2Strategy(invA00,invS));
RCP<LU2x2PreconditionerFactory> precFact = rcp(new LU2x2PreconditionerFactory(precStrat));
Notice that the StaticLU2x2Strategy takes the same objects as the original constructor, it acts as an intermediary to tell the LU2x2PreconditionerFactory what those operators are.
Definition at line 141 of file Teko_LU2x2PreconditionerFactory.hpp.
Build a simple static LU2x2 preconditioner.
Definition at line 63 of file Teko_LU2x2PreconditionerFactory.cpp.
Build a simple static LU2x2 preconditioner.
Definition at line 68 of file Teko_LU2x2PreconditionerFactory.cpp.
Constructor that permits the most generality in building
and
.
Constructor that permits the most generality in building
and
.
Default constructor for use with AutoClone.
Default constructor for use with AutoClone
Definition at line 76 of file Teko_LU2x2PreconditionerFactory.cpp.
Create the LU 2x2 preconditioner operator.
This method breaks apart the BlockLinearOp and builds a block LU preconditioner. This will require two applications of the inverse of the (0,0) block and one application of the inverse Schur complement.
Implements Teko::BlockPreconditionerFactory.
Definition at line 84 of file Teko_LU2x2 114 of file Teko_LU2x2 144 of file Teko_LU2x2 163 of file Teko_LU2x2PreconditionerFactory.cpp.
Determine the type of inverse operator to build.
Determine the type of inverse operator to build. If true use the full LDU decomposition. If false only the upper triangular solve should be used. Motivation for doing this can be found in Murphy, Golub and Wathen, SISC 2000.
Definition at line 236 of file Teko_LU2x2PreconditionerFactory.hpp.
Set the type of inverse operation to use.
Set the type of inverse operator to use. If true use the full LDU decomposition. If false only the upper triangular solve should be used. Motivation for doing this can be found in Murphy, Golub and Wathen, SISC 2000.
Definition at line 248 of file Teko_LU2x2PreconditionerFactory.hpp.
Builder function for creating strategies.
Builder function for creating strategies.
Definition at line 188 of file Teko_LU2x2PreconditionerFactory.cpp.
Add a strategy to the builder. This is done using the clone pattern.
Add a strategy to the builder. This is done using the clone pattern. If your class does not support the Cloneable interface then you can use the AutoClone class to construct your object.
Definition at line 237 of file Teko_LU2x2PreconditionerFactory.cpp.
some members
Definition at line 253 of file Teko_LU2x2PreconditionerFactory.hpp.
If true, use full LDU decomposition, otherwise use the Golub & Wathen style upper block. This is true by default.
Definition at line 259 of file Teko_LU2x2PreconditionerFactory.hpp.
|
http://trilinos.sandia.gov/packages/docs/r10.8/packages/teko/doc/html/classTeko_1_1LU2x2PreconditionerFactory.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
Hi Jason, I don't know Python, but let me share some thoughts that you might find useful. First, a few questions about your manual translations. Are your functions curried? For example, can I partially apply zipWith? Also, you put a "thunk" around things like "cons(...)" --- should it not be the arguments to "cons" that are thunked? Now, on to an automatic translation. As you may know already, Haskell programs can be transformed to "combinator programs" which are quite simple and easy to work with. Here is what I mean by a "combinator program": p ::= d* (a program is a list of combinator definitions) d ::= c v* = e (combinator definition) e ::= e e (application) | v (variable/argument) | c (constant: integer literal, combinator name, etc.) As an example of a combinator program, here is one that reverses the list [0,1,2]. rev v acc = v acc (rev2 acc) rev2 acc x xs = rev xs (cons x acc) cons x xs n c = c x xs nil n c = n main = rev (cons 0 (cons 1 (cons 2 nil))) nil This program does not type-check in Haskell! But Python, being dynamically typed, doesn't suffer from this problem. :-) A translation scheme, D[], from a combinator definition to a Python definition might look as follows. D[c v* = e] = def c() : return (lambda v1: ... lambda vn: E[e]) E[e0 e1] = E[e0] (E[e1]) E[v] = v E[c] = c() Here is the result of (manually) applying D to the list-reversing program. def nil() : return (lambda n: lambda c: n) def cons() : return (lambda x: lambda xs: lambda n: lambda c: c(x)(xs)) def rev2() : return (lambda acc: lambda x: lambda xs: rev()(xs)(cons()(x)(acc))) def rev() : return (lambda v: lambda acc: v(acc)(rev2()(acc))) def main() : return (rev() (cons()(0)( cons()(1)( cons()(2)( nil()))))(nil())) The result of main() is a partially-applied function, which python won't display. But using the helper def list(f) : return (f([])(lambda x: lambda xs: [x] + list(xs))) we can see the result of main(): >>> list(main()) [2, 1, 0] Of course, Python is a strict language, so we have lost Haskell's non-strictness during the translation. However, there exists a transformation which, no matter how a combinator program is evaluated (strictly, non-strictly, or lazily), the result will be just as if it had been evaluated non-strictly. Let's call it N, for "Non-strict" or "call-by-Name". N[e0 e1] = N[e0] (\x. N[e1]) N[v] = v (\x. x) N[f] = f I've cheekily introduced lambdas on the RHS here --- they are not valid combinator expressions! But since Python supports lambdas, this is not a big worry. NOTE 1: We can't remove the lambdas above by introducing combinators because the arguments to the combinator would be evaluated and that would defeat the purpose of the transformation! NOTE 2: "i" could be replaced with anything above --- it is never actually inspected. For the sake of interest, there is also a "dual" transformation which gives a program that enforces strict evaluation, no matter how it is evaluated. Let's call it S for "Strict". S[e0 e1] = \k. S[e0] (\f. S[e1] (\x. k (f x))) S[v] = \k. k v S[f] = \k. k f I believe this is commonly referred to as the CPS (continuation-passing style) transformation. Now, non-strict evaluation is all very well, but what we really want is lazy evaluation. Let's take the N transformation, rename it to L for "Lazy", and indulge in a side-effecting reference, ML style. L[e0 e1] = L[e0] (let r = ref None in \x. match !r with None -> let b = L[e1] in r := Some b ; b | Some b -> b) L[v] = v (\x. x) L[f] = f I don't know enough to define L w.r.t Python. I haven't tried too hard to fully understand your translation, and likewise, you may not try to fully understand mine! But I thought I'd share my view, and hope that it might be useful (and correct!) in some way. Matthew.
|
http://www.haskell.org/pipermail/haskell-cafe/2008-October/049094.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
Haskell Weekly News: January 30, 2006 Greetings, and thanks for reading the 22nd issue of HWN, a weekly newsletter for the Haskell community. Each Monday, new editions are posted to [1]the Haskell mailing list and to [2]The Haskell Sequence. [3]RSS is also available. 1. 2. 3. New Releases * C-- Frontend. Robert Dockins [4]announced the initial alpha release of a [5. 4. 5. * Type level arithmetic. Robert Dockins [6]also released a library for arithmetic on the type level. This library uses a binary representation and can handle numbers at the order of 10^15 (at least). It also contains a test suite to help validate the somewhat unintuitive algorithms. 6. Haskell' This section covers activity on [7]Haskell' this week. The topics this week have been diverse. Next week we'll try to cover activity on the wiki as well. From the mailing list: * [8]Wildcard type annotations * [9]Reworking the Numeric class * [10]Partial application ideas * [11]A more flexible hierarchical module namespace * [12]Record updates * [13]On the importance of libraries * [14]Syntactic support for existentials * [15]Module system/namespace management * [16]Fixing the monomorphism restriction * [17]k patterns * [18]~ patterns * [19]Kind annotations * [20]Class method types * [21]A Match class * [22]Scoped type variables in class instances * [23]Inline comment syntax 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. Discussion * Adding Impredicative Types to GHC. Simon Peyton-Jones [24]pushed a patch into GHC to handle impredicative polymorphism (see [25]Boxy types: type inference for higher-rank types and impredicativity). Secondly, GHC now supports GADTs in the more simplified way described in [26]Simple unification-based type inference for GADTs 24. 25. 26. * New IO library. Bulat Ziganshin [27]sought information on the low-level IO mechanisms used in GHC's IO libraries, in the context of his work on a high-performance IO lib. Some interesting points relating to IO primitives were raised. 27. Darcs Corner Darcs is popular. Isaac Jones [28]brought to our attention the results of the Debian package popularity contest. For the first time a program written in Haskell is more popular than the Haskell toolchain itself. Congratulations to the darcs developers! 28. Quote of the Week <araujo> Haskell is bad, it makes you hate other programming languages. Contributing to HWN You can help us create new editions of this newsletter. Please see the [29]contributing information, send stories to dons -at- cse.unsw.edu.au. The darcs repository is available at darcs get 29.
|
http://www.haskell.org/pipermail/haskell/2006-January/017510.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
// BinarySearch() function: This uses a binary search algorithm to find the index
// position of a given element in the entire array or within a range of elements
// inside a 1-Dimensional array
Console::WriteLine(L"This is the first portion of the program: ");
array<int>^ values = {23, 45, 68, 94, 123, 127, 150, 203, 299};
// This creates an integer array with 9 values
int toBeFound = 127;
// This creates a toBeFound variable containing the value 127 which we are looking for
// in the values array
int position1 = Array::BinarySearch(values, toBeFound);
// This position variable will utilize the BinarySearch function that will find the
// index value of 127 inside the values array by specifying the array it is looking
// through in its first argument: values, and what it wants to find in its second
// argument: toBeFound
if(position1 < 0)
// This will occur if position is not found aka, the BinarySearch function
// returns a negative value after not finding the specified value inside the
// integer array, which will not occur because 127 is IN the value array at
// position 5
// If the element that we are looking for is not found, a negative integer value
// is given by default from the BinarySearch() function
Console::WriteLine(L"{0} was not found.", toBeFound);
else
Console::WriteLine(L"{0} was found at index position {1}.", toBeFound, position1);
// This will just output the 127 found at elemental position 5
// ________________________
// NEW PART OF THE PROGRAM:
// ________________________
Console::WriteLine(L"Here is a new portion of the program: \n \n");
array<String^>^ names = {"Jill", "Ted", "Mary", "Eve", "Bill", "Al", "Ned",
"Zoe", "Dan", "Jean"};
// This will create a string array containing several names, NOT INCLUDING FRED
// I point that out because we will later try to find Fred within this list, but
// he wasn't listed in the first place so his result will return a negative integer
array<int>^ weights = {103, 168, 128, 115, 180, 176, 209, 98, 190, 130};
// This will create an integer array for each individual specified in the names array
array<String^>^ toBeFound2 = {"Bill", "Eve", "Al", "Fred"};
// This is a string array that contains the names of people we want to find
// I later renamed this to be toBeFound2 because of the previous use of the word
// toBeFound in the example above (caused about 5 errors, so at least this was
// the simple solution heh :D)
Array::Sort(names, weights);
// This will use the Sort() function from the Array Class to sort the names with
// their associated weights in alphabetical order based on their names
int result = 0;
// This creates a result variable that we will later use to store the result from
// the BinarySearch function that will look through each of the names in the names
// array for the names that we want to find
for each(String^ name in toBeFound2){
// This ia for each loop that will look throughout each name in to be found
result = Array::BinarySearch(names, name);
// This will then compare the current element aka the current name to the actual
// names array and will give a positive or negative result
// Notice this is a loop, so we will get 3 positive values for Bill, Eve, and Al
// but a negative integer value for Fred
if(result < 0)
Console::WriteLine(L"{0} was not found.", name);
// This will occur for Fred since his name is NOT found within the names array
// to begin with
// The value returned by BinarySearch when it looks for Fred is the bitwise
// complement of the index position of the first element that is GREATER than
// the object you are looking for,
// OR IN OTHER TERMS: the bitwise complement of the Length property of the array
// if no element is greater than the object sought.
else
Console::WriteLine(L"{0} weighs {1} lbs.", name, weights[result]);
// This outputs the corresponding weights for Bill, Eve, and Al respectively since
// they are a positive match from the BinarySearch function that searches through
// the list of names we want to search for and tries to find each individual name
}
// The following is code that is meant to revise the previous code in order to
// be able to add Fred's name into the names string array
String^ name = L"Fred";
// This creates the name which we want to insert into the array
int position = Array::BinarySearch(names, name);
// This will create an index marker variable that will store the current value of
// Fred's binary value
if(position < 0)
position = ~position;
// This will flip Fred's binary value to become a positive result that we can use
// to insert into the newNames list
array<String^>^ newNames = gcnew array<String^>(names -> Length+1);
// This creates a newNames string array, that will store names with an added
// length of 1 so we can add Fred's name into the array
for(int i = 0; i < position; i++)
// This will go through each of teh names in the position
newNames[i] = names[i];
// This is basically copying each individual index value from the previous
// names array into the newNames array
newNames[position] = name;
// This will write the index value of the names list into the newNames list
if(position < names -> Length)
// This searches through the entire old names list
for(int i = position; i < names -> Length; i++)
// This goes throughout the entire name list again along the entire length
// of it
newNames[i+1] = names[i];
// This will assign the next index value to the current names index position
Console::WriteLine("This is the value of the new names list: {0}", newNames);
// This is just my own output statement that will output the new names list,
// but it is giving me A1 apparently for some reason
for(int x = 0; x < newNames->Length; x++)
Console::WriteLine("{0}", newNames[x]);
|
http://forums.devshed.com/c-programming-42/question-about-error-for-newnames-list-in-c-952206.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
Teleconference.2008.08.06/Agenda
From OWL
Call in details
When joining please don't identify yourself verbally; instead, Identify Yourself to ZAKIM on IRC
- Date of Call: Wednesday Augusternardo Cuenca Grau (Scribe List)
- Link to Agenda:
Agenda
- Admin (20 min)
- Roll call
- Agenda amendments?
- PROPOSED: Accept Previous Minutes (23 July)
- PROPOSED: Accept Boston F2F Minutes Day 1 (28 July) and Day 2 (29 July)
- Action items status
- Pending Review Actions
- Action 171 Analyze and comment on Annotation_System_2 / Boris Motik
- Action 175 Report back on names frameworks, naming options / Sandro Hawke
- Action 190 Send email to WG about review responsibilities for forthcoming working drafts / Ian Horrocks
- Action 191 Solicit RPI reviews of key documents / Jie Bao
- Action 176 Draft a comment on XML Schema Datatypes 1.1 draft / Peter Patel-Schneider
- Due and overdue Actions
- Action 162 Investigate top/bottom roles in dl-lite / Diego Calvanese
- Action 165 Investigate easy keys in dl-lite / Diego Calvanese
- Action 150 Initiate discussion with RIF WG and try to reach consensus / Jie Bao
- Action 170 Analyze and comment on Annotation_System_2 / Bijan Parsia
- Action 169 Ask Deb about nesting level of annotations on annotations / Alan Ruttenberg
- Action 168 Test our documents for accessibility with Robert Stevens / Bijan Parsia
- Action 173 Investigate Boris' IEEE reference, re linking floating point to real numbers / Alan Ruttenberg
- Action 174 Provide an rdf serialization for his rich annotation proposal / Bijan Parsia
- Action 178 Clarify what ISSUE-116 is about, considering splitting to clarify / Michael Schneider
- Outcomes of and actions from Boston F2F (40 min)
- Datatypes
- Issue 132 (Replace usage of "constant" with "literal" as defined by RDF and XML) resolved as per Boris's email
- Issue 126 (The list of normative datatypes should be revisited) resolved as per Boris's email
- We will use owl:real(Plus) as the name for the real numberline (plus "extra" values)
- The value spaces of xsd:float and xsd:double will be a subset of the value space of owl:realPlus (real numbers plus +/- inf, +/- zero, NaN). They will be discrete points in that space in line with XML Schema
- Decision on rational postponed pending decision on N-ary (don't need rational if we don't have N-ary)
- xsd:dateTime interpreted as XML Schema 1.1 time line; mandatory time zone for constants (applications may apply non-standard repairs); need to decide if this will be called xsd:dateTime or owl:dateTime (see strawpoll)
- Structural equivalence of literals based on syntactic form
- Annotations
- Bijan and Peter will produce a "specification standard" document by August 20th.
- Possible alternative based on Alan's proposal and Boris and Peter's paper
- Profiles
- N-ary
- OWL Full
- Already have a good draft of RDF-based Semantics; will be frozen for review by 19th August
- Reviews from Jie, Peter and Zhe by 22nd August
- Resolved to publish on or around 1st September
- MOF Metamodel (see slides)
- Generally liked, but some issues need more thought
- Probably add it an an appendix to the syntax document
- User Facing Documents
- Reviewed snapshot of Quick Reference; still incomplete and not in card format
- Deb and Elisa to produce reasonably complete PDF by first week of September
- Reviewed first draft of Requirements
- Good progress made; Vipul, Evan, Christine and Jie to update (making shorter and tighter) within four weeks
- Test Cases
- Some changes to test types needed (e.g., profiles tests)
- Hope to have OWL-1 tests imported into wiki within 2-3 weeks
- Manchester syntax
- Idea is to publish as a note (not rec track)
- Publication Schedule
- On or about 15th September, publish new public working drafts of core docs, including: Syntax, Semantics, RDF-based Semantics, Mapping to RDF, Profiles, XML Syntax
- plus, maybe, Primer, other UFDs
- Reviews needed of all the above documents
- reviews due by 8 September
- Goal is to transition to last call at Cannes F2F in late October
- Issues (25 minutes) - Address as many as possible during allocated time
- Proposals to Resolve Issues
- Other Issue Discussions
- Issue 133 DL-Lite Profile modified to include UNA
- Issue 109 What is the namespace for elements and attributes in the XML serialization?
- Issue 130 Conformance, warnings, errors
- Issue 104 OWL 1.1 DL does not have a disallowed vocabulary
- Issue 118 Should bNodes in OWL 2 DL have existential or skolem semantics?
- Issue 129 Desirable to have rdf:list vocabulary available for use in modeling in OWL 2
- General Discussion
- Additional other business (5 min)
Next Week(s)
- General Discussions (not necessarily in this order)
Regrets
- Carsten Lutz (teaching at ESSLLI)
- Uli Sattler (also teaching at ESSLLI)
- Elisa Kendall (family conflict)
- Evan Wallace (need to leave early for another meeting)
|
http://www.w3.org/2007/OWL/wiki/index.php?title=Teleconference.2008.08.06/Agenda&oldid=10492
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The main concept is the
Actor.
An
Actor is a model of the
Polymorphic
Function Object concept (that can accept 0 to N arguments (where
N is a predefined maximum).
An
Actor contains a valid
Phoenix Expression, a call to one of the function call operator overloads,
starts the evaluation process.
The
actor template class
models the
Actor concept:
template <typename Expr> struct actor { template <typename Sig> struct result; typename result_of::actor<Expr>::type operator()() const; template <typename T0> typename result_of::actor<Expr, T0 &>::type operator()(T0& _0) const; template <typename T0> typename result_of::actor<Expr, T0 const &>::type operator()(T0 const & _0) const; //... };
There are 2*N function call operators for 0 to N arguments (N ==
BOOST_PHOENIX_LIMIT). The actor class accepts
the arguments and forwards the arguments to the default evaluation action.
Additionally, there exist function call operators accepting permutations
of const and non-const references. These operators are created for all N
<=
BOOST_PHOENIX_PERFECT_FORWARD_LIMIT
(which defaults to 3).
On an actor function call, before calling the evaluation function, the actor
created a context. This context consists
of an
Environment and an
Action part. These contain
all information necessary to evaluate the given expression.
The Environment is a model of Random Access Sequence.
The arguments passed to the actor's function call operator are collected inside the Environment:
Other parts of the library (e.g. the scope module) extends the
Environment concept to hold other information
such as local variables, etc.
Actions is the part of Phoenix which are responsible for giving the actual expressions a specific behaviour. During the traversal of the Phoenix Expression Tree these actions are called whenever a specified rule in the grammar matches.
struct actions { template <typename Rule> struct when; };
The nested
when template
is required to be Proto
Primitive Transform. No worries, you don't have to learn Boost.Proto
just yet! Phoenix provides some wrappers to let you define simple actions
without the need to dive deep into proto.
Phoenix ships with a predefined
default_actions
class that evaluates the expressions with C++ semantics:
struct default_actions { template <typename Rule, typename Dummy = void> struct when : proto::_default<meta_grammar> {}; };
For more information on how to use the default_actions class and how to attach custom actions to the evaluation process, see more on actions.
struct evaluator { template <typename Expr, typename Context> unspecified operator()(Expr &, Context &); }; evaluator const eval = {};
The evaluation of a Phoenix expression is started by a call to the function
call operator of
evaluator.
The evaluator is called by the
actor
function operator overloads after the context is built up. For reference,
here is a typical
actor::operator()
that accepts two arguments:
template <typename T0, typename T1> typename result_of::actor<Expr, T0 &, T1 &>::type operator()(T0 &t0, T1 &t1) const { fusion::vector2<T0 &, T1 &> env(t0, t1); return eval(*this, context(env, default_actions())); }
For reasons of symmetry to the family of
actor::operator() there is a special metafunction usable
for actor result type calculation named
result_of::actor.
This metafunction allows us to directly specify the types of the parameters
to be passed to the
actor::operator() function. Here's a typical
actor_result that accepts two arguments:
namespace result_of { template <typename Expr, typename T0, typename T1> struct actor { typedef fusion::vector2<T0, T1> env_tpe; typedef typename result_of::context<env_type, default_actions>::type ctx_type typedef typename boost::result_of<evaluator(Expr const&, ctx_type)>::type type; }; }
|
http://www.boost.org/doc/libs/1_49_0/libs/phoenix/doc/html/phoenix/inside/actor.html
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
A while back, I was assigned to work on a project on which I needed to integrate with another JMS system. As I searched the web for some detailed tutorials, I didn't find any detailed tutorial that could help me. Eventually I figured out all the pieces I had the design and implement in order to get such JMS-to-JMS bridge integration. I decided to summarize the things I learned in this article, not only for my own record keeping purpose, but also helping others who needed similar information. I assumed audiences know the technologies such as spring, and jms.
The intention of this article is to provide a detailed tutorial on the following topics:
• Software required for this article.
• How to publish a Message to queue and consume it.
• How to bridge one Open-JMS to another ActiveMQ-JMS.
I hope readers will enjoy this article! If you have any questions of comments, please leave it in the FAQ section.
ActiveMQ is an open source, Apache 2.0 licensed Message Broker and JMS 1.1 implementation and Enterprise Integration Patterns provider which integrates seamlessly into Geronimo, light weight containers and any Java application. Apache ActiveMQ is fast, supports many Cross Language Clients and Protocols, comes with easy to use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4.
ActiveMQ provides bridging functionality to other JMS providers that implement the JMS 1.0.2 and above specification. A JMS bridge can be co-located with an ActiveMQ broker or run remotely. In order to support JMS 1.0.2 there is separation between Queues and Topics.
Features:
• OpenWire for high performance clients in Java, C, C++, C#
• Stomp support so that clients can be written easily in C, Ruby, Perl, Python, PHP, ActionScript/Flash, Smalltalk to talk to ActiveMQ as well as any other popular Message Broker
• full support for the Enterprise Integration Patterns both in the JMS client and the Message Broker
• Supports many advanced features such as Message Groups, Virtual Destinations, Wildcards and Composite Destinations
• Fully supports JMS 1.1 and J2EE 1.4 with support for transient, persistent, transactional and XA messaging
• Spring Support so that ActiveMQ can be easily embedded into Spring applications and configured using Spring's XML configuration mechanism
• Tested inside popular J2EE servers such as Geronimo, JBoss 4, GlassFish and WebLogic
• Includes JCA 1.5 resource adaptors for inbound & outbound messaging so that ActiveMQ should auto-deploy in any J2EE 1.4 compliant server
• Supports pluggable transport protocols such as in-VM, TCP, SSL, NIO, UDP, multicast, JGroups and JXTA transports
• Supports very fast persistence using JDBC along with a high performance journal
• Designed for high performance clustering, client-server, peer based communication
• REST API to provide technology agnostic and language neutral web based API to messaging
• Ajax to support web streaming support to web browsers using pure DHTML, allowing web browsers to be part of the messaging fabric
• CXF and Axis Support so that ActiveMQ can be easily dropped into either of these web service stacks to provide reliable messaging
• Can be used as an in memory JMS provider, ideal for unit testing JMS Can be used as an in memory JMS provider, ideal for unit testing JMS
OpenJMS is an open source implementation of Sun Microsystems's Java Message Service API 1.1 Specification
Features:
• Point-to-Point and publish-subscribe messaging models
• Guaranteed delivery of messages
• Synchronous and asynchronous message delivery
• Persistence using JDBC
• Local transactions
• Message filtering using SQL92-like selectors
• Authentication
• Administration GUI
• XML-based configuration files
• In-memory and database garbage collection
• Automatic client disconnection detection
• Applet support
• Integrates with Servlet containers such as Jakarta Tomcat
• Support for TCP, RMI, HTTP and SSL protocol stacks
• Support for large numbers of destinations and subscribers
This tutorial requires setup and configuration of the following software packages:
• JDK 1.5 (or higher).
• Open Jms 0.7.7 download link<
• Apache ActiveMQ 5.1 download link
I also recommend the use of Eclipse IDE. But, for this tutorial, all work can be done using a simple code editor (like UltraEdit32, Crimson Editor, or Notepad), Command Prompt
For my own convenience, this tutorial was created on Windows XP. And it should be relative easy to be migrated to other platforms.
Install JDK on Windows XP is super easy, just download the MSI installer, and then install it either default to "Program Files" or directly to "C:\". After installing JDK, it is recommended to configure the system variables:
1. Create system environment "JAVA_HOME" and point it to the JDK base directory (i.e. C:\Program Files\Java\jdk-1.5.0_17 or C:\jdk-1.5.0_17).
After configuring the system variable, open a Command Prompt and type "java -version". The output will indicate the version of JDK installed in the system. This should help verify the success of JDK installation. After the verification, close the Command Prompt.
Install OpenJMS is also easy, download the binary executable archive file from the Open JMS website (). Then unzip openjms-0.7.7-beta-1.zip the archive file to "C:\". This will unpack the archive file to "C:\ ". "C:\ openjms-0.7.7-beta-1" will be the base directory of OpenJMS
Install ActiveMQ is also easy, download the binary executable archive file from the Apache ActiveMQ website (). Then unzip apache-activemq-5.1.0-bin.zip the archive file to "C:\". This will unpack the archive file to "C:\ ". "C:\ apache-activemq-5.1.0 " will be the base directory of ActiveMQ SimpleMessageSender {
private Context jndiContext;
private QueueConnectionFactory factory;
private QueueConnection queueConnection;
private static final String URL = "tcp://localhost:3035";
private static final String CONNECTION_FACTORY = "ConnectionFactory";
private static final String QUEUE_NAME = "jmstojmsBridgeQueue";
/**
* Constructor initialize queue connection factory and connection.
* @throws NamingException
* @throws JMSException
*/
public SimpleMessageSender() throws NamingException, JMSException
{
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, org.exolab.jms.jndi.InitialContextFactory.class.getName());
environment.put(Context.PROVIDER_URL, URL);
jndiContext = new InitialContext(environment);
factory = (QueueConnectionFactory)jndiContext.lookup(CONNECTION_FACTORY);
queueConnection = factory.createQueueConnection();
}
/**
* @param message
*/
public void sendMessage(String message){
try {
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = queueSession.createQueue(QUEUE_NAME);
QueueSender sender = queueSession.createSender(queue);
TextMessage txtMessage = queueSession.createTextMessage("OPEN_JMS :"+message);
sender.send(txtMessage);
System.out.println("Message has been send successfully");
} catch (JMSException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
}
private void close() throws JMSException, NamingException
{
if(queueConnection!=null){
queueConnection.close();
}
if(jndiContext!=null){
jndiContext.close();
}
factory=null;
}
public static void main(String args[]) throws Exception{
if (args.length<1){
System.out.println("Usage : java SimpleMessageSender <message>");
return;
}
SimpleMessageSender simpleMsgSender = new SimpleMessageSender();
simpleMsgSender.sendMessage(args[0]);
}
}
<p>
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
public class SimpleMessageListener implements MessageListener{
private static final String QUEUE_NAME = "jmstojmsBridgeQueue";
public void onMessage(Message message) {
if (message!=null && message instanceof TextMessage){
TextMessage txtMessage = (TextMessage)message;
try {
System.out.println("Message :: "+txtMessage.getText());
} catch (JMSException e) {
e.printStackTrace();
}
}
}
public SimpleMessageListener() throws JMSException {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
QueueConnection queueConnection = factory.createQueueConnection();
queueConnection.start();
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = queueSession.createQueue(QUEUE_NAME);
QueueReceiver receiver = queueSession.createReceiver(queue);
receiver.setMessageListener(this);
}
public static void main(String args[])throws Exception
{
new SimpleMessageListener();
System.out.println("Waiting for Message");
}
}
Before compile the code you have to set the required jar files to classpath
c:\jms>set CLASSPATH=.;<OPEN_JMS_INSTALL_DIR>\lib\jms-1.1.jar; <OPEN_JMS_INSTALL_DIR>\lib\openjms-0.7.7-beta-1.jar;%CLASSPATH%
c:\jms>javac SimpleMessageSender.java
D:\jms>set CLASSPATH=<ACTIVEMQ_INSTALL_DIR>\activemq-all-5.1.0.jar;%CLASSPATH%
Open the <ACTIVEMQ_INSTALLED_DIR>/conf/activmq.xml file.
Add the following code after the </transportConnectors> element.
<p><jmsBridgeConnectors>
<jmsQueueConnector name="OpenJMSBridge-Inbound"
jndiOutboundTemplate="#remoteJndi"
outboundQueueConnectionFactoryName="ConnectionFactory"
localQueueConnectionFactory="#localFactory">
<inboundQueueBridges>
<inboundQueueBridge inboundQueueName="jmstojmsBridgeQueue"/>
</inboundQueueBridges>
</jmsQueueConnector>
</jmsBridgeConnectors>
Add the following code after the </broker> element
<bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">org.exolab.jms.jndi.InitialContextFactory</prop>
<prop key="java.naming.provider.url">tcp://localhost:3035</prop>
</props>
</property>
</bean>
<bean id="localFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
Open the <OPENJMS_INSTALLED_DIR>/config/Openjms.xml file.
Comment it out the following code.
<p>
<!-- Connector
<ConnectionFactories>
<QueueConnectionFactory name="JmsQueueConnectionFactory" />
<TopicConnectionFactory name="JmsTopicConnectionFactory" />
<ConnectionFactory name="RMIConnectionFactory"/>
</ConnectionFactories>
</Connector -->
</p>
NOTE: If you don’t want to comment the above code, you should modify the JMX listening port in ActiveMQ because by default activemq is listening 1099 port number. The same port number is also listening openjms rmi connector.
Step1:
Copy Open-JMS jar files to <ActiveMQ-INSTALLED_DIR>/lib directory.
Step2:
Start Open-JMS using the following batch file.
<openjms_install_dir>\bin>start startup.bat
Step3: Start ActiveMQ-JMS using the following batch file.
<activemq_install_dir>\bin\start activemq.bat
Step4: run the SimpleMessageSender class using the following:
java SimpleMessageSender “This is a Sample Message”
SimpleMessageSender output on console
Step5:
Open another cmd window and set classpath and java path and run SimpleMessageListener class.
java SimpleMessageListener
SimpleMessageListener output on console:
This is all the Java code you need to write to publish and consume java message. Let's examine the activemq.xml jmsBridgeConnectors elements:
jmsBridgeConnectors : is the root element for jms bridge connectors.
jmsQueueConnector: A Bridge to other JMS Queue providers.
jndiOutboundTemplate: used for locating the Connection Factory for the ActiveMQ Connection if the localTopicConnection or localTopicConnectionFactory is not set.
outboundQueueConnectionFactoryName: used to initialize the foreign JMS Connection if localQueueConnection is not set.
localQueueConnectionFactory: used to initialize the ActiveMQ JMS Connection if localQueueConnection is not set.
inboundQueueBridge: Create an Inbound Queue Bridge.
inboundQueueName:The foreign queue name to receive from.
If more information about these elements please visit the following link ActiveMQ.
version1.0
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
General News Suggestion Question Bug Answer Joke Rant Admin
Man throws away trove of Bitcoin worth $7.5 million
|
http://www.codeproject.com/Articles/35957/Implementing-Jms-to-Jms-Bridge-using-ActiveMQ?fid=1539904&df=90&mpp=10&sort=Position&spc=None&noise=1&prof=True&view=Expanded
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
#include <iostream> using namespace std; class Burger { private: double patty; double bun; double cheese; public: Burger(); double getPatty(); double getBun(); double getCheese(); void setPatty(double p); void setBun(double b); void setCheese(double c); double hamburgerCalc(Burger b); double cheeseburgerCalc(Burger b); double dcheeseburgerCalc(Burger b); }; double Burger::hamburgerCalc(Burger b) { double bun = b.getBun(); double patty = b.getPatty(); double total = bun + patty; total = total / 2; return total; } double Burger::cheeseburgerCalc(Burger b) { double bun = b.getBun(); double patty = b.getPatty(); double cheese = b.getCheese(); double total = bun + patty + cheese; total = total / 2; return total; } double Burger::dcheeseburgerCalc(Burger b) { double bun = b.getBun(); double patty = b.getPatty(); double cheese = b.getCheese(); double total = patty+patty+bun+cheese+cheese; total = total / 2; return total; } int main() { cout << "This is the C++ Version." << endl << endl; Burger yum; double patty1; cout << "Enter the cost of each patty: "; cin >> patty1; yum.setPatty(patty1); double bun1; cout << "Enter the cost of each bun: "; cin >> bun1; yum.setBun(bun1); double cheese1; cout << "Enter the cost of each cheese slice: "; cin >> cheese1; yum.setBun(cheese1); double val1 = hamburgerCalc(yum); double val2 = cheeseburgerCalc(yum); double val3 = dcheeseburgerCalc(yum); cout << "A hamburger will cost: $" << val1 << endl; cout << "A cheeseburger will cost: $" << val2 << endl; cout << "A double cheeseburger will cost: $" << val3 << endl; cout << endl << "Programmer: <snip>" << endl; } double Burger::getPatty() { return patty; } double Burger::getBun() { return bun; } double Burger::getCheese() { return cheese; } void Burger::setPatty(double p) { patty = p; } void Burger::setBun(double b) { bun = b; } void Burger::setCheese(double c) { cheese = c; }
I am trying to run this program by typing:
g++ burgerClass.cpp -o burgerClass.o
but i keep getting this:
burgerClass.cpp: In function ‘int main()’:
burgerClass.cpp:78: error: ‘hamburgerCalc’ was not declared in this scope
burgerClass.cpp:79: error: ‘cheeseburgerCalc’ was not declared in this scope
burgerClass.cpp:80: error: ‘dcheeseburgerCalc’ was not declared in this scope
Anyone know what the issue is? thanks.
Your first problem is you delcare a constructor (in your .h file) but you don't reference it in the class functions (.cpp)... So put this:
Burger::Burger() { }
Your other problem is the fact you don't tell the compiler where the functions are (in which class) you declare an object of "yum" so use it..
double val1 = yum.hamburgerCalc(yum); double val2 = yum.cheeseburgerCalc(yum); double val3 = yum.dcheeseburgerCalc(yum);
I don't understand your code. You have a main, then more class functions.. I hope this isn't all in one file.
Thank you, the problem has been solved.
Related Articles
|
http://www.daniweb.com/software-development/cpp/threads/442497/error-not-declared-in-scope
|
CC-MAIN-2013-48
|
en
|
refinedweb
|
The.
I have researched the list of packages that needed a recompilation, and in some cases I performed an upgrade at the same time (qt5 went up to 5.9.3, poppler synced to the 0.62.0 in Slackware-current, qtav went up to 1.12.0). The 64bit packages have already been uploaded but if you are running 32bit Slackware-current (why are you doing that?) you’ll have to wait another day because I just started the compilation there.
What has been updated in the ‘ktown’ repository? Here is a list, mostly in order of compilation:
deps:qt5,qt5-webkit,phonon,qtav,poppler kde4:kdelibs,akonadi4,kdepimlibs4 frameworks:kfilemetadata5 kdepim:EVERYTHING plasma:plasma5-nm applications:okular applications-extra:calligra,digikam,kile
Every package in kdepim? Well yeah, there were many broken packages and it was simply faster to recompile all of kdepim and be done with it.
Users of slackpkg+ will be up & running fast with these updates; the others probably just need to download the individual packages I listed above from a mirror like.
When the 32bit package set has been finished The 32bit packages have now been recompiled and uploaded to the repository.
I will also recompile whatever is needed in the ‘testing’ repository (that’s where the Wayland related packages are stored).
Other – not related to Plasma5 – updates/rebuilds
are coming soon have finally been uploaded too. Those are LibreOffice, Pale Moon, Calibre; these programs are also affected by the updates in slackware-current but the urgency was lower than with the Plasma5 desktop.
Thank you Eric! Will download right away!
Thank you, Eric. You’re a god (- send). 🙂
Thanks for the quick work, Eric! I’ve upgraded the packages and rebooted, but KDE still won’t start. I even reinstalled the entire ktown repo just in case, but no dice. Is it just that not everything has been uploaded yet, or is there something else I need to do?
Thank you Eric!
There is one issue I have come across so far. I use the run command and krunner segfaults:
Application: krunner (krunner), signal: Segmentation fault
Using host libthread_db library “/lib64/libthread_db.so.1”.
[Current thread is 1 (Thread 0x7f7df24e67c0 (LWP 11622))]
Hi Eric! Now everything runs fine… except Krunner. I have the same issue than Radical Dreamer.
The trace from Dr.Konqui is here:
Thanks!!
Eduardo
Sorry, one more thing I’ve run into so I am reporting it. All are just minor issues for me.
kmix: kmix
Unable to load library icui18n “Cannot load library icui18n: (icui18n: cannot open shared object file: No such file or directory)”
kmix –failsafe works though 😉
Actually – disregard my earlier message, I figured out what I did wrong. I had the alienbob repository set to have higher priority than ktown, which meant qt5 and qt5-webkit were kept at older versions. I just changed the priority in slackpkgplus.conf and now I’m up and running 🙂
I am having the same issue with krunner as Eduardo and Radical Dreamer.
sddm.bin wont fire for me, complaining about “libicui18n.so.56” being missing. The default slackware-current repo seem to have upgraded “icu4c-60.1-x86_64-1” to that version. I ran a upgrade using slackpkgplus. These are all my packages that are installed right now.
Hakan:
> qt5-5.9.2-x86_64-1alien
> qt5-webkit-5.9.1-x86_64-1alien
Check the priorities in your slackpkgplus.conf file. You seem to have set the ktown priority lower than the slackbuilds repository (just like chris mentioned above) and as a result, your qt5 and qt5-webkit packages were not upgraded.
Hi Eric, after the latest upgrade all seems to work well, but libreoffice don’t work. He spit out the same message regarding ‘missing libraries libicui18n.so.56’. And the tray icon of dropbox is disappeared
Alienbob:
Yea you are right. I had two things wrong. I had set the tag priority to \”on\” and I also had the wrong PKGS_PRIORITY. This fixed it for me.
PKGS_PRIORITY=( ktown alienbob slackpkgplus )
# TAG_PRIORITY=off
Thanks for your quick update on the packages. 🙂
I might have spoken too soon on krunner – it seems to be working fine now. It segfaulted the first time I logged in to Plasma, but after rebooting the problem went away.
After I reported the issue to Eric on Krunner, it worked without isues at the second boot so I was going to say something similar to what Chris posted. But then, on the third boot and the fourth, and the fifth, it displayed the same bug again. Odd.
Thank you very much.
I have found some not found libraries in deps/telepathy and kde/telepathy packages.
There is libicui18n.so.56 not found in /usr/bin/jsc-1 (this is in openjdk ?)
Indeed there’s some issues with the Telepathy packages but I am not sure if I will have time to deal with those, they are low on my priority list now.
The “jsc-1” binary is not on my system so perhaps it is part of Oracle’s binary JDK package.
@alienbob
Finally I found that jsc-1 is in webkitgtk (another package to recompile)
Helios – OK, not a package I need to fix then if t came from SBo 😉
I have uploaded new packages for Pale Moon and Calibre, and rebuilt my Libre Office packages for -current. There’s still at least mkvtoolix that does not work but that will come later.
Does the Calibre need PyQt5? When I try and run ebook-viewer from calibre-3.13.0-x86_64-1alien I get:
Traceback (most recent call last):
File “/usr/bin/ebook-viewer”, line 20, in
sys.exit(ebook_viewer())
File “/usr/lib64/calibre/calibre/gui_launch.py”, line 81, in ebook_viewer
from calibre.gui2.viewer.main import main
File “/usr/lib64/calibre/calibre/gui2/viewer/main.py”, line 28, in
from calibre.gui2.viewer.ui import Main as MainWindow
File “/usr/lib64/calibre/calibre/gui2/viewer/ui.py”, line 11, in
from PyQt5.Qt import (
ImportError: cannot import name QWebView
both qt5-5.9.3-x86_64-1alien and qt5-webkit-5.9.1-x86_64-2alien are installed.
hi Eric,
I believe kdepimlibs4 needs recompiled too, because of libical
Interesting LoneStar, I did recompile kdepimlibs4 already, I wonder why it still shows a dependency against libical? I even had to apply a patch to get it to compile against libical3.
Note that “ldd” will also show *indirect* dependencies, i.e. a library which kdepimlibs4 links against, still has a libical2 dependency, The trick is finding out which library.
Brad Reed did you use my package or did you compile the package from source, yourself?
My package works fine here, and yes, PyQt5 is required. A private copy of it is included in my package because I compile mine with “BUILD_PYTHON=YES”.
@Eric
I found that kdepimlibs4 had not been updated by slackpkg. I did a reinstall and now it’s ok. Maybe package kept build number 4 like the previous version while it should be bumped to build 5?
I’m also finding that I still have a kde-workspace-4.11.22 which is no longer present in current ktown binaries, but there still is source for it in the source part. Going back to previous posts and READMEs I didn’t find an instruction about removing it like it’s done for other packages that got dropped or replaced.
my bad, I found you posted something about removing it, in a previous ktown announcement. I suggest to add a line about it in READMEs too.
Confirmed. For me the Krunner bug persists.
LoneStar, that was exactly the issue with kdepimlibs4. The new package had the same BUILD number so the pkgtools/slackpkg would not upgrade it.
I will fix that in the repository.
LoneStar I have updated the README at the appropriate place:
Thanks for mentioning it again, because in that old blog article’s comments section I had promised to update the README and I forgot.
Eduardo, initially i wanted to answer that I was unable to get krunner to crash here, but then suddenly it did crash.
I have not touched the plasma-workspace (which contains krunner) nor kwindowsystem (which contains the plugin that is mentioned on standard output when krunner starts crashing).
Thank you Eric for this. I will await any news on the matter.
Thank you. With this update now works everything
Pingback: Links 9/12/2017: Mesa 17.3, Wine 3.0 RC1, New Debian Builds | Techrights
Strange, I can’t build it from your slackbuild either. The build ends with:
*
* Running build
*
Traceback (most recent call last):
File “setup.py”, line 119, in
sys.exit(main())
File “setup.py”, line 104, in main
command.run_all(opts)
File “/tmp/build/tmp-calibre/calibre-3.13.0/setup/__init__.py”, line 236, in run_all
self.run_cmd(self, opts)
File “/tmp/build/tmp-calibre/calibre-3.13.0/setup/__init__.py”, line 228, in run_cmd
self.run_cmd(scmd, opts)
File “/tmp/build/tmp-calibre/calibre-3.13.0/setup/__init__.py”, line 232, in run_cmd
cmd.run(opts)
File “/tmp/build/tmp-calibre/calibre-3.13.0/setup/build.py”, line 245, in run
self.env = init_env()
File “/tmp/build/tmp-calibre/calibre-3.13.0/setup/build.py”, line 140, in init_env
from setup.build_environment import msvc, is64bit, win_inc, win_lib, NMAKE
File “/tmp/build/tmp-calibre/calibre-3.13.0/setup/build_environment.py”, line 84, in
from PyQt5.QtCore import PYQT_CONFIGURATION
ImportError: No module named PyQt5.QtCore
Brad I assume you don’t have PyQt5 installed.
The SlackBuild script will not compile its own python or any python modules if you have python 2.7 installed… but you can get around that by running the following command which will force the inclusion of an internal python interpreter plus the required python modules. Your only external dependencies left will be podofo, unrar, libxkbcommon, qt5 and qt5-webkit:
# BUILD_QT=NO BUILD_PYTHON=YES BUILD_MTP=YES ./calibre.SlackBuild
Alternatlvely you can of course install all the required python modules as external dependencies separately.
Well, I purged everything, resynced to current, reinstalled qt5-5.9.3-x86_64-1alien and qt5-webkit-5.9.1-x86_64-2alien
and now your build of calibre is working for me. I still can’t build it though. Wonder what is up with my system.
Regarding krunner crash: it seems to happen in
/usr/lib64/qt5/plugins/plasma_runner_marble.so according to the backtrace.
As a workaround I removed the marble package (which was not recompiled during the mass recompilation) and krunner works again.
Hope this helps.
Excellent! I uninstalled marble and krunner seems to work again! Thanks!
I have rebuilt the marble package and uploaded it. My krunner is not crashing here now. YMMV.
Why does httpd link to both libicu 56 and libicu 60?
Geremia if you used “ldd” to determine that, be aware that ldd will also show you the “indirect” dependencies, i.e. dependencies of any library that httpd links against directly.
So, it will probably not be httpd that is at fault but some custom extension you compiled in the past.
I didn’t know that about ldd.
thanks
Geremia, if you only want to list the *direct* dependencies of a binary, try the ‘readelf’ command instead. For instance, use:
readelf -d $(which httpd) |grep ‘(NEEDED)’
and play around with the output.
Hi, Eric
I have a very strange problem after all these updates. I keep an instance of pidgin running in the system tray and if I plug in a usb stick with LUKS encrypted partition on it, and try to unlock it by clicking on the systray icon (solid) – no password dialogue comes up, and what is more strange – the pidgin icon dissapears from the systray. The LUKS partition cannot be unlocked and mounted and if I run pidgin again , it shows up but cannot dock into the system tray.
When in xfce4, the unlocking and mounting of the LUKS partition works all right.
Could this mean that solid should be recompiled or it is something else? Does anybody else has a problem like this?
Pidgin can attach to systray again if I log out/log in plasma.
I’m with Slackware current 64bit + Multilib + Ktown. Everithing elase is working as it should (As far as I can tell).
toodr, try looking at the X session log files to see if any of these applications is writing errors.
toodr, I have a problem that is similar to yours. After plugging in a USB stick with a LUKS encrypted partition, if I try to mount it using the device notifier in the system tray, only the spinner starts showing, but no password prompt appears. Also, my custom shortcuts stop working but things like Alt+Tab still work. The custom shortcuts start working again if I just open the Custom Shortcuts configuration page in the System Settings, without making any changes. This seems to restart some services, as it is accompanied by a pop-up notification about the WiFi connection being active, and occasionally also by a notification that kded5 or kdeinit5 closed unexpectedly. After all that, the spinner in the device notifier is still going, but the password prompt still doesn’t appear.
This issue started for me only with the rebuilt KDE 5_17.11 for the latest Slackware-current; I had no problems with the earlier 5_17.11 packages (19 Nov).
Eric, what are the X session log files to check for errors? When attempting to mount the drive, I don’t see anything that is written to /var/log/Xorg.0.log or to ~/.xsession-errors.
This is the only obvious error.
Initializing “kcm_access” : “kcminit_access”
kdeinit5: Got EXEC_NEW ‘/usr/bin/kaccess’ from launcher.
………………………………………………………..
kf5.kded: Could not load kded module “kded_accounts”:”Could not load library /usr/lib64/qt5/plugins/kded_accounts.so: (libicui18n.so.56: could not open file: No such file or directory)” (library path was:”kded_accounts”)
By the way, this behaviour also happens if one tries to unlock any of the KDE Vaults. Without any LUKS partition.
And now I noticed that other icons disapear from the system tray as well. KOrganizer icon, for instance. Just as a result of trying to mount a Vault.
I think, it’s ‘libaccounts-qt5’ who need rebuild 😉
libaccounts-qt5-1.15 stable is available:
This is not an immediate emergency for me.
LUKS and Vaults can be mounted from command line. And there is a new release of KDE soon so maybe these issues will be solved anyway by a new compile of Eric’s.
To Jeff: Thanks for the suggestion for restarting the services without logging out. This really works. And sddm keeps a log file in user’s directory at ~/.local/share/sddm/xorg-session.log
I’ve posted similar posts in the past, but Chromium 63 have been out for a while, and theres been important fixes.
Mikei, yes I know. But the year-end is kind of a busy time, wrapping up all the work for the holidays and handing over tasks to the people that stay in the office.
The family comes first, paid work comes next, the hobbies come last.
There are still parts of KDE that would need a rebuild, for example the Telepathy parts.
Anyway new releases of Framework and Applications are out already and in the meanwhile a temporary fix can be grabbing the icu4c 56.1 package from Slackware 14.2 and copying the library files somewhere in ldconfig path.
Generally I prefer /usr/local/lib64 for such things.
Hi Eric,
It looks like the latest plasma5-nm package (plasma5-nm-5.11.3-x86_64-2alien.txt) was compiled without openconnect as it is missing the .so file and the 2 .desktop files.
I have recompiled the package myself and it created the files fine, however, even with the files installed, it still doesn’t work.
the applet prepares to connect but the dialogue box asking for credentials never shows up and it eventually gives up.
I am not sure where to look to see what the applet does and where it fails. I can connect to the VPN fine using the openconnect command directly.
I haven’t tried recompiling your networkmanager-openconnect package in case the new networkmanager package changed something so that will be my next step.
ArTourter let me know about the progress.
There will not be further recompilations – when I have the time I will compile the newest Frameworks/Plasma/Applications and at that time, also refresh the Telepathy deps.
Since the new Applications 17.12.0 is free of KDE4 stuff now, I will have to see what needs to be preserved in my kde4 & kde4-extragear directories to keep 3rd party kdelibs4-based packages going.
HI Eric,
Well recompiling NetworkManager-openconnect didn’t fix the problem but looking at the output of the compilation it looks like there is a flag being set in the configure file that seem to indicate the limitation:
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_4
modifying the slackbuild to change that value to NM_VERSION_1_10 (was worth a try) has no effect (well we get a slightly different message in the applet before it gives up but other than that nope)
will keep looking
No problem here, Eric, for build latest applications and frameworks 😉
And, latest plasma
Hi Eric, just wanted to report that your latest libreoffice packages for current do not run anymore after today’s boost upgrade in -current. However, symlinking the relevant 1.66.0 libraries with links using the old version 1.65.1 solves (at least temporarily) the problem.
Thanks for all your help and effort.
Eduardo, someone else already mentioned this on the ‘Feedback’ page… it’s what you get for running slackware-current. I don’t know when I will have time to compile a new package, LibreOffice is a big one.
Hi Eric, I understand what you said. I just wanted to note here the workaround in case someone finds it useful. As for the rebuild, don’t worry. I can manage so far. Thanks again!!
Just info, Eric,i have the new ConsoleKit2-1.2.1, installed here, since 8 days, it work without problem 😉
Gérard I think I can still slip that update into the next ktown release.
Thanks, I think you are preparing a nice Christmas present for plasma5 users 😉
You saw that Pat added Mako at current now, mesa no need the patch now 😉
Don’t worry the patch is commented out. It stays there in case someone wants to try these sources on Slackware 14.2.
Ok, Eric, thanks 😉
|
https://alien.slackbook.org/blog/rebuilt-packages-for-plasma5-ktown/
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Ural 1654 Cipher Message
1654. Cipher Message
Time limit: 1.0 second
Memory limit: 64 MB
Müller tried to catch Stierlitz red-handed many times, but always failed because Stierlitz could ever find some excuse. Once Stierlitz was looking through his email messages. At that moment, Müller entered secretly and watched a meaningless sequence of symbols appear on the screen. “A cipher message,” Müller thought. “UTF-8,” Stierlitz thought
It is known that Stierlitz ciphers messages by the following method.
He deletes all spaces and punctuation marks.
He replaces all successive identical letters by one such letter.
He inserts two identical letters at an arbitrary place many times.
Try to restore a message as it was after the second step. For that, remove from the message all pairs of identical letters inserted at the third step.
Input
The only input line contains a message ciphered by Stierlitz. The message consists of lowercase English letters and its length is at most 200000.
Output
Output the restored message.
题意:
把一个序列中相邻的且是偶数个相同的字符删除,奇数个的话就只保留一个。但是要注意,删除的过程中,可能会导致本来不相邻的相同字符变得相邻了,这时候也要删除。
Solution:
用栈模拟,同为水题
代码:
#include<bits/stdc++.h> using namespace std; const int maxn=5000005; int len,top=0; char s[maxn]; inline int read() { int s=0,f=1; char c=getchar(); while (c<'0'||c>'9') { if (c=='-') { f=-1; } c=getchar(); } while (c>='0'&&c<='9') { s=s*10+c-48; c=getchar(); } return s*f; } int main() { while (scanf("%c",&s[top])!=EOF) { if (s[top]=='\n') { break; } if (top>0&&s[top]==s[top-1]) { top--; } else { top++; } } for (int i=0;i<=top;i++) { cout<<s[i]; } return 0; } /* wwstdaadierfflitzz */
|
https://blog.csdn.net/Modestr/article/details/105127713
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
I'm beginning python and I'm trying to use a two-dimensional list, that I initially fill up with the same variable in every place. I came up with this:
def initialize_twodlist(foo): twod_list = [] new = [] for i in range (0, 10): for j in range (0, 10): new.append(foo) twod_list.append(new) new = []
It gives the desired result, but feels like a workaround. Is there an easier/shorter/more elegant way to do this?
A pattern that often came up in Python was
bar = [] for item in some_iterable: bar.append(SOME EXPRESSION)
which helped motivate the introduction of list comprehensions, which convert that snippet to
bar = [SOME EXPRESSION for item in some_iterable]
which is shorter and sometimes clearer. Usually you get in the habit of recognizing these and often replacing loops with comprehensions.
Your code follows this pattern twice
twod_list = [] \ for i in range (0, 10): \ new = [] \ can be replaced } this too for j in range (0, 10): } with a list / new.append(foo) / comprehension / twod_list.append(new) /
You can use a list comprehension:
x = [[foo for i in range(10)] for j in range(10)] # x is now a 10x10 array of 'foo' (which can depend on i and j if you want)
|
https://pythonpedia.com/en/knowledge-base/2397141/how-to-initialize-a-two-dimensional-array-in-python-
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Announcing Pulumi Azure Provider 2.0
We are happy to announce the release of a new major version of the Pulumi Azure provider. Pulumi Azure 2.0 is based on the 2.0 release of the upstream provider and brings several improvements and breaking changes.
This article outlines the most significant changes:
- Improvements in Azure Storage resources
- New resources for VMs & VM Scale Sets
- Removed deprecated resources and fields
- Latest versions in Callback Functions
- Configuring custom timeouts
- How to migrate and where to get help if needed
The provider release is not directly related to our Pulumi 2.0 plans.
Improvements in Azure Storage
We streamlined the experience of working with Azure Storage resources.
The Storage
Account resource has finally received native support for static website provisioning: it’s as simple as declaring a
staticWebsite property:
const storageAccount = new azure.storage.Account("mywebsite", { resourceGroupName: resourceGroup.name, accountReplicationType: "LRS", accountKind: "StorageV2", staticWebsite: { indexDocument: "index.html", }, });
In version 1.x, the
Blob resource could upload a file to a storage container, while the
ZipBlob would take a local directory, zip it, and upload the archive file to a storage container. In 2.0, we deprecated the
ZipBlob resource and combined both capabilities in
Blob.
Blob can now accept an instance of the
FileAsset class.
FileAsset watches the contents of the file on disk, so if the file changes, Pulumi re-uploads the file on the next update.
The following snippet uploads a list of files from a local disk to the newly created static website:
foreach (let file in files) new azure.storage.Blob(file, { storageAccountName: storageAccount.name, storageContainerName: "$web", type: "Block", source: new pulumi.asset.FileAsset(`./wwwroot/${file}`), contentType: "text/html", }), );
Note that
resourceGroupName properties were removed from all storage resources except the account: blobs or queues can’t belong to a resource group on their own.
New Resources for Virtual Machine & Virtual Machine Scale Set
There are four new resources for Virtual Machine & Virtual Machine Scale Set separated by operating system:
LinuxVirtualMachine,
WindowsVirtualMachine,
LinuxVirtualMachineScaleSet,
WindowsVirtualMachineScaleSet. The old-style generic
VirtualMachine and
VirtualMachineScaleSet are still available, so you can take your time before migrating existing stacks.
Here is a snippet that defines an Ubuntu VM:
const vm = new azure.compute.LinuxVirtualMachine("server-vm", { resourceGroupName, networkInterfaceIds: [networkInterface.id], size: "Standard_A0", sourceImageReference: { publisher: "Canonical", offer: "UbuntuServer", sku: "16.04-LTS", version: "latest", }, osDisk: { caching: "ReadWrite", storageAccountType: "Standard_LRS", }, computerName: "hostname", adminUsername: username, adminPassword: password, disablePasswordAuthentication: false, );
Removing Deprecated Resources, Invokes, and Fields
Azure Active Directory now has its own Pulumi provider, so all the AD resources were removed from the
AD namespace of the Azure Provider 2.0.
A number of other resources, invokes, and fields were removed too, following the changes in the upstream provider. You can see the full list in this upgrade guide.
Default Versions in Callback Functions
Serverless as Callbacks running on Azure Functions have bumped the default version of the Azure Functions runtime to
~3 and
Node.js to
~12. As always, you can override the default to set the versions that you require.
Callback Functions also moved from
ZipBlob to
Blob deploy as described above, so expect another replacement operation while upgrading.
Custom Timeouts
Some types of resources take longer to create than others. For instance, provisioning a new Cosmos DB account may take from 10 minutes to over an hour depending on the number of geo locations and other factors.
If the creation of a target resource times out, you can override the default timeout using resource options:
const cosmosdbAccount = new azure.cosmosdb.Account("cosmosdb", { resourceGroupName: resourceGroup.name, offerType: "Standard", geoLocations: manyLocations, consistencyPolicy: { consistencyLevel: "Session" }, }, { customTimeouts: { create: "30m", update: "60m", }, });
You shouldn’t need this ability often, but it can be a lifesaver when you do.
Explicit Adoption
Pulumi comes with a way to adopt existing cloud resources by specifying
import options.
With the 1.x versions of the Azure provider, some resources could become adopted accidentally: if a name would match an existing resource, the upsert operation could succeed, and Pulumi would start managing the existing resource.
The 2.0 version of the provider is rigorous in checking the presence of existing resources with matching names before attempting to create new ones. This measure prevents inadvertent adoption and undesired side effects.
Getting Started with Migration
To get started with Azure provider 2.0, update the versions in your package manager:
// package.json "@pulumi/azure": "^2.0.0",
// csproj/fsproj/vbproj <PackageReference Include="Pulumi.Azure" Version="2.1.0-preview" />
# requirements.txt pulumi-azure>=2.0.0
// Gopkg.toml [constraint]] version = "v2.0.0" name = "github.com/pulumi/pulumi-azure"
There are quite a few breaking changes, so you may need to adjust your code before you can run the program successfully again. Check the upgrade guide for details.
To help with this process, we upgraded all our Azure templates and examples to 2.0.
If you want to stay with the 1.x version, please pin your version to
^1.0.0 or
1.14.0 in the package manager.
If you have issues or questions, reach out to us on Pulumi Community Slack, and we’ll help you through migration.
|
https://www.pulumi.com/blog/pulumi-azure-2-0/
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
TL;DR – C# array refers to a collection of variables that have the same type.
Contents
Creating Arrays in C#
C# arrays hold variables of the same type. When you create an array, you specify the type (for instance, int or string) of data it will accept.
Note: C# arrays can hold any elements, even other arrays.
It is possible to access a specific item in the array by its index. The array elements are kept in a contiguous location.
Tip: the contiguous memory allocation refers to the fact that when a process executes, it requests the necessary memory.
An array is usable only after you make C# declare array with a name and an element type. The second pair of square brackets
[ ] indicates the size of the array.
Note: the index of variables in an array begins at 0.
type[ ] arrayName[]
The most basic type of C# arrays is a single-dimensional array, declared with the following code:
int[] array1 = new int[4];
We have created an array and set its size to 4. However, we did not add any variables to it. You can declare an array by assigning elements to it as well:
int[] array1 = new int[] { 1, 3, 4, 7, 8 };
Previous code examples declared and initialized int type arrays in C#. String arrays can be created by using the following code:
string[] firstString = new String[5];
Now, we declare and initialize a C# string array by adding values to it:
string[] dessert = new string[] {"Cupcake","Cake","Candy"};
Remember: C# completes allocation of the memory for arrays dynamically. Since arrays are objects, the retrieval of C# array length is easy by using the prepared functions.
Initialization of Arrays
To make C# initialize arrays, developers apply the
new keyword. Consider this code:
int[] array1 = new int[6];
C# creates an array and reserves memory space for six integers. However, the initialization process does not end here.
It is important to assign values to the array. The most useful way to create arrays and produce quality code is declaring, allocating, and initializing it with a single line:
int[] array1 = new int[6] { 3, 4, 6, 7, 2};
Every element in an array has a default value which depends on the array type. When declaring an int type, you make C# initialize array elements to 0 value.
Multi-Dimensional Arrays
C# multi-dimensional arrays have multiple rows for storing values. It is possible to make C# declare arrays that have either two or three dimensions.
With the following code, C# creates a two-dimensional array (with
[,]):
int[,] array = new int[5, 3];
You can create three-dimensional arrays using this code:
int[, ,] array1 = new int[4, 2, 3];
Jagged Arrays
C# arrays are jagged when they hold other arrays. The arrays placed in jagged arrays can have different sizes and dimensions.
With the following code, we generate a single-dimensional array with four other single-dimensional int type arrays:
int[][] jaggedArray = new int[4][];
It is crucial to make C# declare arrays and initialize them with the following code:
jaggedArray[0] = new int[4];
jaggedArray[1] = new int[5];
jaggedArray[2] = new int[3];
We created three single-dimensional arrays: the first one contains 4 integers, the second contains 5 integers, and the last one has 3 integers.
You can make C# initialize arrays without setting their size as well. Then, you have to include their element values by using the initializers:
jaggedArray[0] = new int[] { 7, 2, 5, 3, 8 };
jaggedArray[1] = new int[] { 4, 5, 7, 8 };
jaggedArray[2] = new int[] { 14, 18 };
Remember: the elements of jagged C# arrays are reference types, and their default value is null.
Accessing and Adding Values to Arrays
You can make C# add to array new values even after declaration and initialization processes by indicating a specific index.
First, we declare and initialize an array:
int[] array1 = new int[6];
Then, we set a value of 12 for an array in its index 0:
intArray[0] = 12;
The following code assigns a value of 25 for an array in its index 1:
intArray[1] = 25;
We assign a value of 32 for an array in its index 2:
intArray[2] = 32;
To access a specific value in an array, you should indicate the exact index:
intArray[0]; //returns 12
Methods and Properties for Arrays
Here is a list of the most popular methods applied to arrays C#:
A useful tip is to explain how converting a C# byte array to string works:
string s = System.Text.Encoding.UTF8.GetString(buffer, 0, buffer.Length);
There is another option which is split into two parts. You have to include this code for this conversion to work:
UTF8Encoding utf8 = new UTF8Encoding(true, true);
Then, you can use the following code to convert C# byte array to string:
String s2 = utf8.GetString(bytes, 0, bytes.Length);
The following table shows the most common properties for arrays:
foreach Method
The
foreach is an easy method for processing all elements in an array. It influences the elements from index 0 to -1.
The following code example shows how to use
foreach to print the values in an array to the console:
public class Program { public static void Main() { int[] numbers = {7, 12, 1, 5, 3, 8, 9, 20, 4}; foreach (int i in numbers) { System.Console.Write("{0}", i); } } }
C# Array: Useful Tips
- The number and length of dimensions of C# arrays cannot be modified after they are declared.
- Arrays are great for code optimization because developers can store multiple values in one variable instead of creating multiple variables.
- The square brackets (
[]) after the element type indicate that it is an array.
|
https://www.bitdegree.org/learn/c-sharp-array
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
From: Jeff Garland (jeff_at_[hidden])
Date: 2001-07-20 07:44:47
Steve wrote:
> You can specify them in your forward header, and not in your implementation
> header. That's what I do for poolfwd.hpp:
>
> //map_fwd.hpp
> namespace std {
> template <class Key,
> class T,
> class Compare = std::less<T>,
> class Alloc = std::allocator<T> >
> class multimap;
> }
Right, but if the library the author didn't provide this forward declaration a
third party cannot provide the defaults since the library header already defines
these and then the compilers complain....
Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
|
https://lists.boost.org/Archives/boost/2001/07/14887.php
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Properties¶
doublex supports stub and spy properties in a pretty easy way in relation to other frameworks like python-mock.
That requires two constraints:
- It does not support “free” doubles. ie: you must give a collaborator in the constructor.
- collaborator must be a new-style class. See the next example.
Stubbing properties¶
from doublex import Spy, assert_that, is_ with Spy(Collaborator) as spy: spy.prop = 2 # stubbing 'prop' value assert_that(spy.prop, is_(2)) # double property getter invoked
Spying properties¶
Continuing previous example:
from doublex import Spy, assert_that, never from doublex import property_got, property_set class Collaborator(object): @property def prop(self): return 1 @prop.setter def prop(self, value): pass spy = Spy(Collaborator) value = spy.prop assert_that(spy, property_got('prop')) # property 'prop' was read. spy.prop = 4 spy.prop = 5 spy.prop = 5 assert_that(spy, property_set('prop')) # was set to any value assert_that(spy, property_set('prop').to(4)) assert_that(spy, property_set('prop').to(5).times(2)) assert_that(spy, never(property_set('prop').to(6)))
Mocking properties¶
Getting property:
from doublex import Mock, assert_that, verify with Mock(Collaborator) as mock: mock.prop mock.prop assert_that(mock, verify())
Setting property:
from doublex import Mock, assert_that, verify with Mock(Collaborator) as mock: mock.prop = 5 mock.prop = 5 assert_that(mock, verify())
Using matchers:
from hamcrest import all_of, greater_than, less_than from doublex import Mock, assert_that, verify with Mock(Collaborator) as mock: mock.prop = all_of(greater_than(8), less_than(12)) mock.prop = 10 assert_that(mock, verify())
|
https://python-doublex.readthedocs.io/en/latest/properties.html
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Combine the Neural with the Normal.
In this document I will demonstrate density mixture models. The goal for me was to familiarize myself with tensorflow a bit more but it grew to a document that compares models too. The model was inspired from this book by Christopher Bishop who also wrote a paper about it in 1994. I’ll mention some code in the post but if you feel like playing around with the (rather messy) notebook you can find it here.
A density mixture network is a neural network where an input \(\mathbf{x}\) is mapped to a posterior distribution \(p(\mathbf{y} | \mathbf{x})\). By enforcing this we gain the benefit that we can have some uncertainty in our prediction (assign a lot of doubt for one prediction and a lot of certainty for another one). It will even give us the opportunity to suggest that more than one prediction is likely (say, this person is either very tall or very small but not medium). The main trick that facilitates this is the final hidden layer which can be split up into three different parts:
The idea is that the final prediction will be a probability distribution that is given by the trained output nodes via; \[ p(\mathbf{y} | \mathbf{x}) = \sum_{i=1}^k \pi_i \times N(\mu_i, \sigma_i) \]
Graphically, and more intuitively, the network will look something like:
All the non-coloured nodes will have tahn activation functions but to ensure that the result is actually a probability distribution we will enforce this neural network to:
Note that the architecture we have is rather special. Because we assign nodes to probibalistic meaning we enforce that the neural network gets some bayesian properties.
The implementation is relatively straightforward in tensorflow. To keep things simple, note that I am using the
slim portion of
contrib.
import tensorflow as tf # number of nodes in hidden layer N_HIDDEN = [25, 10] # number of mixtures K_MIX = 10 x_ph = tf.placeholder(shape=[None, 1], dtype=tf.float32) y_ph = tf.placeholder(shape=[None, 1], dtype=tf.float32) nn = tf.contrib.slim.fully_connected(x_ph, N_HIDDEN[0], activation_fn=tf.nn.tanh) for nodes in N_HIDDEN[1:]: nn = tf.contrib.slim.fully_connected(nn, nodes, activation_fn=tf.nn.tanh) mu_nodes = tf.contrib.slim.fully_connected(nn, K_MIX, activation_fn=None) sigma_nodes = tf.contrib.slim.fully_connected(nn, K_MIX, activation_fn=tf.exp) pi_nodes = tf.contrib.slim.fully_connected(nn, K_MIX, activation_fn=tf.nn.softmax) norm = (y_ph - mu_nodes)/sigma_nodes pdf = tf.exp(-tf.square(norm))/2/sigma_nodes likelihood = tf.reduce_sum(pdf*pi_nodes, axis=1) log_lik = tf.reduce_sum(tf.log(likelihood)) optimizer = tf.train.RMSPropOptimizer(0.01).minimize(-log_lik) init = tf.global_variables_initializer()
With the implementation ready, I figured it would be nice to generate a few odd datasets to see how the architecture would hold. Below you will see five charts for four datasets.
When looking at these charts we seem to be doing a few things right:
If you look carefully though you could also spot two weaknesses.
The values for sigma can suddenly spike to unrealistic heights, this is mainly visable in the fourth plot. I’ve introduced some regularisation to see if it helps. The model seems to improve, not just in the \(\sigma\)-space but also in the \(\mu\)-space we are able to see more smooth curves.
The regularisation can help, but since \(\pi_i\) can be zero (which cancels out the effect of \(\sigma_i\)) you may need to regulise drastically if you want to remove it all together. I wasn’t able to come up with a network regulazier that removes all large sigma values, but I didn’t care too much because I didn’t see it back posterior output (because in those cases, one can imagine that \(\pi_i \approx 0\)).
Our model is capable of sampling wrong numbers around the edges of the \(x\)-space, this is because \(\sum_i \pi_i = 1\) which means that for every \(x\) the likelihood must be zero. To demonstrate the extremes consider these samples from the previous models;
Note how the model seems to be drawing weird samples around the edges of the known samples. There’s a blob of predicted orange where there are no blue datapoints to start with.
Because \(\sum \pi(x) = 1\) we are always able to generate data in regions where there really should not be any. You can confirm this by looking at the \(\mu\) plots. We could append this shortcomming by forcing that \(\sum \pi(x) = 0\) if there is no data near \(x\). We could “fix” this by appending the softmax part of the \(\pi_i\) nodes with a sigmoid part.
This can be done, but it feels like a lot of hacking. I decided not to invest time in that and instead considered comparing mixture density networks to their simpler counterpart; gaussian mixture models.
It is fashionable thing to try out a neural approach these days, but if you would’ve asked me the same question three years ago with the same dataset I would’ve proposed to just train a gaussian mixture model. That certainly seems like a right thing to do back then so why would it be wrong now?
The idea is that we throw away the neural network and that we train \(K\) multivariate gaussian distributions to fit the data. The great thing about this approach that we do not need to implement it in tensorflow either since scikit learn immediately has a great implementation for it.
from sklearn import mixture clf = mixture.GaussianMixture(n_components=40, covariance_type='full') clf.fit(data)
With just that bit of code, very quickly train models on our original data too.
The model trains very fast and you get the eyeball impression that it fits the data reasonably.
Let’s zoom in on predictions from both models to see how different they are.
It should be said that we’ll be making comparisons between two approaches without any hypertuning (or even proper convergence checking). This is not very appropriate academically, but it may demonstrate the subtle differences in output better (as well as simulate how industry users will end up applying these models). Below we’ll list predictions from both models.
In each case, we’ll be given an \(x\) value and we want to predict the \(y\) value. The orange line is the neural approach and the blue line is from the scikit model. I’ve normalized both likelihoods on the same interval in order to compare them better.
It’s not exactly a full review but just from looking at this we can see that the models show some modest differences. The neural approach seems to be more symmetric (which is correct; I sampled the data that way) but it seems to suffer from unfortunate jitter/spikyness at certain places. More data/regularisation might fix this issue.
Other than that, I would argue the normal scikit learn model is competitive simply because it trains much faster which could make it feasible to do a grid search on the number of components relatively quickly.
Both methods have it’s pros and cons, most notably;
Again, if you feel like playing around with the code, you can find it here.
|
https://koaning.io/posts/feed-forward-posteriors/
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Draft Shape2DView/ru
Description
The
Draft Shape2DView tool produces a 2D projection from a selected 3D solid object such as those created with the
Part,
PartDesign, and
Arch Workbenches.
The resulting projection is a Draft object and is placed in the 3D view. This object can be displayed on a
TechDraw Workbench page, using the TechDraw NewDraft tool. Alternatively, TechDraw has its own tools to create projected views, the
TechDraw NewView and
TechDraw NewProjGroup tools; however, these tools are meant for preparing technical drawings, so they create the views only in the drawing page, and not in the 3D view.
Projection of solid shapes into the XY plane
Usage
- Rotate the view so it reflects the direction of the desired projection. For example, a top view will project the object on the XY plane.
- Select a 3D object.
- Press the
Draft Shape2DView button. If no object is selected, you will be invited to select one.
The projected object will be created below the selected object, lying on the XY plane. It's position can be changed by changing its properties. The projection direction can also be changed after creation with the property editor.
Note: If the selected object is an
Arch SectionPlane, the projection will use the contents and direction of that Section plane; in this case, the "Projection" property will be ignored.
Options
There are no options for this tool. Either it works with the selected object or not.
Properties
- DataProjection: specifies the direction of the projection as a vector. For example, (0,0,1) is a projection looking through the Z axis, which would be projected on the XY plane; (1,0,0) is a projection looking through the X axis, which would be projected on the YZ plane; (0,1,0) is a projection looking through the Y axis, which would be projected on the XZ plane. The values can also be negative, in which case the direction of projection is inverted.
- DataProjection Mode: it can be "Solid", "Individual Faces", "Cutlines", and "Cutfaces".
- The default projection is "Solid", which projects the entire selected shape.
- If only some faces of the base object are selected, the "Individual Faces" mode will project only those faces.
- If the selected object is an Arch SectionPlane, the "Cutlines" mode will project only the edges being cut by the section plane.
- If the selected object is an Arch SectionPlane, the "Cutfaces" mode will display the cut areas of solids as faces.
- DataIn Place: if it is True, together with "Cutlines" or "Cutfaces" modes, the resulting projection will appear co-planar with the Arch SectionPlane. introduced in version 0.17
- DataHiddenLines: if it is True it will show the hidden lines of the projection.
- DataTessellation: if it is True it will perform tessellation of ellipses and splines, that is, it will represent curves with very fine line segments.
- Note: this may be computationally intensive if DataSegment Length is very small.
- DataSegment Length: specifies the size in millimeters of linear segments if DataTessellation is True.
- Note: set a larger value first, and then change it to a smaller value to get better resolution.
- DataVisible Only: if it is True the projection will be recomputed only if it is visible.
Scripting
See also: Draft API and FreeCAD Scripting Basics.
The Draft Shape2DView tool can be used in macros and from the Python console by using the following function:
Shape2DView = makeShape2DView(baseobj, projectionVector=None, facenumbers=[])
- Creates
Shape2DViewas a projection of the given
baseobj.
- If
facenumbersis given, it is a list of face numbers to be considered for the projection.
- If a
projectionVectoris given, it is used; otherwise the default projection is along the Z axis.
The
ProjectionMode attribute needs to be overwritten with the desired mode, which can be
"Solid",
"Individual Faces",
"Cutlines", or
"Cutfaces".
Example:
import FreeCAD, Draft Box = FreeCAD.ActiveDocument.addObject("Part::Box", "Box") Box.Length = 2300 Box.Width = 800 Box.Height = 1000 Shape1 = Draft.makeShape2DView(Box) Shape2 = Draft.makeShape2DView(Box, FreeCAD.Vector(1, -1, 1)) Shape3 = Draft.makeShape2DView(Box, FreeCAD.Vector(-1, 1, 1), [4,5]) Shape3.ProjectionMode = "Individual Faces" FreeCAD.ActiveDocument.recompute()
-
|
https://wiki.freecadweb.org/index.php?title=Draft_Shape2DView/ru&printable=yes
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
It’s a new year and a new release for Panda3D! Version 1.10.0 is one of our most ambitious releases to date and brings with it many enhancements, features, bugfixes, and various other improvements. Let’s jump right in, shall we?
Rebranding
You may have noticed our first change before even downloading the SDK: We now have a completely new look! We have given the website a complete overhaul and have streamlined the process of downloading the latest SDK. We hope you like it, and we look forward to meeting some of the newcomers who will be joining our community in the near future!
Python 3 support
With Python 2 due to sunset next year, Panda3D has used this release cycle to modernize its Python support code. Not only does Panda3D now support the user’s choice of either Python 2 or 3, but also includes coroutine support for those using Python 3.5 and up! Coroutines are defined with
async def and can be added to the TaskManager just like any other task. Asynchronous operations can be performed with
await op(), which will cause the TaskManager to run other tasks until the operation completes, keeping frame rates up without requiring awkward callbacks. This combines the programmer convenience of writing simple functions with the smooth performance of asynchronous operations!
Gamepad/joystick support
This release brings first-class support for reading joystick/gamepad controller input on Windows, Linux, and macOS. Those already familiar with Panda3D’s keyboard/mouse input API should feel right at home with the new gamepad/joystick support, which detects already-present and hotplugged gamepad devices, and even allows assigning a unique prefix to each device’s input events in order to distinguish between multiple gamepads connected at once. What’s more, the new code has all the basics for implementing motion tracker and VR support in a future release. We can’t wait to see what kinds of new multiplayer “living room” style games people create!
Android port
The new release has made significant strides towards bringing the Android port to the level of quality one should expect of a Panda port. It’s now even possible to compile Panda3D on your Android machine, and there is even a third-party development environment available on the Play Store for developing Python games on your Android device. The major shortcoming as of yet is that there is no easy deployment pipeline yet to deploy your games for Android, so that will be a major priority going forward.
Shaders
Shaders are an essential part in achieving more advanced graphics with Panda3D than the fixed-function pipeline offers. So, of course we’ve devoted a lot of attention to improving the shaders in Panda3D. The shader generator, which makes it easy to use advanced effects without having to write shader, has received a significant overhaul. This overhaul dramatically improves its runtime performance, removes frame chugs, and makes it more reliable. Not only that, but it now supports additional features, including point light shadows and reoriented normal mapping.
For those creating their own shaders, we’ve brought many improvements as well, such as a GLSL preprocessor (allowing the use of #include instructions) and the availability of many more built-in inputs for custom shaders.Improving the shader system even further will be a major priority for the next major release of Panda3D, in which we plan to bring a brand new physically-based rendering shader to the engine core, and make it easier to write shaders that target a wide variety of platforms.
OpenGL improvements
There are too many improvements to the OpenGL renderer to name, but perhaps the most exciting is the ability to explicitly request an OpenGL Core Profile.
What is an OpenGL Core Profile? With OpenGL 3.2, Khronos removed many of the older features that had long since been deprecated (such as the fixed function pipeline), to allow driver developers to focus on the more modern graphics techniques without needing to worry about compatibility with older, deprecated functionality. While the newer features are fully capable of superseding the older methods, this does mean losing compatibility with older OpenGL applications. So, OpenGL 3.2 solved this problem by allowing applications to request either a “Core Profile” or a “Compatibility Profile,” where the former allows use of the latest and greatest functionality, and the latter ensures that applications written for OpenGL versions as old as 1.0 continue to function. The OpenGL driver provides the Compatibility Profile, unless the application specifically asks for a Core Profile, thereby indicating its willingness to operate without a fixed-function pipeline and many other legacy features.
Panda3D is able to make use of either profile, but users can now specifically request a Core Profile through use of the
gl-version .prc configuration variable, granting full access to the latest extensions and functionality supported by the system OpenGL driver. Note, however, that doing this opts out of fixed-function pipeline support, and it is the user’s responsibility to provide suitable shaders.
Deployment system
One of Panda3D’s major strengths is how easy it is to use, and for this we also need to make it possible to deploy your application effortlessly to any supported platform. In order to ensure that we can keep up this promise, we’ve rebuilt our deployment system from the ground up for the new release. The new system is built around the existing Python packaging ecosystem, leveraging popular Python packaging tools like setuptools and pip in order to make it easy to build your application into an executable, regardless of which Python version it needs or which external libraries it pulls in.
HarfBuzz text shaping
For many users, making applications accessible to speakers of non-Latin-alphabet languages is of utmost importance. Many of these languages do not follow the basic left-to-right writing rules to which the English-speaking world is most accustomed. Many of these languages, in fact, don’t even use an alphabet! Some of them use one glyph per word, while others use characters made up of overlapping glyphs that must be built up as a series of Unicode codepoints.
To support this, Panda3D now includes support for the HarfBuzz text shaping library, which works in concert with FreeType to lay out and rework the text. HarfBuzz also improves English text, by replacing certain letter pairs with ligatures to improve readability.
Combined with Python 3’s unicode-by-default representation of text, supporting international languages in Panda3D is now something that “just works” without any additional developer attention required.
.flac and .opus support
Panda3D 1.9.0 added non-LGPL support for loading .wav and OGG/Vorbis audio files, for those that don’t wish to rely on the LGPL-licensed FFmpeg to load sound assets. Panda3D 1.10.0 goes a step further by adding support for loading .opus files (via libopus) and .flac files (through built-in code). Sounds like good news for those who prefer the open Xiph.Org audio formats!
General cleanup
This isn’t as interesting in a blog post, but we’ve done a lot of work in the codebase as well to keep everything clean, tidy, and free of bloat. This kind of work helps us work more quickly, attract the attention of other developers, and keep the project as bug-free as possible. A few things which we’ve done since the 1.9.0 release are:
- Added an automated test suite, which will help catch bugs earlier in the development cycle and make Panda3D more stable overall by preventing regressions from sneaking in.
- Removed several files which haven’t been used in years. Less code means less maintenance!
- The Python support code has been completely removed from libpanda.dll and is fully self-contained within the .pyd extensions themselves.
- Panda headers no longer contain using namespace std;
- Many other various stylistic improvements and fixes!
We’ve only just scratched the surface of all of the new goodies this release brings. Want to hear more? Go read the release notes! Want to get started? Head on over to our new download page and try out v1.10.0 for yourself!
12 thoughts on “A new year, a new Panda”
New website looks beautiful, can’t wait to see what the new SDK brings hands-on.
Hm, so let me get this straight, you rebranded the engine (new logo and website basically) but when it comes to features such as Android and physically based rendering support and a proper 201x era shader generator it’s still “planned” rather than available???
I’m sorry but even point light shadows (which were long overdue already) aren’t enough to call this a major release and overhaul.
Until you guys get the fact that game devs want high level graphical features and mobile deployment such as the ones I described they aren’t going to care about any low-level features, code refactoring and the likes. Good effort, but in the wrong direction again. See you in 2022, maybe you’ll finally get it by then what game developers need. Until then I’m sticking with Unity and Godot…
Hi Anon! Thanks for the feedback. We strive to improve the technology in any way that we can, and understanding our shortcomings is the first step toward fixing them. Perspectives such as these are invaluable to that process and we’d like to hear more.
Once again, thanks for taking the time aside to volunteer your perspective, and I’m looking forward to finding out more!
Thanks for checking in! We really hear you, and it’s feedback like yours that are the reason why we have indeed made significant progress on the Android support in this release, and why we have made physically-based rendering and other high-end graphical features the primary priority for the next release. Many of the features you see presented here were in fact intended in service of these goals, such as the lower-level shader and OpenGL renderer changes forming the foundation to let us build high-end shaders, and the new input framework laying the groundwork for mobile input methods—or have been things that were also deemed essential by some other part of the user base. It’s always tricky to balance the diverse needs of the userbase when you’re an open-source project with limited developer resources, which is why you may not be seeing progress in these aspects as fast as you may have hoped.
Rest assured that the rebrand hasn’t been taking away the attention from the core developers; we’ve got some cool plans that we will be bringing into motion within the next few months that we think will really help to propel Panda forward, particularly in the areas that you indicate as important. I hope that you keep checking in with what we do and keep giving feedback on the priorities that matter the most to you.
Anon… bad attitude to start the year. Panda 3D is not for unload your frustrations. Let it go. Forgive yourself.
It all sounds very good!
One question I forgot to ask, is Vulkan support anywhere on the roadmap?
Vulkan support is something we indeed consider a very important goal, though it’s not the main priority for the next release. But many of the changes we will be targeting in the next release—such as an improved shader pipeline that will be able to serve the Vulkan renderer as well—are significant stepping stones in bringing Vulkan support closer, so do expect to see progress on this!
Sweet gravy! This update is mighty tasty!
The new website really is an infinite improvement over the old one, but is I don’t feel it’s right to use screenshots of the RenderPipeline everywhere, as it is not a part of Panda3D and it performs badly on anything but the top GPU’s and is partially broken on intel. Isn’t this misleading to people who are deciding whether to use panda or not may be influenced by this. Some RP screenshots are probably OK, and when this new shader system is completed hopefully there will be equally stunning screenshots using only panda.
Im so happy for this new website. Im sure this will help a lot to get more attention. Python is growing really fast and Panda3d im sure will grow also. A more than a year ago i tried Panda and failed miserable. Unfortunately im not a good programmer, im not even a good coder, but i want to improve this hobby. And I would like to do that by creating some simple game project. I always remembered Panda and my failure 🙂 and today decided to check on you guys, and this new look is a great surprise!!!
Excellent
|
https://www.panda3d.org/blog/sdk-1-10-0-release/
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Hi, Thank you for your suggestion. It's a better approach. Though putting the check in __call_console_drivers() does fix the problem, it's not satisfactory. Because, until cpu_online_map is set up, log_buf is flushed without printing. So I put the check in release_console_sem(). How about this fix? From: David Mosberger <davidm@hpl.hp.com> Subject: Re: [Linux-ia64] where to set rr for uncached region Date: Mon, 26 Nov 2001 15:41:31 -0800 > Hmmh, this is a bit of a nasty problem. We shouldn't be calling any > console drivers until an AP is fully initialized. But the platform > independent part of Linux currently only delays printing on the > boostrap processor. Perhaps printk() should be enhanced with a check > to ensure that a processor is ready for calling the console driver. > For example, in __call_console_drivers() we could have something along > the lines of: > > for (con = console_drivers; con; con = con->next) { > if ((con->flags & CON_ENABLED) && con->write > && (cpu_online_map & 1UL << smp_processor_id())) > con->write(con, &LOG_BUF(start), end - start); > } > > Do you want to try this? Index: kernel/printk.c =================================================================== RCS file: /home/cvsadm/cvsroot/linux/kernel/printk.c,v retrieving revision 1.1.1.8.2.1 diff -u -r1.1.1.8.2.1 printk.c --- kernel/printk.c 2001/11/27 08:28:04 1.1.1.8.2.1 +++ kernel/printk.c 2001/11/29 06:20:35 @@ -505,6 +505,10 @@ for ( ; ; ) { spin_lock_irqsave(&logbuf_lock, flags); must_wake_klogd |= log_start - log_end; +#ifndef CONFIG_IA64_EARLY_PRINTK + if (!(cpu_online_map & 1UL << smp_processor_id())) + break; +#endif if (con_start == log_end) break; /* Nothing to print */ _con_start = con_start; Best regards. -- NOMURA, Jun'ichi <j-nomura@ce.jp.nec.com, nomura@hpc.bs1.fc.nec.co.jp> HPC Operating System Group, 1st Computers Software Division, Computers Software Operations Unit, NEC Solutions.Received on Wed Nov 28 23:34:56 2001
This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:06 EST
|
http://www.gelato.unsw.edu.au/archives/linux-ia64/0111/2507.html
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Hide Forgot
Description of problem:
This change
* Sat Dec 22 2007 Sergio Pascual <sergiopr at fedoraproject.com> 0.9-4
- Arch dependent gnu/bzconfig.h moved to %%libdir/blitz/include/blitz/gnu
breaks as blitz/bzconfig is umodified:
#elif defined(__GNUC__)
/* GNU gcc compiler */
#include <blitz/gnu/bzconfig.h>
and /usr/include/blitz/gnu don't exists anymore.
Header files in %_lib seems broke too, see e.g. apr package
(multilib apr.h hack) how to keep header in %_include:
Well, what I did was to modify also blitz.pc so that
$ pkg-config --cflags blitz
-I/usr/lib64/blitz/include
If you compile your program with
$ g++ myprogram.cc `pkg-config blitz --libs --cflags`
it should work
anyway I will look the apr example and look if it makes sense
I have submitted a bug upstream about this.
*** Bug 478297 has been marked as a duplicate of this bug. ***
|
https://partner-bugzilla.redhat.com/show_bug.cgi?format=multiple&id=450999
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
Hello world,
I want to use IntelliJ to run the Java software I have here:
The software has 2 folders:
samples/
source/
It appears that the Java code in samples/ depends on source/
I want to know how to create a project which allows me to run the code in samples/
I poked at it a bit using the menus in IntelliJ and quickly realized I should ask for help.
Question: How to create/configure an Intellij project which can run the code here:
??
Hello world,
Create a project with 2 modules, one for source, another for modules, make samples module depend on the source module.
ok,
I did this.
cd /tmp/
git clone
cd /tmp/ibjts/
idea.sh
Then I saw idea14 appear.
How to create a project?
Menu has these options:
-New Project
-New Project from existing sources
I picked
-New Project from existing sources
I gave it this path:
- /tmp/ibjts/
It asks for project name.
I gave it 'myproject'
Now I see a project and it has this path:
/tmp/ibjts/myproject
Question:
How to add modules to this project?
I see no 'add module' action in the menus.
This might seem like a simple question but I am used to interpreted
languages like Python, Ruby, and JavaScript which make it very easy to
reuse other peoples code.
I sense progress.
I added this folder as a module:
/tmp/ibjts/samples/
and now, the java-code there appears in idea14.
yay!
The first file is:
/tmp/ibjts/samples/Java/apidemo/AccountInfoPanel.java
The first import is:
import static com.ib.controller.Formats.fmt0;
And it contains some red.
So, I import this folder as a module:
/tmp/ibjts/source/
And that import is still red.
Question1:
Is /tmp/ibjts/samples/ the correct folder when I added the 1st module?
I sense that I have these folder-choices for the 1st module:
/tmp/ibjts/samples/
/tmp/ibjts/samples/Java/
/tmp/ibjts/samples/Java/apidemo/
Which one should I use?
Perhaps I see a clue in this file:
/tmp/ibjts/samples/Java/apidemo/AccountInfoPanel.java
There, I see the declaration:
package apidemo;
Perhaps this Java-call has something to do with an idea-module?
Question2:
Did I use the correct folder when I added the 2nd module?
I sense that I have these folder-choices for the 2nd module:
/tmp/ibjts/source/
/tmp/ibjts/source/JavaClient/
/tmp/ibjts/source/JavaClient/com/
/tmp/ibjts/source/JavaClient/com/ib/
/tmp/ibjts/source/JavaClient/com/ib/client/
/tmp/ibjts/source/JavaClient/com/ib/contracts/
/tmp/ibjts/source/JavaClient/com/ib/controller/
What is the correct folder choice when I add the 2nd module?
I chose
/tmp/ibjts/source/
but I worry that is a wrong choice.
Attached is the correctly configured project with the dependencies between the modules.
Attachment(s):
ibjts.zip
I sense more progress.
Your zip file is very useful.
I will try to use it to recreate the steps I need to follow to create my own project.
I've spent 40 minutes trying but have no success yet.
I see that I am wrestling with two basic questions:
1. How to reuse code in Java?
2. How to use IntelliJ to reuse code in Java?
I now know that to share my code I need a package declaration in my file.java
And, that declaration needs to match a folder structure.
Also I know that CLASSPATH is used to communicate locations of file.class
And I know that I can use javac to create file.class from file.java
Today I learned that IntelliJ asks me to use a hierarchy:
A project has modules which have classes
Also I know that project is tied to a folder.
And that a module is tied to a folder.
What eludes me is the detailed thought process behind building a project from two folders of code.
I know that both folders depend on jdk7 and that folder-A depends on folder-B.
To me that seems like 3 simple facts that I can convey to IntelliJ.
IntelliJ should then give me a project which has all the dependencies connected together.
I used idea14 to study your project.
I see 2 modules:
Java[samples] tied to folder ibjts/samples/Java
JavaClient tied to folder ibjts/source/JavaClient
I assume that that the first module has [samples] next to it for some reason.
Perhaps I use [samples] to identify the project?
I browsed various java files under ibjts/samples/Java.
I see no red anywhere so this project is okay.
I exited idea14.
I did these shell commands:
cd /tmp/
git clone
cd /tmp/ibjts/
Here I see 2 folders:
samples
source
I know that samples depends on source and they both depend on jdk
I run this:
idea.sh
I create a 'project from existing sources' named samples from this folder:
/tmp/ibjts/samples/Java/
I see lots of red in the java files.
I create a module from this folder:
ibjts/source/JavaClient
On the left-hand-side,
Now my project looks like your project.
But,
I still see lots of red in the java files.
Actually the java files in
ibjts/source/JavaClient/
seem to be okay; IntelliJ has found their dependencies.
Question: How to make the red go away from
/tmp/ibjts/samples/Java/
??
See . Make sure samples module has sources module in the dependencies.
ah,
I figured it out!
I see in your project where you set that the samples-module depends on the JavaClient-module.
I did this in my project:
UI-path:
file - ProjectStructure - modules - samples - plus-sign - moduleDependency
All my red is ... GONE.
yay!
Thanks!!!
|
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206169519-Newb-how-to-combine-2-folders-into-1-project-
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
NewFunction-macro
Counts the number of datasets that begin with the letter F (function datasets) and opens the function's Plot Details dialog box to create a new function named Fn where n is one more than the number of datasets counted. If the FUNCTION.OTP graph template is not opened before executing NewFunction, then the function dataset Fn is created but not plotted.
Def NewFunction {
list -sn F B;create %B -f 10;
def ErrorProc [del %B];set %B;del -m ErrorProc;
};
The following script creates a new graph window from the FUNCTION.OTP template and then creates and plots a new function named F1 (assuming that no other function datasets already exist).
GetEnumWin Function;
NewFunction;
|
http://cloud.originlab.com/doc/LabTalk/ref/NewFunction-macro
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
On Wed, May 14, 2003 at 03:31:08PM +0200, Eric Piel wrote: > Hello, > There is a compile error if not compiling for SMP: > +#ifdef CONFIG_SMP > if (!tasklist_lock.write_lock) > +#endif > read_lock(&tasklist_lock); Yuck. The right way to do this is read_trylock(&tasklist_lock); The observant will have noted: #define write_trylock(lock) ({preempt_disable();_raw_write_trylock(lock) ? \ 1 : ({preempt_enable(); 0;});}) /* Where's read_trylock? */ in include/linux/spinlock.h but that doen't justify _not writing it_ when you need it. -- "It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert FiskReceived on Wed May 14 07:16:54 2003
This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:14 EST
|
http://www.gelato.unsw.edu.au/archives/linux-ia64/0305/5466.html
|
CC-MAIN-2020-16
|
en
|
refinedweb
|
#include <wx/nonownedwnd.h>
Common base class for all non-child windows.
This is the common base class of wxTopLevelWindow and wxPopupWindow and is not used directly.
Currently the only additional functionality it provides, compared to base wxWindow class, is the ability to set the window shape.
If the platform supports it, sets the shape of the window to that depicted by region.
The system will not display or respond to any mouse event for the pixels that lie outside of the region. To reset the window to the normal rectangular shape simply call SetShape() again with an empty wxRegion. Returns true if the operation is successful.
This method is available in this class only since wxWidgets 2.9.3, previous versions only provided it in wxTopLevelWindow.
Set the window shape to the given path.
Set the window shape to the interior of the given path and also draw the window border along the specified path.
For example, to make a clock-like circular window you could use
As the overload above, this method is not guaranteed to work on all platforms but currently does work in wxMSW, wxOSX/Cocoa and wxGTK (with the appropriate but almost always present X11 extensions) ports.
|
http://docs.wxwidgets.org/trunk/classwx_non_owned_window.html
|
CC-MAIN-2017-43
|
en
|
refinedweb
|
I've set up listeners in my application to catch SIGTERM, SIGINT and SIGUSR2:
# kill
process.on 'SIGTERM', ->
killExecutors 'SIGTERM'
# ctrl + c
process.on 'SIGINT', ->
killExecutors 'SIGINT'
# nodemon signal
process.on 'SIGUSR2', ->
killExecutors 'SIGUSR2'
FROM node:4.4.7
MAINTAINER Newborns <newborns@versul.com.br>
COPY . /src
EXPOSE 7733
WORKDIR /src
RUN npm install
CMD ["./node_modules/.bin/coffee", "feeder.coffee"]
FROM node:4.4.7
MAINTAINER Newborns <newborns@versul.com.br>
COPY . /src
EXPOSE 7733
WORKDIR /src
RUN npm install
CMD ["./node_modules/.bin/coffee", "--nodejs", "--max_old_space_size=384", "feeder.coffee"]
CMD ./node_modules/.bin/coffee --nodejs --max_old_space_size=384 feeder.coffee
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 4.2 1.0 960940 85424 ? Ssl 20:21 0:01 node ./node_modules/.bin/coffee feeder.coffee
root 16 0.1 0.0 20220 2884 ? Ss 20:22 0:00 bash
root 20 0.0 0.0 17500 2064 ? R+ 20:22 0:00 ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.1 0.3 707704 25272 ? Ssl 20:17 0:00 node ./node_modules/.bin/coffee --nodejs --max_old_space_size=384 feeder.coffee
root 10 1.7 1.1 965900 90068 ? Sl 20:17 0:01 /usr/local/bin/node --max_old_space_size=384 /src/node_modules/.bin/coffee feeder.coffee
TL;DR Use a Javascript loader file instead of the
coffee executable when you need to use extended
node options to avoid the technicalities of signals with forked processes under Docker.
require('coffee-script').register(); require('./whatever.coffee').run();
Then
node --max_old_space_size=384 app.js
Now, onto the technicalities...
The initial process in a container is PID 1 in the containers namespace. PID 1 (or the init process) is treated as a special case by the kernel with regards to signal handling.
So a docker process is expected to handle signals itself.
--nodejsoption
As you have noted,
coffee will fork a child
node process when it has the
--nodejs option to be able to pass the extra options on.
This initially presents some odd behaviour outside of docker with signal handling (on osx at least). A
SIGINT or
SIGTERM will be forwarded onto the child but also kill the parent
coffee process immediately, no matter how you handle the signal in your code (which is running in the child).
A quick example
process.on 'SIGTERM', -> console.log 'SIGTERM' process.on 'SIGINT', -> console.log 'SIGINT' cb = -> console.log "test" setTimeout cb, 5000
When you run this and ctrl-c, the signal is forwarded on to the child process and handled. The parent process closes immediately though and returns to the shell.
$ coffee --nodejs --max_old_space_size=384 block_signal_coffee.coffee ^C SIGINT $ <5ish second pause> test
Then the child process with your code continues running in the background for 5 seconds and eventually outputs
test.
coffee --nodejs
The main problem is the parent
coffee process does not handle any signals in code, so the signals don't arrive and are not forwarded onto the child. This probably requires a change to coffeescript's launcher code to fix.
The signal quirk
coffee --nodejs presents outside of Docker could also be bad if it happened under Docker. If the main container process (the parent of the fork) exits before your signal handlers have a chance to complete in the child, the container will close around them. This scenario is unlikely to happen if the above problem is fixed by just forwarding signals onto the child.
An alternative to using the suggested javascript loader or fixing coffee scripts loader, would be to use an actual init process, like runit or supervisor but that adds another layer of complexity in between docker and your service.
|
https://codedump.io/share/xrCCPOSxLLT9/1/docker-sigterm-not-being-delivered-to-nodejscoffee-app-when-started-with-flags
|
CC-MAIN-2017-43
|
en
|
refinedweb
|
Red Hat Bugzilla – Bug 91677
Griffin Powermate needs additional info in usb.handmap
Last modified: 2014-03-16 22:36:28 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030508
Description of problem:
The Griffin Powermate needs additional info in /etc/hotplug/usb/handmap to
funtion properly with the standard linux kernel driver as shipped with RH9.
Basically it too (like the wacom devices mentioned in the same file) needs, but
does not depend on the evdev driver.
Adding the following lines to usb.handmap fixes the problem:
evdev 0x0003 0x077d 0x0410 0x0000 0x0000 0x00
0x00 0x00 0x00 0x00 0x00
0x00000000
evdev 0x0003 0x077d 0x04aa 0x0000 0x0000 0x00
0x00 0x00 0x00 0x00 0x00
0x00000000
To test use the tools on:
The following is an example test session for the python script:
python>
import powermate
p = powermate.PowerMate()
.. it will throw an exception if it doesn't find the powermate.
Or even simpler - cat /dev/input/event0 - if it's there then it won't say device
not found.
Ref for Powermate product:
Version-Release number of selected component (if applicable):
2002_04_01-17
How reproducible:
Always
Steps to Reproduce:
1. Try using the example code above or catting /dev/input/event0 when the
powermate is plugged in.
2. /var/log/messages also tells you the device has not been recognised if evdev
is not loaded.
Actual Results: Powermate tools don;t work.
Expected Results: Powermate tools should have worked.
Additional info:
Added in 2004_09_23-1.
Note that this is not used with current hotplug packages, however.
|
https://bugzilla.redhat.com/show_bug.cgi?id=91677
|
CC-MAIN-2017-43
|
en
|
refinedweb
|
See also: IRC log
<scribe> Scribe: EdRice
<Norm> ht, wrt xmlFunctions-34 do you concur that the ball wrt our draft is in your court?
<ht> Yes, sigh.
<ht> Mea culpa
<DanC> I'm OK to scribe 25 Apr
Zakim +1.604.534.aaa is Dave
Dan will scribe next week
no regrets for next week.
Resolution: Minutes approved as-is from last week
meeting in Vancouver, starting on the 4th.
Tim and Noah were concerned about 2-3 day meeting length, but neither are on the call.
<DanC> (I still prefer 2 days)
ht: I can book late flights home.
Norm: I have to leave early, so Friday needs to end early on Friday or I'll have to leave early.
<DanC> (if we go 4-5 Oct, for 2 days, both weekends are safe.)
Ed: how about a two day meeting, we just work late if need be.
<Norm> Working late would be fine by me
Vincent: Lets confirm next week with the people who are not here today.
Vincent: Last week we decided to
use our slot for a pannel discussions.
... Steve was interested in my communication, but Steve declined getting the meeting running and be a moderator.
... So, we're on the agenda with the topics, but we need to find someone else to moderate the session.
... Any suggestions?
Norm: Stuart Williams?
general round of agreement, Vicent will contact to see if he'll be in town.
ht: we could invite Ralph on the pannel as well.
DanC: I havent seen an opinion from Ralph however, he may be a better moderator.
Vincent: ok, I have a few names. I'll contact Mishai, Stewart and Ralph. Otherwise we may need more names so if you think of any please share via email.
<dorchard> Ed, that wasn't I that mentioned Ralph. I think it was Dan.
<Zakim> Norm, you wanted to comment on the June f2f
Noah: I updated the logistics page to include possible hotels.
TV and Tim are invited by Lord Jeffery Inn.
Noah: June 12th I'll provide a
dinner if you can attend.
... I'd suggest making your reservations sooner than later.
<Norm> Tell Norm your flight schedules if your flying into BDL
Vincent: I put this on for TV but he's not on the phone.
V: there are three pending actions, only one can be addressed since TV and Tim are not in.
Vincent: ht can you update us on the draft finding?
<Norm> Norm wrote ->
ht: This is stuck in my in-tray and I've been busy, it will likely be several week.
Vincent: so our actions list remains the same for now.
Vincent: To continue our
discussion from last week.
... we talked about reviewing DIX.
Dan: the context came from Lisa
and she 'may be' an area director, but I havent heard
yet.
... The area director solicits people to do the review, but when you do that review you should get back to the authors of the working groups directly
... not with Lisa.
... The authentication service - I doubt there would be much benefit for us to look into. Not really web architecture stuff per say.
... I'm more interested in DIX.
Ed: DIX is very active.
Dan: There are many documents, there is an update just today.
<DanC> new DIX draft today
Dan: should we create a TAG
issue?
... Passwords in the clear should be a TAG issue.
... The DIX issue could be looked at in many ways.
Vincent: We can make the passwords in the clear an issue at any time. Should we spend more time on the documents in front of us.
Ed: I'll look at DIX.
Vincent: ok, we have one reviewer
for DIX. When you have a better view of the status, please
present your point of view during a teleconferance.
... should we make passwords in the clear a new TAG issue?
... We need people who are committed to making progress on this.
Dan: I dont think a short finding would be worth our time, we need to talk about alternatives etc.
Ed: I can start working on it..
<DanC> (I think it should be a TAG issue; I don't know that I can work on it soon. I think it's fine to have TAG issues sit around, acknowledged but not making lots of progress, for 18 months.)
Vincnet: are there other opionions on creating a TAG issue on passwords in the clear?
Vincent: I hear a few people in
doing so.. any objections?
... does anyone obstain? No one, so we have a concensus to open this as a new issue.
RESOLUTION: We will open a new issue 52
<DanC> clearTextPasswords-52
Proposals for the name?
<DanC> passwordsInTheClear-52
+1 on passwordsInTheClear
<Norm> passwordsInClear-52?
Resolution: passwordsInTheClear-52 will be the issue name.
Vincent: Ed will begin drafting.
Ed: I'll communicate this first to www-tag then start drafting..
<scribe> ACTION: Ed to communicate new issue and produce first draft finding. [recorded in]
<DanC>
Dan: it might be worth noting,
there was a workshop a while ago with a follow-up mailing
list.
... need to explore mailing list in relation to TAG
... we did some work in the f2f in september which may be worth linking to.
Vincent: I'll open the issue on the list.
<scribe> ACTION: Vincent to open the issue on the issues list. [recorded in]
Vincent: Should we close this issue now that we've published the finding? There is no open action on this issue.
Dan: are the specifics of PUT in
the new finding?
... yep.. found it.
<DanC> yes, putMediaType-38 is addressed to my satisfaction
Dan: The procedure is to announce that we have resolved the issue and solicit any feedback?
+1
<Norm> +1
HT: ok
Vincent: I agree as well.
RESOLUTION: We have resolved to close putMediaType-38
Vincent: We have published a
finding in Jan. The only action still on the list is an action
for Tim regarding the policy for creating new namespaces.
... Tim is not here, but I see a new policy is being created.
... Should we wait for this new document to be published before closing this issue.
Dan: I dont remember what we wanted in the new version or not..
Vincent: We wanted the W3C policy to be in alignment with our finding.
Dan: I'm moderatly inclined to
keep Tim's action open
... I know there has been some communication on this.
Vincent: ok, so I agree we need Tim on the call before we can close this issue.
Dan: It would also be nice if we could remember why we asked Tim to make a new version.
Vincent: I'll look at the logs/minutes so we can have a more effective discussion next week.
Vincent: This is something that I dont know about at all. I understand the topic and I see that there is a draft, dated Sept 2004 by Norm. There is not much discussion regarding this.
Norm: in summary;
... The question was: Shouldnt there be a standard way to compare 'chunks' of xml.
... the answer was there is not single right answer to this question...
... Timbl pushed back on that finding and asked if we could document 'a' right answer.
... There were some comments, but I never did incorporate those comments.
... We just turned our attention to other things. I'm not sure what we should do next, I could incorporate those comments into the draft
... But we need to make sure that people understand we're producing 'a' way, and not an approved way.
Dan: Does this draft corespond to xQuery?
Norm: I suspect its reasonable close for two chunks of unvalidated content.
Dan: A really nice appendix or two would be an implementation in xQuery or something.
Norm: If the TAG asks me to revise this, I'd consider doing that.
HT: I'm not sure, this may the
top of a slippery slope
... we have the infosec spec and we have the xpath/xquery data model which either is or isnt counter to the infoset
... until we're prepared to tackle all of that I'm not sure that re-issue that finding with the narrow focus would be good.
... I havent reviewed the finding however.
Norm: no, I'm saying your application may have others that you may want to consider. There is no one right answer, even if there was one universal data model.
ht: well, I guess I need to read the finding.
<Norm> Sorry ht, I wasn't trying to send you off to the finding :-)
Vincent: The issue was raised by Tim so we should probably follow-up with Tim.
<Zakim> DanC, you wanted to suggest 2 options that are OK by me: (a) leave it in the someday pile (b) ask I18N if it's an improvement worth spending effort on
Vincent: ok, I didnt feel it was
urgent, it just hasnt been discussed so I put it on the agenda
to get an update. Its clear there are not clear next steps
right now.
... ok, lets leave it for now.
Norm: I'm happy to either update it or leave it on the to-do-list as a lower priority.
ht: This is proceeding as a matter of priority. The write token is with me, I'm going to spend some time on it shortly and get it back to the group.
Vincent: we talked about this two
weeks ago, but no clear action was recorded on this.
... I'll add an action to HT on this to the issues list.
... anything else?
Vincnet: Meeting is adjourned..
This is scribe.perl Revision: 1.127 of Date: 2005/08/16 15:12:03 Check for newer version at Guessing input format: RRSAgent_Text_Format (score 1.00) Succeeded: s/Dave: I/DanC: I/ Succeeded: s/Vincnet/Vincent/ Found Scribe: EdRice Inferring ScribeNick: EdRice Default Present: Ed_Rice, Vincent, Norm, DanC, Ht, +1.604.534.aaaa, Dave Present: Ed_Rice Vincent Norm DanC Ht +1.604.534.aaaa Dave Regrets: Tim Noah WARNING: No meeting title found! You should specify the meeting title like this: <dbooth> Meeting: Weekly Baking Club Meeting Got date from IRC log name: 18 Apr 2006 Guessing minutes URL: People with action items: ed vincent WARNING: Input appears to use implicit continuation lines. You may need the "-implicitContinuations" option.[End of scribe.perl diagnostic output]
|
http://www.w3.org/2006/04/18-tagmem-minutes
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
public class ConnectionHolder extends ResourceHolderSupport
DataSourceTransactionManagerbinds instances of this class to the thread, for a specific DataSource.
Inherits rollback-only support for nested JDBC transactions and reference count functionality from the base class.
Note: This is an SPI class, not intended to be used by applications.
DataSourceTransactionManager,
DataSourceUtils
getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, requested, reset, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unbound
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final String SAVEPOINT_NAME_PREFIX
public ConnectionHolder(ConnectionHandle connectionHandle)
connectionHandle- the ConnectionHandle to hold
public ConnectionHolder(Connection connection)
SimpleConnectionHandle, assuming that there is no ongoing transaction.
connection- the JDBC Connection to hold
SimpleConnectionHandle,
ConnectionHolder(java.sql.Connection, boolean)
public ConnectionHolder(Connection connection, boolean transactionActive)
SimpleConnectionHandle.
connection- the JDBC Connection to hold
transactionActive- whether the given Connection is involved in an ongoing transaction
SimpleConnectionHandle
public ConnectionHandle getConnectionHandle()
protected boolean hasConnection()
protected void setTransactionActive(boolean transactionActive)
DataSourceTransactionManager
protected boolean isTransactionActive()
protected void setConnection(Connection connection)
null.
Used for releasing the Connection on suspend (with a
null
argument) and setting a fresh Connection on resume.
public Connection getConnection()
This will be the same Connection until
released
gets called on the ConnectionHolder, which will reset the
held Connection, fetching a new Connection on demand.
ConnectionHandle.getConnection(),
released()
public boolean supportsSavepoints() throws SQLException
SQLException- if thrown by the JDBC driver
public Savepoint createSavepoint() throws SQLException
SQLException- if thrown by the JDBC driver
public void released()
This is necessary for ConnectionHandles that expect "Connection borrowing", where each returned Connection is only temporarily leased and needs to be returned once the data operation is done, to make the Connection available for other operations within the same transaction. This is the case with JDO 2.0 DataStoreConnections, for example.
releasedin class
ResourceHolderSupport
DefaultJdoDialect.getJdbcConnection(javax.jdo.PersistenceManager, boolean)
public void clear()
ResourceHolderSupport
clearin class
ResourceHolderSupport
|
http://docs.spring.io/spring/docs/3.2.2.RELEASE/javadoc-api/org/springframework/jdbc/datasource/ConnectionHolder.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
#include <coherence/util/TypedCollections.hpp>
Inherits WrapperCollections::AbstractWrapperListIterator.
List of all members.
The type of the handles returned by this iterator, e.g.
Create a new TypedListIterator over the given ListIterator.
The typed version of the method Iterator::next.
Return the next element in the iteration.
The typed version of the method ListIterator::previous.
Return the previous element in the iteration.
The typed version of the method ListIterator::add.
Insert the specified element immediately before the element to be returned from the next call to the next() method. A subsequent call to next() will not return the added element, while a call to previous() would return the added element.
The typed version of the method ListIterator::set.
Replace the last element returned by next() or previous() with the specified element.
|
http://docs.oracle.com/cd/E24290_01/coh.371/e22845/classcoherence_1_1util_1_1_typed_collections_1_1_typed_list_iterator.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
05 August 2010 14:43 [Source: ICIS news]
SINGAPORE (ICIS)--Rabigh Refining and Petrochemical Co (Petro Rabigh) has shut down its polypropylene (PP) plant in ?xml:namespace>
“The company’s propylene stocks are sharply down following an outage early this week at its fluid catalytic cracker (FCC),” said one of the sources.
The FCC unit provides propylene to Petro Rabigh’s 700,000 tonne/year PP plant. The company’s total installed propylene capacity is 900,000 tonnes/year.
The PP plant’s unplanned shutdown has tightened the supply of PP in the
“Supply of PP is quite restricted at the moment, and prices are climbing up this week,” said a Dubai-based trader.
Offers for raffia-grade PP into the Gulf Cooperation Council (GCC) region have surged by $50-100/tonne (€38-76/tonne) from a week ago to $1,250-1300/tonne CFR (cost and freight), the trader said.
Most business for August, however, was already concluded last week at $1,200-1,230/tonne CFR GCC.
Petro Rabigh, a joint venture between state-owned Saudi Aramco and
In addition to the propylene and PP facilities, Petro Rabigh’s complex houses a 1.3m tonne/year ethane cracker, a 300,000 tonne/year high density polyethylene (HDPE) line, a 600,000 tonne/year linear low density polyethylene (LLDPE) line and a 700,000 tonne/year monoethylene glycol (MEG) plant.
($1 = €0.76)
For more on prop
|
http://www.icis.com/Articles/2010/08/05/9382662/petro-rabigh-shuts-polypropylene-plant-on-propylene-shortage.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
Painless AOP with Groovy
Cedric Beust described Aspect Oriented Programming (AOP) as "a great idea that will remain the privilege of a few expert developers". For some, even with Spring and JBoss, the barriers to entry remain too high. Fortunately, this is an area where the dynamic languages may be able to help out. They can provide either a gentle nursery slope for experimentation and learning, prior to the red runs of AspectJ, or a highly productive work environment in their own right. Java developers need not even stray far from home. Groovy, a JVM dynamic language with a Java-like syntax, sports impressively powerful features that make mimicking AOP a breeze. Although we will focus on Groovy in this article, the zeitgeist demands a comparison with the much loved and feared Ruby. Rubyists can also get 80% of the functionality with 20% of the effort.
AOP allows us to modularise code that may otherwise remain entangled across a number of methods and classes. For example, we may find ourselves doing the same security check around a number of different units of work, instantiating some variables before other units and logging some information after yet others have completed or thrown an exception. AOP allows us to write all this functionality once and have it applied to our methods at the appropriate point (before, after, around or when an exception is thrown), where once we may have violated the DRY principle and written it multiple times. Typically, in Java, we would use one of two mechanisms. Either we would use a framework to modify the byte-code of our own classes to directly insert this functionality, or we would dynamically create a proxy for our own classes (either using JDK Dynamic Proxies or CGlib). In Groovy, as we shall see, we need neither technique.
MOPs : not just for cleaning!
Groovy's Metaobject-Protocol is a mechanism by which application developers can modify the implementation and behaviour of their language. Groovy's MOP is particularly powerful. The result of judicious design, all dynamic method calls get routed through invokeMethod and property access through getProperty and setProperty. Thus, we have a single point of contact for modifying the core behaviour of the Objects we create. By overriding invokeMethod, getProperty and setProperty we can intercept every single call to our Objects without the need for a proxy or byte-code manipulation.
Free the functions!
"Would you be willing to trade all the days from this day to that for one chance, just one chance, to come back here and tell our enemies that they may take our lives, but they'll never take our freedom." - Mel Gibson rouses the Scots in Braveheart
Language aficionado Steve Yegge, humourously labelled Java the "Kingdom of the Nouns", a land where functions are enslaved and may only travel attached to a noun. Groovy frees functions from the tyranny of Object bound slavery. A Groovy Closure is an anonymous function that can access its enclosing scope, can be called repeatedly at will, and be passed around as it were data. Syntactically closures are defined in what look like Java code blocks. The example below prints out "hello world from Groovy!".
String printMe = "hello world"
def c = { parameter | println(printMe + parameter} }
c(" from Groovy!")
The ability to create such lightweight functions combined with the power of the Groovy MOP will enable us to implement some AOP-style magic with very little code.
Before we start
If you want to follow the examples below, you'll need to follow these steps:
- Download Groovy :
Groovy can be downloaded from the Groovy homesite
- Follow the installation instructions on the Groovy installation page
- Optionally, download and install the Groovy Eclipse Plugin. The update site for the plugin is. There is a Wiki site with some additional information here. The Groovy Eclipse plugin is still pre-release, but, with a bit of tinkering, I find it works well. You may need to take into account the following :-
Setup your step filters : In preferences/java/debug/stepfiltering, turn on step filtering for the following classes:-
Groovy does a lot of work under the covers and this prevents the Eclipse plugin taking you through the Groovy infrastructure as you execute your code.
- You step into Closures rather than over them
- You can't currently use debug as/groovy directly, instead you must create a new Debug Application configuration. The steps are defined in the wiki.
- In order to get the plugin to find your source you may find that you have to give Eclipse a few additional clues. A work around is to make a copy of your classes directory and add it as the last class folder. Then in project/properties/libraries you can attach your source folder to your dummy class folder.
Iteration 1: Let's get started
AOP allows us to execute an arbitrary function when a specified method is called. When we do this, we are said to be applying "advice". Before and after advice types are particularly easy to implement in Groovy.
Define the infrastructure
First, let's write a Groovy class that can hold the details of a method call that has just been intercepted. We will pass this Object to all our advice implementations as a parameter. This will allow them to "understand" their context, to access and even modify properties on the target Object and the incoming parameters.
N.B. The keyword "def", used here as an instance variable modifier, indicates that the variables are properties. Groovy will add standard JavaBean Getters and Setters for us. Also note that this class extends Expando, as this will be important later.
We can define a class that overrides invokeMethod and inserts optional calls to our before and after advice types. To leverage AOP-like functionality, we need only inherit from this Class. In order to force Groovy to call invokeMethod for each method call to our class we need to implement the marker interface GroovyInterceptable.
In this class the keyword def is being used as a local variable modifier. This indicates that the variable is dynamically typed. We also take advantage of Groovy's convenient parameter naming support to instantiate our AopDetails Object.
This principle can be extended to property access, but, for clarity, I shall leave the implementation of this to your imagination.
We've defined all the necessary infrastructure to get started, so let's demonstrate some AOP in action with an example.
An example in action
We need a main method to apply advice to our Example class, and print out some helpful status messages.
If you are following along with the Groovy Eclipse plugin, you can a breakpoint at the start of the main method and step through the code. We can execute Runner.groovy by right clicking on the file and selecting run-as -> groovy from the popup menu, to debug follow the steps above & in the wiki.The output from executing Runner.groovy is as follows
Calling print message with no AOP :-
Calling print message with AOP before advice to set message :-
hello world
Calling print message with AOP after advice to output status :-
hello world
Status:message displayed
Calling print message via invokeMethod on a Statically defined Object :-
hello world via invokeMethod
Initially, we call printMessage with a Map that contains an empty String under the key "message". However, prior to the next call to printMessage we declare some before advice to be applied to printMessage that changes the message to "hello world". Next, we apply some after advice to output a status message. We can set a breakpoint in invokeMethod to see clearly see what is happening.
"invokeMethod" checks for a Closure to execute with the current method name in the before and after maps. If it finds one - it executes it at the appropriate point.
This trivial example demonstrates principles that can be readily applied to more complex, real world situations.
Iteration 2: Around we go
So far, so straight forward. For the next iteration we'll add in some around advice. Around advice is a more powerful advice type, in that it can modify the flow of the application - it has the power to decide whether or not our target method even get's executed. As such, it is an excellent place to implement security features.
Define the infrastructure
We need to modify our infrastructure to cope with the new Advice type. We don't need to change AopDetails. When designing AopDetails we used Expando as the base class. Expando is a special Groovy Object that leverages similar MOP trickery to provide an expandable Object. We need to add a proceed() method to AopDetails so that our Around advice can call the target method, with Expando, this is no problem. Let's take a look at our new AopObject:
We've added a map to hold our around advice Closures. The continueWith Closure calls the target method, and we temporarily add it to our AopDetails Object as the proceed method. If a suitable around advice exists we call it, otherwise we continue directly to our target method.
Another example in action
Let's make our example a little more real world this time. We will attempt to simulate a web controller.
Our web controller implements a "save" method, and we've mocked up a model Object using powerful Groovy features (Expando and Closures). We've added two functions to our model - params, which loads parameters from the request and save which "saves" the model. As the save action may be performing a sensitive update, it might be a good idea to introduce some security features around it.
The Runner class mocks up Request and Session Objects using Maps. We initially call save on the controller without any security features, but for the subsequent call we insert some around advice that checks the user id stored in the session. Finally, we demonstrate that if the user id is correct the original method can indeed proceed. The output is as follows: -
Attempting initial save : no AOP security:-
Saved model 10 successfully
Attempting save with AOP security & incorrect id:-
Sorry you do not have permission to save this model (10)
Attempting save with AOP security & correct id:-
Saved model 10 successfully
The screenshot shows the debugger at a breakpoint inside the around security Closure in Runner.groovy.
Iteration 3: Reusable methods
With Closures we can define methods independently from Classes. With the MOP, as we have seen with Expando, we can insert those free methods into multiple classes. Heck, we can even inject different methods into different Objects of the same class. This level of modularity is much more fine-grained than standard Java allows. Most of us Java developers are used to injecting services via Object Interface implementations, and we typically use a lot of XML to achieve this!
Define the infrastructure
We can expand our AOP-like infrastructure classes to allow the insertion and deletion of methods from our Objects. We need two new Classes at either end of the inheritance hierarchy to do this. AopIntroductions, which allows us to introduce new methods to our Objects, becomes our base class (AopObject should now extend AopIntroductions). AopRemovals, which prevents calls to specified methods from being executed, is the new top-level class.
Let the games begin!
Now we can have some real fun! We are able to leverage instance methods as reusable components. We can define generic methods in one place and mix them into our Objects across multiple Class types while limiting access to sensitive methods on a per Object basis.
Let's refactor our controller from the previous example by removing the save method. We'll create a CrudOperations class that will be a holder class for crud methods. We'll then inject the methods from our CrudOperations class into our web controller.
Notice the call to the constructor of CrudOperationsMixin, this is where the magic happens!
In the class above we have defined a Map of method references. We're injecting each of those references by their key into the host Object (our web controller).
The beauty is we can still apply around, before and after advice types to our newly added methods! Runner.groovy from the previous example can run as is. However, we'll add another twist by disabling the save method at runtime in a new Class.
Groovy supports operator overloading and the List class uses the left shift operator ("<<") to append new Objects to the List.
The output from running Runner.groovy is as follows:
Attempting initial save : no AOP security:-
save operation
Saved model 10 successfully
Attempting save with AOP security & incorrect id:-
Sorry you do not have permission to save this model (10)
Attempting save with AOP security & correct id:-
save operation
Saved model 10 successfully
Attempting save with save method removed (perhaps for security reasons):-
Caught NoSuchMethodException
In the debugger screenshot below I've highlighted the StackTrace that shows the path from our web controller, where the call to save was made, to our mixins class where the save method actually resides.
From Groovy to Ruby : Alternatives for train drivers
If Groovy isn't to your taste, we could re-implement the above examples in the dynamic language of your choice. For example in Ruby we could override the method_added hook rather than invokeMethod. "method_added" is called when a new method is added to an class. As the methods are added to our Object we can proxy them swapping them out for an implementation that inserts before, after, around advice via alias_method. Even Javascript, once the bane of every web developer's life, has powerful idioms allowing AOP to be implemented easily. There's even a framework for it - AspectJs!
Summary
Dynamic languages like Groovy make implementing custom-AOP infrastructure painless. There is no requirement for byte-code modification, and the infrastructure code base can be kept small so as to be readily understandable by new developers. Groovy's MetaObject-Protocol allows us to mould our Object's behavoiur to suit the problem at hand and first class functions and dynamic typing makes dynamically inserting functionality relatively easy. The examples described here are the first step on the journey towards full AOP functionality. Still left to implement are exception advice, support for the application of multiple advices per method (including advice chaining for arounds) and centralised support for applying Aspects to your Objects. But I hope that I've demonstrated that we can get very far, with relatively little effort, thanks to the power of the Groovy language.
Resources
- Get the code used in this article
- Get Groovy
- The Groovy Eclipse Plugin
- An introduction to AOP in Java
- An introduction to Groovy (quite old)
- Closures in Groovy
- More on Groovy's MOP
- Nothing new under the sun, :around, :before and :after in CLOS 1988.
About the author
John McClean is a software developer living in Dublin, Ireland, where he works for AOL Technologies, Ireland. In his spare time, he develops the Slingshot Application Framework a highly productive environment for developing web-based applications. John maintains a blog where he jots down his thoughts on technical topics of interest.
Nice Article
by
John Wilson
Perhaps you might conside a part 2?
John Wilson
Documentation
by
Horia Muntean
Re: Documentation
by
John Wilson
Re: Nice Article
by
Jeff Payne
Re: Nice Article
by
John McClean
Re: Nice Article
by
Martin Gilday
Re: Nice Article
by
Matthias K.
However, has anyone actually tried to run this code? For me it continually recurses into invokeMethod(), resulting in a stack overflow... duh!
Apart from that, there are some things odd or unclear about the code. Why does AopObject inherit from GroovyObjectSupport? It's a Groovy class, thus it already inherits invokeMethod() naturally. GroovyObjectSupport, according to the documentation, is only meaningful when programming in Java.
The proceed field furthermore is assigned a superfluous closure. You can simply assign continueWith to proceed:
callDetails.proceed = continueWith
That's the idea behind closures... they're addressable pieces of code and can be passed around.
Any help appreciated on that recursion problem though... don't know why a call to super.invokeMethod invokes the same overridden method again.
Re: Nice Article
by
John McClean
The Groovy internals changed significantly in the two years between the original article and your comment, I imagine that is the cause of the infinite recursion.
It's much simpler to do the same thing with Metaclasses these days.
Re: Nice Article
by
Chris Mead
I fixed a couple issues. I am not sure if I am 100% correct as I am only using before and after for now.
1) Add "def proceed" to AopDetails
2) Make sure that your AopObject matches what is onscreen here. I had to remove a method called callInvokeSuper() and simply use "super.invokeMethod(name,args)" instead (which is what is in the screenshot.)
Good luck.
|
http://www.infoq.com/articles/aop-with-groovy/
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
Periodically we get questions about how to extract and use an image compiled as an embedded resource in an assembly. It’s easily done using the Bitmap or Icon constructor that takes a type and string parameters.
The documentation for these constructors describes how they work, but I’ll summarize here. The string parameter is the image name, and the type parameter is used to retrieve the namespace for the resource and construct the long name for it. For example, say you want to leverage the Windows Forms button icon. You need to pass in a type in the System.Windows.Forms namespace (the example in the documentation uses the Button type but you could use any type in this namespace; DataGridView, for example) and the name of the image, in this case "Button.bmp". The constructor combines the namespace of the type and resource name to find the resource in the assembly manifest. For this example, it would search for a resource with a long name of "System.Windows.Forms.Button.bmp". The method call looks like this:
C#:
Bitmap myBitmap = new Bitmap (typeof (DataGridView), “Button.bmp”);
Visual Basic:
myBitmap as new Bitmap (GetType (DataGridView), “Button.bmp”)
On a related note, a useful addition to the Icon class in the .NET Framework version 2.0 is the ExtractAssociatedIcon method. As its name indicates, this static method allows you to extract the icon associated with a file or application. The example in the documentation shows how to extract the icon associated with an application, but you can extract the icon associated with any type of file. The method call is very straightforward; the string parameter is the path to the file and the method returns an icon. The following example sets the form’s icon to the icon for Microsoft Word:
C#
this.Icon = Icon.ExtractAssociatedIcon(@"c:\myResume.doc");
Me.Icon = Icon.ExtractAssociatedIcon("c:\myResume.doc")
|
http://blogs.msdn.com/b/winformsue/archive/2006/11/29/using-images-embedded-as-resources.aspx
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
C-Span Posts Full Archives Online 115."
Not for Long (Score:2)
I predict this goes away pretty quickly- as in a unanimous resolution to cut the project's funding.
Re:Not for Long (Score:5, Informative)
Re:Not for Long (Score:5, Insightful)
C-SPAN is a private non-profit and receives no government funding.
True enough, but that's not really the whole story. I'll quote Wikepedia's summary:
Put crudely, everyone with a cable-TV feed is paying for it. But wait, there's more
..
I doubt anyone would quibble with the above. I sleep comfortably knowing that consumers of (mostly) mindless entertainment along with viewers of CNN, MSNBC, and Fox News all help pay for what's routinely offered on C-SPAN..
Re:Not for Long (Score:5, Informative)
CSPAN isn't always boring. Sometimes authors speak very compellingly about their books. When they've got a good author and a good topic, CSPAN is easily the best thing on the tube.
Re: (Score:2)
I, for one, would certainly agree with you. But the people GP is talking about would find shows like Book TV to be as dull as watching paint dry. Shows like that require that you pay attention and use your brain. And there are no loud explosions.
Re:Not for Long (Score.
I sometimes listen to House/Senate debates on C-Span in the car and when you compare news articles to the actual debate, it's amazing how much nuance journalists throw away.
Our Representatives usually have a very good grasp of the issues, but this fact is rarely carried through into the reporting which follows.
Re:Not for Long (Score:5, Funny)
I think I'm going to go lie down now.
Re:Not for Long (Score.
Not to mention that much of what Congress does is mind-numbingly stupid in its procedural complexity and various random tactics that are commonly used all the time to slow down what's going on even further (and thus make it even more boring).
Back when I was in high school, I'd sometimes turn on C-SPAN when I came home after school after a hard day and needed a nap. It provided useful "white noise."
What I quickly learned was that aside from days when debates were happening on major issues, most of C-SPAN when Congress was in session consisted of Congressmen speaking on obscure resolutions like honoring some random person, or (better yet) delay tactics like quorum calls, invoking procedural idiocies that bog down debate in parliamentary matters, etc.
It's ironic that the service that brought Congress to the public on video resulted in Congressmen themselves hanging out in their offices rather than the chamber, thus creating not only the news soundbite (nobody's usually there listening anyway, so everybody's trying to score a place on the evening news on camera), but also the creation of novel ways of slowing down business. I can remember entire afternoons consisting of quorum calls, where everyone would file into the chamber for attendance purposes that would waste a half hour, file out, and then someone else would "note the absence of a quorum," and the whole process would start all over again.
Your tax dollars at work....
Re: (Score:1)
I sleep comfortably watching C-SPAN.
Re: (Score:2)
Re: (Score:2, Informative)
If you can find anything (Score:5, Insightful)
The video is only as good as the meta data associated with it.
Re: (Score:3, Interesting)
If only 22,776 people sit down and review 10 hours of video each, we can have the entire 26-year span (assuming 24/7 of that 26-year span has video to bother with) done in 10 hours.
It's not as bad as you think.
Re:If you can find anything (Score:5, Funny)
Re: (Score:2)
I have. I think that's what is wrong with me
:P
Re: (Score:2)
The first time I read the headline I did parse it as CPAN and wondered what "footage" had to do with Perl.
Re: (Score:3, Informative)
Why do any work at all? The closed captioning data is all there, and is searchable. Plus if you click the transcript, it takes you to that part of the video.
Re:If you can find anythingWikipedia (Score:3, Interesting)
Re: (Score:2)
Well, they should simply offer tagging. Let them tag positions in the time line with keywords, and anchors to whole URLs. In both directions.
Then everyone watching only a short segment, automatically can become a meta data generator, and if he does it well, others don’t have to watch it again, to find interesting stuff.
Re: (Score:2)
Remember, C-Span is funded entirely by the cable industry.
That's why.
Re: (Score:2)
Are you using Google China by any chance?
Too bad... (Score:5, Insightful)
Re: (Score:3, Insightful)
Well, like most bad legislation, most of the dealing was behind closed doors.
Re: (Score:2)
I hate to break this to you, but most good legislation is dealt behind closed doors, too. Unless you're one of those that believe that there's no such thing as "good legislation".
Re: (Score:1)
No. I'm one of those who believe we should kick down the doors... just as soon as the commercial comes on.
Re:Too bad... (Score:5, Informative)
The doors may be closed (actually, they rarely are), but the cameras are still rolling inside.
Senate committee hearings are streamed live on their respective websites, and are archived shortly thereafter. If you need something that predates the Senate's streaming media operation, the Library of Congress or the National Archives can help you. Because there can be over a dozen hearings going on simultaneously (sometimes while the Senate floor is also in session), most of these do not make it to C-SPAN, although they are indeed available to anybody with the patience to watch them.
If something seems egregiously absent, send a FOIA request.
(Disclaimer: I work for the Senate Recording Studio who are responsible for the production of any TV or Radio broadcasts/recordings that take place in the Senate)
Re: (Score:2)
>>The doors may be closed (actually, they rarely are), but the cameras are still rolling inside.
Interesting.
Out of curiosity, then what's the point of a closed door session if everyone can just watch the streaming video live? (Or after it gets archived, I guess.)
Re: (Score:2)
There are two types of 'closed door' sessions. The first is like the one GP described. The public is not invited in, but the session is still recorded, and those recordings and transcripts are made available to the public. The purpose of these sessions is to allow representatives to discuss issues without having anyone try to play to a visible peanut gallery.
The second type of closed door session is where issues of National Security are discussed. As far as I know, these sessions take place in secure ro
Re: (Score:1)
Senate committee hearings are streamed live on their respective websites, and are archived shortly thereafter.
That's very good to hear and is perfectly sufficient. You don't need a bunch a screaming going on in the background. Just want access to proceedings. If it was up to me I'd also setup cameras in the hallways. There's no small amount of wheeling and dealing going on there too. Giving up their privacy is the price they should have to pay for their authority. I think that's a fair deal.
Re: (Score:2)
This will help with health care. No one will ever need to by sleeping pills again.
Right on! (Score:1)
Like most of the national parks. . . (Score:5, Insightful)
I'm glad this exists but will probably never visit it.
Close captioned? (Score:5, Insightful)
Close captioning textfiles of every video might be more useful. Much easier to sift through data and refine your searches that way. The full record of CC files in
.txt format can't run more than a gigabyte. Anybody got a link to that .torrent?
Re: (Score:3, Informative) [c-spanvideo.org]
Re: (Score:2)
Can someone run a script to rip the transcripts to a series of text files, with a file name, URL, original record date and misc info in the "header"? I'd be happy to seed that torrent. Comon' Slashdot, we can do this!
Re: (Score:1, Informative)
You forgot the quotes "series of tubes" brings this [c-spanvideo.org] up.
Re: (Score:2)
The problem with this strategy is that captions often have typos, and are not properly annotated. As such, they are not considered part of the official congressional record. (Live TV captioners have a tough job. I don't envy them one bit, especially since Senators have been known to mumble from time to time.)
Fortunately, we have official congressional records. They've been available online [loc.gov] (and in libraries) for about as long as we've had libraries or internets, and contain this wonderful information an
Re: (Score:2)
That looks like the actual bill text, I'm looking for the transcription of what was actually said on the house/senate floor. The procedural dialog, debates on bills, and speeches would be very interesting to have on tap and data mine.
Someone already found the transcripts on the cspan website and emailed me directly about it. Maybe someone else can jump in here too and we can scrape the site.
How do i write a wget script that access. [c-spanvideo.org]
Re: (Score:2)
import sys
import urllib2
try:
first, last = [int(x) for x in sys.argv[1:3]]
except:
print 'usage: %s [first#] [last#]'
sys.exit(1)
url = ''
headers = {'User-Agent':'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'}
print first
print last
for i in range(first, last + 1):
print 'Fetching %06i' % i
data = urllib2.urlopen(urllib2.Request(url % i,None,heade
Re: (Score:2)
Re: (Score:1)
Thanks!
Re: (Score:1)
Re: (Score:2)
Some sort of forum system with separate threads (separate from the main page discussion) might be warranted, if that's what you're getting at. The journal system isn't really cutting it.
Re: (Score:1)
I used to work there back in the early 90s when it was still the Public Affairs Video Archives. Not long before I left, I wrote software to parse closed-captioning and generate metadata for the program. It would collect things like what part of the session congress was in, the topics being discussed, who was talking, vote outcomes, etc.
The biggest problem by far was there because it is a live program, there were a lot of misspellings that had to be accounted for, as the people doing the closed captions di
Re: (Score:2)
Any good search terms worth checking out? The "transcripts" available on cspan's site currently is only the first 100 chars or so, but it would appear the entire CC data does exist... In regards to the accuracy, a quick google yields all sorts of complaints about the quality of the CC transcription... better to have something than nothing i suppose. Do you know who I could contact at CSPAN that might actually listen to/execute my request? We're doing a scrape now (Stay tuned) but like I said, it's only the
Re: (Score:2)
Well good luck with that and president President Dwayne Elizondo Mountain Dew Herbert Camacho’s predecessor, who only used grunting, obscene hand gestures, shooting guns while dancing, and a rare expletive in his speeches...
Nothing sacred (Score:1)
Someone above me mentioned Metadata - the Closed caption data is already included in a search-able form, this we don't need to regenerate the metadata.
Also now I can direct link to Obama saying "It helps in Ohio that we got Democrats in charge of the machines" (relating to the election infrastructure). [c-spanvideo.org] (34:31)
Re: (Score:2, Informative)
He then goes on to talk about how corruption is a problem for both parties, it is pretty obvious that the bit you are pointing out is him sniping at Republicans, not him talking about how it's a good thing the corruption in Ohio favors Democrats.
Re: (Score:2)
It's not all boring. Watch Michele Bachmann's floor speeches and count the times her eyes spin around in her head like pinwheels.
Time to add the Lie detector to the Ticker line... (Score:1)
Time to add the Lie detector to the Ticker line...Every time someone lies on Cspan. whoop whoop whoop!
Re:Time to add the Lie detector to the Ticker line (Score:3, Interesting)
Time to add the Lie detector to the Ticker line...Every time someone lies on Cspan. whoop whoop whoop!
Reminds me of a federal election debate here in
.au when the TV network gave each studio audience member a control box so they could indicate "like" or "don't like" for what they were hearing. The composite output was a line on the screen which quickly became called "the worm".
Politicians hated it of course.
Re:Time to add the Lie detector to the Ticker line (Score:4, Funny)
Oblig. Onion [theonion.com]
Re: (Score:2)
Re: (Score:1)
CNN does that for state of the union speeches in the US
no. 1 candidate... (Score:2)
Playback in the House and Senate (Score:2)
Now all we need is a large screen in the House and Senate and allow anyone to call up the video from the past.
Congress person A: "Well I never said that we should cut funding to orphans."
Congress person B: "Let's go to the play back. On June 28th at 10:45 am you gave a speech on the floor, let's listen in,'We should cut funding to orphans.' Sounds to me like now you are lying."
I would watch CSPAN 24-7 just to see both sides tripped up by their own words.
Re: (Score:2)
The Congressional Record is available and easily searchable, which would permit you to do the same thing, although I suppose it's a bit less dramatic.
Now if they'll just fix their web interface ... (Score:3, Insightful)
... so it works with Firefox and Noscript...
(I had finally unscrewed their previous AJAX-or-whatever abortion sufficiently to be able to watch their live feed channels - with manual poking EVERY TIME. But I'd given up on figuring out their interface to their earlier, partial, library offerings.)
Just tried this stupid thing: With only c-spanvideo.org enabled it showed me a static image with no controls. Adding netsuite.com made it hang my browser at 98% CPU. Had to kill it and restart.
Don't they have any competent web designers that actually TEST their product with non-IE browsers?
Re: (Score:3, Insightful)
Javascript isn't the "abortion" it used to be, it's critical in many sites, especially with dynamic content. If you want to block a significant portion of web content, that's your choice, but don't complain when things don't work because you refuse to allow your browser to use the required Javascript libraries.
Re: (Score:2)
Yo, Dude!
I TURNED IT BACK ON.
It STILL didn't work.
Re: (Score:1, Troll)
Try accessing a site with half a browser, get half a site. Guess what, flickr is useless when you disable images too.
Goody! (Score:3, Interesting)
I'm totally going to watch the Iran Contra hearings. Inouwe chewing out North FTW.
Re:Goody! (Score:5, Insightful)
You've got to watch Ollie North's jaw muscles working. You know he's thinking about jumping over the table and snapping Inouwe's neck like a twig. He's trying to decide whether or not his patron Ronald Reagan would have pulled strings to get him pardoned for the attack or not. Considering the blanket pardons that went down later, I'm guessing that Reagan/Bush would have indeed pardoned North if he'd attacked.
The amazing thing about that moment in history is that Oliver North and Ronald Reagan actually believed they were doing God's will by selling arms to the guys in Iran who are now our "sworn enemies" and the "Axis of Evil".). You just watch, by 2012, people will believe that Barack Obama was president on 9/11.
Re:Goody! (Score:5, Insightful)
The amazing thing about that moment in history is that Oliver North and Ronald Reagan actually believed they were doing God's will by selling arms to the guys in Iran who are now our "sworn enemies" and the "Axis of Evil".
Now? The thing that was so scandalous was they were our sworn enemies even then! At least with the Afghan "freedom fighters" that Reagan also armed, we can say that he didn't know then that they would become our great enemy. But with Iran the Reaganites knew exactly who they were dealing with.
Re: (Score:3, Informative)
It is even crazier if you throw in the idea that the 1981 release of hostages was manipulated to get Reagan elected. But this is a suspect theory: [wikipedia.org]
Re: (Score:2)
Well, it's a "suspect" theory until you start to read about Michael Ledeen and his cake in the shape of a key and bible and realize that we were ruled by people who were nuttier than fruitcakes.
And, they were only the farm team for what later became the administration of George W. Bush.
I'm pissed at Pres Obama for a lot of things, but the biggest is that he's letting Bush/Cheney/Rice off the hook for war crimes. I'm angry that GWBush can sit in leisure and grow old gracefully after the things that were don
Re: (Score:3, Insightful)
Better yet, perhaps I should just listen to Anonymous cowards on slashdot.
Other Republicans are saying that too (Score:1)).
She's not the only one saying that. Rudy Giuliani said [huffingtonpost.com] "We had no domestic attacks under Bush; we've had one under Obama."
Mary Matalin said [huffingtonpost.com] that the 9/11 attacks were "inherited" from Clinton.
Re: (Score:2)
There was one terror attack. The following attacks on Afghanistan and Iraq killed more people than that in a month (or even less), AND did NOTHING against it. (As the “terrorists” were in Pakistan and Saudi Arabian states, who are our “friends”).
Oh, and another bit of interesting history: Who supplied the Afghanis with weapons, while the Russians attacked?
Exactly. The US. (Which made the war not cold at all. Just fought with the lives of non-Americans.) I know first-hand.
Re: (Score:2)
That's right, just one if you don't count the anthrax and the DC snipers.
The problem is that Bush gets to take a mulligan for 9/11. That's right, for him that was just a breakfast ball and because it didn't happen again it's not counted against his permanent record. After all, who knew that muslim extremists wanted to destroy the WTC, right?
Re: (Score:3, Insightful)
Unfortunately that's just before the time period released, so that material isn't up yet, but apparently it will be soon -- yes, I read the FA: the meantime, check out the film Coverup [imdb.com], which covers the scandal and has some great scenes from those hearings, including that particular exchange (among others) with Oliver North.
Re: (Score:2)
Amazing Achievement (Score:5, Insightful)
Consider the amount of processing power it took to compress 160,000 hours of video fully indexed and ready for viewing.
Incredible for a non-profit.
Re: (Score:2)
Cheers to you CSPAN, and cheers to everyone else who now has 23 years of non-stop drinking game material!
Just what I've always wanted ... (Score:2)
Comedy goldmine (Score:2)
CPAN (Score:2)
I sense a great disturbance in the Force (Score:2)
As if a million policy wonks creamed their pants simultaneously....
911 Footage is eerie (Score:2)
REMIX (Score:2)
This is an incredible boon for remix video artists who work in political matters. EBN [wikipedia.org] was doing some great work like this in the early 1990s, using just VHS tapes and their own jury-rigged controllers; imagine what they could do now with a library like this at their fingertips and digital video editing technology.
Too Bad No Creative Commons (Score:2)
If those videos could be downloadable for free (instead of for $30.00), I could make some wonderful mash-ups.
Re:Too Bad No Creative Commons (Score:5, Informative)
It's nice to see copyright law working correctly for once.
Re: (Score:2)
Re: (Score:2)
Will the good people at Public.Resource.Org do the ripping & close-captioning for us, perhaps?
Re: (Score:2)
Thanks so much!
Richard Nixon tapes yet? (Score:2)
Are the Richard Nixon tapes online yet? Last I bothered, they were $6 per audio cassette. C-Span Radio would play them every week as they were released several years ago. It was my yard work companion for two years.
All of their archives? (Score:1)
Just me? (Score:4, Insightful)
What does "liberal" have to do with this story? Couldn't simply a news anchor say the same thing? Or does referring to CPAN and Google in a sentence make you a liberal?
In related news... (Score:2)
... C-SPAN is awarded a patent for it insomnia cure.
First clip I searched for (Score:2)
Re:first post (Score:5, Funny)
Point of Order!
Re: (Score:2)
"Point of Order!" is old school Phoenix Wright.
"OBJECTION!"
Re: (Score:2)
Over ruled!
Re: (Score:1)
Re: (Score:1, Informative)
Re: (Score:2)
Bless you for that link. Oh, thank you.
|
http://news.slashdot.org/story/10/03/16/2029242/c-span-posts-full-archives-online
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
HTML Export
The are many ways of writing HTML and it is impossible to please everyone. The exporter has been extensively rewritten several times in order to provide HTML code as clean as possible and there are a number of options, described below, controlling document export.
In addition to the XHTML exporter there is a `Multipart HTML' exporter which converts the XHTML output (possibly consisting of several files, i.e., images, style sheet) into a single MIME-encoded file (traditionally with the extension .mht). Some web browsers save web pages in this format.
Contents
Options
- Export as HTML 4.01
- Export with PHP instructions
- Declare as XML
- Allow extra markup in AWML namespace
- Embed (CSS) style sheet
- Embed images in URLs (Base64-encoded)
Export as HTML 4.01
AbiWord's HTML exporter has always given the user a choice between HTML and XHTML, the latter being XML and thus easier to handle (and ideally to re-import, although this has been an elusive goal). Some people still prefer the traditional HTML, since some browsers don't understand that XHTML is HTML and not just XML (which can almost anything), but increasingly XHTML is preferred and best-understood.
If exporting as HTML then the document will not be declared as XML and markup in the AWML namespace will not be possible, since these options are specific to XHTML.
Export with PHP instructions
This option is seldom (if ever) used but may be of interest. Many websites these days use PHP to give webpages a `corporate look and feel' or to provide a dynamic element to layout. HTML documents have simple <?php (or the older <? ) instructions embedded at the top and bottom and these replace all the site-specific markup. (Often the resulting document is barely recognisable as HTML!)
If this option is selected then AbiWord inserts <?php include ... statements in the head and at the beginning and end of the body of the HTML document. NOTE: Since some versions of PHP get confused by other processing instructions, such as <?xml , it may be necessary to uncheck the `Declare as XML' option.
Unfortunately this is not very customisable and AbiWord's new XHTML template system, available only through command-line conversion of documents to XHTML, can be used to much greater effect.
Declare as XML
XML documents, including XHTML ones, normally start with a line declaring them to be XML. This line is something like:
<?xml version="1.0"?>
Some (old) web browsers see this and get confused, and some versions of PHP also get confused because <? used to be regarded as a PHP insertion point.
If saving as HTML then this option is irrelevant; if as XHTML then uncheck this option to suppress the declaration.
Allow extra markup in AWML namespace
This option is specific to XHTML since it uses XML namespaces to add extra information to the HTML document. However, this is not correctly functional at the moment and its use is not recommended.
Embed (CSS) style sheet
AbiWord generates a lot of style-sheet information related to document styles and this can be embedded within the HTML document in a <style><!-- --></style> section or saved to an external style sheet (filename.html_files/style.css). The former is generally more useful; if an external style sheet is used on the website then it may be best to use the PHP option or, if converting from the command line, an XHTML template.
Embed images in URLs (Base64-encoded)
Images in the AbiWord document are normally saved in a subdirectory (filename.html_files/) and referenced by hyperlink (<img src="filename.html_files/ ... ) but there is a mechanism for saving images within the HTML file itself (although this is generally frowned upon).
Templates & Command-Line Conversion
AbiWord-2.0 has a (still experimental) XHTML template mechanism that can be used when using AbiWord as a command-line tool to convert documents to HTML.
The simplest way to convert a file to HTML using AbiWord, on Unix systems at least, is:
AbiWord --to=html file.abw
which will import file.abw and export as HTML to file.html using default options.
It is possible, however, to specify export options on the command line using --exp-props:
AbiWord --to=html file.abw --exp-props="html4: yes"
The above command specifies that the output is to be HTML 4.01 and not XHTML. All six export options can be specified in this manner: html4, php-includes, declare-xml, use-awml, embed-css and embed-images. Each takes a yes or no, and multiple options can specified, e.g.:
--exp-props="html4: no; declare-xml: no; embed-css: yes"
The --exp-props argument can be used to define an arbitrary number of property name-value pairs. The above six options are reserved property names; there are two other reserved property names associated with XHTML templates: html-template and href-prefix.
XHTML Templates (EXPERIMENTAL)
The XHTML template is a skeleton XHTML document which the exporter first imports and then exports again with modifications. The template contains Processing Instructions which instruct the exporter to insert, e.g., the document title or the document text.
All of the exporter's processing instructions have the form <?abi-xhtml- ... ?>, e.g.:
<?abi-xhtml-insert title?>
<?abi-xhtml-insert meta?>
<?abi-xhtml-insert body?>
In the output, these instructions are replaced with, respectively, the document's title (from the document properties, as text), the document's metadata (document properties, etc., as HTML <meta ... />), and the document's content (as HTML, inside of the usual <body>...</body>).
The template system was written primarily for the AbiWord documentation. The goal was to provide a navigation menu for the AbiWord bundled help documentation. This consists of about 100 AbiWord documents, in several folders, which need to be converted to HTML. The navigation menu needed submenus, and the menu item corresponding to the current webpage needed to be highlighted, etc., and all using only HTML, CSS and relative links between webpages, images and style sheets.
To achieve this with a single template an element of flow control is necessary, and this is achieved by defining variables in the --exp-props argument, e.g.:
--exp-props="active-menu: howto"
One conditional mechanism is substitution in comments. The following in the template:
<style>
<?abi-xhtml-comment-replace property="active-menu" comment="
tr.menu td.$$ div {
background-color: #0000ff;
text-decoration: underline;
}
"?>
</style>
will produce the following in the exported XHTML:
<style>
<!--
tr.menu td.howto div {
background-color: #0000ff;
text-decoration: underline;
}
-->
</style>
since the $$ in the processing instruction comment text is replaced by he value (howto) of the specified property (active-menu).
The principal flow-control mechanism, however, is the use of <?abi-xhtml-if condition?> ... <?abi-xhtml-fi ?> where everything between the two processing instructions is ignored if condition is false. Unfortunately, the condition syntax is currently very limited (e.g., <?abi-xhtml-if active-menu==howto?>) and is likely to be rewritten. (These should be nestable.)
Another processing instruction is <?abi-xhtml-menuitem ...?> which creates a table cell of one sort or another with the specified label text.
Finally, to make relative links between resources possible, link addresses which start with a $ (e.g., <a href="$/about.html"> and <img src="$/images/logo.jpg" />) will have the $ substituted with the value of property href-prefix, e.g.:
--exp-props="html-template: normal.html; href-prefix: .."
This tells Abiword to use the template normal.html in the current directory and to prefix all links (marked with an initial $) with the path .. so <a href="$/about.html"> will change to <a href="../about.html">, and so on.
The best example of XHTML template usage is in AbiWord's abiword-docs CVS module in the directory abiword-docs/ABW/en-US/template/.
|
http://www.abisource.com/help/en-US/howto/howtoexporthtml.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
MSDN Blogs
Microsoft Blog Images
More ...
MSDN FLASH IRELAND - INTERNATIONAL RESOURCES - 17 NOVEMBER 2008
Common Tasks
Blog Home
About
RSS for comments
RSS for posts
Search
Search this blog
Search all blogs
.NET Framework
academic
BizSpark
cool web sites
designer
Developer
dublin
events
Ireland
ISV
Microsoft
MSDN Flash Ireland
MTUG
Pages
Silverlight
software development
startup
students
technology
Training
Visual Studio 2008
web development
Windows 7
WPF
XNA
Archives
Archives
September 2011
(1)
July 2011
(3)
May 2011
(1)
March 2011
(2)
September 2010
(1)
August 2010
(2)
July 2010
(1)
May 2010
(1)
April 2010
(4)
March 2010
(5)
February 2010
(5)
January 2010
(6)
December 2009
(2)
November 2009
(5)
October 2009
(4)
September 2009
(10)
August 2009
(2)
July 2009
(4)
June 2009
(7)
May 2009
(6)
April 2009
(12)
March 2009
(20)
February 2009
(10)
January 2009
(17)
December 2008
(7)
November 2008
(17)
October 2008
(7)
September 2008
(20)
August 2008
(15)
July 2008
(9)
June 2008
(12)
May 2008
(12)
April 2008
(26)
March 2008
(26)
February 2008
(15)
January 2008
(6)
December 2007
(5)
November 2007
(15)
October 2007
(7)
September 2007
(20)
August 2007
(26)
July 2007
(5)
June 2007
(12)
MSDN FLASH IRELAND - INTERNATIONAL RESOURCES - 17 NOVEMBER 2008
Martha Rotter - MSFT
19 Nov 2008 6:46 AM
0
Top News
Developers Seeing Blue at PDC: Windows Azure Unveiled
Register to
try the community preview of Azure Services Platform
and build new applications in the cloud - or use interoperable services that run on Microsoft infrastructure to extend and enhance your existing applications.
Watch Ray Ozzie's keynote
or
read the transcript of Ozzie's address
.
Windows 7 for Developers
This guide describes features and includes vivid screenshots from the pre-Beta version released at PDC. Build applications on a solid foundation, enable richer application experiences, and integrate the best of Windows and Web services.
News for Students
Imagine Cup Game Development Competition
The Game Development Competition challenges you to create a game with a solution that changes the world. The
United Nations' Millennium Goals
, which range from halving extreme poverty to halting the spread of HIV/AIDS and providing universal primary education, are our guide to inspire you to make your project. This is a great opportunity to learn and strengthen your technical and interpersonal skills, connect with thousands of students from all over the world, get access to over 100 hours of technical e-learning and virtual labs, and be the potential winner of up to US$25,000 in the WW Finals, plus an all-expenses-paid trip to the Imagine Cup World Wide Finals in Cairo, Egypt, in July 2009.
•
Round 1 - Qualifying (August 29, 2008 - March 1, 2009)
Required deliverables: Game demo; short, playable video game application; short description of the game including its premise, unique gameplay features, and how it addresses the 2009 Imagine Cup theme; and gameplay instructions.
•
Round 2 - Semi-Finals (March 2, 2009 - May 20, 2009)
If you are invited to advance to compete in round 2, your team must create and submit the following material: A 100% playable video game application, based on the game demo submitted in round 1; game summary; three (3) game screenshots; gameplay instructions; and game video.
Fun links
:
•
Win an Xbox360 by Participating in Microphone
•
Follow HilaryP on Twitter for Daily News for Students
•
Thirsty Developer Interviews Women in Technology
Silverlight 2 Launches
Silverlight 2 is now available, and students can develop applications for free!
Springboard blog
covers the release for students, from free developer tools for Silverlight to free e-learning. Just getting started with Silverlight? Check out the quick video
How Do I Add Silverlight to an Existing Web Site?
Free e-Books
Microsoft Press has a set of
free e-books
to launch your learning with Visual Studio 2008. The free e-book offer includes:
•
Programming Microsoft LINQ by Paolo Pialorsi and Marco Russo
•
Introducing Microsoft Silverlight 2, Second Edition by Laurence Moroney
•
Programming Microsoft ASP.NET 3.5 by Dino Esposito
Microsoft Offers Free Retake on Certification Exams - and an Academic Discount!
Students and faculty are eligible for the Academic Second Shot program. You get two shots at passing the Microsoft 072 Certification exam, and your first exam is offered at an academic discount! For students on a budget, Microsoft's free Second Shot offer is a great opportunity to validate your skill set and upgrade your resume.
Register here.
Featured Content
The SUPER PROmotion
Through March 27, 2009, customers who purchase at least 10 licenses of Microsoft Office Visio Professional 2007 or Microsoft Office Project Professional 2007 through a new or true-up Enterprise Agreement or Select License Agreement with Microsoft Software Assurance can earn up to 15% back on ERP in Microsoft partner subsidy funds.
Make Your Life a Lot Easier with Hyper-V
Virtualization can make your life much easier when it comes to modeling and creating a test environment with a specific OS and set of applications. But how do you get started? Download the
Microsoft Assessment and Planning (MAP) Toolkit
to see if your existing servers can be virtualized into a consolidated virtual environment for your development and test.
Microsoft Visual Studio Tools for Applications (VSTA) 2.0
Microsoft Visual Studio Tools for Applications (VSTA) 2.0 enables your customers to extend your product, leveraging their existing knowledge of Microsoft's Visual Studio environment. The Microsoft VSTA 2.0 SDK is now
available for download
from the Summit Software Web site.
Security Development Lifecycle: Three New Programs
As part of its commitment to make the Security Development Lifecycle (SDL) available to every developer, Microsoft is delivering three new SDL programs and tools this month: the SDL Pro Network, the SDL Optimization Model, and the Microsoft SDL Threat Modeling Tool. These offerings will enable the industry to create more secure and privacy-enhanced technology for an online world.
Learn more
about these programs or
watch a demo
about the SDL Threat Modeling Tool.
Accessing and Using a Mapping Web Service from a Custom Task Pane in Word 2007
Create a Word 2007 add-in that includes a custom task pane which is launched by a ribbon button. The task pane connects to the Microsoft TerraService mapping Web service and allows you to insert the map into a Word document.
Preparing InfoPath Templates to Use in Groove 2007
Use an InfoPath 2007 sample template as the basis for a Groove InfoPath Forms tool, adding your own customization, or without design or layout changes.
Performing Incremental Crawling with the Business Data Catalog in SharePoint Server 2007
Learn to create a Business Data Catalog application definition file in SharePoint Server 2007 that supports incremental crawling.
Introducing Front Runner for Innovate On SQL Server 2008
Whether you are looking to build, upgrade, or migrate your packaged application on Microsoft SQL Server 2008, you should consider joining the Front Runner for Innovate On program. By joining the initiative, you will receive technical and marketing support to help you be one of the first to go to market with an application built on SQL Server 2008.
SQL Server 2008 Promotion - Get on the Case
Begin training now and become a master of Microsoft SQL Server 2008. You'll learn to control powerful new features, taking your skills to the next level. Your efforts will be rewarded. Prove your heroic new abilities in our game, and you could win an incredible prize.
Evaluation Center
Download the Newly Released Windows HPC Server 2008 Trial
A wide range of software vendors, in various verticals, have been designing their applications to work seamlessly with Windows HPC Server 2008 so that users can submit and monitor jobs from within familiar applications without having to learn new or complex user interfaces. Download the 180-day trial software and receive valuable resources delivered at convenient intervals throughout the software evaluation period.
.NET KB Articles
FIX: On a computer that is running the .NET Framework 2.0 Service Pack 1, the file name and the line number are not reported as part of an error message if a Visual C# Web site project is in a directory that has a name that contains parentheses
FIX: The return type or the out argument of an ASMX service method that includes a property that has an internal setter may not be serialized on a computer that has the .NET Framework installed
FIX: When a .NET Framework 2.0-based application sends e-mail messages by using the System.Net.Mail namespace, the FQDN is not sent when you send a HELO or EHLO command
Versioning the publisher policy file for your assemblies
RSS Feeds
.NET Framework 2.0
|
.NET Framework 1.1
Visual Studio 2008, Visual Studio 2005, and Visual Studio .NET KB Articles
PRB: A pinning pointer passed to variable-argument function causes System.BadImageFormatException
Hosting a WPF Control in MFC and Enable Cut-and-Paste
Performance issues in compute-intensive VC++ application after upgrade from VS 2003 to VS 2005
RSS Feeds
Visual Studio 2008
|
Visual Studio 2005
|
Visual Studio 2005 Team Edition
|
Visual Studio .NET 2003
|
Visual Studio .NET 2002
SQL Server and Data Access KB Articles
FIX: A memory leak occurs when you repeatedly invoke a trigger that contains the RAISERROR statement by using a SQLCLR stored procedure in SQL Server 2005
FIX: A SQL Server Agent job that creates a ServerXMLHTTP object by using an ActiveX script remains in the Executing status and is never completed in SQL Server 2005
FIX: When you run a query that contains a JOIN operation in SQL Server 2005, and the ON clause of the JOIN operator contains a LIKE predicate, the query runs slower than in SQL Server 2000
RSS Feeds
SQL Server 2005
|
SQL Server 2000
|
SQL Server 2000 Analysis Services
Web Resources
PDC2008 Available Anywhere, Anytime
If you weren't able to make PDC2008 in person, fear not, code warrior; with PDC2008 sessions available online, you can code on while experiencing the future of the Microsoft technology platform. Watch the keynotes and more than 160 sessions available online. This is where you'll learn about Windows 7, Cloud Services, and the future of a bevy of other products.
Startup 101 with Bob Walsh On-Demand Web Seminar Series
Startup 101 is a set of four Microsoft sponsored on-demand webinars for developers creating software companies. In each session, Bob Walsh, noted Micro ISV/startup expert, addresses the burning questions you have for authorities on legal considerations, accounting, selling software to businesses and resources to help you build your company.
On-Demand Webcast: Interoperability Between Managed and Native Code.
On Demand Webcast: Using Pocket Outlook Data inside a).
Windows XP Professional for Embedded Systems
Attend this webcast to learn how you can take advantage of the full power of the Windows XP Professional operating system.
Virtual Lab: A SharePoint Developer Introduction - Workflow
After completing this lab, you will be better able to build a simple workflow that sends an e-mail when a user adds a document to a document library, build a workflow that creates a task when a user adds a meeting request to a calendar, and modify a workflow to send the administrator a reminder e-mail if a period of time has passed without a resolution to the meeting request.
Virtual Lab: Visual Studio 2008 Windows Communication Foundation and REST
This lab will serve as an introduction to creating Windows Communication Foundation (WCF) services. It will also illustrate how a WCF service can easily be adopted to meet the ever-changing needs of service-based software by adapting the service we create to use REST.
Virtual Lab: Microsoft Office SharePoint Server 2007 Installation and Configuration
After completing this lab you will be more familiar with the installation and configuration options available in Microsoft Office SharePoint Server 2007, such as installing a new farm, configuring global workflow settings, configuring incoming e-mail, administrative tasks, farm topology, provisioning new web applications and configuring alternate forms-based authentication.
geekSpeak Podcast: SharePoint Wikis with David Mann
WMA (17 MB)
|
MP3 (15 MB)
For this geekSpeak, David Mann, who was recently on geekSpeak in August 2008, returns for some more engaging discussion on Microsoft Office SharePoint Server. This time, David enlightens us on best practices for implementing wiki sites using SharePoint Server.
Security for Developers
SDL Series - Article #1: Investigating the Security Development Lifecycle at Microsoft
This article is the first in the "SDL series" - a set of 8 articles investigating the Microsoft Security Development Lifecycle. In this series, through extensive interviews and research, the authors pull back the covers on Microsoft's Security Development Lifecycle e- a development practice upon which millions of users (and billions of dollars) depend.
Applying SDL Principles to Legacy Code
MS08-067 and the SDL
Good Hygiene and Banned APIs
Test Your Security IQ
Threat Models Improve Your Security Process
Agile SDL
More Security...
Training
Free E-book Offer: Introducing Microsoft Silverlight 2
Get free e-book chapters about Silverlight 2, LINQ, and ASP.NET 3.5. Preview a chapter and sign up for the free download offer to get additional content.
Find Great Deals on Training at the SQL Server 2008 Experience
•
40% off select SQL Server 2008 books
•
40% off the Microsoft Press E-Reference Libraries subscription fee
•
20% off E-Learning Collection 2778: Writing Queries Using SQL Server 2008
•
Free E-Learning Course 4331BE: Modifying Data in Tables in Microsoft SQL Server 2008
Free SQL Server 2008 Downloadable E-Book Offer
Written by Industry experts Peter DeBetta, Greg Low, and Mark Whitehorn, Introducing Microsoft SQL Server 2008 will lead you through major new features in SQL Server 2008, including security, administration, performance, high availability, and business intelligence.
Get a Free Retake on Windows Server 2008 Certification Exams
Get a second chance to pass your Windows Server 2008 certification exam with Second Shot. When you register for Second Shot, you will receive a free retake if you don't pass on your first attempt. Through December 31 you'll also get 25% off a future exam if you pass on the first try.
Free Developing Applications Using Visual Basic 2008 or Developing Applications Using Visual C# 2008 Training Download
Learn the basics involved in building Windows applications using Visual Studio 2008 with award-winning training from AppDev. Each download includes more than 1 hour of media runtime along with courseware, labs, and sample code.
Case Studies
Solution Provider Explores Flexible New Cloud Platform to Cut Costs and Expand Business
Pitney Bowes expects to gain flexibility, cut costs, and expand its business with the Azure Services Platform from Microsoft.
Infosys Creates Cloud-Based Solution for Auto Dealers using SQL Data Services
To create its hub-in-the-cloud solution it needed a cloud-based database, which it found in Microsoft SQL Data Services, part of the Microsoft Services Platform.
SQL Server 2008 Runs 6.5-Terabyte SAP ERP Database to Support Microsoft Worldwide
Microsoft upgraded to the beta edition of Microsoft SQL Server 2008 to take advantage of new features, including data compression, backup compression, and some enhancements to existing features like database mirroring.
More Case Studies...
Partner News
LEADTOOLS Imaging SDKs v.16 Ships
Download a free 60-day evaluation with tech support.
Get a Trial, Get a T-shirt
There is a better way to manage software projects. Try VersionOne's Agile Project Management Software, rated #1 by users, and get a free T-shirt.
Download the SpreadsheetGear 2008: Free Fully Functional 30-Day Evaluation
Design dashboards, reports, charts, calculations and business rules in Excel 2003 or Excel 2007 and deploy them with SpreadsheetGear 2008.
Improve .NET Code Quality with Free Trial Download
DevPartner Studio Professional Edition 9.0 enhances code quality with automatic detection and diagnosis of software defects, performance problems, and security vulnerabilities.
Develop Absolutely Free with Visual WebGui 6.2 - VS Express Combination
The free SDK available for download now features compatibility with the free Express Edition of Visual Studio. Download Visual WebGui and start developing advanced Web applications.
Teamprise Remote Accelerator for Team Foundation Server Free Trial
Teamprise Remote Accelerator is a single-user download proxy that provides remote developers with fast access to TFS. Get the free 30-day trial.
Download a 30-Day Free Trial of the Altova MissionKit
Available in multiple configurations, the Altova MissionKit offers an integrated suite of XML, database, and UML tools.
MSDN Flash Ireland
,
Pages
© 2014 Microsoft Corporation.
Trademarks
Privacy & Cookies
Report Abuse
5.6.426.415
|
http://blogs.msdn.com/b/ireland/archive/2008/11/19/msdn-flash-ireland-international-resources-17-november-2008.aspx
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
Updated:
Currently,:
It’s no secret that Microsoft Dynamics NAV customers and partners have needed an ad hoc reporting solution that’s easy to use. Well, now we have one!
We’ve been working in cooperation with Jet Reports, Inc. on the development of an Excel-based reporting solution. The result is Jet Reports Express for Microsoft Dynamics NAV – a simple but effective business reporting tool that gives customers an easy and simple way to create high impact reports and helps us to enhance our BI & Reporting value proposition.
Within a familiar Microsoft Excel environment, users will be able to access Microsoft Dynamics NAV data and utilize all of the Excel capabilities, such as Power Pivot, formatting, charting and Pivot Tables, to create powerful, insightful and well-formatted reports. There are multiple report templates available out of the box.
Plus, users will be able to answer and analyze ad hoc business queries with real time data from Microsoft Dynamics NAV. It’s possible to access and combine data from NAV – including tables, fields, flow fields and dimensions, and you can slice and dice data and do consolidation. You can also drill down into any value in a report to see the underlying data with just one click.
Jet Reports Express for Microsoft Dynamics NAV really is simple to work with and very easy to demo. It’s the perfect solution for the majority of the Microsoft Dynamics NAV customers who need a basic ad hoc reporting solution.
Jet Reports Express for Microsoft Dynamics NAV will be available to Microsoft Dynamics NAV customers as new functionality at no additional costs, provided they are on an active Business Ready Enhancement Plan.
The product can be downloaded via a link from PartnerSource and CustomerSource that will be available sometime in Q3 CY2011. Look out for more information on final release date.
Stay tuned for more information about all the cool things customers can do and partners can demo with this smart reporting tool.
Some may have seen this Add-In somewhere already as it has been around for some time. This is a high level explanation to how it was actually done.
First thing to mention here is that the base for this Add-In is a publicly available sample of Presence Controls intended for Office Communicator 2007. You can find the Sample Code, prerequisites and updates as well as related stuff here: Microsoft Office Communicator 2007 Presence Controls. You can use these Presence Controls with either Microsoft Office Communicator 2007 or with Microsoft Lync.
So in order to build this Sample Presence Add-In Control for Dynamics NAV, you can simply use the output from the above sample, which is a Set of Presence Controls contained in – PresenceControls.dll
Next, create a new Project and include a reference to the Presence Control Set – this is the Dynamics NAV Add-In Project.
For more details on the basics structure and references for a Dynamics NAV Add-In: How to: Create a RoleTailored Client Control Add-in.
After that you have your CreateControl() function which is returning the Add-In control to NAV. The two main things you want to return here are the Objects to be shown in your add-in on screen together The Presence Control and a Textbox:
Dim persona As New persona ‘the presence control, a persona object from the Presence Controls Set
Dim txtbox As New System.Windows.Forms.TextBox ‘a regular text box
In order to display these two controls nicely “as one” you may want to place them in some kind of parent container/containers to have them Size and move properly together. I used System.Windows.Forms.TableLayoutPanel but there are probably better ways to do this.
Finally you will have to need to ensure the control is updated properly:
The Persona Control has a SipUri property, which is basically what you need to bind your Add-In Value to, so you need to ensure that changes to the value are passed both to the Textbox and the Persona Object.
As usual there are a number of ways some nicer than other to achieve this, you could either bind the Persona property SipUri to the Textbox Value itself or handle the updates of the value to both controls manually in your add-in, but the basics are to simply ensure the SipUri of the Persona always needs to be kept as the same as the value of the TextBox, for example:
' Copyright © Microsoft Corporation. All Rights Reserved.' This code released under the terms of the ' Microsoft Public License (MS-PL,.)Public Property Value() As String Implements Microsoft.Dynamics.Framework.UI.Extensibility.IValueControlAddInDefinition(Of String).Value Get Return txtbox.Text End Get Set(ByVal value As String) persona.SipUri = value txtbox.Text = value End SetEnd Property
If all works out well you’ll end up with an Add-in control looking something like this. (See video)
-Johan Emilsson
In one of our previous blog post we discussed the possibility to do Transfooter and Transheader functionality in RDLC(SSRS) reports and describes a viable solution for this in RDLC.
In this blog post we would like to suggest an alternative, a bit more economical and easier to implement solution for the same problem.
For the demo we use the same table and the same report and will strive to achieve the same results as in the mentioned in our previous blog post.
1. Create new report blank report with table 18
2. Create DataItem ”Customer”
3. Go to Section Designer and add the following fields: create a small block of VBS code in order to perform some calculations and store intermediate data
Open “Report->Report Properties” dialog and select “Code” tab, enter the following VBS code:
11. Define a hashtable for storing running accumulated sums for each page of the report
Shared RunningTotals As New System.Collections.Hashtable
12. Define two public functions, which populate and query the hashtable from above
Public Function GetRunningTotal(ByVal CurrentPageNumber)
Return IIF(CurrentPageNumber > 0, RunningTotals(CurrentPageNumber), 0)
End Function
Public Function SetRunningTotal(ByVal CurrentPageTotal, ByVal CurrentPageNumber)
RunningTotals(CurrentPageNumber) = CurrentPageTotal + GetRunningTotal(CurrentPageNumber - 1)
Return RunningTotals(CurrentPageNumber)
End Function
13. Ok, it’s now time to add a Transfooter and Transheader.
Enable Page Header and Page Footer in the report (click “Report->Page Header” and “Report->Page Footer”).
14. In the Page Footer I place a text box with the following expression:
="Transfooter subtotal = " & Code.SetRunningTotal( Sum(ReportItems!Customer__Debit_Amount_.Value), Globals!PageNumber)
This code actually performs the following actions:
- calculate the sum of all “Debit Amount” values on the current page (sic)
- adds this value to the running total, which has been already calculated for the previous page
- returns this value as the actual running total for the current page
15. In the Page header I place a text box with the following expression:
="Transheader subtotal = " & Code.GetRunningTotal(Globals!PageNumber-1)
This code fetches the running total, calculated up to the previous page
16. And then I set distinctive BackgroundColor and font Color just so this Transfooter and Transheader stand out in my report
17. Now I’m almost done but I would like to not see the Transheader on the first page and not to see the Transfooter on the last page.
So I set the following expressions for the “Visibilty->Hidden” properties of the page header:
=IIF(Globals!PageNumber > 1, False, True)
And for the page footer:
=IIF(Globals!PageNumber < Globals!TotalPages, False, True)
18. Now I’m done, I save, import into NAV and compile. After some fit and finish on the report it now looks like this when I print
Now I’m done, I save, import into NAV and compile. After some fit and finish on the report it now looks like this when I print:
Question: Would this also work in the example of having a list of sales order lines per sales header and the sales order lines goes to multiple pages?
Answer: The report above is a bit simplified in order to illustrate the point. It can be easily extended to support your scenario. I.e. the key for the hash should include page number AND header no to accomplish this.
You can download the report object here, thanks to Nickolay Belofastow.
In one of our previous blog posts Rene Gayer shared his report Sales Dashboard. The report provides insight into company’s top customers and items, balance per country region, and item purchases/sales:
The report also shows the list of opportunities, and you can drill into to-dos for each of the opportunities:
In this blog post we offer several improvements for the Sales Dashboard report. The first thing is adding an extra column to the list of to-dos. Note, that there are two occurrences of each to-do in the list, they have different numbers, but the description is same (compare to-dos TD000005 and TD100005 on the screenshot above). It is not clear why until we make the column “Type of to-do” visible. The reason is that each to-do has several participants, for example Organizer and Contact Attendee. To make the column “Type of to-do” visible, you need to do the following:
1. In the Object Designer, select page 70002 Sales Dashboard To-do Part, and then click Design.
2. Add a new field to the page:
3. Click View >Properties, and then set the SourceExpr to Rec > Field Name > System To-do Type.
4. Click OK, and compile the page.
Furthermore the to-dos appear sorted by their number. We offer to sort them by starting date, which is helpful when you want to get a quick overview of the latest to-dos. That is how you can add sorting to the list:
1. In Object Designer, select table 5080 To-do, and then click Design.
2. Click View > Keys.
3. Add new key, which is a field Date (Starting Date):
4. Compile the table.
5. Select the page 70002 Sales Dashboard To-do Type, click Design.
6. Click in the first empty row, and then click View > Properties
7. In the SourceTableView field, click the Assist button.
8. Set the Key to Date, and the Order to Descending. Click OK.
9. Close the Properties window and compile the page.
The final result looks like this – the to-dos are sorted by date and To-do Type is visible:
You can download the objects needed for this report here, thanks to Anna Mihailava.
Based.
This post concerns the charts that live in table 2000000078 "Chart" (Departments/Administration/Application Setup/RoleTailored Client/Charts" (page 9182)). These charts can be added as a system part to a role center or via "Customize this page".
Other charts are not the topic for this particular post. But just to explore the alternatives, more advanced charts can be created using Client Add-ins, examples of which you can find here:
More Charts Add-ins
I'm sure there are more ways to add charts in NAV. Please feel free to add comments about other ways and also your experience with this and other types of charts.
So the charts we are concerned with here, are the system charts. Their characteristics are:
To make the most of them, use their simplicity as a strength and don't try to make them do too much.:
These areas are specifically designed to give a simple and personalized overview, so perfect for charts. is attached just below as a txt file. It contains these objects:
It is known that in Role Tailored Based environment BEEP C/AL function is not supported.
This simple blog is based on SystemSounds Class from System.Media namespace
My Ingredients :
For those of you considering implementing the prepayments functionality in Microsoft Dynamics NAV, a whitepaper has been released to help you sort through the scenarios the feature is designed to address. Prepayments enable you to create and post invoices for advance payments (prepayments) that your company may require before it opens a sales or purchase order. This white paper provides an overview of the current implementation, and explores areas that may be enhanced in future releases. In addition, the white paper notes some of the known limitations.
To review the white paper, go to:
This:
Just have released a new improved release of the Timeline visualization for DynamicsNAV 2009 R2 on Partner Source and Customer Source!
In this update release: New UI features, new interactions, much more flexible API for application developers.
|
http://blogs.msdn.com/b/nav/archive/2011/06.aspx
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
On Wed, Oct 27, 2010 at 3:04 AM, Christian Schneider
<chris@die-schneider.net> wrote:
> Hi Benson,
>
> I just checked the source code of jms transport. It seems that the is not
> even a property useMessageIDAsCorrealationID in JmsConfiguration. The
> JmsOldConfigHolder does not read this property.
> So this does not seem to be used at all. I just copied the description to
> the JmsConfigFeature as I assumed it should be present.
>
> I have not yet tested this with a Tibco Business Works Server where the
> messageId is used to correlate messages but I guess there could be problems.
> There could be another algorithm present of course.
> Any ideas?
Honestly, no. I am a JMS novice, and I am happy to have the SOAP/JMS
stuff working find with ActiveMQ.
>
> Best Regards
>
> Christian
>
>
>
>
> Am 26.10.2010 15:21, schrieb Benson Margulies:
>>
>> There's a nasty spelling error highlighted here. Anyone care to open a
>> JIRA?
>>
>> ---------- Forwarded message ----------
>> From:<confluence@apache.org>
>> Date: Tue, Oct 26, 2010 at 5:18 AM
>> Subject: [CONF] Apache CXF Documentation> Using the JMSConfigFeature
>> To: commits@cxf.apache.org
>>
>>
>> Using the
>> JMSConfigFeature<>
>> Page
>> *edited* by Christian
>>
>> Schneider<>
>> Changes (1)
>> ...
>> |
>> \\
>> Full Content
>>
>> In older CXF version the JMS transport is configured by defining a
>> JMSConduit or JMSDestination. Starting with CXF 2.0.9 and 2.1.3 the JMS
>> transport includes an easier configuration option that is more conformant
>> to
>> the spring dependency injection. Additionally the new configuration has
>> much
>> more options. For example it is not necessary anymore to use JNDI to
>> resolve
>> the connection factory. Instead it can be defined in the spring config.
>>
>> The following example configs use the
>>
>> p-namespace<>from
>> spring 2.5 but the old spring bean style is also possible.
>>
>> Inside a features element the JMSConfigFeature can be>
>>
>> conncection
>> factory and a target destination.
>>
>> <bean id="jmsConfig"
>>> p:>"
>>
>> <property name="targetConnectionFactory">
>> <bean
>>
>> <property name="brokerURL"
>> </bean>
>> </property>
>> </bean>
>>
>> JMSConfiguration options:
>> Name Default
>> Description
>> connectionFactory (mandatory field) Reference to a bean that defines a
>> jms ConnectionFactory. Remember to wrap the connectionFactory like
>> described
>> above when not using a pooling ConnectionFactory
>> wrapInSingleConnectionFactory true Will wrap the connectionFactory
>> with
>> a Spring SingleConnectionFactory, which can improve the performance of the
>> jms transport reconnectOnException false If wrapping the
>> connectionFactory with a Spring SingleConnectionFactory and
>> reconnectOnException is true, will create a new connection if there is an
>> exception thrown, otherwise will not try to reconnect if the there is an
>> exception thrown. targetDestination
>> JNDI name or provider specific name of a destination. Example for
>> ActiveMQ:
>>
>> test.cxf.jmstransport.queue replyDestination
>>
>> destinationResolver DynamicDestination
>> none Reference to a spring transaction manager. This allows to take part
>> in JTA Transactions with your webservice.
>> taskExecutor SimpleAsyncTaskExecutor Reference to a spring
>> TaskExecutor.
>> This is used in listeners to decide how to handle incoming messages.
>> Default
>> is a spring SimpleAsyncTaskExecutor.
>> useJms11> CXF 2.1.3: false true means JMS 1.1 features are used
>> false means only JMS 1.0.2 features are used
>> messageIdEnabled true messageTimestampEnabled true
>> cacheLevel -1 Specify the level of caching that the JMS listener
>> container is allowed to
>> apply.
>> Please check out the java doc of the
>> org.springframework.jms.listenerDefaultMessageListenerContainer for more
>> information
>> pubSubNoLocal false true do not receive your own messages when using
>> topics
>> receiveTimeout 0 How many milliseconds to wait for response messages.
>> 0
>> means wait indefinitely
>> explicitQosEnabled false true means that QoS parameters are set for
>> each
>> message. deliveryMode 1 NON_PERSISTENT = 1 messages will only be kept
>> in
>> memory
>>
>> PERSISTENT = 2 messages will be persisted to disk
>> priority 4
>> Priority for the messages. See your JMS provider doc for details
>> timeToLive 0 After this time the message will be discarded by the jms
>> provider
>> sessionTransacted false true means JMS transactions are used
>> concurrentConsumers 1 minimum number of concurrent consumers for
>> listener
>> maxConcurrentConsumers 1 maximum number of concurrent consumers for
>> listener maxConcurrentTasks 10 Maximum number of threads that handle
>> the
>> received requests (available from cxf 2.1.4 upwards) messageSelector
>>
>> jms selector to filter incoming messages (allows to share a queue)
>> subscriptionDurable
>> false durableSubscriptionName
>>
>> messageType
>> text
>> text
>> binary
>> byte
>> pubSubDomain
>> false
>> false means use queues
>>
>>
>>
>> Change Notification
>>
>> Preferences<>
>> View
>> Online<>|
>> View
>>
>> Changes<>|
>> Add
>>
>> Comment<>
>>
>
> --
> ----
>
>
>
|
http://mail-archives.apache.org/mod_mbox/cxf-dev/201010.mbox/%3CAANLkTikXa7oG35+6RrRGWLdGbWM-eSx32svZYGzJn6CR@mail.gmail.com%3E
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
Hi we discovered a problem with the use of the ZSI and our wsdl. Namespaces were not correctly handeled. Our wsdl is added in attachement.
Therefore we created a small patch in the TC.py:
def get_name(self, name, objid):
'''
Paramters:
name -- element tag
objid -- ID type, unique id
'''
if type(name) is tuple:
return name
ns = self.nspname
# Dirty hack start
if ns is None and isinstance(self, ComplexType):
ns = self.schema
if ns is None and isinstance(self, String):
ns = self.type[0]
# Dirty hack stop
n = name or self.pname or ('E' + objid)
return ns,n
The patch resides between "dirty hack start" and stop.
The actual instance of the wsdl is hosted on tomcat with the xfire webservices stack.
Geert Audenaert
2007-06-12
problem wsdl
|
http://sourceforge.net/p/pywebsvcs/patches/38/
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
So I was going to dive right in and do a part 2 on the WPF ListView tutorial from last week, but as I was writing the code I realized that a lot of it relies on some new and very different constructs that WPF provides to developers. Two of these are deep enough topics on their own that I thought it would be a good idea to give an introduction to them before I dove back into the ListView stuff. So today we are going to talk about Dependency Properties, and in a future tutorial I will talk about how binding works in WPF.
What are dependency properties? The quick definition from the MSDN docs says that a dependency property is a "property that is backed by the WPF property system." Not really a great one-line explanation, but really, I can't blame them. I can't come up with a good one line explanation either. But essentially, it gives you a bunch of infrastructure to do all the things that you often want to do with a normal property - validate it, coerce it into a proper range, give out change notifications, and a number of other aspects. We aren't going to touch on everything that a dependency property can do today - because there is a lot. But we will be talking about how to use them, how to create them, and how to set up validation/coercion/change notification.
So one of the first things I thought was weird about the definition of a dependency property is that it is a static. This didn't make sense to me at first - this property needs to store info relevant to a particular instance of a class, how is it going to do that if it is static? But then, as I read more about them, I.
One thing you do have to note, though, is that for a class to contain dependency properties, it has to in some way derive from DependencyObject. In deriving from this class, you get all the infrastructure needed to participate in the WPF dependency property system.
So at first glance, all the properties on the new WPF controls seem to be regular old properties. But don't be fooled - this is often just a simple wrapper around a dependency property (and the documentation will usually say this). So what does it mean for a property to be a simple wrapper around a dependency property? Lets look at the FrameworkElement.Height property as an example:
public double Height { get { return (double)GetValue(HeightProperty); } set { SetValue(HeightProperty, value); } }
Your first two questions are probably "What are these
GetValue and
SetValue functions?" and "What is this
HeightProperty?", and those
are very good questions indeed. Well,
GetValue and
SetValue are
functions you get by deriving from
DependencyObject. They allow you,
as you might have guessed, to get and set the values of dependency
properties. The
HeightProperty is the dependency property itself - the
static definition part of the
FrameworkElement class.
So far, this is just added complexity, and you're wondering why there is
yet another level of indirection on things. But here is where things get
interesting. In the "old ways", to set up some sort of change
notification on the
Height property here, you would have had to
override it in a new class deriving from this
FrameworkElement class
and added whatever you needed in the 'set' part of the property here.
However, you no longer have to do things like that. Instead, you can:
FrameworkElement myElement; // // myElement gets set to an element // DependencyPropertyDescriptor dpd; dpd = DependencyPropertyDescriptor.FromProperty( FrameworkElement.HeightProperty, typeof(FrameworkElement)) dpd.AddValueChanged(myElement, myHeightChangedFunction);
And now you have a function that will get called any time the height
changes on
myElement! I think that is pretty handy. You can detach the
hook just as easily:
DependencyPropertyDescriptor dpd; dpd = DependencyPropertyDescriptor.FromProperty( FrameworkElement.HeightProperty, typeof(FrameworkElement)) dpd.RemoveValueChanged(myElement, myHeightChangedFunction);
Ok, enough about other people's dependency properties - lets go make our own! Below we have a extremely simple class with a dependency property for "LastName", as well as a property wrapper around it:
public class Person : DependencyObject { public static readonly DependencyProperty LastNameProperty = DependencyProperty.Register("LastName", typeof(string), typeof(Person)); public string LastName { get { return (string)GetValue(LastNameProperty); } set { SetValue(LastNameProperty, value); } } }
The
Register call is pretty simple - you give the property a name (in
this case "LastName"), you say what type of information the property
will hold (in this case a string), and you say what type of object this
property is attached to (in this case Person). A little verbose,
especially when you add in the property wrapper, but not too bad. And
I'm sure Microsoft will find a way to streamline the syntax in the next
version of C#.
A little bit of a side note here - don't ever put anything but the
GetValue and
SetValue calls inside the property wrapper. This is
because you never know if someone will set the property through the
wrapper, or straight through a
SetValue call - so you don't want to
put any extra logic in the property wrapper. For example, when you set
the value of a dependency property in XAML, it will not use the property
wrapper - it will hit the
SetValue call directly, bypassing anything
that you happened to put in the property wrapper.
Back to creating dependency properties. The constructor for
has a couple more optional arguments. And we are going to jump right in
and use them all!
public class Person : DependencyObject { public static readonly DependencyProperty LastNameProperty = DependencyProperty.Register("LastName", typeof(string), typeof(Person), new PropertyMetadata("No Name", LastNameChangedCallback, LastNameCoerceCallback), LastNameValidateCallback); private static void LastNameChangedCallback( DependencyObject obj, DependencyPropertyChangedEventArgs e) { Console.WriteLine(e.OldValue + " " + e.NewValue); } private static object LastNameCoerceCallback(DependencyObject obj, object o) { string s = o as string; if (s.Length > 8) s = s.Substring(0, 8); return s; } private static bool LastNameValidateCallback(object value) { return value != null; } public string LastName { get { return (string)GetValue(LastNameProperty); } set { SetValue(LastNameProperty, value); } } }
The two other arguments to
Register are a
PropertyMetadata instance
and a
validateValueCallback. There are a couple different classes that
derive from
PropertyMetadata, but today we are just using the base
one. The
PropertyMetadata instance allows us to set a default value
(in this case "No Name"), a property changed callback
(
LastNameChangedCallback), and a coerce value callback
(
LastNameCoerceCallback). The default value does exactly what you
might expect. The change callback can do whatever you want it to do, and
you have plenty of information with which to do it. The
DependencyPropertyChangedEventArgs contain both the old and the new
values of the property, as well as a reference to what property was
changed. And the
DependencyObject passed in is the object on which the
property was changed. This is needed because, as you can see, this
method is static. So every time the "LastName" property is changed on
any object, this function will get called.
The same goes for the coerce callback - we get the object on which the property is being changed, and the possible new value. Here we get the opportunity to change the value - in this case, apparently last names are forced to be 8 characters or less.
And finally, we have the
LastNameValidateCallback. This just gets the
possible new value, and returns true or false. If it returns false, an
exception is blown - so in this case, if anyone ever tries to set a null
last name, they better watch out.
So there you go, the basics on dependency property usage and creation. There are a couple areas I haven't covered - inheritance, attached properties, and overriding metadata to name a few. But hopefully this gets off on the right foot with respect to dependency properties, and I'll probably write a tutorial in the next few weeks on those other areas.
|
http://tech.pro/tutorial/745/wpf-tutorial-introduction-to-dependency-properties
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
iSuperLightmap Struct ReferenceA super light map.
More...
[3D]
#include <ivideo/txtmgr.h>
Inheritance diagram for iSuperLightmap:
Detailed DescriptionA super light map.
Definition at line 135 of file txtmgr.h.
Member Function Documentation
Retrieve an image of the whole SLM (for debugging purposes).
Add a lightmap to this SLM.
The documentation for this struct was generated from the following file:
Generated for Crystal Space 1.0.2 by doxygen 1.4.7
|
http://www.crystalspace3d.org/docs/online/api-1.0/structiSuperLightmap.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
EXIT(2) BSD System Calls Manual EXIT(2)
NAME
_exit -- terminate the calling process
SYNOPSIS
#include <unistd.h> void _exit(int status);
DESCRIPTION
The _exit() function terminates a process, with the following conse- quences: o All of the descriptors that were open in the calling process are closed. This may entail delays; for example, waiting for output to drain. A process in this state may not be killed, as it is already dying. o If the parent process of the calling process has an outstanding wait call or catches the SIGCHLD signal, it is notified of the calling process's termination; the status is set as defined by wait(2). o The parent process-ID of all of the calling process's existing child processes are set to 1; the initialization process (see the DEFINI- TIONS section of intro(2)) inherits each of these processes. o. o If the process is a controlling process (see intro(2)), the SIGHUP signal is sent to the foreground process group of the controlling terminal. All current access to the controlling terminal is revoked. Most C programs call the library routine exit(3), which flushes buffers, closes streams, unlinks temporary files, etc., before calling _exit().
RETURN VALUE
_exit() can never return.
SEE ALSO
fork(2), sigaction(2), wait(2), exit(3)
STANDARDS
The _exit function is defined by IEEE Std 1003.1-1988 (``POSIX.1''). 4th Berkeley Distribution June 4, 1993 4th Berkeley Distribution
Mac OS X 10.9.1 - Generated Sun Jan 5 15:21:47 CST 2014
|
http://www.manpagez.com/man/2/_exit/
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
DTD to XML Schema
Discussion in 'XML' started by NSB,:
- 453
- Ben Jessel
- Aug 5, 2004
- Replies:
- 1
- Views:
- 1,692
- Markus
- Nov 23, 2005
[XML Schema] Including a schema document with absent target namespace to a schema with specified tarStanimir Stamenkov, Apr 22, 2005, in forum: XML
- Replies:
- 3
- Views:
- 1,344
- Stanimir Stamenkov
- Apr 25, 2005
- Replies:
- 3
- Views:
- 3,303
New to xml schema - does the dtd/schema validation happens always ?pramodr, Apr 1, 2009, in forum: XML
- Replies:
- 3
- Views:
- 884
- Peter Flynn
- Apr 5, 2009
|
http://www.thecodingforums.com/threads/dtd-to-xml-schema.170294/
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
public class StateChangeEvent extends Object implements Serializable
statechange at a node to the StateChangeListener. There is a distinct instance of this event representing each state change at a node.
Each event instance may have zero or more state change related exceptions
associated with it. The exceptions are of type
StateChangeException.
StateChangeException has a method called
StateChangeException.getEvent() that can be used to associate an event with
an exception.
StateChangeListener, Serialized Form
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ReplicatedEnvironment.State getState()
Stateresulting from this event
public long getEventTime()
System.nanoTime()
public String getMasterNodeName() throws IllegalStateException
IllegalStateException- if the node is in the
DETACHEDor
UNKNOWNstate.
Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.
|
http://docs.oracle.com/cd/E17277_02/html/java/com/sleepycat/je/rep/StateChangeEvent.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
{- | Caution: - Although this module calls 'unsafeInterleaveIO' for you, it cannot take the responsibility from you. Using this module is still as unsafe as calling 'unsafeInterleaveIO' manually. Thus we recommend to wrap the lazy I/O monad into a custom @newtype@ with a restricted set of operations which is considered safe for interleaving I/O actions. - Operations like 'System.IO.hClose' are@. We advise to lift strict IO functions into the lazy IO monad. Lifting a function like @readFile@ may lead to unintended interleaving. -} module System.IO.Lazy ( T, run, ) where import Control.Monad.IO.Class (MonadIO(liftIO), ) import Control.Monad.Trans.State (StateT(StateT), mapStateT, evalStateT, {- runStateT, -} ) import Control.Monad (ap, {- liftM2, -} ) import Control.Applicative (Applicative(pure, (<*>)), ) import System.IO.Unsafe (unsafeInterleaveIO, ) newtype T a = Cons {decons :: StateT RunAll IO a} data RunAll = RunAll deriving Show instance Monad T where return x = Cons $ return x x >>= f = Cons $ mapStateT unsafeInterleaveIO . decons . f =<< mapStateT unsafeInterleaveIO (decons x) instance Functor T where fmap f = Cons . fmap f . decons instance Applicative T where pure = return (<*>) = ap instance MonadIO T where liftIO m = Cons $ StateT $ \RunAll -> fmap (\x->(x,RunAll)) m run :: T a -> IO a run = flip evalStateT RunAll . decons {- correct: run $ do x <- liftIO getLine; y <- liftIO getLine; a <- return (x,y); return (fst a) *LazyIO> run (Control.Monad.replicateM 5 (liftIO getChar)) >>= putStrLn 0011223344 *LazyIO> run (liftIO (putStrLn "bla") >> liftIO getLine) >>= print "bla 1 1" *LazyIO> run $ Monad.liftM (\ ((a,b),(c,d))->b) $ liftM2 (,) (liftM2 (,) (liftIO getLine) (liftIO getLine)) (liftM2 (,) (liftIO getLine) (liftIO getLine)) "1 2 2" -} {- testLazy, testStrict :: IO String testLazy = run $ liftM2 (const) (liftIO getLine) (liftIO getLine) testStrict = run $ liftM2 (flip const) (liftIO getLine) (liftIO getLine) test :: IO (String, RunAll) test = flip runStateT RunAll $ decons $ liftIO getLine >>= \x -> liftIO getLine >> return x -}
|
http://hackage.haskell.org/package/lazyio-0.0.3/docs/src/System-IO-Lazy.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
.1-incubating (.tar.gz) PGP SHA MD5
Apache ServiceMix 3.1-incubating Sources (.tar.gz) PGP SHA MD5
Windows Downloads
Apache ServiceMix 3.1-incubating (.zip) PGP SHA MD5
Apache ServiceMix 3.1-incubating Sources (.zip) PGP SHA MD5
Web Application
Apache ServiceMix Web Application 3.1-incubating (.war) PGP SHA MD5
Bug ** SM-410 - Component Uninstallation : ClassLoader not removed from JVM ** SM-482 - Missing jars in the BPE component ** SM-494 - Problems with JMSFlow and sendSync in start() callbacks. ** SM-536 - The defaultMep is a mandatory attribute on consumer endpoints and should be checked ** SM-559 - WSDL-First example in JBoss ** SM-570 - HTTP connector can blow up while trying to report a problem ** SM-571 - Memory leak in DeliveryChannelImpl ** SM-572 - servicemix-wsn2005 always use the anonymous publisher ** SM-576 - XBeanProcessor does not skip comments ** SM-577 - JSR 181 fault message does not respect WSDL message fault definition ** SM-583 - Jetty context Path verification ** SM-584 - Servicemix archive for Jboss ** SM-585 - Deadlock on BoundedLinkedQueue ** SM-589 - The SourceTransformer should not log a warning when calling toResult with a null Source ** SM-592 - notifier.run() missing from DefaultState ** SM-593 - Jetty jars missing when running servicemix-web example ** SM-597 - Drools xpath expression does not use the namespaces defined ** SM-598 - MTOM attachments are not output by the jsr181 component ** SM-599 - bridge sample client.html providing no status info ** SM-600 - Compilation error in Geronimo ServiceMixGBean ** SM-603 - NullPointerException at org.apache.servicemix.jms.standard.StandardConsumerProcessor.doStart(StandardConsumerProcessor.java:51) ** SM-604 - Allow servicemix-http managed mode to dynamically determine the server, port, and context path it is running on when generating jsr181 WSDLs ** SM-608 - Maven based examples should include the needed repositories ** SM-610 - The ServiceAssembly mbean should return the names of the ServiceUnits ** SM-621 - Issues with ServiceMix startup shell script on Solaris ** SM-622 - JCAFlow with Howl Log throws STATUS_NO_TRANSACTION exception ** SM-668 - JCAFlow should reject synchronous exchanges ** SM-669 - Statistic file should be named stats.csv instead of stats.cvs ** SM-674 - jbi:installComponent (and others) fails authentication against default SM container ** SM-676 - In the instance2 of the ws-notification example, the org.apache.servicemix.tck.ReceiverComponent should be removed ** SM-677 - FTP connection not recovered after ftp server failure/recovery ** SM-678 - Jsr181Component not using SU classloader to load service interface ** SM-691 - Client.html pages do not work in IE ** SM-692 - http endpoint activation ordering ** SM-697 - Using XSLT servicemix component causes a "java.io.IOException: Too many open files" ** SM-700 - ClientFactory should log problems at warning level as they are not critical ** SM-707 - Subscription Manager and Flow MBeans do not get unregistered. ** SM-722 - ExtendedXMLStreamReader strips whitespaces, which breaks servicemix-http when a SOAP invocation contains whitespace nodes ** SM-723 - ServiceMixClientFacade should not call "done" method ** SM-727 - Schema Import problem in a WSDL which doesn't let the service to be doployed on Servicemix ** SM-732 - Fault-messages cause JbiChannel to throw NullPointerException ** SM-736 - JcaConsumerProcessor.start() fails after subsequent stop() ** SM-738 - Invalid jbi.xml when using maven. no description element ** SM-739 - wsdl for pojos exported by jsr181 endpoint is missing complextypes from other namespaces than the service itself ** SM-742 - JdbcAuditor fails on JBoss ** SM-743 - Deadlock in JBoss Deployer during shutdown ** SM-746 - JettyContextManager does not set the truststore parameters for unmanaged ssl endpoints ** SM-748 - Restart of ServiceUnits using PollingEndpoints fails ** SM-754 - Issues with jsr181 proxies using jaxws + doc/lit wrapped ** SM-757 - Pipeline throws NPE when configured in synchronous mode and an exchange in ERROR status is received ** SM-758 - JBoss Deployer 3.0 Snapshot classloading issues ** SM-759 - Error "Attempted read on closed stream" thrown from jsr181 proxies when dealing with streams ** SM-763 - XPathPredicate should not copy the in message before processing it ** SM-764 - Jsr181 does not respect the transaction semantic (sync + tx) ** SM-765 - JCA provider should close the session after use ** SM-766 - Error whit chracters latin1 when send message in JbiChannel. For example "��" ** SM-771 - An IllegalStateException is generated when using an http provider endpoint when it is deployed using the Servicemix Web war (managed mode). ** SM-775 - Positive preliminary response from server when using FTPSender to send multiple files ** SM-778 - JCAFlow stopped working after updating to 3.1 snapshot ** SM-779 - ISO-8859-1 characters are duplicated ** SM-780 - Bug due to change in proxy support for http binding component ** SM-781 - Re: Bug in ScritpComponent when using "script" attribute ** SM-782 - Re-deploy with In-Only Mep ** SM-783 - build fails under java 6 ** SM-785 - Error in method doGetIds in DefaultJDBCAdapter class ** SM-791 - Problem packaging multiple service unit dependant from the same component ** SM-793 - StandardProviderProcessor does not set exchange status to done for InOnly/RobustInOnly exchanges ** SM-794 - jsr181 proxy does not throw faults correctly when used in jaxws mode ** SM-798 - Cannot start Bridge-SA in Geronimo 1.1 + Servicemix 3.0.1 plugin ** SM-801 - can not deploy bridge-sa in apache-servicemix-3.1-incubating-SNAPSHOT + Geronimo 1.2 Beta ** SM-802 - Refactor the Auditor MBean interface to avoid method overloading (which cause problems with JMX) ** SM-804 - Documentation for XPath Router is missing examples ** SM-805 - Incompatible BPELWSDLLocator between wsdl4j-1.5.2 and wsdl4j-1.6.1 ** SM-808 - Remove Xalan dependency in SourceTransformer (was: Servicemix jboss deployer) ** SM-813 - Unique Column Names for JdbcComponent ** SM-814 - Remove the CONTENT_DOCUMENT_PROPERTY property in SourceTransformer to avoid using an old message when properties are forwarded between components ** SM-816 - useless include log framwork into jboss deployer ** SM-819 - Saxon NullPointerException at INFO level ** SM-824 - Webconsole does not work in Internet Explorer 7
Improvement ** SM-521 - Tuning parameters configuration ** SM-565 - Enhance the JSR181 Proxy so that it can proxy non WSDL publishing components ** SM-569 - Refactor servicemix-common for ease of use ** SM-578 - HttpComponent can not be deployed as managed! ** SM-581 - Use WSDL of servicemix-http endpoint if none is supplied by the target ServiceEndpoint ** SM-586 - Upgrade loan-broker example to lingo 1.1 and use different queues to avoid recieving messages from previous client runs ** SM-591 - Extend the servicemix-commons to provide better classloading semantics ** SM-595 - Replace BoundedLinkedQueue by a standard queue ** SM-596 - add throws DeploymentException to getServices() in AbstractXBeanDeployer ** SM-609 - PropertyExpression should have a default constructor + getters / setters ** SM-612 - servicemix-service-engine could set the scope of servicemix-core to provided ** SM-613 - Remove old XBean related stuff (for ServiceMix v1 compatibility and jbi descriptors parsing) ** SM-614 - Parse jbi descriptors using DOM instead of Spring to remove spring dependency for embedded deployments and add validation with xsd ** SM-615 - Update the jbi maven based samples to be able to deploy the SA from the root dir ** SM-617 - make a new base class, DefaultComponent which combines the Component and Lifecycle functionality and can deal with the SpringComponent behaviour, dealing with statically configured endpoint POJOs ** SM-670 - Including JMSFlow in default servicemix.conf ** SM-675 - MimeMailMarshaler supports multiple recipients but does not support multiple to, cc and bcc adresses ** SM-690 - add ability to setup a proxy for provider endpoints ** SM-701 - Standardized the return of exceptions from the AdminCommandsService, also extended the ANT tasks to provide a deferExceptions settings which if set to true allows you to use the same semantics as the deploy/install directories. ** SM-702 - Components instantiated multiple times ** SM-704 - FTPPoller Improvements ** SM-706 - FilePoller needs to add check for delete file before removing the file from workingset ** SM-708 - ServiceUnitAnalyzer does not create parent spring context ** SM-709 - Upgrade to xbean 2.7 and Spring 2.0 ** SM-710 - Upgrade to jetty 6.0.1 ** SM-711 - Upgrade to woodstox 3.0.2 ** SM-712 - Upgrade to xfire 1.2.2 ** SM-713 - make some time values configurable ** SM-714 - component.properties in conf directory ** SM-717 - Upgrade to geronimo 1.2, jencks 2.0, activemq 4.1, lingo 1.1 ** SM-720 - jbi:projectDeploy recurse all subdirectories for multiProject structure ** SM-726 - Upgrade to backport-util-concurrent 2.2 ** SM-729 - Inverse classloader definition in xbean SU ** SM-751 - Flow tracing with correlation id ** SM-752 - Content-Enricher Implementation ** SM-755 - The EIP pipeline should have another exchange target for faults ** SM-756 - The jms/jca consumer endpoint should be able to rollback transactions when an exchange with an ERROR status comes back ** SM-769 - Authorization entries should be defined per operation ** SM-770 - HttpBridgeServlet is not initialize when using jetty 6.1pre3 ** SM-773 - Ability to change the retryCount on provider endpoints ** SM-776 - Improve support for errors while processing jbi exchange and errors while deleting file ** SM-786 - EIP endpoints should extend the new ProviderEnpoint from servicemix-common ** SM-789 - Change groupId of woodstox to org.codehaus.woodstox ** SM-790 - Support for WSDL2 namespace in MEPs ** SM-815 - Externalize values from main configuration file into a single property file ** SM-818 - polymorphic javabean support ** SM-825 - Duplicated dependencies in the top pom
New Feature ** SM-257 - WSDL 2 support with apache woden ** SM-587 - Allow the connections element of the JBI.xml for a Service Assembly to be provided ** SM-588 - Allow services element for a service unit to be provided ** SM-594 - Introduce an Executor and ExecutorFactory to configure all thread pools inside ServiceMix ** SM-601 - Xslt / XQuery SE ** SM-605 - Ability to configure jbi:projectDeploy goal to exclude updating dependencies ** SM-618 - create a file based servicemix-file service engine with nice support for URIs ** SM-619 - Allow the Maven JBI plugin to inject a default bootstrap if one isnt' specified ** SM-673 - Simplify classloader definition for xbean based SU ** SM-695 - Dynamic HTTP provider endpoint ** SM-696 - Add an operation to the EndpointMBean to allow testing the endpoint through jmx ** SM-705 - Static Parameter map injected into XsltComponent ** SM-734 - Drools 3.0 Service Engine ** SM-747 - JBI compliant SE for Quartz ** SM-753 - Provide a way to retrieve the current MessageExchange from a pure POJO in jsr181 ** SM-767 - Statistics should be available at the endpoint level ** SM-777 - FTPSender could have a possibility to be configured with remote directory option ** SM-803 - Deployment events for a more pluggable hot deployer ** SM-809 - Add a way to copy properties using the EIP wire tap when using splitter / aggregator with a non well-behaving component ** SM-817 - log4j service for changing log levels at runtime
Task ** SM-527 - Source restructuration ** SM-671 - Use RI implementations for activation and javamail instead of geronimo ones ** SM-740 - Move org.apache.servicemix.jbi.audit package in its own module ** SM-741 - Upgrade commons-logging to 1.1 and log4j to 1.2.13 to support the log4j TRACE level ** SM-760 - Use spring exploded beans instead of spring.jar to ease classloader definitions
svn co
For a more detailed view of new features and bug fixes, see the changelog
|
http://servicemix.apache.org/SM/downloads/servicemix-3.1.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
24 May 2012 08:53 [Source: ICIS news]
SINGAPORE (ICIS)--PETRONAS is looking at securing a mixture of 10-12 foreign and local partners in its $20bn (€16bn) Refinery and Petrochemical Integrated Development (RAPID) project in ?xml:namespace>
RAPID has so far drawn in
The massive project that will turn Johor into a regional petrochemical hub is expected to be commissioned by the end of
|
http://www.icis.com/Articles/2012/05/24/9563120/malaysias-petronas-eyes-10-12-partners-in-20bn-rapid-project.html
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
Can Books
a list of all the J2ME related books I know about. The computer industry is fast... applications are the wave of the future, and I would have to agree with them. You can do...-The
Lab-J2ME
A must-have for new and seasoned to J2ME. Excellent
Text Example in J2ME
;
In J2ME programming language canvas class is used to paint and draw the
diagrams. Using the same canvas class we are going to draw a box around the text
in our show text MIDlet Example. We have created a class called CanvasBoxText
Design and Implement GPA Calculator
the program should stop.
Assume that all the courses have the same credits number...Design and Implement GPA Calculator Once the user clicks...*;
import java.awt.*;
import java.awt.event.*;
public class GPACalculator
i have problem with classnofounderror
i have problem with classnofounderror import java.sql.*;
public class Tyagi
{
public static void main (String args[])throws SQLException
{
ResultSet rs;
try
{
Class.forName
Class
. Constructor is the method which name
is same to the class. But there are many difference... that how to to implement
the constructor feature in a class. This program... we assign the name of the method same as
class name. Remember
Implement Complex Number Class
Implement Complex Number Class
You all are aware of Complex Numbers... are going to implement Complex Number class and perform operations on it.
Here... of a+ib, where a and b are real numbers and i is the imaginary unit
i have an ques. of advanced java
i have an ques. of advanced java write a wap to implement AWT by login form
The implement keyword
for using the
implement keyword in a class.
public class DominoPizza...) into a java class.
A class implementing an interface must either
implement all...-separated list of interfaces to be
implement by that class
Implement the Queue in Java
Implement the Queue in Java
In this section, you will learn how to implement the
queue. A queue... in the list separately. Some methods and APIs are explained
below which have been used
Class and interface in same file and accessing the class from a main class in different package
Class and interface in same file and accessing the class from a main class... pattern videos on YouTube, however I have a small doubt on some basic Java concept....
I have some classes Animal.java, Dog.java, an interface Fly.java which also has
i have a problem in spring - Spring
i have a problem in spring spring Aop: how to configure proxyfactorybean in xml file for providing advices for one particular class
j2me
j2me why we extends class MIDlet in j2me application
j2me
j2me i need more points about j2me
i have problem in that program - JavaMail
i have problem in that program 1. Write a multi-threaded Java...,
Try the following code:
import java.io.*;
import java.util.*;
class... = pw;
}
public void run(){
try{
int i;
for (i=1;i<10
j2me
j2me I need fifth sem MCA mobile computing lab programs using j2me. i m beginner for j2me and i want to know how to run j2me programs. pls help
J2ME Timer Animation
J2ME Timer Animation
This application illustrates how to use the Timer class and implement
it in the canvas class. In this Tutorial we have given you a good example
J2ME
J2ME how to use form and canvas is same screen in J2ME
Hi Friend,
Please visit the following link:
I/O stream class.
I/O stream class. Explain the hierarchy of Java I/O stream class.
Hierarchy of Java I/O streams
Have a look at the following link:
Java I/O
j2me
j2me hey i m doing a project
can i create message reader using j2me in nokia phone??
pls give me source code or hint
j2me
j2me in j2me i want to know how to acess third form from the second form.... so need a program for example with more thaan three form
J2ME
J2ME how to change the color of the selected date using J2ME.
i.e. if i press select by taking the cursor on the date ,the color of that digit should change
J2ME
J2ME Hi sir, i need a source code for simple calculator along with buttons in mobile application
J2ME
J2ME.
I am using Canvas. I needed to know, if there is any method to get...J2ME how to get the color of a pixel in J2ME but not in Java... line using J2ME
J2ME Command Class
J2ME Command Class
In the given J2ME Command Class example, we have set the various..., 3
etc. In J2ME commands are used for keeping information of the commands - MobileApplications
J2ME Hi
I want to know how I can downlload J2ME programming and if ypu have any idea about it please help me.
Thank Hi Friend,
Please visit the following links:
http
How to implement this superclass Person - Java Beginners
, and an instructor has a salary. It should have a class definitions...How to implement this superclass Person how to Implement... these classes and methods.
Use the following class as your tester class
How to implement session variables - JSP-Servlet
How to implement session variables Hi,
I have a servlet which gets... below. the servlet response is another jsp page(y). I should put the value of amp_num in the Jsp page (y).
How should i do it? I'm trying using
List in J2ME
the
selected item on the same screen. In the example you can see that we have
created a class and then a constructor of the same class. In the constructor we... List in J2ME
handing multiple pages
J2ME handing multiple pages I have 1 midlet and 1 form. How do i... class? Thanks for helping!!
Midlet codes
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class LoginMidlet extends MIDlet
Implement array of objects
Implement array of objects import java.io.*;
import java.util.*;
public class dataa
{
DataInputStream in=new DataInputStream(System.in);
int i;
int a[i]=int acid[5];
String name1[i]=new String[5
program to implement array of objects
program to implement array of objects import java.io.*;
import java.util.*;
public class dataa
{
DataInputStream in=new DataInputStream(System.in);
int i;
int a[i]=int acid[5];
String name1[i]=new String - MobileApplications
j2me Hi,
I have developed a midlet application in j2me now i want to install it in mobile from my WAP site i given a link of JAR file over at WAP... it is opening the corrupt format page. It is not getting install. If i put this jar in ZIP
J2ME question
J2ME question Lets say i have 2 screens. One for new user, another... to choose which category are they. How do i call the screen for new user when the user chooses "new user". IM stuck at if command part
J2ME Tutorials
J2ME Tutorial
are trying to create list using of List class.
List in J2ME... and class to draw a line.
Draw Rectangle in J2ME
In this series of J2ME examples and tutorials, we have introduced you
java: implement a class queue
java: implement a class queue Implement a class Queue which supports the following operations:
boolean isEmpty()
Returns true if the queue is empty, and false otherwise.
int peak()
Returns the value at the front of a non
In Java I have append to an existing string efficiently
In Java I have append to an existing string efficiently Hi,
In a Java program I have to append to a existing string more efficiently so... for this?
Thanks
Hi,
You should use the StringBuilder class
groupby implement in java
groupby implement in java **import java.io.BufferedReader;
import...;
import java.util.Hashtable;
import java.util.Vector;
public class FileReading...(sCurrentLine+delimeter+"1","same",vec,delimeter
j2me - MobileApplications
j2me
I have created a application .
on the first page...") gives me current language i.e. en-us.
now i want change the language to french.
how can i do it?
please answer @ earliest
j2me - MobileApplications
j2me i am trying to load one image in j2me program..but get an exception class not found exception....this is d code..i put the image in src folder... class Midlet extends MIDlet
implements CommandListener
{
private Display
J2ME Frame Animation
J2ME Frame Animation
This application shows to set the Frame Animation and implement it in the canvas class.
In this example we are creating a frame using Gauge class. When
I couldn't solve it
are required to implement the following:
Class LicensingOffice which keeps track...I couldn't solve it *A customer who wants to apply for getting a car... the number of employees working in the office. Provide the class with the following
j2me - MobileApplications
j2me Hi Deepak,
Thank for u earlier suggestion.But i need its date and time when the file was created.But i got solution...*;
public class getCreationDate {
public static void main (String args?
multiple records on same panel
multiple records on same panel i have multiple access of records and i want to display all of them at one panel.Each time a new panel opens for a keyrecord , i want just to show records on same panel or frame, whatever u can
Help
Custom Item in J2ME
in your J2ME applications. In this Midlet, we have tried to do the same
thing... Custom Item in J2ME
In J2ME applications, Custom Items can be created by programmers
j2me- how to subtract time s in j2me???
j2me- how to subtract time s in j2me??? hello everyone!! Am a final year student doing BCA!!
I have taken up j2me as my project and am trying to do...:sec). and i want to add certain features to the app like emergency numbers
Implement Date Class
Implement Date Class
The class Date represents a specific instant in time. It allowed the
interpretation of dates as year, month, day, hour, minute... are going to implement Date Class.
Here is the code:
public class Date
I have crude application
I have crude application I have crude application, how to load into this roseindia.net
regarding j2me - Java Beginners
regarding j2me sir but i have to use the drawString u tell me how can i display two too long strings
Implement push
Implement push Hi..
How do you implement push on a flex applications?
give me answer with example so i clearly understand
Thanks Ans: push implement on a flex applications using BlazeDS Server
J2ME project on handled device
J2ME project on handled device Dear,
I have been assigned with a J2ME project on handled device. Well i have a little bit knowledge about J2ME but i have to present this project.
If u have a demo project on handled device
i want to retriev and update in same form but its not working pls help....
i want to retriev and update in same form but its not working pls help.... ...>PASSPORT SERVICE</h1></a>
<div class="description...">
<a href="useracc.html">HOME</a>
<div class
j2me with xml - Java Beginners
j2me with xml
shahzad.aziz1@gmail.com
i am working in j2me and i want to read and display data using xml file. In j2me application KXML PARSER... bin.EventList
2- Class loading error: Wrong name.... Build failed
i follow all
J2ME - Java Beginners
J2ME I have to Create a currency conversion application that converts between three currencies..............pls show me the coding or mail me the code to rdx_ruLz@hotmail.com.....................thank you
|
http://www.roseindia.net/tutorialhelp/comment/60248
|
CC-MAIN-2015-06
|
en
|
refinedweb
|
GREPPER
SEARCH
SNIPPETS
USAGE DOCS
INSTALL GREPPER
All Languages
>>
Whatever
>>
In the default daemon configuration on Windows , the docker client must be run elevated to connect.
“In the default daemon configuration on Windows , the docker client must be run elevated to connect.” Code Answer
In the default daemon configuration on Windows , the docker client must be run elevated to connect.
whatever by
Busy Bat
on May 20 2020
Donate
Comment
1
docker-machine env --shell cmd default
Source:
stackoverflow.com
Add a Grepper Answer
Whatever answers related to “In the default daemon configuration on Windows , the docker client must be run elevated to connect.”
can i run docker on windows
Cannot connect to the Docker daemon at tcp://0.0.0.0:2375. Is the docker daemon running?
cloud run error: container failed to start. failed to start and then listen on the port defined by the port environment variable.
Couldn't connect to Docker daemon at http+docker://localhost
docker access denied windows 10
docker daemon
docker daemon bind to host and port
docker daemon is not running
docker flask can't connect
docker run port forward
docker windows browser can't see the server
docker: error during connect: In the default daemon configuration on Windows
docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post "": open //./pipe/docker_engine:
docker: Error response from daemon: dial unix docker.raw.sock: connect: no such file or directory
docker: Error response from daemon: Get: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: no such host. in windows
error during connect: Get:
Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: ZONE_CONFLICT: 'docker0' already bound to a zone
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
ERROR: Get
failed to start daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid
Failed to start Docker Application Container Engine
how to start docker
macbook Couldn't connect to Docker daemon - you might need to run `docker-machine start default`
run redis o docker no auth
start docker service on windows
Start the Docker daemon
this error may indicate that the docker daemon is not running
Whatever queries related to “In the default daemon configuration on Windows , the docker client must be run elevated to connect.”
error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privil eges to connect.. windows 10
In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect
In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Get "":
n the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.
In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Get: open //./pipe/docker_engine: The system cannot find the file specified.
docker error during connect in the default daemon configuration on windows
In the default daemon configuration on Windows, the docker client must be ru n elevated to connect.
in the default daemon configuration on windows the docker client must be run elevated to privil
windows
docker: error during connect: This error may indicate that the docker daemon is not running.: Post: open //./pipe/doc
docker: error during connect: This error may indicate that the docker daemon is not running.: Post: open //./pipe/docker_engine: O sistema não pode encontrar o arquivo especificado.
docker windows server elevated
This error may indicate that the docker daemon is not running.
error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.:
docker: error during connect: This error may indicate that the docker daemon is not running.: Post: open //./pipe/docker_engine: The system cannot find the file specified.
error during connect: This error may indicate that the docker daemon is not running.
ocker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
error during connect: This error may indicate that the docker daemon is not running.:
error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect
In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running. (docker.go:894:0s)
In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect
In the default daemon configuration on Windows, the docker client
this error may indicate that the docker daemon is not running
error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.
this error may also indicate that the docker daemon
error during connect: This error may indicate that the docker daemon is not running
the docker client must be run elevated to connect windows 7
ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
docker client must be run elevated to connect
error during connect: This error may indicate that the docker daemon is not running.: Post: open //./pipe/docker_engine: The system cannot find the file specified.
docker: error during connect: In the default daemon configuration on Windows
Couldn't connect to Docker daemon - you might need to run `docker-machine start default`
docker: error during connect: This error may indicate that the docker daemon is not running.:
rror during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect
docker: error during connect: This error may indicate that the docker daemon is not running.
In the default daemon configuration on Windows, the docker client must be run with elevated privileges
In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running
docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.
docker: error during connect: This error may indicate that the docker daemon is not running
error during connect: This error may indicate that the docker daemon is not running.: Get: open //./pipe/docker_engine: The system cannot find the file specified.
In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.
error during connect: This error may indicate that the docker daemon is not running.: Get: open //./pipe/docker_engine: The system cannot find the file specified.
docker error during connect post http
Post: open //./pipe/docker_engine: window 10
Post: open //./pipe/docker_engine:
the docker client must be elevated to connect
jenkins In the default daemon configuration on Windows, the docker client must be run elevated to connect.
docker daemon is not running windows
In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon isnot running.
In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
elevate docker client
In the default daemon configuration on Windows, the docker client must be run elevated to connect
open //./pipe/docker_engine: Le fichier spécifié est introuvable. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
the docker client must be run elevated to connect. This error may also indicate that the docker daemon
In the default daemon configuration on Windows
the docker client must be run elevated to connect.
The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect.
docker client must be run elevated to connect wundows
this error may also indicate that the docker daemon is not running
O sistema não pode encontrar o arquivo especificado. In the default daemon configuration on Windows, the docker client must be run elevated to connect
The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
he system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
open //./pipe/docker_engine: Access is denied. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
In the default daemon configuration on Windows, the docker client must be run elevated to connect.
Cannot open com.docker.service service on computer
In the default daemon configuration on Windows, the docker client must be run elevated to connect
This error may also indicate that the docker daemon is not running.
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
More “Kinda” Related Whatever Answers
View All Whatever Answers »
reset shopware password
how to change your spotify username pc
how to check wifi password using cmd
yup validation password advanced
alter user password postgres
razorpay sandbox test credentials
mysql_secure_installation
get sha1 mac
create db user postgres
stripe api accounts transfer to bank
drupal 8 get user
ue_log
RegExp validation for password explained
audacity stereo to mono
var_dump to log
fivem permissions
ue4 log
discord py edit message
godot get scene root
godot get root node
default raspberry pi login
regex for email
solidus default password
console log formdata
wordpress asking for ftp credentials
heroku login mismatch ip address
fivem registercommand
list of certificates in keystore
keybr.com
change password of user mariadb
disableforiegn key check
setup password psql
regex to verify email
how to set discord bot presence
yup password validation
regex javascript password
discord developer mode
Connection could not be established with host smtp.googlemail.com
log message from jni
default solidus username password
licence key fl studio 2020
password regex
paytm testing credentials
magento2 create admin user command line
yup phone validation
get sha256 has code using powershell
apex get current user id
invalid common user or role name
how to connect postgres user password using command line
magento 2 custom logging
zurb email first second
restoro license key free
How to Generate SHA -1 fingerprint certificate for firebase android project
create user mariadb
genrate crud using command yii2
Command "make:auth" is not defined. Did you mean one of these? make:cast
mailchimp api endpoint
how to know when your windows password will expire
debug log ue4
change password jks file
godot check if in exported version
name = input("What is your name? ") print("So you call yourself " + name + " huh?")
deprecated filter_var() phpmailer
paytm wallet test otp
why doesn't facebook let us have fake names
justthebridger
doVerify() must be an instance of Lcobucci\\JWT\\Signer\\Key
yesn't
default prox mox username
ssh ignore host key verification
if(guess_password == list(password):
knox token experation time
S4913V09H1
2927260.eps 2927262.jpg 2927263.ai License free.txt License premium.txt
Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 f2sm17674989iop.6 - gsmtp
dupont manual address
your responsibilities
wp_mail
SMTP ERROR: Password command failed: 535-5.7.8 Username and Password not accepted.
disable 2 step verification apple
blacklist header logging restassured
crepchiefnotify
okuru token
@everyone
password filetype:docx site:starbucks.com
fortigate vm default credentials
"i see i t i seen it i will impliement thank uyou"
regex email address
k8s env variable own name
how do you create two metamask accounts
smtpauthenticationerror
5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
user stories template
testing authentication required stripe
is hypixel pay to win
console.llog
vap-sure
Perforce password (P4PASSWD) invalid or unset.
ieuser password
paypal owner man
To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host
WordPress AJAX Login Without a Plugin
send email with name
curl -X POST \
chrome import password csv
wordpress bitnami password
laravel create default admin user
allan please add details
fivem groups
what is the difference between roles and permissions
what is role of public key in ssh
msg author is a bot
laravel faker seeder
keytool list certificates
github actions set ssh key
fivem roles
voicemod pro free account
regex generator for password
audit
final messageText = message.data['text'];
yup number validation custom message
test cases for login page
discord bot status
rout debug symfony command
Password RegExp
debug.log
The user name or passphrase you entered is not correct.
Command "make:auth" is not defined
how to get the auth id in lravael
certbot create manual new certificate
drupal 8 get service
User List get Role Name mvc 5
google login issue ionic
authentication vs authorization
how to login using a particular user postrges
magento cli create admin user
cron logs
mailbox
how to extract email id from website
android developer sha1 fingerprint
check heroku logs
how do you use log4j
authur jeffries
how to see detail from process id
grant user all privileges
unique identifier guid example
how to log to the console
outlook mac attach email
yup phone number
New SSH key Github
invoice receipt
erc20 token standard
pihole change password
how to undisable my discord account
ten min email
how to logs
mysql change password
vuejs jwt authentication example
discord bot presence
github generate new ssh key
discord embed empty field
wordpress rest api register user
postgres create user with superuser privileges
what is user story
list cron jobs for all users
discord developer portal
which authentication you used
booostrap signup from
wordpress get current user role
default credentials gcp without browser
git client
git save credentials
Which command would you use to view the history of commits
ahk send
difference between authentication and authorization
slack message curl
if else autohotkey
email valid android and whitelist this origin for your project's client ID.
joi phone number validation
role
heroku login IP address mismatch
show users
command to set user password to never expire in windows
rtl8812au driver
kivy password mask
send email xampp
ssh with key
create public key from private
Cannot find module 'angular2-jwt/angular2-jwt'. 2 import { AuthHttp } from "angular2-jwt/angular2-jwt";
regrex for password
how to list ssh keys
how to make a working login system using code
facebook login issue ionic
what is authorization
2048 bot
yup change error message
Yup password confirm password
definition of user story
what is keyup and keydown
applet"
uuidv4
action hook in wordpress after user registration
plesk email
you must use a personal access token with 'read_repository'
jsonwebtoken generate key
navicat premium key generator
register to vote
Cannot send message without a sender address
django secret key
ssl certificates
paygate payment gateway integration
check if bot has permission discord.js
keytool command sha256
error let's encrypt validation status 400 vestacp
login and registration form
use certbot to generate certificate
sending email with django
Please enter a commit message
install passport local
what is authentication
get current logged in user id in apex
how to take input from user in xcode
aes encryption key fortnite
discord ssl certificate error
sha1 release key android
token
jwt generate token
ssh user password example
ssh - use public key to login
cross validation
password must be 6 characters i mvc
how to reply to thank you
not a valid key=value pair (missing equal-sign) in authorization header 'bearer
paytm test credentials
sunlearn login
run command without sudo password
flutter login authentication api
how to get instagram access token
invalid principal in policy
flask_mail
get public key from certificate
create ssh keys
sbi customer care
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods
unifi keystore password
generate sha key
user_agents
what characters are allowed in an email address
codeigniter send email using smtp gmail
fivem get your identifiers
passport install
Checking if user is a member of the Hyper-V Administrators group ... FAIL
username regex
share link to email
default password for postgres
get channel discord.js
password manager
sendmail "-x" sample
disable ssh password login
passport generate key
input type email
hidden authenticity_token
list ad groups
autohotkey hotkeys
change keystore password
Debug signing certificate SHA-1 flutter
autohotkey message box
Auth::routes(['register' => false]); not working
useradd postgres
login and register form codepen
forgot webmin password
Route [verification.notice] not defined.
change email in git
csrf token method
yup min validation with error message
expo cli change account
administrator
identity add role to user
Action Mailer attachment as URL
keystore get key hashes
Member Count Discord.js
laravel-csrf-token-mismatch
set authorisation headers on form submit
ORA-65096: invalid common user or role name
if user name is wordpress
how to know username apps script
Current user cannot act as service account 881087019435-compute@developer.gserviceaccount.com
or create a self signed certificate openssl in csr
activate internal logging nlog
const emoji = bot.emojis.cache.get("emoji id") message.channel.send(`${emoji}`)
usdt token address
identity server change login url
check twig if user has role
ORACLE STORED PROCEDURE TO ALTER PASSWORD
regex[ress for password
quasar router authentication
mikrotik ssh passwordless
zenmate activation key
Field emailSender in com.optum.link.security.importer.utils.SendMail required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found.
Git config --list to list all the settings
generate keystore on mac
cron not showing notifications
booostrap signup
logout lumen passport
update role spatie
default password for oc login in minishift
Creating mailbox file: File exists
generate serial uuid with intelij
passed to Lcobucci\JWT\Signer\Hmac::doVerify() must be an instance of Lcobucci\JWT\Signer\Key, null given,
auth0 access token
send email in php
User.Identity.Name username
dm all roles with a message
audacious
skovmand/mailchimp-laravel
(#100) pages public content access requires either app secret proof or an app token
runas with password
describe your role
Django Create Super user
goto autohotkey
auth0 npm
how to put show password input field eye
Route::group(['middleware'=>'auth'], function() {
check user by id discord js
how to extract the username of the first 500 followers using selenium
default credentials git
how to generate my RSA key pair
generate ssh in ubuntu
php check if passwords match
how to setup letsencrypt automatic renewal
swal mail
contact count on account trigger
Django Change Password
how to fix The information you’re about to submit is not secure
jwt validate token wordpress
typeorm auto increment id
login-form-html
return confirm sweet alert
mailto generator
linkedin connection message example
what is bearer token
generate key
Django Custom user model
expected response code 250 but got code "535", with message "535-5.7.8 username and password not accepted
logrotate
google cloud sdk login
validate email
how to get a key input
How to allow permission to my new github account
free professional email
wordpress get wp roles
You have multiple authentication backends configured and therefore must provide the `backend` argument or set the `backend` attribute on the user.
how to send a message using discord.js
Debug.Log(Input.GetKey)
decode csrf token online
login-form-css
uuid
Syntax error on token(s), misplaced construct(s)
stripe sdk
can we decrypt sha256
what is an SSL certificate
discord dev portal
What are user defined exceptions
instamojo payment gateway integration
generate private key for jwt
verify
how to point user stories
get users by role name - spatie/laravel-permission
sha-1 fingerprint of keystore certificate
what is log4j
what is oauth2 authentication
No hint path defined for [mail].
paypal testing card details
?id=$1&user=$2
transaction id in paypal gateway integration key stackoverflow
enable basic auth spring boot for certain roles
ad suduer
promt user input C
if(Hash::check($request->old_password,$current_user->password))
tenant meaning
Access ID: Seastham470 Password:1Meanguy!
change author word document
eris web dashboard discord
record log users in spring
mpm bcrypt
To give permission to the specific user for the CRUD operation in the database at a time
oauth twitter
login with facebook get phone number in response
gaured class auth
You're in! You're in! See your nickname on screen? See your nickname on screen? Shiv_73
new password confirm password validation in ionic 5
how to put gmail in cloudfare mx record
webmin postfix email receive
contactless thermometer using esp8266
installing jwt in django
wdio config firefox geckodriver
debug.log rigidbpdy
k7yKJk8vdjHvw56q7bCTxibvT
hidden_field_tag authenticity_token
add user to root group
change password view
verificar password flutter stream
crud application in mean stack
facebook invalid scopes manage_pages. this message is only shown to developers
how to spell premium
myxtremnet.cm login
site: bal:1
phone number authentication
Google Cloud Auth
knowage default login username
updated the mail id in sucuri security plugin
github user
hashpass
'/MSIE\s(?P<v>\d+)/i', @$_SERVER['HTTP_USER_AGENT'], $B) && $B['v'] <= 11
RFC 7231
utorrent log file
how to test signature patch api on developer console
django.contrib.messages
you are not allowed to manage 'ela-attach' attachments
welcome discord.js
Django Give normal user privileges using python shell
An Admin want to automate a business process that need input from users whether they're employees or customers. Identify the correct tool for this requirement
@Sanchit64054668
kryptos message
return Hash::check($value, auth()->user()->password);
user login register with laraevl passport
c# authorize attribute roles
x-auth-type none
passport documents
oracle grant Roles to user
sm1_s905x3_4g_1gbit
reset upi id
jsdelivr discord
EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key
Django LogEntry or Change History
vercel login
accounts.google.co.uk uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe.
JWT Settings
mysql root issues
wp create user programmatically
bcrypt documentation
full name validation
telegram i can i archive chat but when new message comes it comes back
validate rsa id number
change password urls
default merge variables in MailChimp
singning in using username rails
var usuarioId = UUID randomUUID().toString()
how many key are in keyboard
root mysqu.
secret
fluent validation email address regex
log if validation fails api
idrac password
how to do password confirm in Yup
exchange online powershell login
passport-google
what is the deadline to apply for microsoft learn student ambassador program??
mysql default -temp password
mod status config file
net user command to check user account
tinashalom gmail
can not get email address from your social account facebook
find all mailbox delegeations for user
Guideline 5.1.2 - Legal- App Tracking Transparency to request the user's permission
sending a text message with lambda using a database of phone numbers
how To get the release certificate fingerprint:
aubsis
check the role of user in on_message discord.py
Laravel polimorfic faker
welcome ui
sudo pure-pw useradd upload -u $USER -g ftpgroup -d "$PWD" -m <<EOF
disable self purchasing office365
generating ssh key
paypal payment form
setting ssh for github
danghaphuong678@gmail.com
how to set invite manager welcome channel
oauth 2
SPF cause my mail to be rejected
why generatevalue auto not working
what makes the bot talk? is there a word i have to say?
{ "logref": "c7396e36-aebe-4a75-85be-1b0e7dcf4818", "message": "Invalid stage variable value of key environment. Please use values with alphanumeric characters and the symbols ' ', -', '.', '_', ':', '/', '?', '&', '=', and ','." }
validator_isEmail()
postifx add user without create system user account
JEW token authentication in Django UTC
csrf token
auto hot keys
django breadcrumbs
automate Enter passphrase for key mac
what are the scopes required for google sign in
strapi change user password
login form tutorialpoint
how to set custom notification in telegram
validate id number
cant login into hybris commerce backoffice locally
logger ruby
discord enable disabled account
SSH key
usercreationform
reset umbraco password in database
discord.js verify
logging when validation fails
idrac default password
exchange online powershell logout
y7u3t6wf8gm,9ev7hs46ergfjkilo9p0+cvgp4kloj78ts65yjh4f8v79bw35h0g724
JS uramy8e7jth6klryes8hrd8utduf6kgiyes48w7iy6rdjfcghe49u
heroku create super user
environment in your company
laravel php artisan tinker test email
Regex to get reddit comment/submission ID from permalink
logger
default admin password for raspebry pi
how to pluck email from users records
Facebook Login Error Invalid Scope
failed to authenticate on smtp server with username using 3 possible authenticators. authenticator login returned expected response code 235 but got code "535", with message "535-5.7.8 username and password not accepted.
rithwik message
WMIC useraccount get name,sid
sending keystrokes in c
ramyaram2291998@gmail.com
set auth token flutter http
%LOCALAPPDATA%\ExpressVPN\v4\Log\
how to generate logs
verify hash windows 10
system.getproperty("user.dir");
django group permissions method
"client_id": "UKqD7KfvjqALwwskzOVdHg\u003d\u003d",
sonata default crud actions
send money to payal account using api
set _id to id
Hello! We would love to talk to you. Under the EU General Data Protection regulation, we need your approval for the use of personal information (e.g. your name and email). Is this ok with you?
ejs jwt authentication
lack of information in user story
get_user_info
JET token authentication in Django UTC
pug registeration form
Show a Wi-Fi password with Terminal
java login/sign up
how many types of printer configuration based on users
create new logfile with some initial text in logback
passport google oath20
custom user
online advertising services
does a team answer also register as an entry in "My Answers"
data annotation for passwords
internal hashcode1
how to print user name in by passing created by id
query for new messages using gmail api
Property 'users' does not exist on type 'UsersDTO[]'. 29 if (saveUser.users.length < 1) {
lostvariables.tech
Pertama kali running wajib Login menggunakan username dan password jika tidak sesuai dengan username dan password di database maka tidak bisa login (ada notifikasi).
how many environment in your company
ssh passwordless ssh-copy-id
djufyg7y5quIC9UJDDEHBU89JHBYU8J8HBU8JH8JHBVGYGH78UU7HYGBVBYH7U8JN
\MrShan0\CryptoLib\CryptoLib() how it works in yii2
MESSAGEdb
grafana docker password
is a command to create a user account named serena, including a home directory and a description.
Confirm alert
check auth credential laravel
need basic realm
auth guard
AuthenticationTypes.Federation
hey email
Create RS256 JWT linux
author of namesake
whatsapp web algorithem author
ssh config only key
flutter widget username email nice looking
show read unread section in gmail
UUWUUUUU
drupal 8 change password reset link
why didn't jessica tell harvey about the confidentiality agreement
browser uniqe device id
selenium pre login
gmail login
knox token lifetime
codeigniter login with session
client.login discord.js
match cab aujourd'hui
what to do if missing information on user story
php.ini smtp
pesapal payment gateway response
JET token authentication in Django UTC-1
do you write user stories
nice username for instagram
The token has already been used. Each token can only be used once to create a source.
>
check if token is expired
I had something to say but then I forgot it
phpmailer 5 string attachment
django give access to media folder
erpnext get password field
beef xss default password
totp key and token code implementation
create user and give permissions
what is SMS authentication
rspec validate access_token
how to leave an organisation github
reset domain password multipl;e users
#@923uf8023hFO@I#H#
what is verify
langenderferc@gmail.com
extracting token
discord force devices to logout
status code login success
Login with Facebook config in .env file
lostvariables
Google Auth with NextJS
what do you use for logging
solidity how to make a contract where only the owner can withdraw ether 0.7
login functionality
How to Create a SAML 2.0 Service Provider Partner(SP)/Configure OAM as a SAML 2.0 Identity Provider (IdP)
multipass snap
openssl create certificate with private key
create configmap
Auth your client google apis for android
password pattern regex android
Change fn keys to default not to multimedia keys
Instance Credential
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Why is #_=_ appended to the redirect URI? passport facebook
cryptophane delete secret key
minimum age for gmail account in india
wpconfig wp debug
how to get current user detail in lwc
sendgrid message: 'The from email does not contain a valid address.'
validation and verification
valid audience token
arch Term:“x2g-TtY-ga8-sZQsettings Your personal account
braintree payment method token
Registration serializer
utxo model vs account model
activeadmin.register with default_scope
Sending an php website email form
log 12345245676734256
who writes user stories
comment configurer un webhook discord
sending to git
""
how to look for issues you are assignd to on github
With a .name you can:
getkey
Which demat account is best in India Quora
usersettings
create var for google strategy
user not able to fill
processing login user
how to implement passwordless SMS
Oauth2 Full authentication is required to access this resource
phpmailer
autohotkey coment
Define the "integrity rules"
projectsupreme password\
how to extract token
generate ssh key
sighning key
login functionality test scenarios
Nextjs auth0 error);
how to make a owner joined script
platformer lua
discord.js ADMINISTRATOR commend
Check if user logged in Wordpress through JS
activerecord logger
private void checkAnswer(boolean userPressedTrue) { ... mQuestionsAnswered[mCurrentIndex] = true; mTrueButton.setEnabled(false); mFalseButton.setEnabled(false); ... }
generate strong shared key
premiumsellersub
omonoia - grenada
how to spell administrator
Co-22R-DWXwwU8bn_fvZKdXiJott_8hdqp1k
nextcloud letsencrypt
get current logged-in user details in Laravel
spice param logarithmic
udg:///dev/ttyUSB0
mail sending setting magneto for mailhog
laravel: get last id
Registration view
sign tool windows
discord guild.members not working
In order to sign multiple certificates from the same CA + cert-manager
auto logout when session expires laravel
smtpjs
ftp login wordpress not working
how to set application key in lumen
Drush site URI is set to
sha1 realese key
google map disable info window
shakhbozbek7@gmail.com
bitbucket keeps asking for password
efundi login
logger magento2
who is guruthecoder
phpmyadmin timedeconnexion : a placer tt en bas dans "config.inc.php"
mikrotik address list log into file
powerapps send email from other account
vue auth guard
markdown email
traefik middleware authe home
what is your role
change password swing gui
android key generator ssh1
microsoft teams microphone settings
crouton
1734512312
th:if="${#authorization.expression('hasRole(''ADMIN'')
react sending email via Nodemailer using node.js
Apple (au)
telegram variables
membership type= currentusergroups caml
ssh force use password
bcnf
ev. DJANGO CREATE ACC
symfony 5 user management
Creating auth
you have been logged out because your authentication ticket
order total is invalid paypal
pop token
hcc scholarship login
Temporary password has expired and must be reset by an administrator
verify a transaction paystack
password:req yes
not valid RSA key for paramiko
woocommerce create client account without email
web developer near me
twitter bot know if you already retweeted
registration url
how to verify dns settings in mailgun
klavyio manage k maill ists
resource owner password credentials flow oauth
mailpoet 3 rgpd
mailchimp api to check a wordpress users subscription status
sending emails with django
bybon get username
get emails without browser
gcloud show account
${802160913301110795} discord
extract domain name from email id mariadb
github name servers
cancel payment link in razorpay API reference
Who is Novaleigh Bui
laravel authenticate
wordpress basic auth
create master key
spotify keeps pausing pc
Facebook wordpress Login Error: There is an error in logging you into this application. Please try again later.
does brexit make my passport expire
your role
.mylocationtrackoverfbdb
Failed to refresh tokens. Failed to get credentials.
telus invalid session key
read://https_robodaloto.com.br/?url=
spotify developer requirements
send in blue Please provide Email or SMS attribute value to create user
fstab uuid
git apply
MultiValueDictKeyError at /user/register
site:lapd.cj.edu.ro login
how much student loan bank give quora
myecampus login
Creating blog auth
abp session logged in user
generate a token auth0
paytm payment gateway test credentials
drupa 8 how to output to messages are on page
spacy config
google dork code for failed login passwords
loggerInterceptor
recordtypeid from developername
messaging/registration-token-not-registered
rails jwt create
the erc20 token standard Functions
role of documentation
not a valid RSA key
otp based login android
login view
product id in facebook api
providing that information is not modified by malicious users in a way that is not detectable by authorasid users
echo apikey auth
how to decrypt wpa2-psk password
how to apply filter gmail
irc register nickname
password recovery on aws for wordpress website
git cresidential
read://https_
step by step local startegy login and refistarttion with passport
brantasabibraya17@gmail.com
log vala
specify the own log file name using the property
TextInput is email type
lex program to identify token
Customer cus_**** does not have a linked source with ID tok_****
how to make an account system
cross validation error
app script for google forms to email app
your role as tester
no billing attempt event in shopify webhook
syslog message format example
build all directadmin
Failed to refresh tokens. Failed to get credentials amplify
rusherhack client
transaction fee in paystack customization
github use key
Django Zoho CRM Create
Accounts.emailTemplates
If (e.KeyChar < Chr(48) Or e.KeyChar > (57)) And e.KeyChar <> Chr(8) Then e.Handled = True End If
phpstorm entity identification
security+
paypal gateway has reject due to billing adrees
Creating home auth
process ID smartgaga unknowncheats
candidate key
what is the minimum account that can be withdrawn through jazzcash from payoneer
drush: change username
get_flashed_messages
wp add role capabilities
TIdEmailAddressItem undeclared
login urls
Sample code Exposure Notification API
Got Http response code 400 when accessing.
online identity
how to import token from .env file discord bot
discord.js get server guild id
filetype:cfg login "LoginServer="
excel sheet password breaker
Send discord webhook message with autohotkey
caliburn.micro support for passwordbox
how to make a login form discord.js part 1
Is there a way to configure wifi credentails to ardunio uno wifi with laptop
cyberpanel is issuing self signed certificate
1614604273000
founder of cognizant
how to create to register with email in c language
how to add kali and root to my username.txt file
ClamAv scan virus and send an email when finish
your card was declined. try a different card. paypal sandbox
add slide delete emails on gmail
Usercan havemany addresseds
telegram telethon get new user details
specfing location in encrypt.key-store.location
log 17
await _userManager.AddToRoleAsync(user.Id, "Admin");
passport-google-oauth2 cookies
set the seesion smessage win laravle
Enter PIN for authenticator:
generate UUID id for my entities
Define the author of a page:
rédiger des user stories
Keycloak: How to login only through identity provider
useref
Account age not enough script
print (Username 'is a fine name')
console log utf-16
paypal sdk script
allprivatekeys.com 3JurbUwpsAPqvUkwLM5CtwnEWrNnUKJNoD site:allprivatekeys.com
active storage validations
finding commit using a message
guard-rspec
Creating home class auth
discord push to talk not working on pubg mobile
paypal amount breackdown
simple mail service
github user api
applescript voice control
describe optional auth in OpenAPI
loguru - logger exceptions
payhere integration
enter your user D!
change password serializer
powerapps Office365Outlook email html
inurl:/mailscanner/login.php
Generating Public and Private Key
check sendmail logs
session.inputs.count > 0 && session.outputs.count > 0
discord.js reason
get cookies in request (xamarin form)
facebook get profile picture after user logins into website
updated the mail id in wordfence
ens name
selenium code for login
LDAP query to test if user is member or group
mail_form heroku
No such token: stripe payment
github invalid username or password
deviceTag" : 1188439051
best public license
autohotkey
bcrypt
best encryption
audacity download
generate sha1 key for facebook login android
hulu login
nginx access log format
validate email function
aruba webmail
contact form 7 recaptcha
csrf token djnago
stripe customer subscription creation
discord.com home page
verification
nodemailer Error: self signed certificate in certificate chain
non fungible tokens
smtplib not sending email
junior software developer resume examples
login.php
stripe payment refund
LOGGING
taggeddocument gensim example
required
create subscription using cust id in stripe
reddit user count
ecitizen login
how do you logging
browser fingerprint
dupont manual phone number
sha256_crypt.verify
what is verification
reply to a message discord.py
regex to filter login script injection
SEND MESSAGE PERSON ID DISCORD.JS
discord deafen glitch authuser=1
password = sdf345 password.isalpha()
randomuser
i cant log in on google
sorcery check if activation mail was sent
gpg generate key have the encryption capability enabled
forgot mamp root password
form contatti con regione provincia comune
anti spam formulaire contact
creating a payment module for litecart
@typeit/discord
how to add an admin form customer email dropdown in magento 2
ometv without login
nativescript whatsapp status template
required in password field fluid typo3
Sync your account with Bitrise
WebSecurityConfig
how to restrict the user to input english language
Get list mailchip stackoverflow
An organization has decided to give bonus of 25% to employee if the employees year of service is more than 10 years. Program will ask user for their salary and year of service and display the net bonus amount employee will received.
Discord bot client login
gpg -user
qt send email with mail default application
krbtgt password reset and canary files
users/self/feed
Ensure password expiration is 90 days or less
https://[kpi-url]/token/
how do you enforce business rules on a database
remind101/formulae/assume-role
Votre message ne contient pas d'en-tête List-Unsubscribe internet address - use precise location - learn more helpsend feedbackprivacyterms - did not match any book results. search results
minhtri345671
desencriptar contraseña sha512
how to make a group inviter for sl
how to update a roundcube mails in my cpanel
grab internet passwords and mail them to gmail payloads
tree listing in mac
controller to render static data symfony
how to get the player character roblox script
london 50's buildings
punk creeper platform shoes cheap
scrapy itemloader example
print("Minus - 12")
self.new_from_db
tutorials on appsync graphql transformation
english to japanese
google transalte
german english
traductor google
japanese translator
malay to english
pashto to urdu
google translate english to german
google traduction
flutter future builder
word reference
latex sum
using pip windows cmd
how to know the ip address of my pc using
ping
amc stock price
radio button vue
black jack
spring boot run command
moment format date
contains text xpath
flutter raisedbutton example
flutter input text in container
text align center bootstrap
onclick href
itemize latex
how to center a form in bootstrap
find gameobject with tag\
mac active developer path
text-decoration:none; bootstrap
import error no module pip
fontawesome.com mak icon bigger
gson dependency android
add image in markdown
flutter checkbox
in url
glorious model o
krunker io
textfield border flutter
flutter setup macos
portainer
url in latex
minecraft server startup code
expo cli
logging levels hierarchy
How to link multiple docker-compose services via network
RuntimeError: CUDA out of memory.
intext:”Dumping data for table ‘orders’”
rat hole meaning
realtime firebase database : How to check if document exists
series to string
fnaf
html transition
ggplot histogram two groups
google no index no follow tag
xcode archive window
integral e^x/x metodo simpson
linkedlist add element
check if product is discounted
yarn audit fix
sqlite describe table
Serilog.Settings.Configuration
codeigniter 4 starter
mpi_send and mpi_recv
vue disabled
php artisan serve stop
currunt location in flutter
Swift_TransportException Cannot send message without a sender address
javascript destructuring
copy content to clipboard windoesa
disable axis matlab
stack divs without absolute positioning
center form group bootstrap
phpstorm keyboard shortcuts hide menu bar
offset anchor tag when scrolling
how to add people on monster legends
code for a text box in imgui
paytm payment gateway android studio
tower of hanoi worst case time complexity
logging in flutter
nihilistic
how to make footer static bootsrap
How to make a terrain generator in roblox
roblox studio what you something follows you when you mouw
ngtemplateoutlet
zsh mac vi
react-native-image-picker permissions
what version of selenium using
typo3 news canghe more link
how to get the API KEY of my firebase project
what is the diffrence between getline and cin
schoolpad
in url
octal notation in linu
creamy korma sauce
loopback find http query
corpus meaning in tamil
stalin sort
multer storage
Problem binding to port 80: Could not bind to IPv4 or IPv6 letsencrypt
ffmpeg in for loop
bitwise operations
gdb segmentation fault trace
applet"
intellij for mac crack
latex add empty line
redirect to www
how to generate test data
sort by highest number postgres
how to sign out user in flutter with firebase authentication
how to git clone a specific branch
Command 'pip' not found, but there are 18 similar ones
roblox chat tag http ftp online simulator
gitlab markdown table of contents
minecraft sweden guitar
how to run "npm start" ansible pm2
rasputin
nest decorator get request ip
populate datalist from database
round off in dart
antes de morirme letra
nicehash
how to make ndroid app crash
og facebook
install docker ec2
koalas column type
find the runner-up score
chloroplasts
How to make a script that spawns parts
CHAR TO BLOB
The volume integral of x=0,y=0,z=0,x+y+z=1 is
add subdomain on cloudflare
Topbar+ Documentation
docker run with entrypoint
random
ansible package
difference between bug and error
salesforce DmlException
50 dollars in rupees
docker build don't use cache
hangfire delay job
docker compose build
how to list cameras on jetson nano
starwars
zoneofdevelopment
rest api description
declarative schema in magento 2
HoneydewBits
text-align: center;
undefined variable: _server
causative form exercises
get column names method
mac osx open folder from cli
map object
get id from current url for php
symbols array
the tech lead
wie spricht man zuzüglich aus
rust print array
TypeError: Cannot read property 'name' of undefined
google cloud platform
stop scroll end animtion in android
cold fusion get first element of query row
imagemagick convert heic to jpg
the typing type types typing types
bool to string arduino
rfe = RFE(lr, n_features_to_select=9) rfe.fit(X,Y)
boobie
check twig if user has role
fatal: LF would be replaced by CRLF in package.json
transfer file using file_get_content
myscarper heroku.com
there are how many meridians on the globe
resume last page flutter killed app
verbose stack Exit status 126
read://https_
Hak5
auto backup mongodb in docker-compose
Freddy
twig if first array element
pyspark select columns
Jmeter about
bash search multiple string in on line
fibbonacci
find commnad syntax
rohail all meanings
psycopg2 connection
modern warfare mod minecraft black screen
ffmpeg delay sound
roblox gift card
opkg tutorial
rspec model test inclusion
opencv(4.4.0) c:\users\appveyor\appdata\local\temp\1\pip-req-build-71670poj\opencv\modules\imgproc\src\color.cpp:182: error: (-215:assertion failed) !_src.empty() in function
fireb
input positive numbers only
where do you use constructor in framework
different styles of edittext in android
egg floor code
servo control xbox raspberry pi
android get string value
1337
bootstrap list group, nav list
latex chapter name and subsection overlap headers
Day/Night script in roblox studio
where to watch anime for free
visual studio rename namespace
where do you use overloading in framework
dynmap port
embed video in wordpress site
hide scrollbar in firefox
internet in 60 seconds 2020
get last row codeigniter
reshape image matlab
osx tree
gramos de proteina por huevo
Which of the following operators is used for pattern matching? Pick ONE option IS NULL operator ASSIGNMENT operator LIKE operator NOT operator Clear Selection
best games
flutter text default font family
fortnite download
brew herou
Expected an identifier and instead saw 'const'.
multiple root tags android manifest
how to display scroll bar in sublime text 3
mat select text template
is 13 old for a human?
polls/models.py
forme juridique personne morale de droit public
what type of dog is the minecraft dog
excel sumif
describe a challenges
diskpart attributes set hidden
raspberry pi chromium autostart
essentials tp
tom morello
sharex
dream
server minecraft for offline player
generate ssh in ubuntu
static
How can you add a manual line break to a paragraph?
false
sentence length constraint bert hugging
.
|
https://www.codegrepper.com/code-examples/whatever/In+the+default+daemon+configuration+on+Windows+%2C+the+docker+client+must+be+run+elevated+to+connect.
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
@Generated(value="OracleSDKGenerator", comments="API Version: 20160918") public class ListGroupsRequest extends BmcRequest<Void>
getBody$, getInvocationCallback, getRetryConfiguration, setInvocationCallback, setRetryConfiguration
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public static ListGroupsRequest.Builder builder()
public ListGroupsRequest.Builder toBuilder()
public String toString()
toStringin class
Object
public boolean equals(Object o)
equalsin class
Object
protected boolean canEqual(Object other)
public int hashCode()
hashCodein class
Object String getName()
A filter to only return resources that match the given name exactly.
public ListGroupsGroupsRequest.SortOrder getSortOrder()
The sort order to use, either ascending (
ASC) or descending (
DESC). The NAME sort order
is case sensitive.
public Group.LifecycleState getLifecycleState()
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
|
https://docs.oracle.com/en-us/iaas/tools/java/1.37.2/com/oracle/bmc/identity/requests/ListGroupsRequest.html
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
Binary binary literal.
Binary Literals in Java
This feature is very helpful to bit-oriented systems like processors, network protocols and bitmapped hardware device. Earlier the programmers used to transform from binary to decimal/hexadecimal and vice versa. Using this feature will remove this transformation and chances of error will be less in this conversion.
Also, the code using bitwise operations will be more readable with this feature.
Let’s see binary literals in action with a simple java program:
package com.journaldev.util; public class Java7Literals { public static void main(String[] args) { int i=0b0111; byte b=(byte) 0b0111; long l=(long) 0B0111L; System.out.println("i="+i); System.out.println("b="+b); System.out.println("l="+l); } }
Output of the above program is:
i=7 b=7 l=7 x=7
how is x printed. there is no seperate println for it? pls explain
Correction:
“As you all know that we can write integral types (byte, short, int, and long) in Binary and Hexadecimal formats but from Java 7 onwards we can write these numbers in binary format also. ”
It mentions Binary and Hexadecimal, but it should be Octal and Hexadecimal formats.
yes this should be corrected as “octal” instead of binary.
For the Above Prg “x” is not initialized…..
yes ,””x” is not initialized despite we can see it in output.
|
https://www.journaldev.com/603/binary-literals-in-java-java-7-feature
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
Python package to easily retrain OpenAI's GPT-2 text-generating model on new texts.
Project description
A simple Python package that wraps existing model fine-tuning and generation scripts for OpenAI GPT-2 text generation model (specifically the "small", 124M hyperparameter version). Additionally, this package allows easier generation of text, generating to a file for easy curation, allowing for prefixes to force the text to start with a given phrase.
Usage
An example for downloading the model to the local system, fineturning it on a dataset. and generating some text.
Warning: the pretrained model, and thus any finetuned model, is 500 MB!
import gpt_2_simple as gpt2 gpt2.download_gpt2() # model is saved into current directory under /models/124M/ sess = gpt2.start_tf_sess() gpt2.finetune(sess, 'shakespeare.txt',.
NB: Restart the Python session first if you want to finetune on another dataset or load another model.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|
https://pypi.org/project/gpt-2-simple/
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
You are browsing the documentation for version 1.2 which is not maintained anymore.
If some of your projects are still using this version, consider upgrading.
Configuration Reference
Configuration Reference¶
The CreateBundle can be configured under the
cmf_create key in your
application configuration. When using XML you should use the namespace.
Note
The CreateBundle provides no model classes of its own. It still needs to know what persistence layer you are using, in order to decide what service to use to interact with the storage layer during save operations.
Configuration¶
Security¶
The controller that receives save requests from create.js does a security check
to determine whether the current user is allowed to edit content. As it would
not be convenient to show the create.js editor to users not allowed to edit the
site, the controller loading the create.js JavaScript files with the
includeJSFilesAction also uses the same security check, as does the image
upload controller if it is activated.
The default security check checks if the user has a specified role. If nothing
is configured, the default role is
ROLE_ADMIN. If you set the parameter to
boolean
false, every user will be allowed to save changes through the REST
controller.
A last option is to configure your own
checker_service to be used instead
of the role based check.
For more information, see the security section in the bundle doc.
- YAML
- XML
- PHP
persistence¶
This defines the persistence driver and associated classes. The default persistence configuration has the following configuration:
- YAML
- XML
- PHP
object_mapper_service_id¶
You can specify a service implementing
Midgard\CreatePHP\RdfMapperInterface
that will handle objects that need to be stored by the REST handler of
CreatePHP. You need to either specify this service or enable the phpcr
persistence for this bundle to work.
enabled¶
type:
boolean default:
false
If
true, PHPCR is enabled in the service container.
If the CoreBundle is registered, this will default to
the value of
cmf_core.persistence.phpcr.enabled.
PHPCR can be enabled by multiple ways such as:
- YAML
- XML
- PHP
manager_name¶
type:
string default:
null
The name of the Doctrine Manager to use.
null tells the manager registry to
retrieve the default manager.
If the CoreBundle is registered, this will default to
the value of
cmf_core.persistence.phpcr.manager_name.
image¶
These settings are only used with the optional hallo editor. The default CKEditor uses the ELfinder plugin provided by the MediaBundle.
If you need different image handling, you can either overwrite
model_class and/or the
controller_class.
Metadata Handling¶
- YAML
- XML
- PHP
auto_mapping¶
If not set to false, the CreateBundle will look for mapping files in every
bundle in the directory
Resources/rdf-mappings.
rdf_config_dirs¶
Additional directories to look for mapping files besides the auto mapped directory.
REST handler¶
You can configure the REST handler class with the
rest_controller_class
option. Furthermore it is possible to enable
rest_force_request_locale.
When this option is enabled, the current request locale is set on the model
instance. This is useful in order to automatically translate a model to
the request locale when using inline editing, instead of editing the model
in the locale in which it is currently stored, which might be different
than the request locale due to language fallback.
Note
The
rest_force_request_locale option requires that the
CoreBundle is enabled.
Editor configuration¶
You can tweak a few things on the editor. Most of the time, the only relevant
setting is the
plain_text_types.
- YAML
- XML
- PHP
plain_text_types¶
A list of RDFa field types that will be edited with a plain text editor without any formatting options. All other fields are edited with the WYSIWYG options activated.
editor_base_path¶
If you use a non-standard setup, you can adjust the editor base path configuration. This is only relevant for CKEditor.
fixed_toolbar¶
Fix the editor toolbar on top of the page. Currently only supported by the hallo.js editor.
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
|
https://symfony.com/doc/1.2/cmf/bundles/create/configuration.html
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
Decoder for the Automatic Picture Transmission protocolDecoder for the Automatic Picture Transmission protocol
All you need is a (relatively inexpensive) software-defined radio and antenna for 137 MHz (following for example these instructions) to receive data from the NOAA weather satellites NOAA 15, NOAA 18 and NOAA 19. The data is first recorded using a software like GQRX ().
Installation of APDDecoder.jlInstallation of APDDecoder.jl
import Pkg Pkg.develop(PackageSpec(url=""))
- Make plots of a decoded and georefenced data stream with the following Julia command:
import APTDecoder APTDecoder.makeplots("gqrx_20190825_182745_137620000.wav","NOAA 15")
The first argument of
APTDecoder.makeplots is the wav file which should include the date and time in UTC (which is the default for GQRX) and the name of the satellite, e.g. "NOAA 15", "NOAA 18" or "NOAA 19".
This produces the following images:
This is the raw data. Channel a is on the right and channel b on the left. Note that channel b is just switching the wave-length during the capture. In part of Europe the sun went already down.
AlternativesAlternatives
- NOAA-APT with some excellent documentation
- apt-decoder
- aptdec
- DirectDemod
- apt137
- APT3000
- ...
CreditsCredits
Many thanks to the authors of the SatelliteToolbox.jl and the DSP.jl. These packages are used to predict the satellite orbit and to extract the APT signal.
|
https://juliapackages.com/p/aptdecoder
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
PMPROCESSPIPE(3) Library Functions Manual PMPROCESSPIPE(3)
__pmProcessPipe, __pmProcessPipeClose - support for process execution at the end of a pipe
#include "pmapi.h" #include "libpcp.h" int __pmProcessPipe(__pmExecCtl_t **handle, const char *type, int toss, FILE **fp); int __pmProcessPipeClose(FILE *fp); are provide a convenient and safe alternative to popen(3) and pclose(3) for executing commands in a separate process that is connected to the caller by a pipe. Setting up the command and arguments is fully documented in __pmProcessAddArg(3) and is identical to the procedure used to setup __pmProcessExec(3). Once all the command name and arguments have been registered calling __pmProcessPipe uses a pipe(2), fork(2) and execvp(2) sequence to execute the command. The type argument needs to be ``r'' to read from the pipe, else ``w'' to write to the pipe.. Obviously some combinations of argument values make no sense, e.g. type equal to ``r'' and PM_EXEC_TOSS_STDOUT set in toss or type equal to ``w'' and PM_EXEC_TOSS_STDIN set in type. __pmProcessPipe returns a standard I/O stream for the pipe via the fp argument. Once the caller determines all the work has been done, __pmProcessPipeClose should be called. Nested calling of __pmProcessExec(3) and/or __pmProcessPipe is not allowed. Once __pmProcessAddArg(3) is called with handle set to NULL to start the registration and execution sequence any attempt to start a second registration sequence will be blocked until the first one is completed by calling __pmProcessExec(3) or __pmProcessPipe.
execvp(2), fork(2), pclose(2), pipe(2), popen(2), __pmProcessAddArg(3), __pmProcessExec(3) and waitpid(3).
If successful __pmProcessPipe returns 0. Other conditions are rare (e.g. alloc failure) and are indicated by a return value that can be decoded using pmErrStr(3). The return status from __pmProcessPipeClose is a little more complicated. If.PROCESSPIPE(3)
Pages that refer to this page: __pmprocessexec(3)
|
https://man7.org/linux/man-pages/man3/__pmProcessPipe.3.html
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
How to Response.Cookies.Append() in ASP.Net Core 1.1?
I am trying to add Globalization to an Intranet application, using a cookie to allow users a culture preference. The middleware is set up and running but I have run into an issue with appending to the cookie based on the UI selection.
The method is straight from the Asp.Net Core documentation as below:
public void ConfigureServices(IServiceCollection services) { services.Configure<RequestLocalizationOptions>( options => { var supportedCultures = new List<CultureInfo> { new CultureInfo("en-US"), new CultureInfo("en-GB"), new CultureInfo("fr-FR"), new CultureInfo("es-ES") }; options.DefaultRequestCulture = new RequestCulture(culture: "en-GB", uiCulture: "en-GB"); options.SupportedCultures = supportedCultures; options.SupportedUICultures = supportedCultures; }); services.AddLocalization(); services.AddMvc(config => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build(); config.Filters.Add(new AuthorizeFilter(policy)); }) .AddViewLocalization(); services.AddSession(options => { options.CookieName = "Intranet"; }); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>(); app.UseRequestLocalization(locOptions.Value); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } ); }
The issues are:
- Response does not exist
- LocalRedirect does not exist
I have tried:
- HttpResponse, HttpRequest
- LocalRedirectResult
From the docs where you got that sample, you can see that the code comes from GitHub with lots of sample projects. This particular sample comes from Localization.StarterWeb.
Your two "missing" methods are actually part of
ControllerBase (which is what
Controller inherits from. So if you put this action method into a controller, it will work.
public class HomeController : Controller { ); } }
ASP.NET Core Working With Cookie, ASP.NET Core Working With Cookie. This article explains how ASP. In ASP.NET, we can access cookies using httpcontext.current but in ASP. Append(key, value, option);; } public void Remove(string key); {; Response. public IActionResult Index(); {; //read cookie from IHttpContextAccessor; string HttpContext.Response.Cookies.Append( "name", "value", new CookieOptions() { SameSite = SameSiteMode.Lax }); All ASP.NET Core components that emit cookies override the preceding defaults with settings appropriate for their scenarios. The overridden preceding default values haven't changed.
In ASP .NET Core 2.1+, if you use the cookie policy feature for implementing GDPR by invoking
app.UseCookiePolicy() in
Startup.cs, make sure to mark your cookie as essential, otherwise it won't be sent to users who haven't accepted your policy.
Response.Cookies.Append( CookieRequestCultureProvider.DefaultCookieName, CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)), new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1), IsEssential = true } );
Obviously, you should also mention the cookie in your privacy statement.
HttpResponse.Cookies Property (System.Web), Gets the response cookie collection. ASP.NET includes two intrinsic cookie collections. The collection accessed through the Cookies collection of HttpRequest ASP.NET Core Working With Cookie. This article explains how ASP.NET Core deals with cookies. Cookies are key-value pair collections where we can read, write and delete using key. HTTP Cookie is some piece of data which is stored in the user's browser.
First of all you've to use CookieRequestCultureProvider. Later one the action you have in the example should works just fine. I would also add this:
CultureInfo.CurrentCulture = culture; CultureInfo.CurrentUICulture = culture;
Here is my config:
public void ConfigureServices(IServiceCollection services) { services.AddLocalization(opts => { opts.ResourcesPath = "Resources"; }); services.AddMvc() .AddViewLocalization( Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat.SubFolder, opts => { opts.ResourcesPath = "Resources"; } ) .AddDataAnnotationsLocalization(); services.Configure<RequestLocalizationOptions>(opts => { var supportedCultures = new[] { new CultureInfo("en-US"), ... }; opts.DefaultRequestCulture = new Microsoft.AspNetCore.Localization.RequestCulture("en-US"); opts.SupportedCultures = supportedCultures; opts.SupportedUICultures = supportedCultures; }); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.UseRequestLocalization(); app.UseMvc(routes => { routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}"); }); }
HttpResponse.Cookies Property (Microsoft.AspNetCore.Http , Gets an object that can be used to manage cookies for this response. Cookies Property. Definition. Namespace: Microsoft.AspNetCore.Http Http.IResponseCookies Cookies { get; } Applies to. ASP.NET Core. 3.1 3.0 2.2 2.1 2.0 1.1 1.0 Read and Write Cookies in ASP.NET Core 1.0. One of the basic requirements in several web applications is storing and retrieving small pieces of information in cookies. This article will discuss with an instance how ASP.NET Core 1.0 deals with cookies. You will learn here to read and write cookies using ASP.NET Core.
Cookies and Consent in ASP .NET Core, This is the third of a new series of posts on ASP . NET Core web app, you should see a cookie popup that appears on every page that can be you to store the user's “No” response in the cookie itself, thus going against their wishes. UseCookiePolicy() in the Configure() method of your Startup.cs file. 10 things to know about in-memory caching in ASP.NET Core: Consume ASP.NET Core Web API using HttpClient: Offline installation of VS2017 in 4 Easy Steps: Read and Write Cookies in ASP.NET Core 1.0: Form, Query String and HttpContext in ASP.NET Core 1.0: Seed Users and Roles Data in ASP.NET Core Identity: Use Razor Pages, MVC, and Web API in a
Consider adding a version of Response.Cookies.Append that does , It is specially useful for backward compatibility with ASP.NET (not Core) where cookies were not encoded automatically by the framework and I am still battling with setting cookies in asp.net core sighing for the simplicity of php at times setcookie() wishing for it in asp.net core – Max Apr 14 '17 at 7:47 1 This is not an answer, it is a status update.
Using Cookie Middleware without ASP.NET Core Identity, AspNetCore.Authentication.Cookies package. Then add the following lines to the Configure method in your Startup.cs file before the app.UseMvc() statement;. Closed 8 months ago. I have a simple ASP.NET Core 2.1 application which is supposed to set and then read a cookie. Whenever I try to read the cookie it returns null. Looking further in the browser's inspect tool I am unable to find it. I came up with this small implementation to see if I can sort out whats going on, but it is not working..
- Do you have that code inside a controller or is it standalone somewhere else?
- Possible duplicate of Cookies and ASP.NET Core
- Controller ... not class. That was a silly mistake, thank you so much!
- Great timing. Just starting work on a new app in 2.1, perhaps 2.2 soon and will be coming across this shortly I would imagine.
- This doesn't answer the question at all.
- And how does the code you've provided allow the user to switch culture preferences?
- The code which I provided is showing the configuration which I'm using to use exactly the same action as was in the question. I've also mention in the first paragraph that "...the action you have in the example should works just fine..." if the configuration will be correct.
- Thanks for posting that code. I have updated my question to include my startup elements. I am not localizing in anyway so have no .resx files to include but I think we are very similar. It is interesting that you are using Microsoft.AspNetCore.Localization.RequestCulture() for default though.
|
https://thetopsites.net/article/52604397.shtml
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
Why cast after an instanceOf?
instanceof java
how to convert string to user defined object in java
java 8 instanceof
java casting
java checked cast
java cast(object to class)
cast vs instanceof
In the example below (from my coursepack), we want to give to the
Square instance
c1 the reference of some other object
p1, but only if those 2 are of compatible types.
if (p1 instanceof Square) {c1 = (Square) p1;}
What I don't understand here is that we first check that
p1 is indeed a
Square, and then we still cast it. If it's a
Square, why cast?
I suspect the answer lies in the distinction between apparent and actual types, but I'm confused nonetheless...
Edit: How would the compiler deal with:
if (p1 instanceof Square) {c1 = p1;}
Edit2:
Is the issue that
instanceof checks for the actual type rather than the apparent type? And then that the cast changes the apparent type?
Thanks,
JDelage
Keep in mind, you could always assign an instance of Square to a type higher up the inheritance chain. You may then want to cast the less specific type to the more specific type, in which case you need to be sure that your cast is valid:
Object p1 = new Square(); Square c1; if(p1 instanceof Square) c1 = (Square) p1;
Casting In Java 8 (And Beyond?), If obj is null, it fails the instanceof test but could be cast because null can be a reference of any type. Dynamic Casting. A technique I encounter The instanceof operator tests whether the prototype property of a constructor appears anywhere in the prototype chain of an object. JavaScript Demo: Expressions - instanceof. function Car (make, model, year) { this.make = make; this.model = model; this.year = year; } var auto = new Car ('Honda', 'Accord', 1998); console.log (auto instanceof
The compiler does not infer that since you are in the block, you have done a successful check for the type of the object. An explicit cast is still required to tell the compiler that you wish to reference the object as a different type.
if (p1 instanceof Square) { // if we are in here, we (programmer) know it's an instance of Square // Here, we explicitly tell the compiler that p1 is a Square c1 = (Square) p1; }
In C# you can do the check and the cast in 1 call:
c1 = p1 as Square;
This will cast
p1 to a Square, and if the cast fails, c1 will be set to
null.
Object Type Casting in Java, An overview of type casting in Java, covered with simple and easy to understand examples. Learn about the instanceof operator in Java After the conversion in the above example, myInt variable is 1, and we can't restore Java instanceof and its applications instanceof is a keyword that is used for checking if a reference variable is containing a given type of object reference or not. Following is a Java program to show different behaviors of instanceof.
There's a difference between measuring if some object will fit in a box, and actually putting it in the box.
instanceof is the former, and casting is the latter.
Casting and runtime type checking (using instanceof)—ArcObjects , About casting a run time type checking (using instanceof). ArcObjects follow an interface based programming style. Many methods use interface types as The java instanceof operator is used to test whether the object is an instance of the specified type (class or subclass or interface). The instanceof in java is also known as type comparison operator because it compares the instance with type. It returns either true or false. If we apply the instanceof operator with any variable that has null
Because this particular syntactic sugar is not yet added to the language. I think it was proposed for Java 7, but it doesn't seem to have entered project coin
Thinking in Java 10: Detecting Types, Thinking in Java 10: Detecting Types - Checking before a cast. This is the keyword instanceof, which tells you if an object is an instance of a particular type. After creating the AssociativeArray, it is filled with key-value pairs of pet names Is there an instanceof analog for checking at compile-time? In my case, I'm trying to throw a ClassCastException as part of my definition of Queue's add method. My first thought was instanceof but I got error: illegal generic type for instanceof during compilation. – Ungeheuer Sep 21 '17 at 3:47
Old code wont work correctly
The impield cast feature is justified after all but we have trouble to implement this FR to java because of backward-compatibility.
See this:
public class A { public static void draw(Square s){...} // with impield cast public static void draw(Object o){...} // without impield cast public static void main(String[] args) { final Object foo = new Square(); if (foo instanceof Square) { draw(foo); } } }
The current JDK would compile the usage of the second declared method. If we implement this FR in java, it would compile to use the first method!
If something is an instance of a class why then cast it into that class , For example in the challenge it asks us to establish if obj is an instance of String, if it is, then cast it as a String!? Clearly I am missing something Unfortunately, there are no great options here. Remember, the goal of all of this is to preserve type safety. " Java Generics " offers a solution for dealing with non-genericized legacy libraries, and there is one in particular called the "empty loop technique" in section 8.2. Basically, make the unsafe cast, and suppress the warning. Then loop
JEP 305: Pattern Matching for instanceof (Preview), It is tedious; doing both the type test and cast should be unnecessary (what else would you do after an instanceof test?). This boilerplate -- in In the above example, cast() and isInstance() methods are used instead of cast and instanceof operators correspondingly. It's common to use cast() and isInstance() methods with generic types. Let's create AnimalFeederGeneric<T> class with feed() method which “feeds” only one type of animals – cats or dogs,
Dynamic casting in Java, The instanceof operator requires a type, not a Class instance e.g. item instanceof Date; The cast syntax as well e.g. (Date) item. The instance.
Java “instanceOf”: Why And How To Avoid It In Code, The java “instanceOf” operator is used to test whether the object is an instance of Except this, we must admit that the readability suffers after adding In this case, we will still have the instanceOf and the casting, but we can, $ g++ badcast.cpp -o badcast -Wall && ./badcast terminate called after throwing an instance of 'std::bad_cast' what(): std::bad_cast Abort trap (core dumped) $ g++ badcast.cpp -o badcast -frtti -fexceptions -Wall && ./badcast terminate called after throwing an instance of 'std::bad_cast' what(): std::bad_cast Abort trap (core dumped) $ gcc -v Using built-in specs.
- That's why he's asking a question delnan...
- Regarding the question in your edit, why not just try to compile it yourself? You don't need the SO community to act as a compiler for you.
- @Mark Peters - point well taken, my interest is not really what would happen, but more how differently the compiler would parse that.
- That was what I didn't understand, thanks. I did a 2nd edit on my question to focus on that.
- well, I think the compiler can know that it is a
Square.
- @Bozho, what do you mean? Not the current compiler. But I suppose it is possible.
- well, from your answer it appeared that the compiler can't possibly know this. But it can, it's just not implemented yet (hence my answer)
- It could be possible theoretically, but would not respect Java syntax and thus is not permitted by the compiler. Anyway since generics are in the language I'm not sure it is really a good thing to use instanceof. It is better to manipulate only well-defined interfaces.
- Or in C#,
if (p1 is Square s) { /* s is a non-null instance of Square, within this scope */ }
- Assuming its a method's variable where no other thread can access, I always can put something in a box that fits instanceof!!!!
- I hope it doesn't get added. Instanceof and cast is most often a design smell (should be using polymorphism). Making it more elegant will just aggravate the problem.
- @Mark Peters -
instanceofis a pretty valid usecase sometimes, although it is often misused.
|
https://thetopsites.net/article/52417189.shtml
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
Let's make an easy and simple circle progress bar from an animated SVG in a React component. We only need a SVG, some hooks and a bunch of props to make it customizable.
The scope of this guide is to make a simple but customizable circle progress bar for starting at a very basic level of SVG animations.
If you want to skip the guide and check/fork the final result you can do it here and in this playground.
Folder structure
I'll be following this folder structure:
-src |-components |--CircleProgressBar |---index.js |---CircleProgressBar.js |---CircleProgressBarBase.js
index.jswill import/export
CircleProgressBar.js, is a good practice and is easy when you want to import the component.
CircleProgressBar.jswill hold the styled version of
CircleProgessBarBase.js. I'm using styled-components and I like to wrap the entire component in a separate file and working like in a normal CSS. We can discuss this part (or any other, but specially this one :D)
CircleProgressBarBase.jswill have all the magic, like any other regular React component.
Basic Maths
Don't fear, this will be short and painless I promise!
const circleConfig = { viewBox: '0 0 38 38', x: '19', y: '19', radio: '15.91549430918954' };
We create this
circleConfig object which have:
viewBox: The current viewbox (min-x, min-y, width, height) for the SVG.
xand
yare the position of our SVG which is exactly the half (the middle) of the viewbox.
radiois exactly a circle with a circunference of 100, why 100? Because is easy to understand to us in further calculations. Then, if you apply the formula for getting the radius (r = circunference / 2 π) you'll get the magic number.
Later when we write the
circle in html we'll use this calculations.
Basic SVG
First of all, let's create the SVG, without any animations or props:
<figure className={className}> <svg viewBox={circleConfig.viewBox}> <circle className="ring" cx={circleConfig.x} cy={circleConfig.y} r={circleConfig.radio} <circle className="path" cx={circleConfig.x} cy={circleConfig.y} r={circleConfig.radio} </svg> </figure>
We're using the calculations we wrote above and have two elements inside of the SVG:
ring: This circle will be used as the remaining content, if the main stays at 80%, this will be the 20% lasts. (For now is not visible btw)
path: Will display the percentage/value, for now it's a 100% (all the circle).
Add
strokeDasharray="75 25" to the second circle and check what happends.
The idea behind these numbers is
strokeDasharray creates dashes in the stroke of a SVG shape. We're creating one stroke of 75 with color
teal and other stroke of 25 transparent which allows to see the
gray circle behind.
Because we're coming from a circle with circunference of 100, now the values for percentages are out of the box without any additional calculation :D
Now you can see both circles but... something is wrong, we want to start our progress bar at 12 o'clock, now it's starting at 3, for fix that, we need to add the property
strokeDashoffset.
We want to "move" the stroke a
25% behind of his current position. For that we will use
strokeDashoffset="25" in the second circle again.
Ok now is looking good!
Display Text
We have a SVG which displays some kind of progress, let's add a number to display the exact number of progression and what mean that progression.
Inside of our current SVG:
<figure> <svg viewBox={circleConfig.viewBox}> <circle className="ring" cx={circleConfig.x} cy={circleConfig.y} r={circleConfig.radio} <circle className="path" cx={circleConfig.x} cy={circleConfig.y} r={circleConfig.radio} <g className="circle-label"> <text x="50%" y="50%" className="circle-percentage"> 75% </text> <text x="50%" y="50%" className="circle-text"> COMPLETE </text> </g> </svg> </figure>
We need to add some styles, for that in
CircleProgressBar.js add:
import styled from 'styled-components'; import CircleProgressBarBase from './CircleProgressBarBase'; const CircleProgressBar = styled(CircleProgressBarBase)` `; export default CircleProgressBar;
Inside of the template literal let's add the css:
.circle-label { transform: translateY(0.25em); } .circle-percentage { font-size: 0.6em; line-height: 1; text-anchor: middle; transform: translateY(-0.25em); } .circle-text { font-size: 0.2em; text-transform: uppercase; text-anchor: middle; transform: translateY(0.7em); }
At this point we have a regular SVG circle progress bar, let's a few tweaks to make it dynamic and valuable as a React component.
Basic Props
Let's implement this props:
trailStrokeColorfor the stroke color in the ring circle.
strokeColorfor the stroke color in the path ring.
percentagefor the total %.
innerTextfor the meaning of percentage.
Names of the props are totally up to you.
The
CircleProgressBarBase.js with props now:
import React from 'react'; const INITIAL_OFFSET = 25; const circleConfig = { viewBox: '0 0 38 38', x: '19', y: '19', radio: '15.91549430918954' }; const CircleProgressBarBase = ({ className, trailStrokeColor, strokeColor, percentage, innerText }) => { return ( <figure className={className}> <svg viewBox={circleConfig.viewBox}> <circle className="ring" cx={circleConfig.x} cy={circleConfig.y} r={circleConfig.radio} <text x="50%" y="50%" className="circle-percentage"> {percentage}% </text> <text x="50%" y="50%" className="circle-text"> {innerText} </text> </g> </svg> </figure> ); }; export default CircleProgressBarBase;
Worth to mention:
classNameis needed because the styled-prop will pass the CSS classes with this.
strokeDasharray={${percentage} ${100 - percentage}
}is the calculation we hardcoded before as
75 25.
Now import in a different js file the component with props and check the result:
import React from 'react'; import CircleProgressBar from './components/CircleProgressBar'; const App = () => { return <CircleProgressBar trailStrokeColor="gray" strokeColor="teal" percentage={75} } render(<App />, document.getElementById('root'));
Number Animation
Let's add an animation in the number, from 0 to the value passed into
percentage.
The strategy will be, use the state, because a React component only re-render if his state or props changes. We will need
useState and
useEffect hooks from
react.
const [progressBar, setProgressBar] = useState(0);
progressBar now is the state of the component, starting at 0, and can be "modified" through
setProgressBar.
const updatePercentage = () => { setTimeout(() => { setProgressBar(progressBar + 1); }, 5); }; useEffect(() => { if (percentage > 0) updatePercentage(); }, [percentage]); useEffect(() => { if (progressBar < percentage) updatePercentage(); }, [progressBar]);
The first
useEffect will be triggered when
percentage prop is changed. This is needed instead of a simple
[], that will be on mount, because if you use this component in combination with a backend service you first will pass
percentage={0} and later in async mode, a value.
The second
useEffect will be triggered when the
progessBar is modified.
Both effects will execute
updatePercentage, that function executes a
timeout which will execute the inner function in 5 milliseconds.
Now your
CircleProgressBar will "fill" the number from 0 to the value passed through
percentage prop at a constant time of 5ms, seems an animation but in fact it's a simple re-render.
Try to use different values than 5ms and check the behaviour.
Stroke Animation
Let's enter to the real deal, the number is already "animated" now it's time to the stroke.
The strategy will be the same than before, we can apply a good looking CSS animation but... we already have one value which indicates the percentage and would be nice if the stroke and the number dance together.
Use
progressBar for the calculations in
strokeDashArray:
// strokeDasharray={`${percentage} ${100 - percentage}`} strokeDasharray={`${progressBar} ${100 - progressBar}`}
Now the stroke will grow with every re-render at the same speed than the number. I guess we can't really call this an animation after all.
Extra Stuff
In the Github repo you can find extra stuff made in the component such as:
- A prop
speedto choose which speed want to use in the "animation".
- A legend to display with the Circle.
- The
ringcan be spaced or solid like in the example.
- Prop type validation and default prop values.
Conclusion
We learn the creation of a simple SVG shape with "animations" in a isolated React component.
The component can be extended in multiple ways, for example removing the local state and passing the
progressBar from outside as a prop to display a real progression in the comunicacion with a service using RxJS.
The repo is open for any improvement or customization you may think would be cool and is available for use with:
yarn add @bit/dastag.ui-components.circle-progress-bar
Enjoy!
Discussion (3)
Oh thank you!!
This is the first complete tutorial about this.
Great text.
The second image of circle with strokedashoffset 25 is the same of without it. It's correct?
Yes, the image is not the correct, thanks!
|
https://dev.to/dastasoft/animated-circle-progress-bar-with-svg-as-react-component-28nm
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
AVS Display Cards for Tablets 1.0
The guidance on this page is based on implementing the TemplateRuntime 1.0 and PlaybackController 1.0 APIs for Tablets. If you are using different versions, choose another page from the drop-down menu above. This page contains Tablet-specific Display Card design guidance. For general multimodal best practices, please see Multimodal Display.
Display Cards for Alexa provide visuals to support verbal responses, and give your customers an additional way to interact with Alexa.
If you are implementing Display Cards on a device, the Cards should properly display all content, templates, media attributions, and media controls. In addition, we expect that:
- A Display Card will appear as soon as Alexa begins responding or media begins playing, and the Display Card’s contents will match the Alexa response or media.
- Transitions between Display Cards will be smooth, as will the transition into displaying Cards and dismissing Cards.
- Display Cards will respond to screen interactions and voice utterances as described in the design guidelines for your product’s device class.
- Alexa attention states for Listening and Thinking will appear on top of any visible Display Card, and will not be obscured.
Details for each of these are provided in the guidelines below.
Static Display Cards
Global elements
Alexa shows Static Display Cards in response to certain non-media queries. All Display Cards in this section have the following global elements.
Elements
The numbered elements in the illustration above are described in more detail here.
Titles: All cards will have a mainTitle. Some will have a subTitle.
Alexa Skills Icon: This icon (top right) appears when a third-party provides the information being displayed on the Card. If the information is not being provided by a third-party, this icon will not appear.
Barge-In Button: This button (bottom center) can be tapped at anytime to activate and talk to Alexa.
GUI Dismiss Button: Tapping the "X" hides the GUI and ends the Alexa response.
Notes on the guidelines for static Display Cards
All specs are based on a reference template of 1280 x 800dp.
Layout is given in percentages to help adapt the template to your device’s screen resolution.
Font sizes are given on the reference screen. These sizes should scale as the resolution of screen changes. If no line-height is given, the line-height is the same as the font size.
mainTitle and subTitle should never exceed one line. If the text exceeds the width of the container, the crop the text and use an ellipsis.
Image assets and icons marked in dp size should scale as the resolution of screen changes.
All of the assets URL can be found in the Asset section of this documentation.
Voice Chrome
Voice chrome is a visual indicator of the Alexa attention states such as Listening, Thinking, and Responding. Most tablets will use on-screen voice chrome, although it is possible to use on-device LEDs to display the states instead.
Details of how and when voice chrome should be displayed can be found in the Interactions section below, and in the Interruption Scenarios section on this page. The colors and animations of voice chrome should follow the patterns specified in the Attention System documentation.
Interactions
There are two modes you can choose from for the static Display Cards: light and dark. Depending on the color scheme of the card, Alexa will be evoked on a white or black overlay.
Note: NowPlaying cards use only dark mode.
The following is an example of the screen states a customer might view when interacting with Alexa.
Invoke Alexa in light mode
Note: Active voice chrome is on the top of a white overlay with 50% opacity.
Invoke Alexa in dark mode
More information on dark mode is available under Dark Mode.
Note: Active voice chrome is on the top of a black overlay with 50% opacity.
Example interaction breakdown
Step 1: Invocation
The customer activates Alexa with the wake word “Alexa” or with a control on the device (physical or GUI button for example). This activates voice chrome to show Alexa is listening.
Step 2: Listening
Once Alexa is invoked and voice chrome is displayed, the customer can control Alexa with their voice. If Alexa recognizes an utterance, it processes the intent and display a Card. If Alexa doesn’t hear anything from the customer within 8 seconds, voice chrome dismisses.
Step 3: Response and Dismissal
Alexa responds verbally, and when applicable, with a Display Card. Audio and visuals should always be in sync, showing the card and playing audio simultaneously. Once Alexa finishes speaking, the card should dismiss automatically after 2 seconds of inactivity.
If, before playback is complete, the customer:
Taps the barge-in button (the Alexa logo), then TTS stops and voice chrome should display on top of the Card.
Taps the “X”, then the card clears and the TTS stops.
The Card should not be dismissed before TTS is complete, unless the customer has done so manually. Tapping the barge-in button (the Alexa logo) should stop the TTS, dismiss the Card, and open the voice chrome.
Additional interaction scenarios are described in the Interruption Scenarios section.
BodyTemplate1
BodyTemplate1 is used for Q&A, Wikipedia queries, and third-party Skill requests that do not contain a photo. Sample utterances that would invoke BodyTemplate1 include:
- “How deep is the ocean?”
- “What is the definition of “paradox”?”
- "What is the Karman line?"
- "What is bike polo?"
Style
Layout
Note: The body content (textField) can extend off the bottom of the screen, which the customer can access by scrolling.
Data
JSON
{ "directive": { "header": { "namespace": "TemplateRuntime", "name": "RenderTemplate" }, "payload": { "token": "{{STRING}}", "type": "BodyTemplate1", "title": { "mainTitle": "Who is Usain Bolt?", "subTitle": "Wikipedia" }, "skillIcon": { "sources": [ { "url": "", "size": "small" } ] }, "textField": "Usain St Leo Bolt, OJ, CD born 21..." } } }
BodyTemplate2
BodyTemplate2, like BodyTemplate1, is used for Q&A, Wikipedia queries, and third-party Skill requests but, unlike BodyTemplate1, it also returns an image. Sample utterances that would invoke BodyTemplate2 include:
- “Who is Usain Bolt?”
- “What is 5 miles in kilometers?”
- “Who wrote To Kill a Mockingbird?”
- “Where is New Mexico?”
Style
Layout
Note: The image height and width are maximum dimensions. Images should resize to avoid exceeding either dimension.
Data
JSON
{ "directive": { "header": { "namespace": "TemplateRuntime", "name": "RenderTemplate" }, "payload": { "token": "{{STRING}}", "type": "BodyTemplate2", "title": { "mainTitle": "Who is Usain Bolt?", "subTitle": "Wikipedia" }, "skillIcon": { "sources": [ { "url": "", "size": "small" } ] }, "textField": "Usain St Leo Bolt, OJ, CD Born 21 August...", "image": { "contentDescription": "Image with two sources." "sources": [ { "url": "", "size": "small" }, { "url": "", "size": "large", "widthPixels": 1200 , "heightPixels": 800 } ] } } } }
ListTemplate1
ListTemplate1 is used to display items in a list, such as a calendar or shopping list. Sample utterances that would invoke ListTemplate1 include:
- “What’s on my to do list?”
- “Add eggs to my shopping list.”
- “When is my next event?”
- “Add “Lunch with Jayla” to my calendar.”
Style
Layout
Note: The distance between leftTextField and rightTextField is static. For example, if leftTextField displays more characters than shown here, rightTextField should push right and the distance between the two should remain the same.
Data
Variation: Calendar
Note: The distance between the time and event is static.
JSON
{ "directive": { "header": { "namespace": "TemplateRuntime", "name": "Render" }, "payload": { "token": "{{STRING}}", "type": "ListTemplate1", "title": { "mainTitle": "Title", "subTitle": "Subtitle" }, "skillIcon": { "contentDescription": "Source for the skill icon.", "sources": [ { "url": "", "size": "small" } ] }, "listItems": [ { "leftTextField": "1.", "rightTextField": "Alfa" }, { "leftTextField": "2.", "rightTextField": "Bravo" }, { ... } ] } } }
WeatherTemplate
WeatherTemplate is used with all weather-related utterances, such as:
- “What’s the weather?”
- “Will it rain today?”
- “What’s the weather in [location]?”
Style
Layout
Weather template layout in 3 digits
Data
JSON
{ "directive": { "header": { "namespace": "TemplateRuntime", "name": "RenderTemplate" }, "payload": { "token": "{{STRING}}", "type": "WeatherTemplate", "title": { "mainTitle": "San Francisco", "subTitle": "Friday, October 31" }, "skillIcon": null, "currentWeather": "75°", "description": "Mostly cloudy and more humid with a couple of showers and ...", "currentWeatherIcon" { "contentDescription": "Weather image sources.", "sources": [ { "url": "", "size": "medium" } ] }, "highTemperature": { "value": "76°", "arrow": { "contentDescription": "Up arrow sources.", "sources": [ { "url": "", "size": "medium" } ] }, }, "lowTemperature": { "value": "45°", "arrow": { "contentDescription": "Down arrow sources.", "sources": [ { "url": "", "size": "medium" } ] }, }, "weatherForecast": [ { "image": { "contentDescription": "Partly cloudy...", "sources": [ { "url": "", "size": "small" } ] }, "day": "Sat", "date": "Oct 22", "highTemperature": "71°", "lowTemperature": "55°" }, { ... } ] } } }
Dark mode
You may want to adapt the templates to use a dark mode, for example for night-time use. Dark mode provides a more pleasant experience in low lighting. To implement dark mode:
- Change body and footer backgrounds to black (#000000).
- Change all black text (#151320) to white (#ffffff).
- For image URLs on the WeatherTemplate, use “darkBackgroundUrl” instead of “url”.
Here are examples of the result.
NowPlaying Cards
Alexa uses NowPlaying in response to media requests. Sample utterances that would invoke NowPlaying include:
- “Play jazz music”
- “Play Smoke & Retribution”
- “Play Freakonomics on iHeartRadio”
- “Play a country station from [third-party music provider]”
VUI Playback Commands
The customer can control media playback either using GUI or VUI. VUI playback commands include:
- Play
- Stop
- Cancel
- Pause
- Resume
- Rewind
- Start Over
- Louder
- Softer
- Set Volume
- Mute
- Unmute
- Shuffle
- Restart
- Get details
- Who is this?
Global Elements
Alexa shows the NowPlaying GUI in response to media queries. All NowPlaying Cards in this section have the following global elements.
The global elements in the NowPlaying Card include:
Media metadata
Playback controls: These will vary depending on the media type and the service.
Progress bar: Appears with most media types.
Barge-in button (Alexa logo): This button can be tapped at any time to activate and talk to Alexa.
“X" button: Tapping the “X" should hide the GUI and stop playback.
Media artwork: This could be album art, a radio station logo, a program logo, or book artwork.
Music provider logo: The logo of the service providing the media.
Controls Per Music Service Provider
Alexa can play music from multiple Music Service Providers. Controls vary per provider offering. For example, a live radio station might not have forward and back controls. The correct controls for each offering will be specified in the PlayerInfo directive.
Controls per Music Service Provider
Note: Amazon Music and Pandora are available only for commercial devices.
Interactions
The following is an example of the screen states a customer might view when interacting with Alexa.
Step 1: Invocation
The customer activates Alexa with the wake word “Alexa” or with a control on the device (depending on the device). This activates voice chrome to show Alexa is listening.
Step 2: Listening and intent processing
Once voice chrome is invoked the customer can control Alexa with their voice. If Alexa recognizes an utterance it will process their intent and display a GUI. If Alexa doesn’t hear anything from the customer within 5 seconds, clear the voice chrome.
Step 3: Response and dismissal
In response to media requests, Alexa displays a NowPlaying GUI with media metadata and playback controls.
If the customer:
- Dismisses the GUI by tapping the “X" or navigating away from the Card with device controls, then both the Card dismisses and audio stops. Note: If your device supports playback controls elsewhere on your device (see Additional Playback Controls), then the "X" should dismiss only the GUI and allow music playback to continue.
- Pauses or stops the music via voice or the button, then the audio stops and the Card remains. The Card should then auto-dismiss after one minute of inactivity.
- Activates Alexa again while the music is playing, the music attenuates and voice chrome reappears awaiting the next command.
Additional interaction scenarios are described in the Interruption Scenarios section.
Specs
Style
Layout
Note: Media artwork is constrained by the container shape and should never exceed these dimensions. In cases where artwork is not a square or is smaller than the container shape, it should be horizontally and vertically centered within the container shape.
Notes
- The source/author information is one line, and the mainTitle can be two lines maximum. If the mainTitle exceeds two lines, truncate the text and use an ellipsis.
- If content extends past its maximum number of lines, truncate the text and use an ellipsis.
- When mainTitle has two lines, titleSubtext1 and titleSubtext2 push down to accommodate. The controls and progress bar do not move.
Data
Examples
Example 1: Amazon Music
“Alexa, play Smoke & Retribution”
JSON The “name” key-value pair may come back as “Amazon Music,”“Prime Music,” or “Prime Station.” If Prime is not enabled, “name” will be “Digital Music Store.”
The
name key-value pair may come back as “Amazon Music”, “Prime Music”, or “Prime Station”. If Prime is not enabled,
name will be “Digital Music Store.”
{ "directive": { "header": { "namespace": "TemplateRuntime", "name": "RenderPlayerInfo", "messageId": "{{STRING}}", "dialogRequestId": "{{STRING}}" }, "payload": { "audioItemId": "{{STRING}}", "content": { "title": "{{STRING}}", "titleSubtext1": "{{STRING}}", "titleSubtext2": "{{STRING}}", "header": "{{STRING}}", "headerSubtext1": "{{STRING}}", "mediaLengthInMilliseconds": {{LONG}}, "art": {{IMAGE_STRUCTURE}}, "provider": { "name": "{{STRING}}", "logo": {{IMAGE_STRUCTURE}} } } "controls": [ // This array includes all controls that must be // rendered on-screen. { "type": "{{STRING}}", "name": "{{STRING}}", "enabled": {{BOOLEAN}}, "selected": {{BOOLEAN}} }, { "type": "{{STRING}}", "name": "{{STRING}}", "enabled": {{BOOLEAN}}, "selected": {{BOOLEAN}} }, { ... } ] } } }
Example 2: iHeartRadio Live Radio
“Alexa, play Hollywood Breakdown on iHeartRadio”
JSON
{ "directive": { "header": { "namespace": "TemplateRuntime", "name": "RenderPlayerInfo", "messageId": "{{STRING}}", "dialogRequestId": "{{STRING}}" }, "payload": { "audioItemId": "{{STRING}}", "content": { "title": "The summer of \"sequel-itis\" and beginning of awards season", "header": "KCRW's Hollywood Breakdown", "mediaLengthInMilliseconds": 0, "art" : { "sources" : [ { "size" : "medium", "url" : "" } ] }, "provider": { "name": "iHeartRadio Live Radio", "logo" : { "sources" : [ { "url" : "" } ] } } } "controls": [ { "type": "BUTTON", "name": "PLAY_PAUSE", "enabled": true, "selected": false }, ] } } }
Controls-Only Template
There may be instances when no metadata is returned from a NowPlaying request. In this instance, use the Controls-Only Template, which includes a minimized set of visuals.
Note: For certain Music Service Providers, the PlayerInfo directive is sent after the PlaybackStarted Event. In these cases, we recommend adding logic to wait 2 seconds for the PlayerInfo directive. If metadata is not returned after this time, display the Controls-Only Template.
Controls-Only Template
Style
Layout
Data
Native Playback Controls
Many tablets support playback controls on the customer's notifications panel or other universally accessible panel. If your device supports this native framework, then you should support the use of these controls for music playback from Alexa.
This playback controller should display the following metadata:
- art (album artwork)
- title
- titleSubtext1
- provider name
- any other applicable playback controls.
Tapping on the metadata should return the customer to the nowPlaying GUI of the current song.
Transitions
Transitions should be quick (< 1 sec) and employ easing to create a smooth feel. First the background fades in, followed by the content. To account for latency, a background placeholder box should appear in place of an image, which transitions to the fully loaded image when it arrives.
Cards exit the opposite way they came in. The text fades out first and then the Card fades.
Interruption Scenarios
The following are examples of the states the customer sees when interrupting Alexa's response.
Card to Card
Step 1: Utterance1
At Utterance1, voice chrome overlays the existing screen.
Step 2: TTS1 + GUI1
Alexa responds.
Step 3: Utterance 2 (Interruption)
When the customer interrupts Alexa (via tap or wake word), Alexa stops speaking and voice chrome overlays the existing card.
Step 4: TTS2 + GUI2
Alexa responds to utterance2 via voice and replaces the old card with a new one. This card dismisses according to regular dismissal rules.
NowPlaying to Card
Step 1: Utterance1
At Utterance1, voice chrome overlays the existing screen.
Step 2: TTS1 + GUI1
Alexa responds. Music plays.
Step 3: Utterance 2 (Interruption)
When the customer interrupts Alexa (via tap or wake word), the music attenuates and voice chrome overlays the nowPlaying GUI.
Step 4: TTS2 + GUI2
If the utterance is understood and a card is required, Alexa responds to the utterance via voice and a new card. Once the TTS completes, the music returns to the regular volume. The card dismisses according to regular dismissal rules, except that when dismissed, the customer returns to the nowPlaying card.
If the song changes during this time, when returning the nowPlaying GUI should reflect the new song.
Card to NowPlaying
Step 1: Utterance1
At Utterance1, voice chrome overlays the existing screen.
Step 2: TTS2 + GUI1
Alexa responds.
Step 3: Utterance2 (Interruption)
When the customer interrupts the music (via tap or wake word), Alexa stops speaking and the voice chrome overlays the existing card.
Step 4: TTS + GUI2
Alexa responds to Utterance 2 via voice and a new card. Once the TTS completes, music begins playing. This card dismisses according to regular dismissal rules.
NowPlaying to Error
Step 1: Utterance1
At Utterance1, voice chrome overlays the existing screen.
Step 2: TTS2 + GUI1
Alexa responds. Music plays.
Step 3: Utterance2 (Interruption)
When the customer interrupts the music (via tap or wake word), the music attenuates and voice chrome overlays the nowPlaying GUI.
Step 4: GUI1
If no utterance is understood, the voice chrome removes, returning to the nowPlaying GUI, and the music returns to it’s original volume.
Assets
These resources are provided for you to use with your display cards.
For tablets with a resolution of 1280x800dp or higher, we recommend using the large assets listed below. For lower resolution tablets, use the small assets. For resolutions that are much larger or smaller, you can also scale the assets for your needs.
Alexa
- Alexa logo (barge-in button): small tablets, large tablets
- GUI dismiss button ("X" button): small tablets, large tablets
Transport controls
The following are assets for media player controls.
Play
Pause
Prev
Alexa.
|
https://developer.amazon.com/en-US/docs/alexa/alexa-voice-service/display-cards-tablets-1-0.html
|
CC-MAIN-2021-25
|
en
|
refinedweb
|
I just announced the new Spring Boot 2 material, coming in REST With Spring:
1. Overview
In this tutorial, we’ll do a quick overview of the ANTLR parser generator and show some real-world applications.
2. ANTLR
ANTLR (ANother Tool for Language Recognition) is a tool for processing structured text.
It does this by giving us access to language processing primitives like lexers, grammars, and parsers as well as the runtime to process text against them.
It’s often used to build tools and frameworks. For example, Hibernate uses ANTLR for parsing and processing HQL queries and Elasticsearch uses it for Painless.
And Java is just one binding. ANTLR also offers bindings for C#, Python, JavaScript, Go, C++ and Swift.
3. Configuration
First of all, let’s start by adding antlr-runtime to our pom.xml:
<dependency> <groupId>org.antlr</groupId> <artifactId>antlr4-runtime</artifactId> <version>4.7.1</version> </dependency>
And also the antlr-maven-plugin:
<plugin> <groupId>org.antlr</groupId> <artifactId>antlr4-maven-plugin</artifactId> <version>4.7.1</version> <executions> <execution> <goals> <goal>antlr4</goal> </goals> </execution> </executions> </plugin>
It’s the plugin’s job to generate code from the grammars we specify.
4. How Does it Work?
Basically, when we want to create the parser by using the ANTLR Maven plugin, we need to follow three simple steps:
- prepare a grammar file
- generate sources
- create the listener
So, let’s see these steps in action.
5. Using an Existing Grammar
Let’s first use ANTLR to analyze code for methods with bad casing:
public class SampleClass { public void DoSomethingElse() { //... } }
Simply put, we’ll validate that all method names in our code start with a lowercase letter.
5.1. Prepare a Grammar File
What’s nice is that there are already several grammar files out there that can suit our purposes.
Let’s use the Java8.g4 grammar file which we found in ANTLR’s Github grammar repo.
We can create the src/main/antlr4 directory and download it there.
5.2. Generate Sources
ANTLR works by generating Java code corresponding to the grammar files that we give it, and the maven plugin makes it easy:
mvn package
By default, this will generate several files under the target/generated-sources/antlr4 directory:
- Java8.interp
- Java8Listener.java
- Java8BaseListener.java
- Java8Lexer.java
- Java8Lexer.interp
- Java8Parser.java
- Java8.tokens
- Java8Lexer.tokens
Notice that the names of those files are based on the name of the grammar file.
We’ll need the Java8Lexer and the Java8Parser files later when we test. For now, though, we need the Java8BaseListener for creating our MethodUppercaseListener.
5.3. Creating MethodUppercaseListener
Based on the Java8 grammar that we used, Java8BaseListener has several methods that we can override, each one corresponding to a heading in the grammar file.
For example, the grammar defines the method name, parameter list, and throws clause like so:
methodDeclarator : Identifier '(' formalParameterList? ')' dims? ;
And so Java8BaseListener has a method enterMethodDeclarator which will be invoked each time this pattern is encountered.
So, let’s override enterMethodDeclarator, pull out the Identifier, and perform our check:
public class UppercaseMethodListener extends Java8BaseListener { private List<String> errors = new ArrayList<>(); // ... getter for errors @Override public void enterMethodDeclarator(Java8Parser.MethodDeclaratorContext ctx) { TerminalNode node = ctx.Identifier(); String methodName = node.getText(); if (Character.isUpperCase(methodName.charAt(0))) { String error = String.format("Method %s is uppercased!", methodName); errors.add(error); } } }
5.4. Testing
Now, let’s do some testing. First, we construct the lexer:
String javaClassContent = "public class SampleClass { void DoSomething(){} }"; Java8Lexer java8Lexer = new Java8Lexer(CharStreams.fromString(javaClassContent));
Then, we instantiate the parser:
CommonTokenStream tokens = new CommonTokenStream(lexer); Java8Parser parser = new Java8Parser(tokens); ParseTree tree = parser.compilationUnit();
And then, the walker and the listener:
ParseTreeWalker walker = new ParseTreeWalker(); UppercaseMethodListener listener= new UppercaseMethodListener();
Lastly, we tell ANTLR to walk through our sample class:
walker.walk(listener, tree); assertThat(listener.getErrors().size(), is(1)); assertThat(listener.getErrors().get(0), is("Method DoSomething is uppercased!"));
6. Building our Grammar
Now, let’s try something just a little bit more complex, like parsing log files:
2018-May-05 14:20:18 INFO some error occurred 2018-May-05 14:20:19 INFO yet another error 2018-May-05 14:20:20 INFO some method started 2018-May-05 14:20:21 DEBUG another method started 2018-May-05 14:20:21 DEBUG entering awesome method 2018-May-05 14:20:24 ERROR Bad thing happened
Because we have a custom log format, we’re going to first need to create our own grammar.
6.1. Prepare a Grammar File
First, let’s see if we can create a mental map of what each log line looks like in our file.
<datetime> <level> <message>
Or if we go one more level deep, we might say:
<datetime> := <year><dash><month><dash><day> …
And so on. It’s important to consider this so we can decide at what level of granularity we want to parse the text.
A grammar file is basically a set of lexer and parser rules. Simply put, lexer rules describe the syntax of the grammar while parser rules describe the semantics.
Let’s start by defining fragments which are reusable building blocks for lexer rules.
fragment DIGIT : [0-9]; fragment TWODIGIT : DIGIT DIGIT; fragment LETTER : [A-Za-z];
Next, let’s define the remainings lexer rules:
DATE : TWODIGIT TWODIGIT '-' LETTER LETTER LETTER '-' TWODIGIT; TIME : TWODIGIT ':' TWODIGIT ':' TWODIGIT; TEXT : LETTER+ ; CRLF : '\r'? '\n' | '\r';
With these building blocks in place, we can build parser rules for the basic structure:
log : entry+; entry : timestamp ' ' level ' ' message CRLF;
And then we’ll add the details for timestamp:
timestamp : DATE ' ' TIME;
For level:
level : 'ERROR' | 'INFO' | 'DEBUG';
And for message:
message : (TEXT | ' ')+;
And that’s it! Our grammar is ready to use. We will put it under the src/main/antlr4 directory as before.
6.2. Generate Sources
Recall that this is just a quick mvn package, and that this will create several files like LogBaseListener, LogParser, and so on, based on the name of our grammar.
6.3. Create our Log Listener
Now, we are ready to implement our listener, which we’ll ultimately use to parse a log file into Java objects.
So, let’s start with a simple model class for the log entry:
public class LogEntry { private LogLevel level; private String message; private LocalDateTime timestamp; // getters and setters }
Now, we need to subclass LogBaseListener as before:
public class LogListener extends LogBaseListener { private List<LogEntry> entries = new ArrayList<>(); private LogEntry current;
current will hold onto the current log line, which we can reinitialize each time we enter a logEntry, again based on our grammar:
@Override public void enterEntry(LogParser.EntryContext ctx) { this.current = new LogEntry(); }
Next, we’ll use enterTimestamp, enterLevel, and enterMessage for setting the appropriate LogEntry properties:
@Override public void enterTimestamp(LogParser.TimestampContext ctx) { this.current.setTimestamp( LocalDateTime.parse(ctx.getText(), DEFAULT_DATETIME_FORMATTER)); } @Override public void enterMessage(LogParser.MessageContext ctx) { this.current.setMessage(ctx.getText()); } @Override public void enterLevel(LogParser.LevelContext ctx) { this.current.setLevel(LogLevel.valueOf(ctx.getText())); }
And finally, let’s use the exitEntry method in order to create and add our new LogEntry:
@Override public void exitLogEntry(LogParser.EntryContext ctx) { this.entries.add(this.current); }
Note, by the way, that our LogListener isn’t threadsafe!
6.4. Testing
And now we can test again as we did last time:
@Test public void whenLogContainsOneErrorLogEntry_thenOneErrorIsReturned() throws Exception { String logLine ="2018-May-05 14:20:24 ERROR Bad thing happened"; // instantiate the lexer, the parser, and the walker LogListener listener = new LogListener(); walker.walk(listener, logParser.log()); LogEntry entry = listener.getEntries().get(0); assertThat(entry.getLevel(), is(LogLevel.ERROR)); assertThat(entry.getMessage(), is("Bad thing happened")); assertThat(entry.getTimestamp(), is(LocalDateTime.of(2018,5,5,14,20,24))); }
7. Conclusion
In this article, we focused on how to create the custom parser for the own language using the ANTLR.
We also saw how to use existing grammar files and apply them for very simple tasks like code linting.
As always, all the code used here can be found over on GitHub.
|
https://www.baeldung.com/java-antlr
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
Trading Strategies and Financial Models. Alexander Barinov
- Daisy White
- 1 years ago
- Views:
Transcription
1 Trading Strategies and Financial Models Alexander Barinov This version: July 2014 c 2014 Alexander Barinov
2 Contents 1 Topics in Market Efficiency EMH and Expected Returns Random Walk Hypothesis and Expected Returns Predictable Expected Returns Are Consistent with the EMH EMH Is About Abnormal Returns EMH, Trading Costs, and Limits to Arbitrage EMH and Trading Costs Limits to Arbitrage: Definition The Difference between Trading Costs and Limits to Arbitrage EMH, Competition, and Information Production People Making the Market Efficient Will Be Rewarded EMH Is Similar to Perfect Competition EMH: Conclusion Trading Costs Price impact Order Book Example Hiding in the Volume
3 4 CONTENTS Determinants of Price Impact Recent Trends in Price Impact Measuring Price Impact Bid-Ask Spread The Market Maker Example Determinants of Bid-Ask Spread Bid-Ask Spread as a Trading Cost Measuring the Bid-Ask Spread Short Sales Uses of Shorting Short Sales as an Insurance Zero-Investment Portfolios Alpha as a Trading Strategy Return Short-Sale Constraints and Mispricing The Winner s Curse The Miller (JF 1977) Story Determinants of Shorting Fees Short-Sale Constraints and Uncertainty Predictability of Risk Predictability Basics Why Expected Return Is Predictable? Treasury Bills, Inflation, and Expected Market Return
4 CONTENTS Default Premium and Expected Market Return Term Premium and Expected Market Return Dividend Yield and Expected Market Return Long-Run Predictability Caveats Long-Run Predictability in an Efficient Market Long-Run Predictability in an Irrational Market Long-Run Predictability and Statistical Caveats Expected and Unexpected Higher Expected Return Means Lower Current Return Back to Inflation and Expected Return Why Macro Variables Should Be Lagged Change Stands for News High Expected Returns During Recessions? Yes! Conditional CAPM Conditional CAPM: Theory Risk According to the CAPM Risk According to the Conditional CAPM How Important is the Risk Captured by the Conditional CAPM Conditional CAPM in the Data First Look at the Value Effect Empirical Setup Interpreting the Results Conditional CAPM Works, but Not by Enough
5 6 CONTENTS 6 Consumption CAPM and Intertemporal CAPM Consumption CAPM Risk According to Consumption CAPM Consumption CAPM in Real-Life Examples Intertemporal CAPM ICAPM Hunts for Consumption Proxies ICAPM Controls for Shifting Wealth from Good to Bad Periods ICAPM Example: Inflation Risk ICAPM Is Broader than Conditional CAPM ICAPM and the Value Effect: An Example VIX and the Business Cycle Change in VIX as an ICAPM Factor Factor-Mimicking Portfolio ICAPM and Multifactor Models Fama-French Model as APT Fama-French Model as ICAPM Introduction to Anomalies Anomaly: Definition First Possible Explanation: Rational Stories Ad-hoc CCAPM/ICAPM and Other Ways to Link Anomalies to Risk Three Views on the Fama-French Model Second Possible Explanation: Behavioral Stories
6 CONTENTS Limits to Arbitrage Speculation and Noise Traders Third Possible Explanation: Are Anomalies Real? Conclusion Value Effect Definition Rational Stories Investment Story Volatility Risk Story Other Risk-Based Stories Behavioral Stories Value Effect and Size Value Effect and Idiosyncratic Volatility Value Effect and Institutional Ownership Value Effect and Earnings Announcements Is the Value Effect Real? Trading Costs Story Value Effect Out-of-Sample Momentum Definitions Price Momentum Short-Term Reversal
7 8 CONTENTS Long-Term Reversal Post-Earnings Announcement Drift Earnings Momentum Rational Stories Initial Remarks Momentum Returns and the Business Cycle Momentum Risk and the Business Cycle Earnings Momentum Factor Behavioral Stories Momentum for Small, Young, and Volatile Stocks Momentum for High Turnover Stocks Momentum for Micro Caps Momentum for Growth Firms Momentum and Reversal during Bull and Bear Markets Momentum and Earnings Announcements Is Momentum Real? Trading Cost Story: Summary of the Evidence Trading Cost Story: Example Momentum Out of Sample New Issues Puzzle Definition How Stock Is Issued The Degree of the Underperformance
8 CONTENTS New Issues Puzzle in Multi-Factor Models New Issues Puzzle in Event Time Related Puzzles Risk-Based Stories Firm-Type Stories: New Issues and the Small Growth Anomaly Firm-Type Stories: Volatility Risk Story Firm-Type Stories: New Issues and Investment Factor Risk-Shift Stories: New Issues and Leverage Risk-Shift Stories: New Issues and Turnover Behavioral Stories Basic Behavioral Story Behavioral Story and Different Types of Issues Behavioral Stories, Size, and Market-to-Book New Issues and Earnings Management New Issues Puzzle: Measurement Issues Calendar-Time vs. Event-Time Pseudo Market-Timing Uncertainty Effects Definitions Idiosyncratic Volatility and Expected Returns Idiosyncratic Volatility Discount Analyst Disagreement Effect Turnover Effect
9 10 CONTENTS Turnover Variability Effect Risk-Based Stories Johnson (JF 2004) Model Extending the Johnson Model: Volatility Risk Extending the Johnson Model: Cross-Section Volatility Risk Explains the Uncertainty Effects Mispricing Stories Miller (JF 1977) Story Is Not Behavioral Residual Institutional Ownership and Uncertainty Effects Probability to Be on Special Uncertainty Effects, Short-Sale Constraints, and Volatility Risk Credit Rating and Uncertainty Effects Are Uncertainty Effects Real? Idiosyncratic Volatility Discount at NYSE Lagged and Expected Idiosyncratic Volatility Idiosyncratic Volatility Discount and Short-Term Reversal Analyst Disagreement Effect and Liquidity Uncertainty Effects Around the World Seasonality in Stock Returns January Effect Turn-of-the-Year Effect Small Firms in January Small Growth Firms in January
10 CONTENTS The Other January Effect Monday Effect Weekend Risk and Volatility Monday Effect: Discovery and Disappearance Monday Effect and the Bid-Ask Bounce Monday Effect for Options Where Did the Monday Effect Go? Monday Effect for Puts? Monday Effect and the Delta Robustness of the Monday Effect Monday Effect and Limits to Arbitrage Distress Risk Puzzle Definition Default Risk as a Covariance Distressed Firms and Default Risk O-Score and Z-Score O-Score, Z-Score, and Returns Risk-Based Stories Risk-Shifting Around Bankruptcy Leverage and Self-Selection Johnson (JF 2004) Model Behavioral Stories Distress Risk Puzzle and Market-to-Book
11 12 CONTENTS O-score, MB, and Earnings Announcements Credit Rating Effect Credit Rating Effect in Recessions Credit Rating Effect and Downgrades Credit Rating Effect in Cross-Section Credit Rating Effect and Analyst Disagreement Measurement Issues Errors-in-Variables Cannot Explain Anomalies Equity as a Call Option on the Assets O-Score and R&D Expenses Accrual Anomaly Definition What Are Accruals? Accrual Anomaly How to Measure Accruals? Discretionary Accruals What Drives the Accrual Anomaly? Risk-Based Stories Accrual Anomaly and Value Effect Accrual Anomaly and Investment Factor Predicting Accrual Anomaly Behavioral Stories Accrual Anomaly in Cross-Section
12 CONTENTS Accrual Anomaly and Earnings Announcements Topics in Performance Measurement Alpha and Appraisal Ratio Alpha Appraisal Ratio Alpha or Appraisal Ratio? Zero-Investment Portfolios Set the Risk-Free Rate to Zero Numerical Example Topics in Performance Evaluation What the Manager Does That You Cannot? Multifactor Models and Performance Evaluation R-square and Portfolio Manager s Activity Carhart Model Alpha and Management Fees Who Gets the Alpha? Persistence of Performance What Drives the Alpha? Mutual Fund Flows An Example of Performance Measurement and Evaluation Four Ways to Measure Risk An Example of the Analyst Disagreement Effect
13 14 CONTENTS Applying the Carhart Model The Conditional CAPM Take on Risk The ICAPM Take on Risk The Downfall of Levered ETFs Levered ETFs: Definition and History Constant Leverage Trap Constant Leverage Trap and Pseudo Market Timing Constant Leverage and Trading Costs Constant Leverage Trap Is Not the Only Reason Levered ETFs Underperform Controlling for Trading Costs Explains the Underperformance of Levered ETFs A New Measure of Trading Costs Liquidity and Expected Returns Liquidity: A Special Characteristic Different Holding Periods and Clientele Effects Theory: Bid-Ask Spread and Expected Returns Example 1: Two Stocks, Two Investors Example 2: Three Stocks, Three Investors Amihud and Mendelson: Many Stocks, Many Investors Price Impact and Expected Returns The Amihud Measure and Expected Returns
14 CONTENTS Example 3: Two Stocks, Two Investors Example 4: Three Stocks, Two Investors Example 5: Two Stocks, Three Investors Liquidity Risk Liquidity as a State Variable Forming a Liquidity Risk Factor Three Dimensions of Liquidity Risk Pastor-Stambaugh Factor Examples with Liquidity Risk Factors Introduction to Behavioral Finance The Starting Point and the Road Ahead Mispricing and Limits to Arbitrage What We Need to Do Noise Traders and Covariances: Theory Starting Point: Those Who Create Mispricing Should Go Broke How Those Who Create Mispricing Avoid Going Broke Characteristic and Covariances: A New Take Noise Traders and Covariances: Evidence Index Additions and Deletions Betas and Infrequent Trading Measuring Investor Sentiment Sentiment and Anomalies
15 16 CONTENTS 22 Overview of Select Behavioral Theories Psychological Biases and Momentum Conservatism Bias and Representativeness Heuristic Conservatism Bias and Representativeness Heuristic in One Model Overconfidence and Self-Attribution Overconfidence and Self-Attribution in One Model Prospect Theory Equity Premium Puzzle Mental Accounting and Equity Premium Prospect Theory and Skewness Preference Asset Pricer s Take on Behavioral Finance Eugene Fama on Behavioral Finance Aggregation and Data Mining
Market Efficiency and Behavioral Finance. Chapter 12
Market Efficiency and Behavioral Finance Chapter 12 Market Efficiency if stock prices reflect firm performance, should we be able to predict them? if prices were to be predictable, that would create the
FINA 4330: Trading Strategies and Financial Models
FINA 4330: Trading Strategies and Financial Models Course Syllabus Fall 2014 Instructor Dr. Alexander Barinov, PhD, University of Rochester Assistant Professor, Department of Banking and Finance Terry
CHAPTER 11: THE EFFICIENT MARKET HYPOTHESIS
CHAPTER 11: THE EFFICIENT MARKET HYPOTHESIS PROBLEM SETS 1. The correlation coefficient between stock returns for two non-overlapping periods should be zero. If not, one could use returns from one
QUANTITATIVE FINANCIAL ECONOMICS
Ill. i,t.,. QUANTITATIVE FINANCIAL ECONOMICS STOCKS, BONDS AND FOREIGN EXCHANGE Second Edition KEITH CUTHBERTSON AND DIRK NITZSCHE HOCHSCHULE John Wiley 8k Sons, Ltd CONTENTS Preface Acknowledgements 2.1
CHAPTER 11: THE EFFICIENT MARKET HYPOTHESIS
CHAPTER 11: THE EFFICIENT MARKET HYPOTHESIS PROBLEM SETS 1. The correlation coefficient between stock returns for two non-overlapping periods should be zero. If not, one could use returns from one period
ANALYSIS AND MANAGEMENT
ANALYSIS AND MANAGEMENT T H 1RD CANADIAN EDITION W. SEAN CLEARY Queen's University CHARLES P. JONES North Carolina State University JOHN WILEY & SONS CANADA, LTD. CONTENTS PART ONE Background CHAPTER
Stock Returns Following Profit Warnings: A Test of Models of Behavioural Finance.
Stock Returns Following Profit Warnings: A Test of Models of Behavioural Finance. G. Bulkley, R.D.F. Harris, R. Herrerias Department of Economics, University of Exeter * Abstract Models in behavioural
Investment Portfolio Management and Effective Asset Allocation for Institutional and Private Banking Clients
Investment Portfolio Management and Effective Asset Allocation for Institutional and Private Banking Clients Senior Managers Days 4 1 WHY attend this programme? This
Lecture 10: Market Efficiency
Lecture 10: Market Efficiency Prof. Markus K. Brunnermeier Overview Efficiency concepts EMH implies Martingale Property Evidence I: Return Predictability Mispricing versus Risk-factor Informational (market)
Crisis Alpha and Risk in Alternative Investment Strategies
Crisis Alpha and Risk in Alternative Investment Strategies KATHRYN M. KAMINSKI, PHD, RPM RISK & PORTFOLIO MANAGEMENT AB ALEXANDER MENDE, PHD, RPM RISK & PORTFOLIO MANAGEMENT AB INTRODUCTION The investment
The Case For Passive Investing!
The Case For Passive Investing! Aswath Damodaran Aswath Damodaran! 1! The Mechanics of Indexing! Fully indexed fund: An index fund attempts to replicate a market index. It is relatively simple to create,
Models of Asset Pricing The implications for asset allocation
Models of Asset Pricing The implications for asset allocation 2004 Finance & Investment Conference 28 June 2004 Tim Giles CHARLES RIVER ASSOCIATES Vice President CRA London CRA 2004 Agenda New orthodoxy
CONTENTS OF VOLUME IB
CONTENTS OF VOLUME IB Introduction to the Series Contents of the Handbook Preface v vii ix FINANCIAL MARKETS AND ASSET PRICING Chapter 10 Arbitrage, State Prices and Portfolio Theory PHILIP H. DYBVIG
Market Efficiency: Definitions and Tests. Aswath Damodaran
Market Efficiency: Definitions and Tests 1 Why market efficiency matters.. Question of whether markets are efficient, and if not, where the inefficiencies lie, is central to investment valuation. If markets
B.3. Robustness: alternative betas estimation
Appendix B. Additional empirical results and robustness tests This Appendix contains additional empirical results and robustness tests. B.1. Sharpe ratios of beta-sorted portfolios Fig. B1 plots the Sharpe
René Garcia Professor of finance
Liquidity Risk: What is it? How to Measure it? René Garcia Professor of finance EDHEC Business School, CIRANO Cirano, Montreal, January 7, 2009 The financial and economic environment We are living through
ABACUS ANALYTICS. Equity Factors and Portfolio Management: Alpha Generation Versus Risk Control
50 Washington Street Suite 605 Norwalk, Connecticut 06854 info@abacus-analytics.com 203.956.6460 fax 203.956.6462 ABACUS ANALYTICS Equity actors and Portfolio Management: Alpha Generation Versus Risk Control
Tilted Portfolios, Hedge Funds, and Portable Alpha
MAY 2006 Tilted Portfolios, Hedge Funds, and Portable Alpha EUGENE F. FAMA AND KENNETH R. FRENCH Many of Dimensional Fund Advisors clients tilt their portfolios toward small and value stocks. Relative
Chap 3 CAPM, Arbitrage, and Linear Factor Models
Chap 3 CAPM, Arbitrage, and Linear Factor Models 1 Asset Pricing Model a logical extension of portfolio selection theory is to consider the equilibrium asset pricing consequences of investors individually
What Level of Incentive Fees Are Hedge Fund Investors Actually Paying?
What Level of Incentive Fees Are Hedge Fund Investors Actually Paying? Abstract Long-only investors remove the effects of beta when analyzing performance. Why shouldn t long/short equity hedge fund investors
Foundations of Asset Management Goal-based Investing the Next Trend
Foundations of Asset Management Goal-based Investing the Next Trend Robert C. Merton Distinguished Professor of Finance MIT Finance Forum May 16, 2014 #MITSloanFinance 1 Agenda Goal-based approach to investment,
Key Concepts and Skills
Chapter 10 Some Lessons from Capital Market History Key Concepts and Skills Know how to calculate the return on an investment Understand the historical returns on various types of investments Understand
FIN 432 Investment Analysis and Management Review Notes for Midterm Exam
FIN 432 Investment Analysis and Management Review Notes for Midterm Exam Chapter 1 1. Investment vs. investments 2. Real assets vs. financial assets 3. Investment process Investment policy, asset allocation,
An ERI Scientific Beta Publication. The Dimensions of Quality Investing: High Profitability and Low Investment Smart Factor Indices
An ERI Scientific Beta Publication The Dimensions of Quality Investing: High Profitability and Low Investment Smart Factor Indices March 2015 2 An ERI Scientific Beta Publication The Dimensions of Quality
Ankur Pareek Rutgers School of Business
Yale ICF Working Paper No. 09-19 First version: August 2009 Institutional Investors Investment Durations and Stock Return Anomalies: Momentum, Reversal, Accruals, Share Issuance and R&D Increases Martijn
The term structure of equity option implied volatility
The term structure of equity option implied volatility Christopher S. Jones Tong Wang Marshall School of Business Marshall School of Business University of Southern California University of Southern California First Look at Closed-end Funds in China
A First Look at Closed-end Funds in China Gongmeng Chen Oliver Rui and Yexiao Xu This version: May 2002 Abstract This paper documents a number of stylized facts about Chinese closed-end funds. Although
Asset Management Contracts and Equilibrium Prices
Asset Management Contracts and Equilibrium Prices ANDREA M. BUFFA DIMITRI VAYANOS PAUL WOOLLEY Boston University London School of Economics London School of Economics September, 2013 Abstract We study
An Intermarket Approach to Beta Rotation
An Intermarket Approach to Beta Rotation The Strategy, Signal, and Power of Utilities Market Technicians Association An Intermarket Approach to Beta Rotation Charles V. Bilello, CMT Michael A. Gayed, CFA
Risk and return (1) Class 9 Financial Management, 15.414
Risk and return (1) Class 9 Financial Management, 15.414 Today Risk and return Statistics review Introduction to stock price behavior Reading Brealey and Myers, Chapter 7, p. 153 165 Road map Part 1. Valuation
Appendices with Supplementary Materials for CAPM for Estimating Cost of Equity Capital: Interpreting the Empirical Evidence
Appendices with Supplementary Materials for CAPM for Estimating Cost of Equity Capital: Interpreting the Empirical Evidence This document contains supplementary material to the paper titled CAPM for estimating
Smart Indices How Smart Are They?
Smart Indices How Smart Are They? Dr. Benedikt Henne CIO Systematic Equity Allianz Global Investors May 8th, 2014 Understand. Act. Smart Indices Can Investors Do Better Than Cap Weighted Indices? Smart
CHAPTER 11: ARBITRAGE PRICING THEORY
CHAPTER 11: ARBITRAGE PRICING THEORY 1. The revised estimate of the expected rate of return on the stock would be the old estimate plus the sum of the products of the unexpected change in each factor times,
8.1 Summary and conclusions 8.2 Implications
Conclusion and Implication V{tÑàxÜ CONCLUSION AND IMPLICATION 8 Contents 8.1 Summary and conclusions 8.2 Implications Having done the selection of macroeconomic variables, forecasting the series and construction
6 Week 3. Fama-French and the cross section of stock returns detailed notes
6 Week 3. Fama-French and the cross section of stock returns detailed notes 1. Big questions. (a) Last week does expected return vary over time? Is 1999 (2000 )different from 2004(2005 )? If so, why? (Something
Lecture 1: Asset pricing and the equity premium puzzle
Lecture 1: Asset pricing and the equity premium puzzle Simon Gilchrist Boston Univerity and NBER EC 745 Fall, 2013 Overview Some basic facts. Study the asset pricing implications of household portfolio
Risk factors in the Russian stock market
Risk factors in the Russian stock market ALEXEI GORIAEV 1 New Economic School March 2004 Draft version 1 New Economic School, Nakhimovsky pr. 47, Moscow 117418, Russia. Phone: +7095 129 3911, fax: +7095
Value-Based Management
Value-Based Management Lecture 5: Calculating the Cost of Capital Prof. Dr. Gunther Friedl Lehrstuhl für Controlling Technische Universität München Email: gunther.friedl@tum.de Overview 1. Value Maximization
Use the table for the questions 18 and 19 below.
Use the table for the questions 18 and 19 below. The following table summarizes prices of various default-free zero-coupon bonds (expressed as a percentage of face value): Maturity (years) 1 3 4 5 Price
Interest Rates and Inflation: How They Might Affect Managed Futures
Faced with the prospect of potential declines in both bonds and equities, an allocation to managed futures may serve as an appealing diversifier to traditional strategies. HIGHLIGHTS Managed Futures have
Wel Dlp Portfolio And Risk Management
1. In case of perfect diversification, the systematic risk is nil. Wel Dlp Portfolio And Risk Management 2. The objectives of investors while putting money in various avenues are:- (a) Safety (b) Capital author.
Liquidity of Corporate Bonds
Liquidity of Corporate Bonds Jack Bao, Jun Pan and Jiang Wang MIT October 21, 2008 The Q-Group Autumn Meeting Liquidity and Corporate Bonds In comparison, low levels of trading in corporate bond market
NPTEL
NPTEL Syllabus Security and - Video course COURSE OUTLINE This course provides a broad overview of investment management, focusing on the application of finance theory to the issue faced by portfolio managers
Low Volatility Equity Strategies: New and improved?
Low Volatility Equity Strategies: New and improved? Jean Masson, Ph.D Managing Director, TD Asset Management January 2014 Low volatility equity strategies have been available to Canadian investors for
Risk, Return and Market Efficiency
Risk, Return and Market Efficiency For 9.220, Term 1, 2002/03 02_Lecture16.ppt Student Version Outline 1. Introduction 2. Types of Efficiency 3. Informational Efficiency 4. Forms of Informational Efficiency
Chapter 7 Risk, Return, and the Capital Asset Pricing Model
Chapter 7 Risk, Return, and the Capital Asset Pricing Model MULTIPLE CHOICE 1. Suppose Sarah can borrow and lend at the risk free-rate of 3%. Which of the following four risky portfolios should she hold
MSc Finance and Economics detailed module information
MSc Finance and Economics detailed module information Example timetable Please note that information regarding modules is subject to change. TERM 1 TERM 2 TERM 3 INDUCTION WEEK EXAM PERIOD Week 1 EXAM
Fundamentals of Investing
Fundamentals of Investing Fundamentals of Investing, International Edition Table of Contents Cover Contents Part One: Preparing to Invest Chapter 1 The Investment Environment Investments and the Investment
Lecture 8: Stock market reaction to accounting data
Lecture 8: Stock market reaction to accounting data In this lecture we will focus on how the market appears to evaluate accounting disclosures. For most of the time, we shall be examining the results
Markets and Banks. Stephen Kealhofer 5Oct11
Markets and Banks Stephen Kealhofer 5Oct11 1 Outline Financial intermediation Characteristics of markets Prior versus current academic views Relationship of information vs liquidity trading Drivers of
Investing on hope? Small Cap and Growth Investing!
Investing on hope? Small Cap and Growth Investing! Aswath Damodaran Aswath Damodaran! 1! Who is a growth investor?! The Conventional definition: An investor who buys high price earnings ratio stocks or,
Quants: Beyond multi-factor models. Nomura Global Quantitative Equity Conference May 21st 2010
Quants: Beyond multi-factor models Nomura Global Quantitative Equity Conference May 21st 2010 Generating alpha from quant models It is like the old story of the man who was going to fight a duel the next
The New Diversification Adding Alternative Investments
The New Diversification Adding Alternative Investments Investing in alternative investments presents the opportunity for significant losses, including the loss of your total investment. Such strategies
Financial Markets And Financial Instruments - Part I
Financial Markets And Financial Instruments - Part I Financial Assets Real assets are things such as land, buildings, machinery, and knowledge that are used to produce goods and services. Financial assets
Best Styles: Harvesting Risk Premium in Equity Investing
Strategy Best Styles: Harvesting Risk Premium in Equity Investing Harvesting risk premiums is a common investment strategy in fixed income or foreign exchange investing. In equity investing it is still
Introduction. Part IV: Option Fundamentals. Derivatives & Risk Management. The Nature of Derivatives. Definitions. Options. Main themes Options
Derivatives & Risk Management Main themes Options option pricing (microstructure & investments) hedging & real options (corporate) This & next weeks lectures Introduction Part IV: Option Fundamentals»
Foundations of Factor Investing
Jennifer Bender Remy Briand Dimitris Melas Raman Aylur Subramanian Executive Summary Factor investing has become a widely discussed part of today s investment canon. In this paper, we discuss the rationale
The Science of Investing
DIMENSIONAL FUND ADVISORS The Science of Investing UNITED STATES UK/EUROPE CANADA ASIA PACIFIC There is a new model of investing: a model based not on speculation but on the science of capital markets.
Leverage and Pricing in Buyouts: An Empirical Analysis
Leverage and Pricing in Buyouts: An Empirical Analysis Ulf Axelson Stockholm School of Economics and SIFR Tim Jenkinson Oxford University and CEPR Per Strömberg Stockholm School of Economics, SIFR, CEPR
Performance Evaluation on Mutual Funds
Performance Evaluation on Mutual Funds Dr.G.Brindha Associate Professor, Bharath School of Business, Bharath University, Chennai 600073, India Abstract: Mutual fund investment has lot of changes in the
THE NUMBER OF TRADES AND STOCK RETURNS
THE NUMBER OF TRADES AND STOCK RETURNS Yi Tang * and An Yan Current version: March 2013 Abstract In the paper, we study the predictive power of number of weekly trades on ex-post stock returns. A higher
Option Trading and Stock Price Movements
Option Trading and Stock Price Movements Allen M. Poteshman University of Illinois at Urbana-Champaign QWAFAFEW Presentation January 27, 2005 Outline Information in option volume about direction of future
Cost of Capital, Valuation and Strategic Financial Decision Making
Cost of Capital, Valuation and Strategic Financial Decision Making By Dr. Valerio Poti, - Examiner in Professional 2 Stage Strategic Corporate Finance The financial crisis that hit financial markets
THOMSON REUTERS STARMINE QUANTITATIVE ANALYTICS
THOMSON REUTERS STARMINE QUANTITATIVE ANALYTICS Grounded in sound economic intuition and backed by rigorous analysis, our robust models span sectors, regions, and markets to help you achieve higher returns
|
http://docplayer.net/27765976-Trading-strategies-and-financial-models-alexander-barinov.html
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
What I am looking to do is replace a print statement with a new print statement. In layman's terms, I want the console to print
Downloading... and then replace it with
Downloading...done! as soon as the downloading finishes. I have tried this answer but it just prints some garbage and then the print statement on a new line. I am using Python 3. Thanks in advance!
use
end="" in the first
end is a
new line but you can change it by passing your own value:
print("Downloading...",end="") #your code here print("Done!")
output:
Downloading...Done!
help on
In [3]: print?.
A simple example:
import time print("Downloading... ", end='') time.sleep(3) print("done.")
you can also replace a part of the line printet before using "\r":
import time print("Downloading... ", end='') time.sleep(3) print("\r.............. done.")
This of course only works as long as you don't print a newline anywhere before the carriage return character.
print ("Print this line, and print a newline") print ("Print this line, but not a newline", end="")
If you'd like a interactive
..., i.e. it grows, you could do something like this. Just change the conditional in the
while with something more fitting, or even use
while True and a
if and
break inside the loop.
>>> import time >>> def dotdotdot(): ... print("Downloading", end="") ... a = 0 ... while a < 10: ... print(".", end="") ... time.sleep(1) ... a += 1 ... print("done!") ... >>> dotdotdot() Downloading..........done!
|
http://www.dlxedu.com/askdetail/3/bceb36d654483f03b4aefde77e3e356d.html
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
Short solution in Creative category for Non-unique Elements by inovitsky
#Your optional code here
#You can import some modules or create additional functions
def checkio(data):
#Your code here
#It's main function. Don't remove this function
#It's used for auto-testing and must return a result for check.
return [item for item in data if data.count(item)>1]
#Some hints
#You can use list.count(element) method for counting.
#Create new list with non-unique elements
#or remove elements from original list (but it's bad practice for many real cases)
#Loop over original list
April 23, 2014
Forum
Global Activity
Jobs
Class Manager
Leaderboard
Coding games
Python programming for beginners
|
https://py.checkio.org/mission/non-unique-elements/publications/inovitsky/python-3/short/share/d02ab88a3cec905aaa91ffec2dc488b3/
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
This is an example of a plug-in which can be dynamically loaded into stellarium. More...
#include <TextUserInterface.hpp>
The Text User Interface (TUI) plugin replaces the old (pre-0.10 series) text user interface. It used to be activated with M until the 0.14 series, but was changed to Alt-T for 0.15 and later (to be consistent with the Ctrl-T hiding of the GUI)..
Implements StelModule.
|
http://stellarium.org/doc/0.18/classTextUserInterface.html
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
In this post, we will see an example of how to do a Left Outer Join in LINQ and C#.
In a previous post, we saw how to do an Inner join in C# and LINQ where each element of the first collection appears one time for every matching element in the second collection. If an element in the first collection has no matching elements, it does not appear in the join result set. However in a Left Outer Join, each element of the first collection is returned, regardless of whether it has any correlated elements in the second collection.
Let us see this with an example.
class Program
{
static void Main(string[] args)
{
List<Book> bookList = new List<Book>
{
new Book{BookID=1, BookNm="DevCurry.com Developer Tips"},
new Book{BookID=2, BookNm=".NET and COM for Newbies"},
new Book{BookID=3, BookNm="51 jQuery ASP.NET Recipes"},
new Book{BookID=4, BookNm="Motivational Gurus"},
new Book{BookID=5, BookNm="Spiritual Gurus"}
};
List<Order> bookOrders = new List<Order>{
new Order{OrderID=1, BookID=1, PaymentMode="Cheque"},
new Order{OrderID=2, BookID=5, PaymentMode="Credit"},
new Order{OrderID=3, BookID=1, PaymentMode="Cash"},
new Order{OrderID=4, BookID=3, PaymentMode="Cheque"},
new Order{OrderID=5, BookID=5, PaymentMode="Cheque"},
new Order{OrderID=6, BookID=4, PaymentMode="Cash"}
};
}
}
public class Book
{
public int BookID { get; set; }
public string BookNm { get; set; }
}
public class Order
{
public int OrderID { get; set; }
public int BookID { get; set; }
public string PaymentMode { get; set; }
}
}
Let us do a Left Outer Join between the Book and Order collection
var orderForBooks = from bk in bookList
join ordr in bookOrders
on bk.BookID equals ordr.BookID
into a
from b in a.DefaultIfEmpty(new Order())
select new
{
bk.BookID,
Name = bk.BookNm,
b.PaymentMode
};
foreach (var item in orderForBooks)
Console.WriteLine(item);
Console.ReadLine();
In the code shown above, the query uses the join clause to match Book objects with Order objects testing it for equality using the equals operator. Up till here, the query is the same as in our previous article.
Additionally in order to include each element of the Book collection in the result set even if that element has no matches in the Order collection, we are using DefaultIfEmpty() and passing in an empty instance of the Order class, when there is no Order for that Book.
The select clause defines how the result will appear using anonymous types that consist of the BookID, Book Name and Order Payment Mode.
OUTPUT
Observe that BookID =2 was included in the list even though it did not have an entry in the Order table. You can compare this result with the one we got in our previous article to understand the difference between Inner Join and Left Outer Join.
Make sure you read my previous article Inner Join Example in LINQ and C# to understand the difference between the Inner Join and Left Outer Join.
Will you give this article a +1 ? Thanks in advance
5 comments:
Nice post. That syntax shows how to simulate a left outer join when the 2 tables aren't related, but in things like LINQ to SQL, you can just use this:
var orderForBooks =
from bk in Books
select new
{
bk.BookID,
Name = bk.Name,
PaymentMode =
from o in bk.Orders
select o.PaymentMode
};
Granted, the shape of the result set is different (not flattened one per row), but it's another option. You just need to be sure to set up FKs in your database.
Yes! Thanks for sharing your code Dan.
Dan Miser's solution creates structure very different from SQL Left join. PaymentMode is IEnumerable collection packed anonymous object. It may be empty. Using this structure in pure C# code is not a problem but sending it to Reporting Services requires additional transformations
It would be nice if your example was for a left outer join on a DB table rather than two hard coded objects.
Hey.
Nice Code, but to specify each field in "select" is very "static" I would say.
My problem is, that do not know the data structure i'am going to join, because it will be specified by user interactions in runtime.
I want to join two "EnumerableRowCollection"s with unknown fields, but linq allows me only to "select" one of the entity structures at the end.
Actually I expected same results like a "SQL-Left-Join", that will join table structures as well...
My code:
var baseTable = GetDataTable(...);
var joinTable = GetDataTable(...);
var baseTableAsEnumerable = baseTable.AsEnumerable();
var joinTableAsEnumerable = joinTable.AsEnumerable();
var joinResult = from baseAlias in baseTableAsEnumerable
join joinAlias in joinTableAsEnumerable
on baseAlias.Field(baseColumn)
equals joinAlias.Field(joinColumn)
into joinedQueryResult
select joinedQueryResult.First();
The result of this example only contains column structure of "joinTableAsEnumerable", but should contain both - "baseTableAsEnumerable" AND "joinTableAsEnumerable".
My idea was to "create" a new "DataRow" by my own, but this will not result in a correct join-entity at the end. Take a look:
...
into joinedQueryResult
select GetNewJoinedRow(baseTable.Columns, joinTable.Columns, joinedQueryResult.First());
Any solutions?
|
https://www.devcurry.com/2011/01/linq-left-join-example-in-c.html?showComment=1352908672463
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
This analysis so far has not taken into account the time value of money. One dollar received today is worth more than one dollar received five years from today. But how much more? That would depend on how much the recipient thinks he could earn on that dollar: in other words, what's an adequate rate of return?
A dollar received today and invested in a financial instrument that yields 10% would be worth $1.10 after one year. $1.10 is the future value of your dollar given the time period for investment (one year) and the rate of return (10%). After five years, the future value of your dollar would be $1.61. This value is
or
Conversely, ...
No credit card required
|
https://www.safaribooksonline.com/library/view/business-analysis-with/0789725525/0789725525_ch12lev1sec2.html
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
How to create a new Controller in Laravel Framework web-based application ?. It is actually quite easy and it can be done in a several ways. In my opinion there is two ways to done it :
1. The first one is manually create the Controller file.
This step requires everything to be done in manual. Several tasks need to be done in order to accomplish this step. Below are the sequence of the steps :
Create a new File in controller folder of Laravel web-based application. It exists in app/Http/Controller and the execution can be done from the command line by typing the following command :
touch controller_name Description : touch : It is a tool used to create an empty file if it is not exist in the first time. controller_name : It is the parameter of touch command which also represent name of the which is going to be created and associated with the controller name.
For an example :
user@hostname:/var/www/html/laravel-testing/app/Http/Controller# touch HelloController user@hostname:/var/www/html/laravel-testing/app/Http/Controller#
Based on the above output, the controller and also the name of file is HelloController.
But first of all, check the current working directory of the controller file which is going to be created is actually in app/Http/Controller of the project by typing ‘pwd’ command. The usage about the command on detail can be read in article named ‘Check current working directory in Linux with pwd command ‘.
user@hostname:/var/www/html/laravel-testing/app/Http/Controller# pwd /var/www/html/laravel-testing/app/Http/Controller user@hostname:/var/www/html/laravel-testing/app/Http/Controller#
Following the above execution command, fill the content of the file named HelloController with the script shown below :
<?php namespace App\Http\Controllers; class HelloController extends Controller { public function index(){ return view('hello'); } } ?>
To test the above script whether it is actually running or not, first of all, create a new file named hello.blade.php in resources/views. Below is the content of the file itself :
<!DOCTYPE html> <html> <head> <title>Laravel</title> <link href="//fonts.googleapis.com"> <div class="title">Hello, welcome to Laraland !</div> </div> </div> </body> </html>
The above snippet code is retrieved from the article titled ‘Laravel 5 Hello World from another with this link :
The last thing is to create a route definition which can be defined in routes/web.php whenever Laravel 5.3 is used in the development. But the route definition can be specified in app/Http/routes.php if the version of the Laravel used for the development is below Laravel 5.3. The line is shown as follows :
Route::get('hello', 'HelloController@index');
For testing purpose, a local URL has already been prepared. This is the output’s execution when the URL for an example typed in URL Web browser : :
2. The second one is by executing a certain command which is used in a command line using the artisan tool.
By creating Controller file using artisan utility, it can be done by executing the following command with certain pattern as follows :
php artisan make:controller Controller_File_Name Description : php : It is a utility used to execute php program via command line. artisan : It is a command-line interface included with Laravel. Provides number of helpful commands that can assist you while you build your Laravel web-based application. make:controller : It is a additional option command used to create a new Controller. Controller_File_Name : It is the argument of the command provided as the name of the new Controller which is going to be created.
This is the example of the above command :
user@hostname:/var/www/html/laravel-testing$ php artisan make:controller FileController Controller created successfully. user@hostname:/var/www/html/laravel-testing$
The result can be seen where the command executed above is a success by checking whether the controller file has been created or not in app/Http/Controller as shown below :
user@hostname:/var/www/html/laravel-testing/app/Http/Controllers$ ls Auth Controller.php FileController.php user@hostname:/var/www/html/laravel-testing/app/Http/Controllers$
The above shown that there is a file successfully created and the name is match with the one given in the command executed to create controller file which is FileController. If the file itself is checked, the content which can be found is shown as follows :
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; class FileController extends Controller { // }
It means, artisan tool has succeed on creating controller named FileController with the above template. The rest of the steps are the same with the manual created controller explained previously.
One thought on “Create Controller in Laravel using command”
|
http://www.dark-hamster.com/programming/create-controller-in-laravel-using-command/
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
[
]
Chris Trezzo updated HDFS-9922:
-------------------------------
Issue Type: Sub-task (was: Bug)
Parent: HDFS-7541
> Upgrade Domain placement policy status marks a good block in violation when there are
decommissioned nodes
> ----------------------------------------------------------------------------------------------------------
>
> Key: HDFS-9922
> URL:
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Reporter: Chris Trezzo
> Assignee: Chris Trezzo
> Priority: Minor
>
> When there are replicas of a block on a decommissioned node, BlockPlacementStatusWithUpgradeDomain#isUpgradeDomainPolicySatisfied
returns false when it should return true. This is because numberOfReplicas is the number of
in-service replicas for the block and upgradeDomains.size() is the number of upgrade domains
across all replicas of the block. Specifically, we hit this scenario when numberOfReplicas
is equal to upgradeDomainFactor and upgradeDomains.size() is greater than numberOfReplicas.
> {code}
> private boolean isUpgradeDomainPolicySatisfied() {
> if (numberOfReplicas <= upgradeDomainFactor) {
> return (numberOfReplicas == upgradeDomains.size());
> } else {
> return upgradeDomains.size() >= upgradeDomainFactor;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
|
http://mail-archives.apache.org/mod_mbox/hadoop-hdfs-issues/201603.mbox/%3CJIRA.12948119.1457464447000.36220.1457464600945@Atlassian.JIRA%3E
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
2011-07-27 21:29:08 8 Comments
When I make an SSL connection with some IRC servers (but not others - presumably due to the server's preferred encryption method) I get the following exception:
Caused by: java.lang.RuntimeException: Could not generate DH keypair at com.sun.net.ssl.internal.ssl.DHCrypt.<init>(DHCrypt.java:106) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:556) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:183):893) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165) ... 3 more
Final cause::100) ... 10 more
An example of a server that demonstrates this problem is aperture.esper.net:6697 (this is an IRC server). An example of a server that does not demonstrate the problem is kornbluth.freenode.net:6697. [Not surprisingly, all servers on each network share the same respective behaviour.]
My code (which as noted does work when connecting to some SSL servers) is:
SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, trustAllCerts, new SecureRandom()); s = (SSLSocket)sslContext.getSocketFactory().createSocket(); s.connect(new InetSocketAddress(host, port), timeout); s.setSoTimeout(0); ((SSLSocket)s).startHandshake();
It's that last startHandshake that throws the exception. And yes there is some magic going on with the 'trustAllCerts'; that code forces the SSL system not to validate certs. (So... not a cert problem.)
Obviously one possibility is that esper's server is misconfigured, but I searched and didn't find any other references to people having problems with esper's SSL ports, and 'openssl' connects to it (see below). So I'm wondering if this is a limitation of Java default SSL support, or something. Any suggestions?
Here's what happens when I connect to aperture.esper.net 6697 using 'openssl' from commandline:
~ $ openssl s_client -connect aperture.esper.net:6697 CONNECTED(00000003) depth=0 /C=GB/ST=England/L=London/O=EsperNet/OU=aperture.esper.net/CN=*.esper.net/[email protected] verify error:num=18:self signed certificate verify return:1 depth=0 /C=GB/ST=England/L=London/O=EsperNet/OU=aperture.esper.net/CN=*.esper.net/[email protected] verify return:1 --- Certificate chain 0 s:/C=GB/ST=England/L=London/O=EsperNet/OU=aperture.esper.net/CN=*.esper.net/[email protected] i:/C=GB/ST=England/L=London/O=EsperNet/OU=aperture.esper.net/CN=*.esper.net/[email protected] --- Server certificate -----BEGIN CERTIFICATE----- [There was a certificate here, but I deleted it to save space] -----END CERTIFICATE----- subject=/C=GB/ST=England/L=London/O=EsperNet/OU=aperture.esper.net/CN=*.esper.net/[email protected] issuer=/C=GB/ST=England/L=London/O=EsperNet/OU=aperture.esper.net/CN=*.esper.net/[email protected] --- No client certificate CA names sent --- SSL handshake has read 2178 bytes and written 468: 51F1D40A1B044700365D3BD1C61ABC745FB0C347A334E1410946DCB5EFE37AFD Session-ID-ctx: Master-Key: DF8194F6A60B073E049C87284856B5561476315145B55E35811028C4D97F77696F676DB019BB6E271E9965F289A99083 Key-Arg : None Start Time: 1311801833 Timeout : 300 (sec) Verify return code: 18 (self signed certificate) ---
As noted, after all that, it does connect successfully which is more than you can say for my Java app.
Should it be relevant, I'm using OS X 10.6.8, Java version 1.6.0_26.
Related Questions
Sponsored Content
0 Answered Questions
Capturing client/server TLS version in Python requests
- 2017-10-02 19:02:37
- PalePal
- 172 View
- 2 Score
- 0 Answer
- Tags: python ssl python-requests
13 Answered Questions
[SOLVED] Why does Java have transient fields?
8 Answered Questions
[SOLVED] Why is subtracting these two times (in 1927) giving a strange result?
28 Answered Questions
[SOLVED] SSL certificate rejected trying to access GitHub over HTTPS behind firewall
- 2010-09-23 09:41:46
- oharab
- 536375 View
- 366 Score
- 28 Answer
- Tags: git ssl github cygwin ssl-certificate
2 Answered Questions
[SOLVED] Why don't Node.js TLS supported ciphers correspond to the openssl supported ciphers?
- 2014-01-21 08:01:47
- Ming-Chih Kao
- 1467 View
- 3 Score
- 2 Answer
- Tags: node.js security ssl encryption openssl
0 Answered Questions
Is ssl_dhparam necessary for nginx when client use the cipher DHE-RSA-AES256-SHA256
- 2017-09-28 08:02:32
- Y.Tian
- 357 View
- 0 Score
- 0 Answer
- Tags: ssl nginx encryption
14 Answered Questions
[SOLVED] Why does this code using random strings print "hello world"?
0 Answered Questions
MySQL - SSL - with TLS1.2 cipher AES256-SHA256 / DHE-RSA-AES256-SHA256
1 Answered Questions
[SOLVED] Some clients accept SSL cert; others reject it
- 2014-08-10 02:22:32
- Paul Draper
- 6355 View
- 6 Score
- 1 Answer
- Tags: ssl https ssl-certificate
@Sam 2018-08-08 19:33:51
Recently I have the same issue and after upgrading jdk version from 1.6.0_45 to jdk1.7.0_191 which resolved the issue.
@Jose Antonio Sánchez Pujante 2018-03-22 09:03:54
It is possible that you have incorrect Maven dependencies. You must find these libraries in Maven dependency hierarchy:
If you have these dependencies that is the error, and you should do this:
Add the dependency:
Exclude these dependencies from the artifact that included the wrong dependencies, in my case it is:
@David Guyon 2018-03-22 09:20:47
The question already received many answers and has one validated answer. Moreover the question has been asked more than 6 years ago. I'm not sure if it's still relevant.
@Vivin Paliath 2011-07-27 22:39:41
The problem is the prime size. The maximum-acceptable size that Java accepts is 1024 bits. This is a known issue (see JDK-6521495).
The bug report that I linked to mentions a workaround using BouncyCastle's JCE implementation. Hopefully that should work for you.
UPDATE
This was reported as bug JDK-7044060 and fixed recently.
Note, however, that the limit was only raised to 2048 bit. For sizes > 2048 bit, there is JDK-8072452 - Remove the maximum prime size of DH Keys; the fix appears to be for 9.
@Paŭlo Ebermann 2011-07-27 22:56:05
+1. Everyone who has a Sun Developer Network Account, please vote for this bug.
@sam 2011-07-28 16:23:53
Thanks. Seems a pretty serious problem given the existence of servers which request a larger size! :( I tried BouncyCastle; if you set it up as preferred provider it crashes with a different exception (sigh), and I can't see an obvious way to use that just for DH. However, I found an alternative solution, which I'll add as a new answer. (It's not pretty.)
@N.. 2013-08-26 05:20:56
Cool. This has been fixed in newer versions of Java. But my question is about using older version.. When I use older version, sometimes it works and sometimes it gives above exception..Why so random behaviour? If its a bug in java, then I guess it should never work?
@mjj1409 2015-03-20 21:52:35
The BouncyCastle's JCE provider implementation worked for me
@bebbo 2015-05-16 20:06:38
This has not been fixed. The limit was changed from 1024 to 2048. Thus a prime size > 2048 yields the same error
@fuzzyTew 2015-06-30 22:19:10
The 2048 fix was backported to IcedTea 2.5.3 . Newer versions of IcedTea increased it to 4096.
@ajon 2015-07-03 17:31:37
When I updated Java on the machine, this issue went away.
@samy 2015-08-17 10:40:47
Is it also fixed for 4096bit keys with java 1.8.0_51 on Ubuntu 14.04? Because I'm getting the same error while trying to connect to a server.
@sleske 2016-02-09 16:05:10
@bebbo: Correct. Support for primes > 2048 bit was requested in JDK-8072452 - Remove the maximum prime size of DH Keys.
@bebbo 2016-02-09 17:19:10
@sleske: A request does not mean it has already been changed. Such a limitation is simply superfluous. Right now it's not available.
@user1332994 2016-05-15 04:36:46
The problem is the DH prime size. The maximum-acceptable size that Java accepts is 2048 bits. While we wait for Oracle to expand the limit, you can compile with Excelsior Jet which has an expanded limit.
@plugwash 2017-06-02 15:21:53
@N it depends on the server configuration. The bug only manifests if the server chooses a DHE ciphersuite and then sends a prime that the client considers too large. It is seen less often with Java 7 than Java 6 because Java 7 supports ECDHE and most server's preffer ECDHE over DHE.
@Saheed 2017-03-16 16:25:46
I encountered the SSL error on a CentOS server running JDK 6.
My plan was to install a higher JDK version (JDK 7) to co-exist with JDK 6 but it turns out that merely installing the newer JDK with
rpm -iwas not enough.
The JDK 7 installation would only succeed with the
rpm -Uupgrade option as illustrated below.
1. Download JDK 7
2. RPM installation fails
3. RPM upgrade succeeds
4. Confirm the new version
@covener 2017-01-07 17:00:45
I used to get a similar error accessing svn.apache.org with java SVN clients using an IBM JDK. Currently, svn.apache.org users the clients cipher preferences.
After running just once with a packet capture / javax.net.debug=ALL I was able to blacklist just a single DHE cipher and things work for me (ECDHE is negotiated instead).
A nice quick fix when it is not easy to change the client.
@Raffael Meier 2017-01-05 16:28:13
I use coldfusion 8 on JDK 1.6.45 and had problems with giving me just red crosses instead of images, and also with cfhttp not able to connect to the local webserver with ssl.
my test script to reproduce with coldfusion 8 was
this gave me the quite generic error of " I/O Exception: peer not authenticated." I then tried to add certificates of the server including root and intermediate certificates to the java keystore and also the coldfusion keystore, but nothing helped. then I debugged the problem with
and got
and
I then had the idea that the webserver (apache in my case) had very modern ciphers for ssl and is quite restrictive (qualys score a+) and uses strong diffie hellmann keys with more than 1024 bits. obviously, coldfusion and java jdk 1.6.45 can not manage this. Next step in the odysee was to think of installing an alternative security provider for java, and I decided for bouncy castle. see also
I then downloaded the
from and installed it under C:\jdk6_45\jre\lib\ext or where ever your jdk is, in original install of coldfusion 8 it would be under C:\JRun4\jre\lib\ext but I use a newer jdk (1.6.45) located outside the coldfusion directory. it is very important to put the bcprov-ext-jdk15on-156.jar in the \ext directory (this cost me about two hours and some hair ;-) then I edited the file C:\jdk6_45\jre\lib\security\java.security (with wordpad not with editor.exe!) and put in one line for the new provider. afterwards the list looked like
(see the new one in position 1)
then restart coldfusion service completely. you can then
and enjoy the feeling... and of course
what a night and what a day. Hopefully this will help (partially or fully) to someone out there. if you have questions, just mail me at info ... (domain above).
@Evgeny Lebedev 2016-12-05 07:59:02
I've got this error with Bamboo 5.7 + Gradle project + Apache. Gradle tried to get some dependencies from one of our servers via SSL.
Solution:
with OpenSSL:
example output:
Append output to certificate file (for Apache -
SSLCertificateFileparam)
Restart apache
Restart Bamboo
Try to build project again
@rico-chango 2016-10-18 20:17:07
For me, the following command line fixed the issue:
java -jar -Dhttps.protocols=TLSv1.2 -Ddeployment.security.TLSv1.2=true -Djavax.net.debug=ssl:handshake XXXXX.jar
I am using JDK 1.7.0_79
@Ramgau 2017-03-02 03:16:10
I faced same situation using JDK 1.7.0_xx. BY default issue will be solved after using jdk 1.8. But sometime we can not upgrade jdk quickly. So my issue solved after adding system configuration: System.setProperty("https.protocols", "TLSv1.2"); System.setProperty("deployment.security.TLSv1.2", "true");
@v.ladynev 2015-11-21 17:11:15
I have the same problem with Yandex Maps server, JDK 1.6 and Apache HttpClient 4.2.1. The error was
with enabled debug by
-Djavax.net.debug=allthere was a message in a log
I have fixed this problem by adding BouncyCastle library
bcprov-jdk16-1.46.jarand registering a provider in a map service class
A provider is registered at the first usage of
MapService.
@comeOnGetIt 2016-04-28 20:05:05
Where did you write this static block of code ?
@v.ladynev 2016-04-29 06:07:58
@comeOnGetIt I update my answer.
@anre 2016-06-01 15:08:47
Solved the problem by upgrading to JDK 8.
@mjj1409 2015-03-20 22:12:34
The "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" answer did not work for me but The BouncyCastle's JCE provider suggestion did.
Here are the steps I took using Java 1.6.0_65-b14-462 on Mac OSC 10.7.5
1) Download these jars:
bcprov-jdk15on-154.jar
bcprov-ext-jdk15on-154.jar
2) move these jars to $JAVA_HOME/lib/ext
3) edit $JAVA_HOME/lib/security/java.security as follows: security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider
restart app using JRE and give it a try
@DiveInto 2015-04-27 01:37:40
works for me! though not quite sure what I am doing.
@TinusSky 2015-07-07 13:42:31
security.provider.2=org.bouncycastle.jce.provider.BouncyCastleProvider did work better, putting it on 1. resulted in errors in default software.
@v.ladynev 2015-11-22 09:19:56
This works for me too, but I have added a provider dynamically. Reffer my answer here for details.
@Majid 2017-04-27 10:21:31
Thanks it works on java 1.6
@phillipuniverse 2017-05-26 20:43:05
Thanks a ton, this worked for me and was required in order to successfully build the Tomcat 7.0.78 source.
@Peter Azuka Molokwu 2016-04-05 16:20:42
We got the same exact exception error returned, to fix it was easy after hours surfing the internet.
We downloaded the highest version of jdk we could find on oracle.com, installed it and pointed Jboss application server to the directory of the installed new jdk.
Restarted Jboss, reprocessed, problemo fixed!!!
@pka 2015-11-14 18:57:58
If you are still bitten by this issue AND you are using Apache httpd v> 2.4.7, try this:
copied from the url:
command. Alternatively, you can use the following standard 1024-bit DH parameters from RFC 2409, section 6.2:
Add the custom parameters including the "BEGIN DH PARAMETERS" and "END DH PARAMETERS" lines to the end of the first certificate file you have configured using the SSLCertificateFile directive.
I am using java 1.6 on client side, and it solved my issue. I didn't lowered the cipher suites or like, but added a custom generated DH param to the cert file..
@plugwash 2017-06-02 15:39:40
Be aware that it is now believed that 1024 bit DH is computationally feasible (though hellishly expensive) to break.
@Tor 2015-07-10 07:44:48
You can disable DHE completely in your jdk, edit jre/lib/security/java.security and make sure DHE is disabled, eg. like
jdk.tls.disabledAlgorithms=SSLv3, DHE.
@Abhiram mishra 2016-04-19 07:09:49
It did not work for me. I am using java 1.6.0_33
@hoangthienan 2016-06-27 01:19:33
that is only available in JDK 1.7 and later. link
@MrSmith42 2018-02-12 15:52:04
Solved the problem for me JDK 1.8.0_144-b01
@Jason Martin 2015-07-01 23:33:36
If the server supports a cipher that does not include DH, you can force the client to select that cipher and avoid the DH error. Such as:
Keep in mind that specifying an exact cipher is prone to breakage in the long run.
@angelcorral 2015-05-07 12:44:48
You can installing the provider dynamically:
1) Download these jars:
bcprov-jdk15on-152.jar
bcprov-ext-jdk15on-152.jar
2) Copy jars to
WEB-INF/lib(or your classpath)
3) Add provider dynamically:
import org.bouncycastle.jce.provider.BouncyCastleProvider;
...
Security.addProvider(new BouncyCastleProvider());
@ishanbakshi 2016-01-04 03:33:34
This solution works well, and was a good fit for my case since I wanted to make the changes only at the project level and not at the server/environment level. Thanks
@Raphael Roth 2016-03-23 07:41:24
does not work for me
@Japheth Ongeri - inkalimeva 2016-11-11 12:19:14
Thanks! this worked for me. In my case it was itext importing bcp 1.4 causing emails to google to fail.
@Hadi Momenzadeh 2017-05-23 07:29:00
Tnx, it worked for mee too. :)
@Bertl 2014-11-19 17:08:12
This is a quite old post, but if you use Apache HTTPD, you can limit the DH size. See
@Zsozso 2013-08-15 13:47:50
Here is my solution (java 1.6), also would be interested why I had to do this:
I noticed from the javax.security.debug=ssl, that sometimes the used cipher suite is TLS_DHE_... and sometime it is TLS_ECDHE_.... The later would happen if I added BouncyCastle. If TLS_ECDHE_ was selected, MOST OF the time it worked, but not ALWAYS, so adding even BouncyCastle provider was unreliable (failed with same error, every other time or so). I guess somewhere in the Sun SSL implementation sometimes it choose DHE, sometimes it choose ECDHE.
So the solution posted here relies on removing TLS_DHE_ ciphers completely. NOTE: BouncyCastle is NOT required for the solution.
So create the server certification file by:
Save this as it will be referenced later, than here is the solution for an SSL http get, excluding the TLS_DHE_ cipher suites.
Finally here is how it is used (certFilePath if the path of the certificate saved from openssl):
@Ludovic Guillaume 2015-08-10 11:16:16
Just tested your solution. It's working as intended. Thanks. Actually, just adding
jdk.tls.disabledAlgorithms=DHE, ECDHEin
JDK_HOME/jre/lib/security/java.securityalso works and avoid all this code.
@stephan f 2015-10-26 13:46:01
Just disabling DHE worked for me:
jdk.tls.disabledAlgorithms=DHE. Using 1.7.0_85-b15.
@Eric Na 2016-01-12 19:11:06
Added jdk.tls.disabledAlgorithms=DHE, ECDHE in JDK_HOME/jre/lib/security/java.security and worked fine! Thank you! Using 1.7.0_79
@kubanczyk 2016-06-08 13:36:19
Don't disable ECDHE. It's different than DHE and does not even use prime numbers.
@user1172490 2016-11-22 23:00:34
Can someone please tell me how i can get the 'certFilePath'. I've been stuck on this for a week. @Zsozso
@Lekkie 2013-05-22 08:29:27
If you are using jdk1.7.0_04, upgrade to jdk1.7.0_21. The problem has been fixed in that update.
@user2666524 2013-08-19 23:40:11
I just downloaded Java SE Development Kit 7u25, and according to the little program I wrote to determine the maximum supported DH size, it's still 1024.
@Sébastien Vanmechelen 2015-07-30 15:43:42
Problem still exists with JDK 1.7.0_25
@Elazaron 2015-08-25 09:07:17
updating jre worked for me .had 6.22 updated to 7.59 . problem solved.
@Shashank 2015-10-05 02:29:32
I am using JDK 1.7.0_79. Doesn't work for me
@dgoverde 2016-02-17 03:37:30
@Shashank - Upgrading to JDK 1.8.0_73 worked for me.
@mjomble 2011-11-17 21:02:40
Try downloading "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" from the Java download site and replacing the files in your JRE.
This worked for me and I didn't even need to use BouncyCastle - the standard Sun JCE was able to connect to the server.
PS. I got the same error (ArrayIndexOutOfBoundsException: 64) when I tried using BouncyCastle before changing the policy files, so it seems our situation is very similar.
@clevertension 2014-12-17 01:51:52
it can't be work in my env when i replace the files from JCE
@Joerg 2015-03-16 17:17:20
have you done anyhting else? or just copied the 2 files into the folder?
@mjomble 2015-03-16 20:57:09
It's been a while but as far as I remember, that was all I needed to do. Apart from restarting any running Java processes afterwards.
@Peter Šály 2018-09-06 10:07:09
Does not work for me.
@sam 2011-07-28 16:30:49
The answer above is correct, but in terms of the workaround, I had problems with the BouncyCastle implementation when I set it as preferred provider:. Then, supposing the server supports an alternative algorithm, it will be selecting during normal negotiation. Obviously the downside of this is that if somebody somehow manages to find a server that only supports Diffie-Hellman at 1024 bits or less then this actually means it will not work where it used to work before.
Here is code which works given an SSLSocket (before you connect it):
Nasty.
@Vivin Paliath 2011-07-28 16:38:47
Sad that this is the only way :(. That ticket has been open since '07. Strange that nothing has been done about it in 4 years.
@Shashank 2015-10-05 02:28:43
I am new to java securities. Please help where should I write this piece of code?
@Gianluca Greco 2016-02-16 11:06:29
I tried every solution in this thread and this was the only one that worked with my ibm jvm (ibm-java-s390x-60).
|
https://tutel.me/c/programming/questions/6851461/why+does+ssl+handshake+give+39could+not+generate+dh+keypair39+exception
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
Rave JavaScript API
Rave Core JS ** GOALS
- rave core should have clear dependency tree; it should have no external dependencies outside of underscorejs.
- rave core should be separate from the portal; it should be lightweight, built to provide rave's core functionality of managing and rendering sets of widgets and no extra overhead related to the portal.
- rave core should be extensible. As in implementer you should NEVER need to overlay a file (rave_ajax.js is the only exception) in order to get required functionality. You should be able to build a portal or website around rave core entirely through its api / extending its objects.
File: rave_ajax.js
namespace: rave.ajax
dependencies: jQuery
description:
Wraps jQuery's $.ajax function, isolating rave core's dependency on jQuery to this one file. Any implementer who wishes to use another ajax library will overlay rave_ajax.js, and wrap their ajax library of choice so that it maches the api of $.ajax.
File: rave_api
namespace: rave.api
dependencies: rave.ajax
description:
Defines functions to access rave's rest & rpc apis. This file manages all ajax interaction with the server. It should depend only on the rave.ajax namespace. It should provide callbacks for any interaction that needs them, and should have know knowledge of further results(i.e. if errors should be displayed to a user on a failed call, it is on the calling library to implement - no ui or core interaction should be invoked from rave_api. Besides factoring out dependencies there have been no major changes to the rave.api spec.
File: rave_core.js
namespace: rave
dependencies: rave.api, rave.RegionWidget
description:
Defines rave's core functionality. Manages registration of widgets, widget providers, views (agnostic).
rave.registerProvider(name, provider)
- name String the name of the provider, such as 'open social' or 'wookie'. This should correspond to the string provided by a widget definition's TYPE field (case insensitive)
- provider Object widget provider object, implementing those methods expected by the rave.RegionWidget interface.
- returns Object returns the provider object
rave.getProvider(name)
- name String the name of the provider (case insensitive)
- returns Object widget provider object
rave.registerWidget([regionId], definition)
- *deprecated* [regionId] Number or String the regionId of the widget. This parameter is not used and is deprecated. Currently supported until the rave rendering is updated.
- definition Object the widget definition as provided by rave's RegionWidgetRenderer class
- returns Object rave.RegionWidget instance
rave.getWidget(regionWidgetId)
-regionWidgetId String
-returns rave.RegionWidget instance
rave.getWidgets()
-returns Array of rave.RegionWidget instances for the registered widgets
rave.unregisterWidget(regionWidget)
- regionWidget String the regionWidgetId of the widget to unregister OR Object the rave.RegionWidget instance
rave.registerView(name, view)
- name String key to register the view under (case insensitive)
- view Object an agnostic view object implementing those methods expected by the rave View specification OR Function constructor for a view object implementing those methods expected by the rave View specification
rave.getView(name)
- name String key view was registered under (case insensitive)
- returns Object registered view object OR Function registered view constructor
rave.renderView(name, [args...])
If the registered view is a constructor function, first instantiates a new instances of the view. Then invokes the render function of the view, passing it any remaining arguments.
- name String key view was registered under
- args * any remaining args are passed to the registered view's render function
- returns Object the rendered view instance. view._uid will be defined on the view - this is a unique identifying string that can be used to retrieve and destroy the rendered view.
rave.getRenderedView(_uid)
- _uid String unique identifier string as defined on the view._uid that is returned from rave.renderView
- returns Object rendered view instance
rave.destroyView(_uid, [args…])
invokes the destory() method on the view object, passing it any remaining arguments.
- _uid String unique identifier string as defined on the view._uid that is returned from rave.renderView
- args * any remaining args are passed to the registered view's destroy function
rave.registerOnInitHandler(handler)
registers a function that will be invoked after rave.init() has been called. onInit handlers will be called in the order they were registered
- handler Function function to invoke
rave.init()
function to be called once all rave resources and extensions are loaded. Kicks off initializing of providers, widget objects, and any registered onInit handlers
rave.log([args…])
utility function wrapping console.log that can safely be called without throwing an error in any browser environment.
- args * arguments that will be passed to console.log if it exists
rave.getManagedHub()
Instantiates (if needed) and returns an OpenAjax.hub.ManagedHub instance
- returns Object an OpenAjax.hub.ManagedHub instance
File: rave_widget
namespace: rave.RegionWidget
dependencies: rave.api
description:
Defines rave.RegionWidget as an abstract class that provides a common interface & functionality for any registered rave widget.
rave.RegionWidget(definition) constructor for abstract RegionWidget objects. All attributes from the definition are placed on the instance.
Ex: var widget = new rave.RegionWidget({type: 'opensocial', name: 'myWidget'};
widget.name == 'myWidget' //true
In general you will not call this constructor directly - instead you will use rave.registerWidget() to create new RegionWidgets and use rave.getWidget() / rave.getWidgets() to access the RegionWidget instances.
- definition Object the widget definition as provided by rave's RegionWidgetRenderer class
- returns Object rave.RegionWidget object instance
rave.RegionWidget.extend(mixin)
convenience function to extend or override RegionWidget's prototype, allowing implementers to add custom functionality.
- mixin Object key / value pairs to extend the RegionWidget prototype
rave.RegionWidget.defaultView
property that dictates the default view widgets will be rendered into
- String view name, initializes to 'default'
rave.RegionWidget.defaultWidth
property that dictates the default width of a rendered widget iframe
- Int width in pixels, defaults to 320
rave.RegionWidget.defaultHeight
property that dictates the default height of a rendered widget iframe
- Int height in pixels, defaults to 200
rave.RegionWidget.prototype.render(el, opts)
Renders a region widget instance into a dom element. Invokes the widget providers renderWidget method.
- el DomElement the DOM element into which the widget's iframe will be injected and rendered OR
String if a string is provided as the element, rave will look for a registered view by that string. It will render that view and inject the widget into the dom element returned by the view's getWidgetSite() method
- opts Object options object that is passed to the registered widget provider's renderWidget method
- returns Object this. Returns the regionWidget instance for chaining.
rave.RegionWidget.renderError(el, error)
This method should be invoked by widget providers if there is an error in rendering the widget.
- el HTMLElement the DOM element the widget was to be inserted into
- error String the text if the error message
rave.RegionWidget.prototype.close(el, opts)
Closes the region widget and removes the region widget from the page (persisted back to rave). If the widget was rendered within a view, destroys that view. Invokes the widget providers closeWidget function.
- opts * options object that is passed to the widget provider's closeWidget function
rave.RegionWidget.prototype.show()
Changes the widget's collapsed state and persists to the rave api. Does not take any ui actions - it is on the implementer to bind ui interactions and use this method to persist show / hide state.
rave.RegionWidget.prototype.hide()
Changes the widget's collapsed state and persists to the rave api. Does not take any ui actions - it is on the implementer to bind ui interactions and use this method to persist show / hide state.
rave.RegionWidget.prototype.moveToPage(toPageId, [cb])
Changes the widget's pageId and and persists to the rave api. Does not take any ui actions - it is on the implementer to bind ui interactions and use this method to persist widget location state.
- toPageId String or Int id of page that the widget is being moved to
- cb Function callback function to be invoked after persist is completed
rave.RegionWidget.prototype.moveToRegion(fromRegionId, toRegionId, toIndex)
Changes the widget's region and index and and persists to the rave api. Does not take any ui actions - it is on the implementer to bind ui interactions and use this method to persist widget location state.
-fromRegionId String or Int id of regionId the widget is being moved from
-toRegionId String or Int id of regionId the widget is being moved to
-toIndex String or Int id of index within the region the widget is being moved to
rave.RegionWidget.prototype.savePreferences(updatedPrefs)
Overwrites the widget's userPrefs object and persists to the rave api. Does not take any ui actions - it is on the implementer to bind ui interactions and use this method to persist user prefs state.
File: rave_opensocial, rave_wookie
namespace: n/a
dependencies: rave, opensocial & wookie implementations, respectively
description:
These files provide implementations of the abstract rave.RegionWidget interface for open social and wookie widgets. They do not attach anything to the rave namspace, but call rave.registerProvider directly.
Specifications -
Rave Provider
The object handed to rave.registerProvider must conform to the following specification or there will be errors
usage: rave.registerProvider('providerName', provider);
requirements:
provider.init()
Should run any setup needed to implement the provider. This method is invoked by rave.init() and will run before any rave.RegionWidget instances are instantiated.
provider.initWidget(widget)
Should do any work to preload caches or prepare for widget. This method does NOT render the widget, but does any work that can happen early.
-widgetDefinition Object rave.RegionWidget instance.
provider.renderWidget(widget, el, [opts])
Provider-specific implementation needed to render a widget into a dom element
- widget Object rave.RegionWidget instance.
- el DomElement
- opts Object bag of options that are passed from rave.renderWidget()
provider.closeWidget(widget, [opts])
Provider-specific implementation needed to close a widget
- widget Object rave.RegionWidget instance.
- opts Object bag of options that are passed from rave.closeWidget()
provider.setDefaultGadgetSize(width, height)
Provider specific implementation needed to set default size of widget
- width Int width in pixels
- height Int height in pixels
provider.setDefaultView(view)
Provider specific implementation for setting the default view a widget should be rendered into
- view String view name
Rave View
The argument handed to rave.registerView. Rave is completely agnostic of any dependencies, libraries, mv* frameworks, etc. It simply expects the view to be either…
an object that implements the following methods, or…
a constructor function that instatiates objects which implement the following methods
usage: rave.registerView('myView', {render: function(){...}, getWidgetSite: function(){...}, destroy: function(){...});
requirements:
view.render([args…])
Renders the view into the ui. Can take any number & type of arguments, which are simply passed from rave.renderView
-returns Object the render function MUST return itself (i.e. return this;)
view.getWidgetSite()
OPTIONAL. This method is required only if it will ever be used for rendering a widget. Meaning either a call from widget.render('viewName'), or if it will be exposed to opensocial open views spec.
- returns DomElement a raw DomElement (not a query object) which the widget iframe will be inserted into
view.destroy([args…])
Performs any teardown necessary to unrender the view. Can take any number & type of arguments, which are simply passed from rave.destoryView().
|
https://wiki.apache.org/rave/JSAPI
|
CC-MAIN-2018-39
|
en
|
refinedweb
|
S E P T E M B E R 1 9 9 9
The instructions above are for this month's puzzle only. See a complete introduction to clue-solving.
See the solution to last month's Puzzler.
5. "Eternities" is dedicated to a civil-rights figure (8)
10. I would like names for girls (4)
11. Solicit drink in one half of duplex (4,2)
13. Company soldier captures heart of stray dog (5)
16. After outbreak, "untouchable" agent's haste (8)
17. Stuff you believe as visitor to our world laughs (5)
19. Fair attractions covered in diamonds display rainbow colors (8)
21. Again, Study in Scarlet including actor from The Crying Game (6)
23. Find Mexican food in the Mexican counter (6)
25. Name of a notable Ethiopian girl I caught amid visit (8)
29. A formal examination cut short in Roman courts (5)
30. Samples of men's epics recast (9)
31. Church figure in 150, an old Norseman (6)
32. Some dishes with pronounced merits (8)
33. Gift-getters witness sign of acknowledgment in return (6)
Down
1. Mediterranean capital misrepresented as "Ionic" (7)
2. Tokyo's old name in verse written up (3)
3. Less often seen live in Red River (5)
4. Small trend reverses works in a magazine office (5)
5. Heater for coffee container in front (7)
6. Oh, mother's one with guts (5)
7. Something just passing convertible -- mere heap (8)
8. Ringing of two notes on land (10)
9. Gave some lip to shortstop and starter for Expos in blue (6)
12. Eating the last piece of cake, you laugh (2-3)
14. Austrian dog disrupted school ceremonies (11)
15. Grow bitter about a diner (7)
18. Quarry surrounding Los Angeles Catholic bishop's office (7)
20. Use a magic spell on door (8)
22. Unfinished set in Rent's creating problems (7)
23. Decked in foliage, started holding prayer (6)
24. Comb and powder (5)
26. Exercise time has Penny in a bad mood (5)
27. Music of the 1970s is in Washington Circle (5)
28. Energy used by Hoover vendors (5)
Copyright © 1999 by The Atlantic Monthly Company. All rights reserved.The Atlantic Monthly; September 1999; The Puzzler - 99.09;
Volume 284, No. 3; page 107.
|
http://www.theatlantic.com/past/docs/issues/99sep/9909puzz.htm
|
CC-MAIN-2016-40
|
en
|
refinedweb
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.