text
stringlengths
454
608k
url
stringlengths
17
896
dump
stringclasses
91 values
source
stringclasses
1 value
word_count
int64
101
114k
flesch_reading_ease
float64
50
104
Qt Test class in subdir project can't find ui_mainwindow.h from production subdir project Hi. I have set a project up to contain two subdir projects: one normal project and one unit test project. I'm trying to create a unit test for the MainWindow class in the normal project by creating a MainWindowTest class in the test project. MainWindow now only contains a QPushButton myButton widget, and I'd like to test its existence and behaviour in MainWindowTest. An example test function: void MainWindowTest::initTestCase() { QVERIFY2(win.myButton, "myButton doesn't exist"); } This is the test class: #include <QtCore/QCoreApplication> #include "../SomeProject/mainwindow.h" class MainWindowTest : public QObject { Q_OBJECT public: MainWindowTest(); ~MainWindowTest(); private slots: void initTestCase(); void cleanupTestCase(); void test_case1(); private: MainWindow win; }; And this is the folder hierarchy: --> SomeProject -----> GUI_Tests -----> SomeProject In the header of MainWindow class I declared MainWindowTest as friend, so that I can access private elements (aka. the widgets) of it in the test class: #include "ui_mainwindow.h" class MainWindow : public QMainWindow, private Ui::MainWindow { Q_OBJECT friend class MainWindowTest; public: explicit MainWindow(QWidget *parent = nullptr); }; The problem seems to be that the compiler cannot find the ui_mainwindow.h file as long as the GUI_Test subdir is part of the entire project: ~/SomeProject/SomeProject/mainwindow.h:5: error: ui_mainwindow.h: No such file or directory #include "ui_mainwindow.h" If on the other hand I remove the GUI_Test subdir in the main project .pro file (only SomeProject remains the sole project), everything seems to compile normally. The question then arises: how can I make the GUI_Test subproject aware of the ui_mainwindow.h header that will only be generated later by UIC? Here's what I tried so far to solve the issue: - add GUI_Tests.depends = SomeProject to the main .pro file --> didn't work - add #include ui_mainwindow.h to the test .cpp file --> didn't work - included all the source files of SomeProject to the Test Class's .pro file --> didn't work As I understand this should be a simple thing to do right? Creating unit tests for your GUI classes and then running them with each compile. Am I missing something? Any suggestions? Should I approach my ultimate goal (writing tests and running them automatically) differently? Thanks in advance. - jsulm Qt Champions 2018 @PusRob said in Qt Test class in subdir project can't find ui_mainwindow.h from production subdir project: GUI_Tests Can you show its pro/pri file? I think you need to add your ui file to FORMS there, just like in SomeProject. Hi. This is the autogenerated .pro file of the GUI_test subdir project. I also added the ui file to forms, but still no luck: QT += testlib QT += gui CONFIG += qt warn_on depend_includepath testcase TEMPLATE = app SOURCES += tst_mainwindowtest.cpp FORMS += mainwindow.ui I also tried with FORMS += ../SomeProject/mainwindow.ui, but still no luck. I don't understand what else it needs. Any ideas? EDIT: ok, if I add QT += widgets then the header gets generated, but now I get undefined reference errors.
https://forum.qt.io/topic/103884/qt-test-class-in-subdir-project-can-t-find-ui_mainwindow-h-from-production-subdir-project
CC-MAIN-2019-30
refinedweb
503
58.99
Bugzilla – Bug 122 [code-cleanup] SymbolTable class cleanup, Type should not derive from Value, eliminate ConstantPointerRef class Last modified: 2004-07-17 20:19:26 You need to before you can comment on or make changes to this bug. It would be nice if the following changes were made to the core LLVM class hierarchy: 1. Type should not derive from Value. Types are not values. Originally they were made this way to make the symbol table easier to implemented, but that's the wrong reason. 2. The SymbolTable class should not derive from std::map, it should _contain_ an std::map, which will allow us to simplify and understand the interface. 3. The ConstantPointerRef bridge class should be eliminated. To do this, we need to make GlobalValue derive from Constant, which it should have done all along. ConstantPointerRef's are an ugly wart that needs to be removed from LLVM. -Chris Also, the alloca and malloc instructions should take an optional alignment argument. This argument, for malloc, allows us to represent valloc and memalign directly in LLVM. For alloca, it allows us to support the alignment attributes in the GCC front-end directly. Global variables should also be extended to support alignment attributes. This will be required for vectorization work. If an alignment is specified as zero, the default, then that means we should follow the target alignment settings. This should be _by far_ the most common setting, so we should not even bother encoding this argument into the bytecode file unless it is nonzero. Mine. In an effort to learn more about VMCore, I'm going to try and implement this bug. I'm going to start with the SymbolTable since I'm familiar with it and the change is relatively straightforward. If I can do that without breaking things, I'll try making Type not derive from Value. Each change will constitute a separate patch on a CVS branch. Nice! Sounds great! As you probably know, the best way to go about this is to add methods to SymbolTable that are *only* used for dealing with types, and force all of LLVM to go through that interface (ie, the existing interface would assert if given a type). Once everything is converted over, we can see what breaks when we make Type not derive from Value. That will be a big win, both for making LLVM cleaner and for reducing the memory consumption of allocated types (which there can be a lot of). As always, let me know if you have any questions or run into any problems. :) -Chris That's pretty much the tack I've taken. I've started with making the std::map base type of SymbolTable be a data member. That work is already done and I've converted all the code in VMCore that directly manipulated the base class with functors on the interface of SymbolTable. I'm going to do this in a very slow, careful way. Once I've got the SymbolTable change to compile, I'll make sure all the regressions still work. When they do, I'll head into the Value != Type change. Work on this bug is being committed to branch bug_122. Currently, I have completed step 2, making SymbolTable not derive from std::map. After this change, the regression test looks like: --- STATISTICS --------------------------------------------------------------- 336 tests total 328 ( 98%) tests as expected 1 ( 0%) tests unexpected ERROR 7 ( 2%) tests unexpected FAIL --- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- Regression.Assembler.ConstantExprFold : FAIL , expected PASS Script: /proj/work/llvm/build/test/tmp/trConstantExprFold.llx/testscript.ConstantExprFold.llx Output: /proj/work/llvm/build/test/tmp/trConstantExprFold.llx/testscript.ConstantExprFold.llx.out Regression.C++Frontend.2004-01-11-DynamicInitializedConstant: FAIL , expected PASS Script: /proj/work/llvm/build/test/tmp/tr2004-01-11-DynamicInitializedConstant.cpp.tr/testscript.2004-01-11-DynamicInitializedConstant.cpp.tr Output: /proj/work/llvm/build/test/tmp/tr2004-01-11-DynamicInitializedConstant.cpp.tr/testscript.2004-01-11-DynamicInitializedConstant.cpp.tr.out Regression.C++Frontend.2004-03-08-ReinterpretCastCopy: FAIL , expected PASS Compiling C++ code failed Regression.C++Frontend.2004-03-15-CleanupsAndGotos: FAIL , expected PASS Compiling C++ code failed Regression.CFrontend.2003-06-29-MultipleFunctionDefinition: FAIL , expected PASS Compiling C code failed Regression.CFrontend.2003-12-14-ExternInlineSupport: FAIL , expected PASS Script: /proj/work/llvm/build/test/tmp/tr2003-12-14-ExternInlineSupport.c.tr/testscript.2003-12-14-ExternInlineSupport.c.tr Output: /proj/work/llvm/build/test/tmp/tr2003-12-14-ExternInlineSupport.c.tr/testscript.2003-12-14-ExternInlineSupport.c.tr.out Regression.CFrontend.2004-01-08-ExternInlineRedefine: FAIL , expected PASS Compiling C code failed Regression.CFrontend.2004-02-12-LargeAggregateCopy: ERROR , expected PASS Interrupted. make: [qmtest] Error 1 (ignored) The SymbolTable redesign is completed. I have also committed changes to reduce the use of Type::TypeTy which is slated to disappear with the dissociation of Type from Value. While I complete this bug, and until Type::TypeTy can go away, please do not propagate new code that uses it. There is no reason to use it in order to access the "type plane" in the new SymbolTable. There are some corner cases where its still needed elsewhere, however. Here's a quickie summary of how the new SymbolTable interface affects its users: 1. The data structures are embedded so if you were thinking of using any std::map functionality, its gone. 2. Some of the generic std::map functionality has been added to SymbolTable to make it compatible (e.g. empty() ). 3. The iterator names and concepts have changed significantly. In the future, please use the following conventions: (a) To iterate over the all type planes use plane_begin() and plane_end(). These are semantically equivalent to the begin() and end() methods inherited from std::map on the old SymbolTable. For iterating over planes, please use an iterator named PI. (b) To iterate over the type type plane (the plane of Type::TypeTy), please use type_begin() and type_end(). Previously, users of the SymbolTable would use ST.find(Type::TypeTy) to access the type type plane. This is now semantically incorrect and will always return std::map.end()! Use type_begin() and type_end() instead. These will get you an iterator over the name/Type pairs in the type type plane. For iteration over types, please use an iterator named TI. (c) To iterate over the values in one type plane (except for the plane of types), use value_begin(Type*) and value_end(Type*). These methods will get you an iterator over the name/Value pairs in the single type plane given by the arguments. For iterating over values, please use an iterator named VI. 4. Some functionality (like "strip") has been moved into the SymbolTable. This means that the SymbolStripping pass is now a single call to the SymbolTable::strip() method. Next steps on bug 122 (each a separate commit): * Completely rid ourselves of Type::TypeTy. This involves a rewrite of the SlotCalculator which will be divided up between Bytecode writer and ASM writer. * Make Type not inherit from Value and fix the resulting fall out. * Get rid of ConstantPointerRef. An incremental step has been committed to CVS. I've separated the AsmWriter use of SlotCalculator from the Bytecode Writer's use of it. AsmWriter now has a "SlotMachine" embedded into the anonymous namespace in AsmWriter.cpp that is a drastically pared down version of SlotCalculator. Additionally, the checks in SlotCalculator to see if we're writing Bytecode or not have been removed since SlotCalculator is now only used by Bytecode Writer. Another cleanup when Type does not derive from Value: remove "setName" in the Type class. Everyone should go through the SymbolTable or Module interfaces to set names *for* types, because you can't set a name *on* a type! -Chris The Type != Value change has been committed. Here are the patches: As a note, the stuff in Comment #1 has now been turned into Bug 400. I believe the CPR changes are the only thing left in this bug. -Chris Created an attachment (id=153) [details] CPR Elimination Discussion From #llvm IRC This attachment provides a discussion between Chris and Reid about how to make getting rid of ConstantPointerRef easier. The only remaining task before closing this bug is to remove ConstantPointerRef from the LLVM IR. This will happen by making GlobalValue derive from Constant and adjusting the use of Constants. However, as described by Chris in the first attachment, there are some ways to do this that will make things easier. The remaining tasks consist of: 1. Make the GlobalValue destructor automatically delete any Constants that are pointing to the GlobalValue. The basic logic is in the Constant::destroyConstant() method. This should traverse the constant graph to make sure any dead constants it uses are also deleted. If the GlobalValue itself is used then an assertion should happen because attempting to delete used GlobalValues is an IR error. 2. Provide a GlobalValue method similar to use_empty (say, use_empty_except_constants) that will return true if the only users of the GlobalValue are transitively dead constants. 3. Remove the ConstantPointerRef class and make GlobalValue derive from Constant. Note that doing 1 and 2 first will make 3 much easier because much of the CPR code will be eliminated that would have otherwise needed to be modified. As a further "incrementalization" of #3, I'll point out that you can make GlobalValue derive from constant without necessarily auditing all of the isa<Constant>/isa<GlobalValue> calls. I'm not sure if that will actually help, because the work must be done, but fine-grained incrementalization is good :) -Chris There were only 9 of those that I found with llvmgrep so they're done. The CPR Changes are done. Commits are here: through The changes required for this bug have been completed. Marking it resolved. One more thing: MAJOR KUDOS to Chris Lattner for his expert technical assistance in the resolution of this bug. It was a real education for me, which was my main interest in tackling this bug.
http://llvm.cs.uiuc.edu/PR122
crawl-001
refinedweb
1,663
56.86
The Fl_Color_Chooser widget provides a standard RGB color chooser. More... #include <Fl_Color_Chooser.H> The Fl_Color_Chooser widget provides a standard RGB color chooser. You can place any number of the widgets into a panel of your own design. The diagram shows the widget as part of a color chooser dialog created by the fl_color_chooser() function. The Fl_Color_Chooser widget contains the hue box, value slider, and rgb input fields from the above diagram (it does not have the color chips or the Cancel or OK buttons). The callback is done every time the user changes the rgb value. It is not done if they move the hue control in a way that produces the same rgb value, such as when saturation or value is zero. The fl_color_chooser() function pops up a window to let the user pick an arbitrary RGB color. They can pick the hue and saturation in the "hue box" on the left (hold down CTRL to just change the saturation), and the brightness). fl_color_chooser(). Creates a new Fl_Color_Chooser widget using the given position, size, and label string. The recommended dimensions are 200x95. The color is initialized to black. Returns the current blue value. 0 <= b <= 1. Returns the current green value. 0 <= g <= 1. Set the hsv values. The passed values are clamped (or for hue, modulus 6 is used) to get legal values. Does not do the callback. This static method converts HSV colors to RGB colorspace. Returns the current hue. 0 <= hue < 6. Zero is red, one is yellow, two is green, etc. This value is convenient for the internal calculations - some other systems consider hue to run from zero to one, or from 0 to 360. Returns which Fl_Color_Chooser variant is currently active. Set which Fl_Color_Chooser variant is currently active. Returns the current red value. 0 <= r <= 1. Sets the current rgb color values. Does not do the callback. Does not clamp (but out of range values will produce psychedelic effects in the hue selector). This static method converts RGB colors to HSV colorspace. Returns the saturation. 0 <= saturation <= 1. Returns the value/brightness. 0 <= value <= 1.
http://www.fltk.org/doc-1.3/classFl__Color__Chooser.html
CC-MAIN-2017-47
refinedweb
351
70.09
There should be a way for the new whine scheduler to specify which columns are listed in a message. This could get a little bit tricky, and isn't critical to landing the scheduled whines, so I'm putting it in its own bug.. *** Bug 277708 has been marked as a duplicate of this bug. *** Created attachment 199964 [details] [diff] [review] robzilla_v1 patch attached. Moved column definition, display column determiniation, select column determination, and sort order determination into Search.pm, and used those functions in whine.pl to generate the search. To see the custom columns, the "columnlist" cgi parameter needs to be in the saved search URL (but there is no interface for this yet). too late for 2.22 It would be great if whine mails could send "Full Text Bug Listing" of bugs that match query. Comment on attachment 199964 [details] [diff] [review] robzilla_v1 Cool patch, unfortunately it has bitrotten because of changes to buglist. Few general comments for an updated patch: 1) Maybe DefineColumn sub should be a private one? This means it should start with a _, if I'm not mistaken. 2) Search.pm is already very long and adding these subs there make it even longer. Maybe we should instead add them to some sub namespace, like Bugzilla::Search::Columns or something like that. mkanat, any ideas about the module namespace this should use? (In reply to comment #7) > mkanat, any ideas about the module namespace this should use? Yeah. The whole thing should be one Bugzilla::Search::ColumnList object. It shouldn't be a module with subroutines, it should be an object that you can pass into "new Bugzilla::Search". I don't know when I'll get the time to update the patch, so if someone else wants to take it, go right ahead. *** Bug 344658 has been marked as a duplicate of this bug. ***". Untargeting this bug until it sees some action. *** Bug 359463 has been marked as a duplicate of this bug. *** Fixing this bug would improve our work team's production as it will help management in notification of bug status. I tried setting the flag to "yes" for blocking 3.0 to have someone continue to work this bug but the flag failed to post because I do not have the permission to post a flag, to your bug.(In reply to comment #11) >". (In reply to comment #14) > I tried setting the flag to "yes" for > blocking 3.0 to have someone continue to work this bug but the flag failed to > post because I do not have the permission to post a flag, to your bug. That's because we don't let you decide whether this bug should block 3.0 or not. Normal users can only do requests (blocking3.0?). Anyway, the two weeks deadline is now over, meaning this enhancement will definitely not go into Bugzilla 3.0. *** Bug 376293 has been marked as a duplicate of this bug. *** I agree completely that having custom format capability with whining would be fantastic. If nothing else, I think it's important to see a last changed date as part of the columns so readers can see when something changed versus their last whine. Rob - if you're still working on this issue, would you mind updating? I'm reassigning to default because your last patch is more than two years old. (In reply to comment #5) > It would be great if whine mails could send "Full Text Bug Listing" of bugs > that match query. i second this; would be great to be able to send a "Full Text Bug Listing" to someone who is not in the office. *** Bug 440727 has been marked as a duplicate of this bug. *** *** Bug 478022 has been marked as a duplicate of this bug. *** when will solve this problem? I'm also in need of this fix, when is it possible to have another update since the last comment please? Come on, can't be that difficult. (In reply to comment #23) > Come on, can't be that difficult. Patches welcome: Alternately, you're welcome to hire somebody to work on this. None of us get paid to work on Bugzilla. Created attachment 650703 [details] [diff] [review] v2 Instead of supporting just custom columns, I think a better solution is to take the column list as defined in the saved query. This also addresses supporting custom fields. Attached is a patch that I think goes in the right direction. One issue I see is that the abbreviation table is currently hardcoded in list/table.html.tmpl. Instead, this should be defined in perhaps fielddefs so that it can be reused. One could then define abbreviations through the editfields admin page. Comment on attachment 650703 [details] [diff] [review] v2 >+++ whine.pl 2012-08-09 13:46:36.746252000 -0700 >+ push @searchfields, "bug_id"; Did you make sure bug_id is not already in @searchfields? Duplicating columns is going to make Oracle unhappy. >+ $bug->{columnlist} = \@searchfields; You should rather store the column list as part of $thisquery as all bugs belonging to the same query will have the same columns. >+++ template/en/default/whine/mail.txt.tmpl 2012-08-09 15:33:58.068348000 -0700 >+ [% FOREACH col=bug.columnlist %] >+ [% IF col.length > padding; padding = col.length; END %] You should look at the length of field_descs.$col, not $col. Also, write this as: [% padding = field_descs.${col}.length IF field_descs.${col}.length > padding %] Otherwise your patch looks good. Note that your patch doesn't apply cleanly on the current code (4.3.2+): Hunk #1 FAILED at 47. 1 out of 1 hunk FAILED -- saving rejects to file template/en/default/whine/mail.txt.tmpl.rej patching file template/en/default/whine/mail.html.tmpl Hunk #1 FAILED at 61. 1 out of 1 hunk FAILED -- saving rejects to file template/en/default/whine/mail.html.tmpl.rej Created attachment 663325 [details] [diff] [review] v3 I'm very interested in seeing this bug resolved and it seemed like only a few tweaks to the previous patch were necessary. Here is a new version with the changes that were suggested, although the third suggestion didn't work for me so I stuck with the original logic (although I switched the variable name). I hope I'm not stepping on Albert's toes by submitting this. It just seemed so close ... Created attachment 663327 [details] [diff] [review] v3 Ack, the previous attachment was the wrong version. This one is correct. Thanks Kent. Glad that you can help! Feel free to take over. I still think the abbreviation table in list/table.html.tmpl should be moved to a more central place so that it can be used in this patch. Although that may be a separate ticket. There is likely an additional patch needed to support custom abbreviations via the custom field admin page. I thought about it and felt that not having abbreviations in the email shouldn't stop this bug. Moving the abbreviation table to a more central place is probably worth considering, but I think it is a separate bug. Comment on attachment 663327 [details] [diff] [review] v3 >=== modified file 'template/en/default/whine/mail.html.tmpl' >+ [% FOREACH col=query.columnlist %] Nit: add whitespaces around "=". >=== modified file 'template/en/default/whine/mail.txt.tmpl' >+ >+ [% largest_title = 0 %] Don't add an empty line, else it will appear in the email. >+ [% FOREACH col = query.columnlist %] >+ [% NEXT IF col == 'bug_id' %] >+ [% IF field_descs.${col}.length > largest_title %] >+ [% largest_title = field_descs.${col}.length %] The indentation is 2 characters in templates. Also, as it's a plain text email, the indentation matters in the output. Also, both templates miss 'columnlist' in their INTERFACE section at the top of the template. >=== modified file 'whine.pl' >+ if (defined $searchparams->param('columnlist')) { 'defined' is not needed. If it's defined but empty, we should ignore it. I tested your patch and it works great. I will fix the comments above on checkin. Thanks a lot for your patch! r=LpSolit Reassigning the bug to Kent as his patch is the one which is going to be checked in, but I will mention both Kent and Albert as authors in the commit message. Just on time for Bugzilla 4.4! :) Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified whine.pl modified template/en/default/whine/mail.html.tmpl modified template/en/default/whine/mail.txt.tmpl Committed revision 8426. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.4/ modified whine.pl modified template/en/default/whine/mail.html.tmpl modified template/en/default/whine/mail.txt.tmpl Committed revision 8419. Added to relnotes for 4.4. The change to whine/mail.txt.tmpl has problems on saved searches where 'short_short_desc' is one of the columns. I see these errors: Argument "" isn't numeric in numeric gt (>) at template/en/default/whine/mail.txt.tmpl line 58, <DATA> line 522. Argument "" isn't numeric in subtraction (-) at template/en/default/whine/mail.txt.tmpl line 66, <DATA> line 522. . . I believe this is due to 'short_short_desc' (i.e. first 60 characters) not being one of the fields in vars.field_descs in global/field-descs.none.tmpl. What is the proper way to fix this? 1. Add 'short_short_desc' to vars.field_descs definition in global/field-descs.none.tmpl 2. Define field_descs.short_short_desc in whine/mail.txt.tmpl (similar to how it is in list/change-columns.html.tmpl) Both appear to work. short_short_desc is already in field-descs.none.tmpl. Yes it is! I didn't have that change in my tree yet. Sorry! :-o
https://bugzilla.mozilla.org/show_bug.cgi?id=245375
CC-MAIN-2016-40
refinedweb
1,608
69.38
class test: def __init__(self, ln, wd): with self: ln = ln * 25.4 # keep in mm wd = wd * 25.4 area = ln * wd How could this be sorted out? -- Emile van Sebille emile at fenx.com --------- "Carlos Ribeiro" <cribeiro at mail.inet.com.br> wrote in message news:mailman.993562981.5640.python-list at python.org... > At 11:49 26/06/01 +0000, Maciej Pilichowski wrote: > >I have just started learning Python yesterday but... > > > > >def with_is_broken(a): > > > with a: > > > print x > > > > > >The snippet above assume that "a" must have a member attribute called "x". > > > >Nope. As you referred to Pascal -- if "a" has a member "x" it is read > >as "a.x", if not it is standalone "x". > > There must be some misunderstanding here. My snippet (incomplete, as I > pointed out) assumed that Python had a "with" keyword, just to show the > kind of problems that arise. In Python, the compiler/interpreter has no way > to tell beforehand if x is a member of a, a local variable, a module level > variable, or a global variable. This ambiguity makes the use of with in > Python impossible. > > Now, let us take a look at the "with" block in Pascal: > > with a do > writeln(x); > > The compiler knows in advance everything about "a". If "a" does define a > member called "x", then writeln() will reference "a.x". If "x" is not a > member of "a", then the compiler will recursively search on the outer > namespaces until it finds a definition for "x". If it does not find, it > will stop - it is a fatal error, caught at compile time. > > > > Carlos Ribeiro > > >
https://mail.python.org/pipermail/python-list/2001-June/100325.html
CC-MAIN-2020-24
refinedweb
269
75.1
screen_create_pixmap_buffer() Function type: Flushing execution Synopsis: #include <screen/screen.h> int screen_create_pixmap_buffer( screen_pixmap_t pix ); Arguments: - pix - The handle of the pixmap for which a new buffer will be allocated. Library: screen Description: Call this function to add a buffer to a pixmap. Pixmaps are restricted to a single buffer. No rendering can be performed onto the pixmap until a buffer has been created or attached. If the buffer size hasn’t been set explicitly, the buffer size will default to the first display’s size.. Also, a buffer cannot be created if a buffer was previously attached using screen_attach_pixmap_buffer(). Returns: If the function succeeds, it returns 0 and a new pixmap buffer is created. Otherwise, the function returns -1 and errno is set. Classification: Windowing API
https://developer.blackberry.com/playbook/native/reference/com.qnx.doc.screen.lib_ref/topic/rscreen_create_pixmap_buffer.html
CC-MAIN-2020-34
refinedweb
126
59.09
// Send input register address Wire.beginTransmission(address); Wire.send(REGISTER_INPUT); Wire.endTransmission(); // Connect to device and request two bytes Wire.beginTransmission(address); Wire.requestFrom(address, 2); // 2 bytes. if (Wire.available()) { data = Wire.receive(); } ; Wire.endTransmission(); beginTransmission(address); endTransmission(address); //without sending any data...receiveFrom(REGISTER_INPUT, 1); // to receive 1 byte from the register I'm interested instore=receive(); #include "Wire.h"unsigned int alt1 = 0;void setup(){ Wire.begin(); Serial.begin(115200);}void loop(){ Wire.beginTransmission(0x5D); //address assuming AD0 is set high Wire.send(0x14); //sensor information register Wire.endTransmission(); Wire.requestFrom(0x5D,1); //request one byte alt1 = Wire.receive(); Serial.println(alt1,DEC); delay(500);} I notice that the Wire.requestFrom() function actually requires the address as one of its arguments, but I don't think I want to do that again because it's not part of the data flow as specified by the MPR084. Quote from: GreyGnome on Mar 06, 2011, 06:57 amI notice that the Wire.requestFrom() function actually requires the address as one of its arguments, but I don't think I want to do that again because it's not part of the data flow as specified by the MPR084. Look at page 8 of their spec. The address is part of reading, that's normal for I2C. You send the slave address with the read bit set, then the requestFrom clocks out the data bytes, as required. Wire.beginTransmission (SLAVE_ADDRESS); Wire.send (cmd); Wire.endTransmission (); Wire.requestFrom (SLAVE_ADDRESS, responseSize); Thus, a read is initiated by first configuring the MPR084's command byte by performing a write (Figure 12). The master can now read 'n' consecutive bytes from the MPR084, with the first data byte being read from the register addressed by the initialized command byte. Wire.beginTransmission (SLAVE_ADDRESS); Wire.send (cmd); // send command byte (slave register) Wire.endTransmission (); Wire.requestFrom (SLAVE_ADDRESS, (byte) 1); // get a data byte back (switch to read mode) byte value = Wire.receive (); // get that byte from the buffer Can you post the code you are using? Make sure the address you are using matches the address of the IC with address line. Can you post a schematic also so we can see if you have it wired up correctly? Another thing to keep in mind, because it's a Freescale device, is that it may require the use of a repeated start, instead of a stop bit, after sending the command.... Please enter a valid email to subscribe We need to confirm your email address. To complete the subscription, please click the link in the Thank you for subscribing! Arduino via Egeo 16 Torino, 10131 Italy
http://forum.arduino.cc/index.php?topic=54490.msg389791
CC-MAIN-2016-36
refinedweb
440
59.3
Heya, new util-linux is a prerequisite for the whole hal thing. I've just downloaded and built it from git.debian.org[1], and I encountered the following problem with ENOMEDIUM, that seems to be Linux-specific. I'm attaching a proposed patch. I'm quoting the whole context: | /* ask kernel developers why we need such ugly open() method... */ | static int | open_device(const char *devname) | { | int retries = 0; | | do { | int fd = open(devname, O_RDONLY); | if (fd >= 0) | return fd; | #ifdef ENOMEDIUM | if (errno != ENOMEDIUM) | break; | #endif | if (retries >= CRDOM_NOMEDIUM_RETRIES) | break; | ++retries; | sleep(3); | } while(1); | | return -1; | } Do you people think of a better patch? *ding* Reading it again, I guess it'd be better to just add “#else break” in there, no? 1. git://git.debian.org/users/lamont/util-linux.git [master] ./autogen.sh && debuild -b It is supposed to reach experimental first. After the build, the symbols file shows missing uuid_{,un}pack: | - uuid_pack@UUID_1.0 2.16-1 | +#MISSING: 2.16-2# uuid_pack@UUID_1.0 2.16-1 | - uuid_unpack@UUID_1.0 2.16-1 | +#MISSING: 2.16-2# uuid_unpack@UUID_1.0 2.16-1 I'll start and figure out where that comes from later tonight. Mraw, KiBi. --- a/lib/fsprobe.c +++ b/lib/fsprobe.c @@ -31,8 +31,10 @@ open_device(const char *devname) int fd = open(devname, O_RDONLY); if (fd >= 0) return fd; +#ifdef ENOMEDIUM if (errno != ENOMEDIUM) break; +#endif if (retries >= CRDOM_NOMEDIUM_RETRIES) break; ++retries; Attachment: signature.asc Description: Digital signature
https://lists.debian.org/debian-bsd/2009/07/msg00095.html
CC-MAIN-2016-40
refinedweb
247
50.94
Guest Blog by Carmen Livia Ibanescu, Microsoft Student Partner at University College London A little bit about myself My name is Carmen-Livia Ibanescu. I am currently a Computer Science Student at UCL and on the fall I will start my second year here. I am from Romania and I have been programming since high-school. Choosing to study in London has been one of the best decision I have ever made since it is a great place to find opportunities, grow my network and attend many activities such as hackathons, tech conferences, workshops or talks. I believe that the best part about programming is the fact that it can be integrated to any field from medicine, psychology, mathematics or even bio-chemistry. I am eager to learn more and I mostly enjoy making mobile apps or solving algorithmic problems since I can develop my logical skills. I am not afraid to challenge myself and I make the most of any opportunity to gain any additional knowledge. As for now, I know C/C++, Java, Haskell, JavaScript (alongside with CSS and HTML) and a bit of C#. In the future, I am looking forward to learn the R language for Data Science as well as do some courses on Machine Learning. You can find me on my Linkedin profile or on my Github. Introduction In the following post, you will be able to learn how to build your first Xamarin Android app using C#. The main goals of this little tutorials are · Build your first mobile app · Understand the key functionalities that a mobile app must have and how to structure it · Get familiar with C# The app we are going to build is a mailing app that allows the user to attach images to the e-mails. The editor we are going to use is the Visual Studio Community 2016. The source code of this project can be found on this link. The mobile app will work as following: 1. The user opens the application 2. The user fills in the input fields with the data needed (Subject, recipient and text message of the e-mail) 3. The user can attach a picture to the e-mail (in this case, the gallery will automatically open and the user needs to select an image; after the user chooses the image, it will be displayed on the page of the app) 4. The user presses send. After that, the users must choose the mailing provider to be used. Figure 1 How the app will look like Why choose Xamarin to make your first mobile app? Xamarin is one of the best cross-platforms mobile development framework. If you are looking forward to develop you C# skills doing something fun, Xamarin is the answer. The performance is very good and comparable to native and covers all major mobile platforms like Android, iOS and Windows. The documentation of Xamarin is large and well structured, so it is easy to find everything you need in there. Moreover, while working with Xamarin on Visual Studio, you can test out your app to see if there are any bugs or exceptions you did not cover. You can easily deploy your app on Google play or Apple store. Building the app Start out by creating a new Blank App Android project. Name it as “My first app”. Figure 2 Getting started The files of the app will appear on the right. We will start by opening the Main.axml file. It is in the Resources/layout folder. This is the default user interface layout file for an application. Figure 3 How to locate the Main.axml file On the bottom left, click on “source”. Figure 4 Getting to the source code Now we will start adding some code. Start by deleting the backslash from the code. Figure 5 Where to start adding some code We need to add the elements of the app here. The app will have 9 UI widgets: TextView, EditText, Button and ImageView. The “TextView” elements will show only some simple text (user will not be able to modify it; it is used only to display some simple text). The “TextView” elements are 1,3 and 5. “EditText” are the input fields that need to be filled in by the user. When the user presses on that space, the keyboard will automatically pop up. The “EditText” Elements available are 2,4 and 6. “Buttons” are important elements of the app. When they are pressed, an action will happen. In our application, one button is used to select an image to attach in the e-mail (no 7 ), while the other button ( no 9 ) will ask the user what mail app to use. “ImageView” will display the image chosen on the page. Figure 6 The 9 UI widgets of the app Each of these UI widgets will have a unique id. We can think the id’s to be a “bridge” between the main.axml file ( where the UI elements are ) and the MainActivity.cs file ( where basically all the back-end code is). In order to better understand the key functionalities of each element, we will analyses the code of one button. 1: <Button 2: android:text="Attach a photo" 3: android:layout_width="match_parent" 4: android:layout_height="wrap_content" 5: android:id="@+id/button1" 6: android:textStyle="bold" 7: android:background="@android:drawable/toast_frame" 8: android: android:text will display some text on the button (what the button does). In order to make the text bold, we have added the android:textStyle attribute. android:backgroundTint and android:background are responsible for the background of the button. android:layout_width and android:layout_height will set the size of the button. All of these are customizable and easy to understand. The button has an id ( android:id="@+id/button1 ) and we will use it in the MainActivity.cs in order to set it an action when it is pressed. Now we need to go make these buttons and input text work. In order to do that, open the “MainaActivity.cs” file. Figure 7 Locating the MainActiviy.cs file In order to better understand the code, we will need to see what is going to be the flow of the application. As far as we know so far, we have some input fields, 2 buttons and one ImageView box. Let’s start with the first button, the “Attach the button”. When this button is pressed, the application will need to perform some action: the image gallery will open and the user must select a picture. When the picture is chosen, the mobile app will get the location (each file have a location. An image for example is located in the gallery folder or on a SD card) of the image and display it in the ImageView box. The next button is “Send”. When it is pressed, it will take all the text from the fields “Subject”, “E-mail” and “Message” as well as the location of the image the user wants to be attached to the e-mail. (It is not necessary for the e-mail to have an attachment). After that, it will ask the user to choose a webmail provider. Supposing the user chose “Outlook” as its webmail provider, the Outlook app will open, and it will have the subject, recipient’s name, the message and the attachment added. There are 2 global variables. There is the imageView variable that will display the image while the other one is a string that will hold the location of the image selected. 1: ImageView imageView; 2: System.String uris; We will work with some variables. The first three (subject, to, message) are just some strings of texts. They are the data needed for an e-mail. Then there are the two buttons. We will need them I order to set some events to happen when they are selected. A method “FindViewById” is called for each variable. This method finds a view that was identified by the id attribute from the XML file. 1: var subject = FindViewById<EditText>(Resource.Id.editText1); 2: var to = FindViewById<EditText>(Resource.Id.editText2); 3: var message = FindViewById<EditText>(Resource.Id.editText3); 4: var btnCamera = FindViewById<Button>(Resource.Id.button1); 5: var btnSend = FindViewById<Button>(Resource.Id.button2); 6: imageView = FindViewById<ImageView>(Resource.Id.imageView); Now, we want to write down what event we want to happen when the “Attach button” is pressed. As a result, when the btnCamera is pressed, we want some operation to happen. As a result, we will use “Intent”. It is used to launch external applications with the intent to do something. In our case, we plan the gallery to appear in order for the user to select an image. Intent is part of the Android.Content namespace (One important feature of the C# language is the usage of the Namespaces. A namespace is a set of related objects and within a namespace, a user can declare classes, interfaces or another namespace.) which contains classes for accessing and publishing data on a device. 1: btnCamera.Click += (s, e) => 2: { 3: var imageIntent = new Android.Content.Intent(); 4: imageIntent.SetType("image/*"); 5: imageIntent.SetAction(Android.Content.Intent.ActionGetContent); 6: StartActivityForResult( 7: Android.Content.Intent.CreateChooser(imageIntent, "Select photo"), 0); 8: }; This block of code will only help us to open the gallery. However, we still need to display the image chosen on the ImageView box and get the location of the image. For that, we will need to override the OnActivityResult Method. It is called when an activity launched exits (in this case, when the image was chosen). The method takes a requestCode of the activity which started it with, the resultCode it returned, and any additional data from it. We will override this method in order to display the image in the ImageView block as well as to get the location of the image. After it had displayed the image (imageView.SetImageURI(data.Data); ), uris will be a string that holds the location of the image ( it was globally declared) . The Data.data is an uri (uniform resource identifier) and is a compact representation of a resource available to your application on the intranet or Internet. Data.data basically holds the image selected. 1: protected override void OnActivityResult(int requestCode, 2: [Android.Runtime.GeneratedEnum] Result resultCode, Android.Content.Intent data) 3: { 4: base.OnActivityResult(requestCode, resultCode, data); 5: if (resultCode == Result.Ok) 6: { 7: var imageView = 8: FindViewById<ImageView>(Resource.Id.imageView); 9: imageView.SetImageURI(data.Data); 10: uris = GetPathToImage(data.Data); 11: } 12: } We will need to create a method that returns the location of the image. The method will return the location as a string. The function will take one parameter which is the uri to the image selected. An image can exist in 3 possible folders: the gallery (Media Storage), SD card (External Storage) or download folder. The function will get the path and return it as a string. 1: private string GetPathToImage(Android.Net.Uri uri) 2: { 3: string doc_id = ""; 4: using (var c1 = ContentResolver.Query(uri, null, null, null, null)) 5: { 6: c1.MoveToFirst(); 7: System.String document_id = c1.GetString(0); 8: doc_id = document_id.Substring(document_id.LastIndexOf(":") + 1); 9: } 10: 11: string path = null; 12: 13: 14: string selection = Android.Provider.MediaStore.Images.Media.InterfaceConsts.Id + " =? "; 15: using (var cursor = ContentResolver.Query(Android.Provider.MediaStore.Images.Media.ExternalContentUri, null, selection, new string[] { doc_id }, null)) 16: { 17: if (cursor == null) return path; 18: var columnIndex = cursor.GetColumnIndexOrThrow(Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data); 19: cursor.MoveToFirst(); 20: path = cursor.GetString(columnIndex); 21: 22: } 23: return path; 24: } Now, we need to write what will happen when the “Send” button is pressed. Our plan is the following: get the data that was filled in in the input fields “Subject”, “E-mail” and “Message” and the image selected, choose a mail provider and send all of these data to the other application. We will work again with “intent”, but this time we create our own kind of intent named email(we create the email variable of type intent). Using “ActionSend” with the email intent we make sure that we will deliver some data to the other mailing app. 1: btnSend.Click += (s, e) => 2: { 3: 4: 5: Android.Content.Intent email = new Android.Content.Intent(Android.Content.Intent.ActionSend); 6: 7: 8: email.PutExtra(Android.Content.Intent.ExtraEmail, new string[] { to.Text.ToString() }); 9: email.PutExtra(Android.Content.Intent.ExtraSubject, subject.Text.ToString()); 10: email.PutExtra(Android.Content.Intent.ExtraText, message.Text.ToString()); 11: 12: if (uris != null) 13: { 14: 15: 16: var filePath = System.IO.Path.Combine(uris, ""); 17: var File = new Java.IO.File(filePath); 18: var path = Android.Net.Uri.FromFile(File); 19: 20: email.PutExtra(Android.Content.Intent.ExtraStream, path); 21: } 22: email.SetType("message/rfc822"); 23: 24: StartActivity(Android.Content.Intent.CreateChooser(email, "Send Email Via")); 25: 26: 27: }; After that, we need to check if the user attached any image. As we know, the string uris holds the location of the image. If an image was selected, then we need to attach the image to the e-mail. First of all, we need to convert the string to a path( System.IO.Path.Combine combines the string uri with “” and creates a path). After that, we convert the path to a file ( we actually want to attach a file, not a location ). Finally, we attached the file to the e-mail. After all of these have been done, we make sure to encapsulate everything into a message (email.SetType("message/rfc822"); ) and make the user to pick another mail application than the default ( StartActivity(Android.Content.Intent.CreateChooser(email, "Send Email Via")); ). How the app works Here are some screenshots of how the app will work. Figure 8 The first page of the app. Filling in the fields with some data Figure 9 Attach a photo button was pressed. The gallery is opened Figure 10 After the photo was chosen, it is displayed on the page Figure 11 The "Send" Button was pressed. The user is asked to choose another mailing app Figure 12 The text, subject, recipient and the photo were added to the e-mail Other resources If you are looking to find out more about some features of Xamarin, I prepared for you some extra materials Xamarin Microsoft Virtual Academy Course Text Fields for Xamarin.Android Take a picture and save it using the Camera – you can try to modify the original code of the app by allowing the user to attach a picture taken by the camera Launch a phone Dialer - good for understanding better Intent Display pictures in a grid layout
https://blogs.msdn.microsoft.com/uk_faculty_connection/2017/06/11/how-to-build-your-first-xamarin-app/
CC-MAIN-2018-26
refinedweb
2,455
66.54
Abstract classes. Abstract methods. Keyword abstract. Examples Contents - 1. What is an abstract class? Purpose of abstract classes. The general form of an abstract class declaration. Keyword abstract - 2. What is an abstract method? General form - 3. A schematic representation of the declaration and use of an abstract method in an abstract class. Example - 4. An example that demonstrates the use of abstract classes - 5. Explanation to the example of paragraph 4 - 5.1. Why are the Area() and ShowName() methods are declared abstract in the Figure class? - 5.2. Why Figure class is declared as abstract? - 5.3. Why in the class Figure methods Area() and ShowName() do not contain the implementation code (method body)? - 5.4. Is it possible to add other non-abstract methods in the abstract Figure class? - 5.5. Is it possible to create an instance of the Figure class in the main() function of the UseAbstractClass class? - 5.6. What is the essence of late binding in the GetArea() method of the class UseAbstractClass? - 6. Is it possible to declare in an abstract class some non-abstract methods, that have a (body) implementation? - 7. An example of creating a hierarchy of abstract classes - 8. Can an abstract class does not contain abstract methods? - 9. What are the differences between using abstract classes and using interfaces? - 10. The advantages of using abstract classes - Related topics Search other websites: 1. What is an abstract class? Purpose of abstract classes. The general form of an abstract class declaration. Keyword abstract An abstract class is a class that contains methods that have no implementation. An abstract class is created to create a common interface between different implementations of classes that are derived from an abstract class. An abstract class is created to define some common features of its derived classes. It is forbidden (it makes no sense) to create an object of an abstract class. A class is considered abstract if at least one abstract method is declared in the class. Before declaring an abstract class, the abstract keyword is placed. The general form of the abstract class declaration is as follows: abstract class ClassName { // class methods and variables ... abstract type AbstractMethod1(parameters1); abstract type AbstractMethod2(parameters2); ... abstract type AbstractMethodN(parametersN); } here - ClassName – the name of the abstract class that is declared; - AbstractMethod1, AbstractMethod2, AbstractMethodN – names of abstract methods declared in an abstract class; - type – some type; - parameters1, parameters2, parametersN – the list of parameters that receive the corresponding abstract methods with the names AbstractMethod1, AbstractMethod2, AbstractMethodN. ⇑ 2. What is an abstract method? General form Abstract method – a method whose implementation in the program does not make any sense. The abstract method is only a declaration of a form (interface) and not an implementation. As with the abstract class, the abstract method starts from the abstract keyword. If an abstract method is declared in a class, then the class is also considered abstract. In this case, the abstract keyword is also placed before the class name. If a certain class is inherited from an abstract class, then this class must override all abstract methods of the base abstract class. Otherwise, an error will be generated. The general form for declaring an abstract method in an abstract class is as follows: abstract class ClassName { // ... type AbstractMethod(parameters); } here - ClassName – the name of an abstract class that contains an abstract method called AbstractMethod; - AbstractMethod – the name of an abstract method that returns a value of specified type and receives parameters. In the class inheritance hierarchy (extensions), abstract methods are something common. Specific implementations of abstract methods are placed on classes inherited from abstract classes. ⇑ 3. A schematic representation of the declaration and use of an abstract method in an abstract class. Example The diagram shows a simple example of declaring an abstract class called AbstractClass. This class contains an abstract method declaration named ShareMethod(). From the abstract class AbstractClass two classes are inherited with the names Class1, Class2. These classes implement the ShareMethod() method, which is declared in the AbstractClass class as abstract. Figure. The scheme of interaction between the abstract class and derived classes in Java ⇑ 4. An example that demonstrates the use of abstract classes The example declares an abstract class Figure, describing general information about a certain geometric figure on a plane. From the class Figure two classes are inherited (Triangle and Circle), which override the abstract methods of the class Figure. In the class Figure are declared: - hidden (protected) property name, which defines the name of a geometric figure; - hidden (protected) constant pi; - abstract method ShowName(), which displays the name of the figure; - abstract method Area(), which calculates the area of the figure; - method that returns the name of the figure (the value of the name field). // abstract class that describes some geometric figure abstract class Figure { protected String name = ""; // the name of figure protected double pi = 3.1415; // constant Pi // abstract methods that will be redefined in derived classes abstract void ShowName(); // display the name of the figure abstract double Area(); // the calculation of area // method that returns the name of the figure String GetName() { return name; } } Two classes with the names of Triangle and Circle also implemented. These classes inherit (extend) the class Figure. In the class Triangle() are implemented: - internal variables a, b, c, which are sides of a triangle; - class constructor; - the ShowName() method, which overrides the abstract ShowName() method of the Figure class. This method displays the class name “Triangle”; - the Area() method, which overrides the abstract Area() method from the Figure class. The method calculates the area of a triangle. // a class that implements the triangle class Triangle extends Figure { double a, b, c; // sides of a triangle // constructor Triangle(double a, double b, double c) { name = "Triangle"; this.a = a; this.b = b; this.c = c; } // override abstract method ShowName() void ShowName() { System.out.println("Triangle"); } // override abstract method Area() // area of a triangle double Area() { // check whether it is possible to form a triangle from distances a, b, c if (((a+b)<c) || ((b+c)<a) || ((a+c)<b)) return 0.0; double p = (a+b+c)/2; // semiperimeter double s; // Heron's formula s = Math.sqrt(p*(p-a)*(p-b)*(p-c)); return s; } } The Circle class implements a circle that belongs to geometric shapes. Therefore, the Circle class inherits (extends) the Figure class. In the class Circle are implemented: - internal variable r, defining the radius of a circle; - constructor; - the Area() method, redefining the same-named abstract method of the Figure class. The method calculates the area of a circle; - the method ShowName(), which overrides the abstract method of the same name of the class Figure. The method displays the class name “Circle”. // a class that implements a circle inherits a class Figure class Circle extends Figure { double r; // constructor Circle(double r) { name = "Circle"; this.r = r; } // override abstract method Area() double Area() { return pi*r*r; } // override abstract method ShowName() void ShowName() { System.out.println("Circle"); } } In order to demonstrate the use of abstract classes, an additional class is created called UseAbstractClass. This class implements: - GetName() method that returns the name of the instance f, which is passed as an input parameter. The parameter f is a reference to the class Figure; - GetName() method that returns the name of the instance f, which is passed as an input parameter. The parameter f is a reference to the class Figure; - method GetArea(), which returns the area of the instance f of the class Figure. An instance (object) f of class is an input parameter of the method. This method clearly demonstrates the so-called late binding, the essence of which is described below; - static method main(), which is the entry point to the program. This method implements the demonstration of the abstract class Figure. // class that uses the abstract class Figure public class UseAbstractClass { // method that receives reference to base class static String GetName(Figure f) { return f.GetName(); // invoke the method to base class } // method that returns the area of the figure, f - reference to the base class // late binding is used, // the method for calculating the area is determined based on the value of f static double GetArea(Figure f) { return f.Area(); // invoke the area calculation method } public static void main(String[] args) { // Demonstration of using the Area() and ShowName() abstract methods Figure f1 = new Triangle(3.5, 1.8, 2.2); // an instance of the Triangle class Figure f2 = new Circle(3.0); // instance of the Circle class double area; // display the names of the instances f1, f2 f1.ShowName(); // Triangle f2.ShowName(); // Circle String name; name = GetName(f1); // name = "Triangle" System.out.println(name); name = GetName(f2); // name = "Circle" System.out.println(name); // calculating the area for a triangle // implementation of late binding area = GetArea(f1); // area = 1.6833281765597579 System.out.println("area = " + area); // calculating the area of a circle // implementation of late binding area = GetArea(f2); // area = 28.2735 System.out.println("area = " + area); } } As a result of the use of the function main() of class UseAbstractClass, the following result will be displayed: Triangle Circle Triangle Circle area = 1.6833281765597579 area = 28.2735 ⇑ 5. Explanation to the example of paragraph 4 Explanation of an example (see previous paragraph) in the form of questions. 5.1. Why are the Area() and ShowName() methods are declared abstract in the Figure class? The class Figure is a generalization of a geometric figure. This class defines the general properties of the whole variety of geometric shapes. Specific shapes (triangle, circle) extend (extends) the capabilities of the class Figure or, in other words, inherit the class Figure. In our case, the triangle (class Triangle) and the circle (class Circle) are chosen as concrete figures. In the Figure class, the Area() method is declared as abstract, since it is impossible to determine the area of a generalized figure, since it is not yet known what figure it is (triangle or circle). For a triangle (class Triangle) the area is determined by the Heron’s formula. For a circle, the area is determined by the standard formula S = π·R2. From here we can conclude: it makes no sense to call the Area() method from the base class Figure. This method is declared only for organizing a hierarchical call to the Area() methods, which calculate the areas of shapes of specific implementations of the classes derived from the Figure class. In our case, these derived classes are the Triangle and Circle classes. ⇑ 5.2. Why Figure class is declared as abstract? If a class contains at least one abstract method, then this class is considered as abstract. The Figure class contains two abstract methods, so the abstract keyword is placed before the class declaration. ⇑ 5.3. Why in the class Figure methods Area() and ShowName() do not contain the implementation code (method body)? If the method is declared abstract in the abstract class (with the abstract keyword), then this method should not contain implementations (according to Java syntax). This is explained by the fact that calling this method does not make sense. ⇑ 5.4. Is it possible to add other non-abstract methods in the abstract Figure class? Yes, it is. An abstract class may contain non-abstract methods (as opposed to an interface). ⇑ 5.5. Is it possible to create an instance of the Figure class in the main() function of the UseAbstractClass class? No, it is not. That is, the following line Figure f3 = new Figure(); is a Java compiler error: “Cannot instantiate the type Figure”. However, it is possible to declare a reference to the class Figure. Since the Figure class is basic for the Triangle and Circle classes, using this link, you can create instances of classes derived from Figure. The following code demonstrates the use of the reference to the base class Figure: // base class reference declaration Figure f3; // creating an instance of the class Circle, derived from Figure f3 = new Circle(2.5); // invoke the class method Circle f3.ShowName(); ⇑ 5.6. What is the essence of late binding in the GetArea() method of the class UseAbstractClass? The GetArea() method gets a link with the name f of the abstract class Figure, which is the base class hierarchy (two classes, Triangle and Circle, are inherited from the Figure class). static double GetArea(Figure f) { return f.Area(); // invoke the area calculation method } Then the Area() method in the string is called by reference. ... return f.Area(); ... At the time of compiling of the GetArea() method, it is impossible to say which instance of a class (Triangle or Circle) will be passed to the method. So you can’t say which Area() method will be called. Therefore, a reference to the base class Figure is passed to the method. In the main() function when calling the GetArea() method ... Figure f1 = new Triangle(3.5, 1.8, 2.2); // the instance of class Triangle Figure f2 = new Circle(3.0); // the instance of class Circle ... // calculating the area for a triangle // implementation of late binding area = GetArea(f1); // the instance of the Triangle class is passed. ... area = GetArea(f2); // the istance of Circle class is passed ... various references (f1, f2) are passed to this method which are instances of classes derived from the class Figure. These references are instances of the Triangle and Circle classes. In the first case area = GetArea(f1); inside the GetArea() method, the compiler assigns to the reference f the value of the link f1, which points to the class that contains the Area() method of the Triangle class. Thus, the binding of the generalized reference f to the class Triangle occurs due to the inheritance hierarchy. This binding is called late binding. Details of late binding – this is another topic. In exactly the same way, an instance of f2 of the Circle class is associated with a generalized reference f in the GetArea() method area = GetArea(f2); ⇑ 6. Is it possible to declare in an abstract class some non-abstract methods, that have a (body) implementation? Yes, it is. The abstract class allows the implementation of non-abstract methods. ⇑ 7. An example of creating a hierarchy of abstract classes If a class derived from an abstract is declared, and in this class there is no implementation of abstract methods, then this class is automatically considered as abstract. You must specify abstract before the name of this class, otherwise the compiler will generate an error. Example. Below is an example of a hierarchy of abstract classes. // abstract class hierarchy abstract class A { abstract void Show(); } // Class B has no implementation of the abstract Show() method from Class A, // so this class is also abstract abstract class B extends A { abstract void Show(); // no implementation } // in class C, an abstract method Show() of classes A, B is implemented class C extends B { // implementation of method Show() void Show() { System.out.println("Class C"); } } As you can see from the example, in class B, the abstract Show() method is inherited, which has no implementation. Therefore, you must specify the abstract keyword before declaration a class B. Using class C may be, for example, the following A obj = new C(); // reference to base class A obj.Show(); // C obj2 = new C(); // reference to class C objC2.Show(); ⇑ 8. Can an abstract class does not contain abstract methods? Yes, it can. This is necessary in cases where abstract methods in the class are not needed, but the creation of instances of this class must be prohibited. ⇑ 9. What are the differences between using abstract classes and using interfaces? The following differences exist between abstract classes and interfaces: - abstract classes can contain implementations of methods, interfaces cannot; - in interfaces, all the methods that are declared are abstract. In abstract classes, you can declare both abstract and non-abstract methods; - variables that are declared in interfaces must be initialized. In abstract classes, internal variables can be not initialized; - in interfaces, all declared variables are implicitly considered as constants (declared with the keywords final, static). In abstract classes, declared variables are not considered as constants. ⇑ 10. The advantages of using abstract classes Using abstract classes provides the following benefits: - using the abstract keyword before declaring a class emphasizes the abstractness of this class. This, in turn, tells the developer how to use this class; - abstract classes are useful when reworking programs. With the help of abstract classes, you can easily “move” general methods up the hierarchy. ⇑ Related topics - Interfaces. Features of use in combination with classes. The advantages of using interfaces. Keywords interface, implements. Examples
https://www.bestprog.net/en/2019/04/01/abstract-classes-abstract-methods-keyword-abstract-examples/
CC-MAIN-2022-27
refinedweb
2,760
55.34
Given a number n as string, find the nth even-length positive palindrome number . Examples: Input : n = "1" Output : 11 1st even-length palindrome is 11 . Input : n = "10" Output : 1001 The first 10 even-length palindrome numbers are 11, 22, 33, 44, 55, 66, 77, 88, 99 and 1001. As, it is a even-length palindrome so its first half should be equal to second half and length will be 2, 4, 6, 8 …. To evaluate nth palindrome let’s just see 1st 10 even-length palindrome numbers 11, 22, 33, 44, 55, 66, 77, 88, 99 and 1001 . Here, nth palindrome is nn’ where n’ is reverse of n . Thus we just have to write n and n’ in a consecutive manner where n’ is reverse of n . Below is implementation of this approach . C/C++ // C++ program to find n=th even length string. #include <bits/stdc++.h> using namespace std; // Function to find nth even length Palindrome string evenlength(string n) { // string r to store resultant // palindrome. Initialize same as s string res = n; // In this loop string r stores // reverse of string s after the // string s in consecutive manner . for (int j = n.length() - 1; j >= 0; --j) res += n[j]; return res; } // Driver code to test above function int main() { string n = "10"; cout << evenlength(n); return 0; } Java // Java program to find nth even length Palindrome import java.io.*; class GFG { // Function to find nth even length Palindrome static String evenlength(String n) { // string r to store resultant // palindrome. Initialize same as s String res = n; // In this loop string r stores // reverse of string s after the // string s in consecutive manner for (int j = n.length() - 1; j >= 0; --j) res += n.charAt(j); return res; } // driver program public static void main (String[] args) { String n = "10"; System.out.println(evenlength(n)); } } // Contributed by Pramod Kumar Output: 1001 Time Complexity : O(n): - Calculate the difficulty of a sentence - Minimum insertions to form a palindrome with permutations allowed - Keyword Cipher - Count of Palindromic substrings in an Index range - Minimum steps to delete a string after repeated deletion of palindrome substrings -.
https://www.geeksforgeeks.org/nth-even-length-palindrome/
CC-MAIN-2018-13
refinedweb
359
69.52
7. Advanced Form Applications Contents: Guestbook Survey/Poll and Pie Graphs Quiz/Test Form Application Security Four different CGI applications are presented in this chapter, all of which use queries and form information to produce some interesting documents with hypertext and graphics. These applications include: - Guestbook: A form interface for users to leave comments on a particular Web page for other people to see. The concepts behind the guestbook are very simple: Present a form to the user to fill out, process the form information, and store it in a file. - Poll or a Survey: A CGI program that allows you to solicit opinions from users and present them with a dynamically created pie graph illustrating the up-to-date results. This application involves displaying a form and manipulating and storing the form data into a format that we can read easily and quickly at a later time. When the user elects to see the current results, we simply read in all of the data and graph it. - Quiz/Test: A unique interface that shows you how to "extend" HTML by adding new tags! This CGI application reads the specified data file consisting of tags to create quizzes (as well as regular HTML), formats it to HTML, and sends it to the browser. It will also correct the quiz once the user completes it. 7.1 Guestbook One of the most common applications on the Web is a guestbook. It is simply a form that allows visitors to enter some information about themselves. This information is placed in a file for everyone to see. Here are the steps that need to be taken to create a guestbook: - Display a form with such fields as name, email address, and comments - Write a CGI program to decode the form - Place the information in a file The program begins as follows: #!/usr/local/bin/perl $webmaster = "shishir\@bu\.edu"; $method = $ENV{'REQUEST_METHOD'}; $script = $ENV{'SCRIPT_NAME'}; $query = $ENV{'QUERY_STRING'}; $document_root = "/usr/local/bin/httpd_1.4.2/public"; $guest_file = "/guestbook.html"; $full_path = $document_root . $guest_file; In this initialization code, the document_root variable is the directory that contains your HTML files. Set this variable to the value of DocumentRoot, as defined in the srm.conf configuration file. The guest_file variable contains the relative path to the guestbook file, relative to DocumentRoot. And full_path represents the full path to the guestbook file. It is very important to separate the full path from the relative path, as you will see in a moment. $exclusive_lock = 2; $unlock = 8; The lock definitions are stored in the exclusive_lock and unlock variables, respectively. if ($method eq "GET") { if ($query eq "add") { This program is coded slightly differently from the programs that you have seen in this book. Let's first see how this program can be accessed: - A URL of, using the GET method, will present a form for visitors to enter information. - A URL of, using the GET method, will display the actual guestbook file. (The user can also see the guestbook file by opening that file directly, e.g., by accessing.) - When the form is submitted using the POST method, this program decodes the information, and outputs a thank-you message. As you can see, this program is very versatile. It handles all tasks of the guestbook. You could just as easily split the program into its constituents: an HTML form, a program to display the guestbook (optional), and a program to decode the form information. There are advantages either way. Combining all tasks into the single program ensures that all components of the program are in one place, and files cannot be accidentally misplaced. On the other hand, separating them ensures that each component of the guestbook is independent, and can be modified without risking the integrity of the other components. It is matter of personal preference. $date_time = &get_date_time(); The get_date_time subroutine displays the current date and time. &MIME_header ("text/html", "Shishir Gundavaram's Guestbook"); The MIME_header subroutine outputs a chosen MIME header, and sets the title of the document to the user-specified argument. The only reason for the subroutine is to make the program more compact. print <<End_Of_Guestbook_Form; This is a guestbook CGI script that allows people to leave some information for others to see. Please enter all requested information, <B>and</B> if you have a WWW server, enter the address so a hypertext link can be created. <P> The current time is: $date_time <HR> First, an introductory message is displayed, along with the current date and time. (You cannot call subroutines from within print "blocks," so the get_date_time subroutine to get the date and time was called earlier and placed in the date_time variable.). <FORM METHOD="POST"> <PRE> <EM>Full Name</EM>: <INPUT TYPE="text" NAME="name" SIZE=40> <EM>Email Address</EM>: <INPUT TYPE="text" NAME="from" SIZE=40> <EM>WWW Server</EM>: <INPUT TYPE="text" NAME="www" SIZE=40> </PRE> <P> <EM>Please enter the information that you'd like to add:</EM><BR> <TEXTAREA ROWS=3 COLS=60</TEXTAREA><P> <INPUT TYPE="submit" VALUE="Add to Guestbook"> <INPUT TYPE="reset" VALUE="Clear Information"><BR> <P> </FORM> <HR> End_Of_Guestbook_Form As you can see, there is no ACTION attribute to the <FORM> tag. By omitting the ACTION attribute, the browser defaults to sending the completed form to the current CGI program. The METHOD is set to POST--as we'll see later, this is how the guestbook program will know the form has been completed. The various elements that comprise a form are output. The <PRE> tags align the text fields. Figure 7.1 shows how a completed form is rendered by Netscape Navigator. If there was no query specified, the guestbook data file is displayed for output. } else { if ( open(GUESTBOOK, "<" . $full_path) ) { flock (GUESTBOOK, $exclusive_lock); The full_path variable contains the full path to the guestbook file. The main reason for storing the relative path and full path separately is that hypertext anchors need the relative path, while the full path is needed to open the file. Before you open any file, it is always a good idea to check that the file can be opened. &MIME_header ("text/html", "Here is my guestbook!"); while (<GUESTBOOK>) { print; } flock (GUESTBOOK, $unlock); close(GUESTBOOK); The loop iterates through each line of the file and displays it to standard output. Figure 7.2 shows the output. } else { &return_error (500, "Guestbook File Error", "Cannot read from the guestbook file [$full_path]."); } } If there were any problems opening the file, an error message is sent to the client. The return_error subroutine is the same as the one presented in Chapter 4, Forms and CGI. Remember the "add" form, in which the <FORM> tag used a METHOD of POST? Here's where the form is processed. If the request method is POST, it means that the user filled out the form, and submitted it back to this program. } elsif ($method eq "POST") { if ( open (GUESTBOOK, ">>" . $full_path) ) { flock (GUESTBOOK, $exclusive_lock); $date_time = &get_date_time(); &parse_form_data (*FORM); Now we add the new entry to the guestbook. First, the program checks to see if it can write to the guestbook file. If there are no errors, the file is opened in append mode, and exclusively locked. The form information is decoded and placed in the FORM associative array. The parse_form_data subroutine in this program is slightly different than the one we've previously encountered in Chapter 4, Forms and CGI; it does not check for GET requests, since the program only uses it for POST. $FORM{'name'} = "Anonymous User" if !$FORM{'name'}; $FORM{'from'} = $ENV{'REMOTE_HOST'} if !$FORM{'from'}; Above is a construct you might not have seen before. It is a simpler way of saying: if (!$FORM{'name'}) { $FORM{'name'} = "Anonymous User"; } if (!$FORM{'from'}) { $FORM{'from'}=$ENV{'REMOTE_HOST'}; } In other words, the form variables name and from are checked for valid information. If the fields are empty, default information is stored. $FORM{'comments'} =~ s/\n/<BR>/g; The information that the user entered in the <TEXTAREA> field is stored in comments. Every newline character is replaced by the HTML break tag. This ensures that the information is displayed correctly. Note that if the user enters HTML code (or SSI directives) as part of the comments, the code will be interpreted. This could be dangerous. See Chapter 9, Gateways, Databases, and Search/Index Utilities, for an intricate regular expression that "escapes" HTML code. print GUESTBOOK <<End_Of_Write; <P> <B>$date_time:</B><BR> Message from <EM>$FORM{'name'}</EM> at <EM>$FORM{'from'}</EM>: <P> $FORM{'comments'} End_Of_Write The user name, host, and comments, along with the current date and time, are written to the guestbook file. if ($FORM{'www'}) { print GUESTBOOK <<End_of_Web_Address; <P> $FORM{'name'} can also be reached at: <A HREF="$FORM{'www'}">$FORM{'www'}</A> End_of_Web_Address } print GUESTBOOK "<P><HR>"; If an HTTP address was provided by the user, it is also displayed. flock (GUESTBOOK, $unlock); close(GUESTBOOK); The file is unlocked and closed. It is very important to unlock and close the guestbook file to ensure that other people can access it. Finally, if all goes well, a thank-you message is displayed, as well as links to view the guestbook. &MIME_header ("text/html", "Thank You!"); print <<End_of_Thanks; Thanks for visiting my guestbook. If you would like to see the guestbook, click <A HREF="$guest_file">here</A> (actual guestbook HTML file), or <A HREF="$script">here</A> (guestbook script without a query). End_of_Thanks If the program cannot write to the guestbook file, an error message is generated. Another error is sent if an invalid request method is used to access this CGI program. } else { &return_error (500, "Guestbook File Error", "Cannot write to the guestbook file [$full_path].") } } else { &return_error (500, "Server Error", "Server uses unsupported method"); } exit(0); The MIME_header subroutine simply displays a MIME header, as well as a title and heading for the document. If the third argument is not specified, the heading will be the same as the title. sub MIME_header { local ($mime_type, $title_string, $header) = @_; if (!$header) { $header = $title_string; } print "Content-type: ", $mime_type, "\n\n"; print "<HTML>", "\n"; print "<HEAD><TITLE>", $title_string, "</TITLE></HEAD>", "\n"; print "<BODY>", "\n"; print "<H1>", $header, "</H1>"; print "<HR>"; } The get_date_time subroutine returns the current date and time. sub get_date_time { local ($months, $weekdays, $ampm, $time_string); $months = "January/February/March/April/May/June/July/" . "August/September/October/November/December"; $weekdays = "Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday"; local ($sec, $min, $hour, $day, $nmonth, $year, $wday, $yday, $isdst) = localtime(time); The localtime function returns a nine-element array, which consists of the time, the date, and the present time zone. In previous examples, we were using only the first three elements of this array; in this example, we're assigning all nine. if ($hour > 12) { $hour -= 12; $ampm = "pm"; } else { $ampm = "am"; } if ($hour == 0) { $hour = 12; } $year += 1900; $week = (split("/", $weekdays))[$wday]; $month = (split("/", $months))[$nmonth]; The week and the numerical month returned by the localtime function are zero based. The week variable is set to the alphanumeric weekday name by retrieving the string corresponding to the numerical weekday from the variable weekdays. The same process is repeated to determine the alphanumeric month name. $time_string = sprintf("%s, %s %s, %s - %02d:%02d:%02d %s", $week, $month, $day, $year, $hour, $min, $sec, $ampm); return ($time_string); } Finally, the date returned by the get_date_time subroutine is in the form of: Friday, August 18, 1995 - 02:07:45 pm The last subroutine in the guestbook application is parse_form_data. sub parse_form_data { local (*FORM_DATA) = @_; local ( $request_method, $post_info, @key_value_pairs, $key_value, $key, $value); read (STDIN, $post_info, $ENV{'CONTENT_LENGTH'}); @key_value_pairs = split (/&/, $post_info); foreach $key_value (@key_value_pairs) { ($key, $value) = split (/=/, $key_value); $value =~ tr/+/ /; $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg; if (defined($FORM_DATA{$key})) { $FORM_DATA{$key} = join ("\0", $FORM_DATA{$key}, $value); } else { $FORM_DATA{$key} = $value; } } } As mentioned earlier, this subroutine does not check for GET requests. There is no need to do so, because the loop in the main program does the needed checking. Back to: CGI Programming on the World Wide Web © 2001, O'Reilly & Associates, Inc.
http://oreilly.com/openbook/cgi/ch07_01.html
CC-MAIN-2014-35
refinedweb
2,006
62.38
which mobile phone ur using. and it will help if u close all other application that are running and only open you own application. information about mobile though would also help me give a better... Type: Posts; User: nicenouman; Keyword(s): which mobile phone ur using. and it will help if u close all other application that are running and only open you own application. information about mobile though would also help me give a better... hi guys i have a query, is SSL supported by series40 3rd Edition Phones. if so how can i implement. Tiger79 is absolutely right but how much data are you planning to download. i agree with you. it might not be possible. which phone are you using? Can u please explain what u did as this could be important information for someone using netbeans for first time. like me:) what kind of error are you getting at is it Access Denied Exception. i am using the feature of vibration in Nokia 6680 and E50. if you want to sign the midlet loads of information available for you just search this forum u will find plenty of posts. Can you please tell us which tool you are using to compile and SDK for development? try to catch the Access Denied Expection if u can. i suspect u dont have access to events. try writing some error log in a file in catch block may be application quits so quickly that ur not able to... Have checked the compatability of CLDC and MIDP versions of both the games and mobile phones. file if recoreded successfully will be saved at the location you have provided by looking at the code below it will be saved at"+"audio.amr what ur trying to do is hell of a task. i have been searching through internet about ur problems as i found the topic very interesting, as far as my understanding. u would need to define a protocol... can anybody help me out as i need this information fairly quickly. thanx a lot hartti finally i have some definate answer as i have searched a lot and wasnt able to find solution to these visibly simple issues. hi guys i am using CheckBoxes for selecting few things from user. i amusing nokia E50. probelm is user has to create these choices at runtime. meaning i have provided an interface to the user when he... Craig can you tell me plz which protocol is used for communication with Tetra Connectivity Server? and from where I get its details. Thanks in advance Check file connection API plz. its also allows u to delete files. Process is very simple. can i ask the reason why? i mean some sort of security issue or anything. Search for file connection API. u will find plenty of code examples. here is a sample import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.util.*; import... thanx traud. this was something new and very informative for me. but one thing though if root-authority-certificate was not required then why did they include it and cause all this trouble? any... sony erricson phone will give u toruble if there more threads and traud is right u better search there forum and find solution. and if u do let me know. i have a similar issue and i have banging my... try another folder keeping checking all the folder. there must be some folder which will not give security exception ur only hope is to see if there is a mobile out there which supports arabic language. otherwise i dont think it will work for u.
http://developer.nokia.com/community/discussion/search.php?s=6589315ab4d6d36cb8130154893f420f&searchid=2061371
CC-MAIN-2014-15
refinedweb
609
76.01
You can download the Flash Builder 4 beta from Adobe Labs More information about the Flex 4.0 SDK can be found here The requirements are: - Flash Builder 4 Beta 2 - Coldfusion 8+ - SQL server 2005+ Create a new flex project ‘Login_Webservice_cfc’ We first need to create the application layout. We choose the design view to make our life easier (ctrl+`), then drag and drop a Panel component from the Coponents views. From the Properties View set the Title as ‘Login’ and set width and height as 250,150 respectively. Set the Panel to always be in the center of the screen by selecting the proper checkboxes from the Constrains area and set both values to ’0′. After that, drag and drop a form component inside the panel from the componets view and set width and height to 100%. We next need to add two TextInput components; one for the Username and one for the Password inputs. When you add a form component using the design view, Flash builder adds a FormItem wraper for you. So the code for each of your inputs will be similar to this: Formitem <mx:FormItem <s:TextInput </mx:FormItem> Set the labels and IDs using proper values (for the example I use ‘Username’ and ‘Password’ respectively). At the end you will need a submit button to handle the form submission. Drag and drop a button from the component view below the two text inputs. Use the ‘SubmitBtn’ as an ID value and the ‘Login’ as label value. As you can see, you need to remove the label value from the submit button FormItem. Click on it and just remove it. The Login panel should look like this: and the mxml code like this: Panel component code "/> </mx:FormItem> <mx:FormItem> <s:Button </mx:FormItem> </mx:Form> </s:Panel> If you build your application you will see that everything looks fine except for the password input that needs to display its value as password rather than as normal text. All you need is to add this as an input attribute: displayAsPassword=”true Now we need to connect our application to a Web service. For this example I use a coldfusion component (cfc). This is the code for my coldfusion component (.cfc): Cfc component source <cfcomponent output="false"> <cffunction access="remote" name="Authenticate" output="false" returntype="struct" hint="This Component authenticates User Accounts"> <cfargument name="Username" required="yes" type="string" /> <cfargument name="Password" required="yes" type="string" /> <cfquery name="Login" datasource="#Session.DSN#"> SELECT * FROM tblLogin WHERE Username = '#Arguments.Username#' AND Password = '#Arguments.Password#' </cfquery> <cfset ReturnObj = structNew() /> <cfif Login.recordcount gt 0> <cfset ReturnObj.Success = true /> <cfset ReturnObj. <cfset ReturnObj.ReturnCode = 1 /> <cfset ReturnObj.Username = #Login.AccountName# /> <cfset ReturnObj.Password = #Login.AccountSurname# /> <cfelse> <cfset ReturnObj.Success = false /> <cfset ReturnObj. <cfset ReturnObj.ReturnCode = 2 /> </cfif> <cfreturn ReturnObj> </cffunction> </cfcomponent> Save the file as ‘login.cfc’ on your local web server. You can see that we ask for two required arguments to be passed: Username and Password and then we create a structure and fill in it with some information. If we validate the user we also put the Name and the surname of the user within the structure. Now I will use the Flash Builder to call the web service. The Flash builder makes our life easier with new functionality. From the Data/Services View, select ‘Connect to Data/Service’ and choose Web Service (the last one on the right hand side) and click next. Now add the web service path ‘’, leave the rest of the settings as they are and click finish. Be aware that if the web service is on a remote machine you need to edit the ‘crossdomain.xml’ file for security reasons. Now in the Data/Services View you can see the cfc method and the two required arguments. Username and Password are required arguments and the return type will be Object, because we set the coldfusion function to use ‘struct’ as returntype. We are almost there! Drag the Authenticate function from the Data/Services view and drop it on the Submit button. Flash builder does all the hard work for you: it creates the actionscript classes and adds some pieces of code as well within your mxml file. Flash builder would just have made a submit handler for you and you need to edit it a bit. Your function should look like this: Login handler protected function SubmitBtn_clickHandler(event:MouseEvent):void { AuthenticateResult.token = login.Authenticate(Username.text, Password.text); } I will edit the code a bit so I can have a result function as well as a custom fault handler function. I also create some variables to hold the user’s data if the authentication is successful. The full code will be like this: Full mxml code <.utils.ObjectUtil; import mx.controls.Alert; private var rs:Object; private var Success:Boolean; private var Message:String; private var ReturnCode:int; private var FullName:String; //Failed to connect to the wsdl service private function GeneralFailed_Handler(e:FaultEvent):void { Alert.show(e.fault.faultString, "Error connecting to the service"); } //Login Handler private function SubmitBtn_clickHandler(event:MouseEvent):void { AuthenticateResult.token = login.Authenticate(Username.text, Password.text); } //Result Handler for Account Authentication private function AuthenticateResult_resultHandler(e:ResultEvent):void { //check the result Alert.show(ObjectUtil.toString(e.result),"Login Results") rs = new Object(); rs = e.result; Success = rs['SUCCESS']; Message = rs['MESSAGE']; ReturnCode = rs['RETURNCODE']; if(ReturnCode == 1) { FullName = rs['LOGIN']['NAME'] + " " + rs['LOGIN']['SURNAME']; }else{ Alert.show(Message, "Try Again"); } } ]]> </fx:Script> <fx:Declarations> <login:Login <s:CallResponder </fx:Declarations> " displayAsPassword="true"/> </mx:FormItem> <mx:FormItem> <s:Button </mx:FormItem> </mx:Form> </s:Panel> </s:Application> Now, if you test your application you will see I have put two alert messages, one for a failed login and a general one to display the result of the submission form: I hope you found this interesting and informative! :D Enjoy! Tags: Coldfusion, Flash Builder 4, Web Service Hi, I am trying to get some interactivity and functionality to my site. I have a mysql database and a coldfusion hosting service and I have most of the tools I need to build the funcionality I want to get. But I want to go pro with the security. I need a good and solid login process. I looked at your sample here but couldn’t make it work myself. Is there a way you could help me out? Send me a quote perhaps? All I need is a secure login right now but I’d like to have somebody assisting me in this process. Regards - Very Nice! Thank you! I had a problem with the #Login.AccountName# in the CFC in which I forgot to rename it to my database column name. Once I corrected the change it worked great. It was a pain working with Flex 3, especially with the CFC generator, but this Flash Builder 4 is amazing so far. Still some glitches, but definitely better than Flex 3. - Trackback link:
http://blog.nitorsys.com/flash-builder-4-login/
CC-MAIN-2017-30
refinedweb
1,163
56.05
Python provides numerous built-in functions that are readily available to us at the Python prompt. Some of the functions like input() and print() are widely used for standard input and output operations respectively. Let us see the output section first. Python Output Using print() function We use the print() function to output data to the standard output device (screen). We can also output data to a file, but this will be discussed later. An example of its use is given below. print('This sentence is output to the screen') Output This sentence is output to the screen Another example is given below: a = 5 print('The value of a is', a) Output The value of a is 5 In the second print() statement, we can notice that space was added between the string and the value of variable a. This is by default, but we can change it. The actual syntax of the print() function is: is an example to illustrate this. print(1, 2, 3, 4) print(1, 2, 3, 4, sep='*') print(1, 2, 3, 4, sep='#', end='&') Output 1 2 3 4 1*2*3*4 1#2#3#4& Output formatting Sometimes we would like to format our output to make it look attractive. This can be done by using the str.format() method. This method is visible to any string object. >>> x = 5; y = 10 >>> print('The value of x is {} and y is {}'.format(x,y)) The value of x is 5 and y is 10 Here, the curly braces {} are used as placeholders. We can specify the order in which they are printed by using numbers (tuple index). print('I love {0} and {1}'.format('bread','butter')) print('I love {1} and {0}'.format('bread','butter')) Output I love bread and butter I love butter and bread We can even use keyword arguments to format the string. >>> print('Hello {name}, {greeting}'.format(greeting = 'Goodmorning', name = 'John')) Hello John, Goodmorning We can also screen. It is optional. >>> num = input('Enter a number: ') Enter a number: 10 >>> num '10' Here, we can see that the entered value 10 is a string, not a number. To convert this into a number we can use int() or float() functions. >>> int('10') 10 >>> float('10') 10.0 This same operation can be performed using the eval() function. But eval takes it further. It can evaluate even expressions, provided the input is a string >>> int('2+3') Traceback (most recent call last): File "<string>", line 301, in runcode File "<interactive input>", line 1, in <module> ValueError: invalid literal for int() with base 10: '2+3' >>> eval('2+3') 5 Python Import When our program grows bigger, it is a good idea to break it into different modules. A module is a file containing Python definitions and statements. Python modules have a filename and end with the extension .py. Definitions inside a module can be imported to another module or the interactive interpreter in Python. We use the import keyword to do this. For example, we can import the math module by typing the following line: import math We can use the module in the following ways: import math print(math.pi) Output 3.141592653589793 Now all the definitions inside math module are available in our scope. We can also import some specific attributes and functions only, using the from keyword. For example: >>> from math import pi >>> pi 3.141592653589793 While importing a module, Python looks at several places defined in sys.path. It is a list of directory locations. >>> import sys >>> sys.path ['', 'C:\\Python33\\Lib\\idlelib', 'C:\\Windows\\system32\\python33.zip', 'C:\\Python33\\DLLs', 'C:\\Python33\\lib', 'C:\\Python33', 'C:\\Python33\\lib\\site-packages'] We can also add our own location to this list.
https://cdn.programiz.com/python-programming/input-output-import
CC-MAIN-2020-40
refinedweb
627
65.83
# Tutorial. Deploying Django project to Heroku and storing static content on AWS S3: basic scenario from start to finish Introduction ------------- This tutorial is aimed to help Django beginners who want to run a project on Heroku while storing static files on AWS S3. While being a major help for web developers, both services can be hard for beginners to set up correctly. I’ll admit these topics can be found covered separately elsewhere, but there are also some unaccountable nuances if you are trying to make both work in a single project. Personally I couldn’t find a source which would not only cover Heroku deployment or S3 usage, but would address those nuances as well. Reading the manuals trying to figure out what do you have to do to deploy a project correctly might be an important part of learning, but it can also make you lose focus on what you are currently trying to study or, even worse, discourage you altogether. If this is your story, look no further. I hope instructions below will help you to deploy your project in a single track without having to consult with other resources. The text is broken down into 3 logically distinct chapters: prerequisites for local Django app (a mini-chapter), integrating  AWS S3 into your app for storing static files, and finally deploying to Heroku. You might not want to go through the entire process in one sitting. In the beginning of each chapter an approximate time required to complete chapter’s instructions will be noted so it is possible for the reader to plan ahead. I would advise not to break down a single chapter into multiple sittings, but if it is not possible, at least try to complete all work covered by a single sub-chapter section in a single go. Links to official documentation will be provided in text in case you might need extra details on particular actions. Strings starting with 'YOUR' in all uppercase letters in code, files and commands needs to be replaced in accordance with your settings/paths/accounts. --- I. Local Django app ------------------- *Chapter completion estimate: 5 minutes* **Prerequisites** * A Django app running locally on a dev server which is using some local DB and local filesystem for media/static storage This tutorial is not meant to help you with developing the app. If this is what you need, Django’s official documentation is one of the best and most comprehensive ones out there. It contains a tutorial that is lengthy but will get you comfortable with the framework, and if you follow it you will have a working web-app by the time you finish. My assumptions are that your Django project is finished and can be run locally using the built in Django web server. I hope all sensitive keys, like Django secret-key and such are not hard-coded and are set up in settings.py via importing environmental variables. If this is not the case, chapter II has a section on using environmental variables to store such data so you can use it as a reference. I assume you are using some sort of virtualenv, though strictly speaking it is not a must for this tutorial. Git repo will be used to deploy to Heroku. If you are already using git for version control, this is great, but don’t panic if you’re not, since setting up a local git repo for the task is also covered in an appropriate section below. Before we continue, let’s pause and reflect on why might Heroku not be enough on its own for deployment? Well, while your Heroku app can store long-term data to a DB, Heroku’s dynos are “stateless”. You can’t save say media files the way you did on your local machine. It is also somewhat more convenient to store static files outside your main repo. This is where S3 storage comes in. We’ll use it to store and serve media and static files. --- II. Set up AWS S3 upload/download for media files ------------------------------------------------- *Chapter completion estimate: just under 2 hours* ### Prerequisites #### An AWS account Skip this part if you already have an account. Go to <https://aws.amazon.com/>. Click on the “Create an AWS account” button and follow the wizard. This will be your root account. It will be used to manage your resources via AWS dashboards and consoles. #### An S3 bucket Skip this part if you already have an S3 bucket you want to use for this project. Login into [AWS Management Console](https://console.aws.amazon.com/console/home) and use “find service” bar to locate ‘S3’ service. Once you are in S3 console click the “+ Create bucket” Button. Follow the bucket creation wizard, the only field you have to fill in right now is the bucket name, leave everything else at default settings, we will deal with this later on. --- ### AWS S3 side You can use your root AWS account to upload/download files from your bucket via browser, but we need an “IAM” type user for programmatic access. #### Create a new IAM Group ![](https://habrastorage.org/r/w1560/getpro/habr/upload_files/268/6f1/8fd/2686f18fdb792d9bea7b89c4890ee58e.png)Go to the [IAM dashboard](https://console.aws.amazon.com/iam/), select “groups” from the menu and follow the wizard after clicking the “Create New Group” button. Official documentation on this topic can be found at this [link](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups_create.html). Just pick a name and skip adding policies, we will set it up in just a second. When you have created a group, we need to create a policy as explained below. #### Set up a policy for the group to access the bucket Select “Policies” section in the menu and click the “Create policy” button. We’ll need to set up permissions with this JSON which allows listing, uploading, downloading and deleting (documentation on this part is available [here](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html).): ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::YOUR-BUCKET-NAME" ] }, { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": [ "arn:aws:s3:::YOUR-BUCKET-NAME/*" ] } ] } ``` Now just add a name and a description so you don’t get confused in a week or two. Return to your “groups”, select the group you’ve created at previous step and attach the created policy via the “Attach policy” wizard in “Permissions” tab. ![](https://habrastorage.org/r/w1560/getpro/habr/upload_files/bbb/057/c79/bbb057c798fe584d5894de8a228363f2.png)#### Create an IAM user for programmatic access and add it to said group To create a user follow the “Create User” wizard in “Users” section of the dashboard. Make sure to tick the “Programmatic access” check box! ![](https://habrastorage.org/r/w1560/getpro/habr/upload_files/ba5/aa8/9cc/ba5aa89cc7662d16787d5d31bde5c1f1.png)At “permissions” step select the group created at the previous stage of this tutorial. Other options, such as tags, are optional. --- ### Django / Local Machine Now we are ready to start making changes to your project and testing out programmatic access. #### Install django-storages and boto3 We’ll need to install two packages we will be using to communicate with S3: “`Django-storages`” and “`boto3`”. Heroku will also need to know which packages need to be installed. This can be done with a “`requirements.txt`” file and chapter III covers this topic.  It’s better to actually install the upper mentioned packages at this point instead of just adding them to “`requirements.txt`” for Heroku. That way we can test our S3 IAM account access to the bucket. Chances are you’ll have no issues installing packages to your environment with a tool of your choosing be it `pip` or `pipenv`, but here is a “pip” example just for completeness’ sake: `pip install boto3 django-storages` #### Setup ENV variables for S3 access It’s a bad idea to hardcode stuff like secret keys in your source code. We’ll be using environmental variables to let your Django project know the confidential information required to connect to your S3 bucket. Go to your IAM AWS console, select your user and go to the “Security Credentials” tab. Click on “Create access key” button. When you are creating an access key, a secret access key is generated as well. Later on you can’t look it up; you can only create a new access key. So store it somewhere secure until you don’t need it anymore. Then again, when using a user for this single project there is almost no hassle in creating a new access key if you need it, so don’t worry too much. Below are all environmental variables we’ll need to set up. ``` AWS_ACCESS_KEY_ID='YOUR-IAM-USER-ACCESS-KEY' AWS_SECRET_ACCESS_KEY='YOUR-IAM-USER-SECRET-ACCESS-KEY' AWS_STORAGE_BUCKET_NAME=’YOUR-BUCKET-NAME’ AWS_URL='https://YOUR-BUCKET-NAME.s3.amazonaws.com/' ``` You can also setup Django secret key in a same manner if you haven’t done so already. While the actual names of the variables are not important at the final stages, we will be running a test scenario in the next section, and this is where the naming will matter so it’s easiest to keep them as in the example above. Let’s export the variables. Linux commands example below: ``` export AWS_ACCESS_KEY_ID export AWS_SECRET_ACCESS_KEY export AWS_STORAGE_BUCKET_NAME export AWS_URL ``` Remember that variables are confined to a single bash session! If you run a script with the above lines, the session will be over as soon as the script finishes. So either run the tests described below in the same session, or run your script as `. variable_script.sh` Notice the dot! #### Test access to bucket with a test boto3 script Now it’s time to find out how we are doing so far. Prepare a local test file (referred to as “YOUR-LOCAL-FILE” below, we’ll use it to test uploads) and manually upload some other test file to your bucket via [S3 dashboard](https://s3.console.aws.amazon.com/s3/home) using root account (referred to as “YOUR-MANUALLY-UPLOADED-FILE-NAME”, we’ll use it to test downloads). Here is a small script to test programmatic access. ``` import boto3 # constants BUCKET_NAME = 'YOUR-BUCKET-NAME’ S3_FILE = 'YOUR-MANUALLY-UPLOADED-FILE-NAME' LOCAL_NAME = 'YOUR-LOCAL-NAME-FOR-THIS-FILE' s3 = boto3.resource('s3') # test listing bucket = s3.Bucket(BUCKET_NAME) for f in bucket.objects.all(): print(f.key) # test downloading bucket.download_file(S3_FILE, LOCAL_NAME) # test uploading data = open('YOUR-LOCAL-FILE', 'rb') bucket.put_object(Key='YOUR-FILE-NAME-ON-S3-FOR-THIS-FILE', Body=data) ``` Notice how we didn’t have to explicitly point out the access keys? Boto3 will look for appropriate env variables by itself. Check the output of bucket listing, check if “S3\_FILE” was downloaded with “LOCAL\_NAME” and if the “YOUR-LOCAL-FILE” was uploaded to S3 with “YOUR-FILE-NAME-ON-S3-FOR-THIS-FILE”. If something is not right go back to check if you haven’t missed something. #### Modify settings.py We’ll need to add the storages app to our Django project, and add relevant S3 variables and settings. Add the following lines in the top portion of `setting.py` (import `os` if it isn’t imported yet) after “`BASE_DIR`” and Django secret key declarations. ``` import os # AWS S3 SETTINGS AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY') AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME') AWS_URL = os.environ.get('AWS_URL') AWS_DEFAULT_ACL = None AWS_S3_REGION_NAME = 'us-east-2' AWS_S3_SIGNATURE_VERSION = 's3v4' ``` You can see that there are some additional setting, like “AWS\_DEFAULT\_ACL” and “AWS\_S3\_REGION\_NAME”. The later one is optional but others are necessary. It is out of the scope of this tutorial, but you can look up [Django-storages documentation](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html) on what these are for. We’ll also need to add ‘`storages`’ to `INSTALLED_APPS` list, like in the example below. I only have the default apps besides ‘`storages`’ in this example, your custom apps should be there as well of course. ``` INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'storages', ] ``` To let Django know what are we using for media and static files storage, add this at the bottom section of your `settings.py`: ``` STATIC_URL = AWS_URL + '/static/' STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' MEDIA_URL = AWS_URL + '/media/' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' ``` Now comment out/delete lines with definitions of `STATIC_ROOT` and `STATICFILES_DIRS`. #### Test media upload/download on dev server This is the time to test how our Django settings are doing. Before we run a local test server we will need to run the `collectstatic` command, since our code will refer to a remote static storage location: `python manage.py collectstatic` Now we can run and test our app: `python manage.py runserver 0.0.0.0:8000` Go to your browser and type in the address of the test server in the address bar and test out if it’s working properly. You can use the ‘Network’ tab in the developer’s console of your browser to check if the static files are indeed downloaded from S3 (example with bootstrap stylesheet being downloaded from bootstrap domain is presented on a screenshot below). Just hover over the ‘File’ column on the appropriate static file, its URL should be referring to an S3 server. Don’t forget to check media uploading/downloading as well. ![](https://habrastorage.org/r/w1560/getpro/habr/upload_files/61e/741/e21/61e741e219b957a6ab1ea0f691f22535.png) --- II. Prepare app and deploy to Heroku ------------------------------------ *Chapter completion estimate: 1 hour* ### Prerequisites #### Heroku account If you don’t have a Heroku account yet, sign up at [heroku.com](https://www.heroku.com/). #### Git It’s not surprising if you were already using some sort of version control software when developing your project. We will need git to upload your project to Heroku. If you have been using Git for your project and already have a git repo, you can skip to the next step; just make sure you are going to include all further changes in ‘master’ branch since we will push it to Heroku. Install git if it’s not already installed on your system. This step is somewhat system dependent, but it is easy to figure out so we’ll leave it to you. Switch to your project’s directory (the one that contains manage Django’s ‘`manage.py`’) in the command shell of your choosing (use “git bash” shell if you are running Windows) and create a git repo with ‘`git init`’ command. Your project directory might contain a lot of files that are not part of the project per se, local database, static files such as images, etc. Excluding files from your repo is done via ‘`.gitignore`’ file stored in the same directory where you had run ‘`git init`’. Open it in a text editor and add what you need to exclude. There are a ton of great discussions on the web focused around best practices for ‘`.gitignore`’ when working on Django projects. In case you need a quick solution, here is what my test project’s ‘`.gitignore`’ looks like: ``` *.sqlite3 *.pyc __pycache__ *.jpg *.jpeg *.png db.sqlite3 ``` Now we need to make a commit on master branch. Type the following commands in your command shell: `git add -A` `git commit -m “YOUR SHORT DESCRIPTION FOR COMMIT HERE”` You can check on your commit with a `git status` --- ### Local machine #### Install heroku-cli utility and log in We’ll need to install heorku command line tool. This step is system dependent but pretty straightforward. I encourage you to visit [heroku’s article](https://devcenter.heroku.com/articles/heroku-cli#download-and-install) for installation instructions. After you have finished installing heroku-cli utility you will need to login: `heroku login` This will open a browser window for you to enter your credentials. #### Modify setting for Heroku We need to modify ‘`setting.py`’ to prepare the project to run on Heroku. We’ll go for the easiest route in this tutorial and use ‘`Django-Heroku`’ python package. `pip install Django-heroku` Change your local development database settings in `settings.py` to the following: ``` ALLOWED_HOSTS = ['.herokuapp.com'] # heroku database settings import dj_database_url DATABASES = {} DATABASES['default'] = dj_database_url.config(conn_max_age=600, ssl_require=True) ``` We will also need to add this at the very bottom: ``` import django_heroku django_heroku.settigns(locals(), staticfiles=False) ``` This last line contains a crucial setting for this tutorial. You can find separate tutorials on how to set up Django projects to serve static files via AWS S3, as well as on how to set it up for Heroku, but you will be left wondering why S3 settings work on your local machine and… stop working as soon as you push it to Heroku. Well, this is why. The `django_heroku.settigns()` call will override all other settings and set them to what Heroku needs. The bad news is that it overrides settings including our AWS S3 static url settings! This is why we need to pass a keyword argument ‘`staticfiles=False`’ which will disable automatic configuration of static files. #### Produce a ‘requirements.txt’ file In this step we will create a file to let Heroku know which Python packages need to be installed for your project to run. Heroku understands both pip’s classic ‘`requrements.txt`’ and pipenv’s ‘`pipfile`’. Both can be edited manually but in this tutorial we will try to strand away from manual editing where it is possible to minimize possible errors. It is not recommended to use Django development server as a production web-server. Running Django-projects via Gunicorn server is a popular solution to this problem. Now let’s install Gunicorn to your env so we can automatically get it in ‘`requrements.txt`’ later on: `pip install gunicorn` And now for ‘requirements.txt’ run this in your project directory (next to manage.py): `pip freeze > requirements.txt` The final content of ‘`requirements.txt`’ of course depends on what other packages you are using in your project. #### Produce a ‘Procfile’ Heroku needs to know how you want it to run your application. A ‘`Procfile`’ is used for this. In your project’s directory create a file with a ‘`Profile`’ filename and add the following content: ``` release: python manage.py migrate web: gunicorn YOUR-PROJECT-NAME.wsgi ``` This will let Heroku know that it needs to run two commands: apply migrations and run your project via gunicorn. As a side note, currently Heroku uses Python 3.6.12 by default. If you need a different version you can specify it by creating a ‘`runtime.txt`’ in your project’s directory right next to the ‘`Procfile`’. An example of ‘`runtime.txt`’ for Python 3.9.0 looks like this: ``` python-3.9.0 ``` #### Make final commit and deploy to Heroku Now that we have all we need, it’s time to make one final commit to master branch and push it to Heroku. If you already used git for version control before starting out with this tutorial just make sure ‘master’ branch includes all latest changes (as well as ‘`requirements.txt`’ and ‘`Procfile`’ files). In case you initialized git for the first time during this tutorial, you just need to make a commit. In your project’s directory run: `git add -a` `git commit -m “Heroku staging”` We are ready to deploy to Heroku. First create a Heroku app: `heroku create` This command should output the name of your app as well. Let’s tie a git remote with the correct url: `heroku git:remote –a YOUR-HEROKU-APP-NAME-FROM-PREVIOUS-STEP` And now we are ready to push our repo: `git push heroku master` We still need to set environmental variables that your project uses for Heroku before we run the app. Continue to the next section. --- ### Heroku's side #### Set up environmental variables Now is the time we need the security information we used in “Setup ENV variables for S3 access” section of this tutorial. If you lost something just look it up in S3 consoles. In particular go to your IAM AWS console, select your IAM user and go to the “Security Credentials” tab for secret keys. You can’t look up the AWS\_SECRET\_ACCESS\_KEY for your access key, but you can create a new access key and make sure you know the secret key this time. Setting up environmental variables for Heroku can be done from your [Heroku dashboard](https://dashboard.heroku.com/) in your internet browser or heroku-cli utility. Here is a set of commands to do it via cli utility: `heroku config:set AWS_ACCESS_KEY_ID='YOUR-IAM-USER-ACCESS-KEY'` `heroku config:set AWS_SECRET_ACCESS_KEY='YOUR-IAM-USER-SECRET-ACCESS-KEY'` `heroku config:set AWS_STORAGE_BUCKET_NAME=’YOUR-BUCKET-NAME’` `heroku config:set AWS_URL='https://YOUR-BUCKET-NAME##.s3.amazonaws.com/'` You can check up on your config by typing this command: `heroku config` Launch the app -------------- The final step. This can be done via [Heroku dashboard](https://dashboard.heroku.com/) or heroku-cli utility: `heroku ps:scale web=1` And finally you can visit the url of your app (you can always look it up in dashboard) or use the following cli shortcut: `heroku open` This is it! Now you can test your app out and make sure downloading/uploading static files from S3 works as intended. ---
https://habr.com/ru/post/535054/
null
null
3,577
55.13
Prev MFC VC STL Code Index Headers Your browser does not support iframes. Re: std::vector : begin, end and insert - Using Objects instead of ints From: "Doug Harrison [MVP]" <dsh@mvps.org> Newsgroups: microsoft.public.vc.mfc Date: Sat, 19 May 2007 13:14:50 -0500 Message-ID: <u5bu43dep04mnh4mv3ugma7gv6cltgl7t9@4ax.com> On Fri, 18 May 2007 16:52:24 +0100, Gerry Quinn <gerryq@indigo.ie> wrote: In article <hevj43555ho2a29390i1hdah5dmugti9ka@4ax.com>, dsh@mvps.org says... Some things to note: 1. When there's a choice, prefer preincrement to postincrement, because pre doesn't require creation of a temporary object to return the original value. That is, use ++it instead of it++. (I know, K&R taught the opposite, but this is C++, which itself would have been better named ++C. <g>) My view is that readability trumps efficiency in most cases, The thing is, efficiency can be measured objectively, while "readability" is highly subjective. I'm not interested in arguing which is more "readable", ++i or i++. However, besides being more efficient for most class types, ++i is definitely easier to think about than i++, because the former simply increments i, while the latter creates a temporary copy of i, increments i, and returns the temporary, which is ultimately discarded without being used in the case we're discussing. While it makes most of the same points, you might want to read what the C++ FAQ says about this: The bottom line is that in C++, it's conventional to use pre when there's a choice, and there are decent reasons for this. particularly where the efficiency gain is likely to be very small or nonexistent. I find postincrement more readable, and use it everywhere except for special cases. Postincrement certainly seems more idiomatic in for loops, because if you are incrementing in the body of the loop you will need to use it: for ( int i = 0; i < vec.size(); ) { CPoint & pt = vec[ i++ ]; } FWIW, many people would say that embedding expressions with side-effects inside other expressions is not very "readable". Again, this is a departure from K&R thinking, and I don't necessarily agree with it, at least not in all cases, because there are times when it would actually be incorrect to split the operation into two statements, e.g. when erasing a list iterator. In any event, I think you're really reaching to motivate something you probably learned very early on. I wonder, what do you do for reverse iteration? Do you really sit down and think about how you might write a certain kind of loop that omits stmt3 in a for-loop header when you decide how to write stmt3 for the vast majority of loops, when the former is driven by correctness considerations and the latter is not? (BTW, vector::size returns vector::size_type, which is an unsigned type. Consequently, you really shouldn't use int for your index type.) I presume VC7 optimises vector::iterator down to a real pointer, though? I dunno. Compile with /FAs and look at the assembly code. 4. The vector::at function is not really an "alternative" to operator[], because the former checks its argument and throws an exception if it's out of bounds. The latter doesn't perform any error-checking, and thus there are major differences in performance and behavior between the two. Then it's *exactly* an alternative! If it were the same it would effectively be an alias. The problem is, lots of people will read an unqualified "alternative" claim as an "equivalence" claim. I think that's perfectly understandable considering how you presented it: CPoint & pt = vec[ i ]; // or alternatively CPoint & samething = vec.at( i ); For the reasons I gave, I cannot imagine non-trivial usage of either which would allow the substitution of one for the other without the surrounding code suffering ripple effects from the change. 6. If you're really nuts about efficiency, don't use vec.end() (or vec.size()) in your loop condition. Instead save its value to a (const) variable and use it instead. I'd rather hope that the optimiser would take care of that, so long as the size of the vector is not altered inside the loop. Here's a little program fragment for you to try: #define _SECURE_SCL 0 #define _HAS_ITERATOR_DEBUGGING 0 #include <vector> typedef std::vector<int> VecT; void g(int); void f1(VecT& v) { for (VecT::size_type i = 0; i < v.size(); ++i) g(v[i]); } void f2(VecT& v) { for (VecT::iterator i = v.begin(); i != v.end(); ++i) g(*i); } Compiled with: cl -c -FAs -O2 -EHsc -W4 a.cpp VC2005 optimizes the end() call but not size(), and the dereferencing of the iterator is more efficient as well. If it *is* altered, or more specifically if it is enlarged past its initial capacity, the advantages of operator[] will become clear. Sure, that's an advantage of using indexes. If you use iterators, you have to convert them to indexes and recompute them once they're invalidated. That's a good reason not to store vector iterators in another data structure. (But note that indexes can become invalidated under some conditions as well, such as inserting before their position.) However, we were talking about loops that iterate over the whole container, and IME, at least, this issue doesn't come up very often in this context. It's not the sort of thing that's going to cause me to treat std::vector differently from all other containers by default. (I could say that treating the containers uniformly makes it easier to substitute one for the other, and while that's true to a very small extent, it's not a persuasive argument, because it's so rarely applicable.) Though if you are doing tricks like that, vector::at may be a good idea... I don't think so. The only use for vector::at is when the provenance of the index argument is unknown (e.g. user input), and one is too lazy to do his own range-checking and/or wants the exception behavior of vector::at. That is, if I'm writing a loop that moves things around such that index variables have to be updated, I'm not going to use "at" in the misplaced hope that it will catch mistakes I made in the updating. That would be conflating exception handling with bug detection, which is a huge mistake. What is useful is a more generalized range-checking feature, which handles operator[] and iterators as well, which does not use C++ exceptions to report errors, that can be enabled for debugging purposes, such as was introduced in VC2005. -- Doug Harrison Visual C++ MVP Generated by PreciseInfo ™ "From)
http://preciseinfo.org/Convert/Articles_MFC/STL_Code/MFC-VC-STL-Code-070519211450.html
CC-MAIN-2021-49
refinedweb
1,129
61.97
Hi, I'm new at programming and I made this little program to test myself... but it didn't work! The problem seems to be at the end with the if/else statement. It always says "You're right!". Thanks in advance! Code:#include <iostream> using namespace std; int main() { int a, b, c; struct gamelibrary { int gamecube; int playstation; int xbox; }; gamelibrary john; cout<< "How many gamecube games does John have?\n"; cin>> john.gamecube; cout<< "How many playstation games does John have?\n"; cin>> john.playstation; cout<< "How many xbox games does John have?\n"; cin>> john.xbox; cout<< "So John has "<< john.gamecube <<" gamecube games, right?\n"; cout<< "1. Yes\n2. No\n"; cin>> a; cin.get(); if (a = 1){ cout<< "You're right!"; } else { cout<< "You're wrong!"; } cin.get(); }
https://cboard.cprogramming.com/cplusplus-programming/74687-if-else-statement-not-working.html
CC-MAIN-2017-13
refinedweb
134
98.41
JDeveloper provides a set of modeling tools which allow you to visually create tables on a diagram. You can create new tables directly on a database diagram, or import existing tables from a database schema, or work with offline tables in the navigator and then drag them on a diagram to work with them further. Once you have finished modeling the tables, you can generate the changes directly to the database, or create a DDL file to be run later. You can create and edit database components directly on a database diagram. This is called in-place editing. For instance, you can create or edit columns, or edit keys and constraints on a modeled table, or draw foreign key relationships between tables directly on the diagram. You can import tables from a live database connection by dragging them directly onto a diagram and reconcile your changes with the database and create the DDL to generate the changes back to the database. This lesson will discuss the following: Step 2 - Create a Database Diagram Time to complete 1 hour Move your mouse over this icon to show all screenshots. You can also move your mouse over each individual icon to see only the screenshot associated with it. The tutorial guides you through the process of importing two tables from the Human Resources schema on the database. This will give you two offline table definitions which you can edit and manipulate on a diagram. You will also create an offline table directly onto the diagram. Once you have finished working with the offline tables, you will create the DDL to create the new tables in the new schema. Back to Topic List In order for this lesson to work successfully, you will need to have performed the following: Install Oracle JDeveloper10g. Install the sample schema and create a connection to the HR or HR8 schema to use in this lesson. See Installing the Sample Schemas and Establishing a Database Connection tutorial., and customize it to make JDeveloper's database functionality available. In the Applications Navigator, right-click Applications and choose New from the context menu. In the Create Application Workspace dialog, rename the application Application1 to DBModeling. Notice that the directory name changes to match the new name. Before selecting the application template, you are going to customize it. Click Manage Templates to open the Manage Application Templates dialog. Under the Web Application [Default] node, select Data Model. Locate Database in the available technologies list and move it to the selected technologies list, then click OK. Make sure that the application template is Web Application [Default], and click OK. The DBModeling workspace is created and displayed as a node in the navigator. Save your work by clicking on the Save All button. You should save your work at regular intervals as you work through the rest of this tutorial. In this step you will create a database diagram. With the Model project selected in the Application Navigator, right-click and choose New from the context menu. This opens the New Gallery. In the Categories list, select Offline Database Objects in the Categories list, then select Database Diagram from the Items list. Click OK to open the Create Database Diagram dialog. Accept the defaults and click OK. A new database diagram opens. You should see the Component Palette, which shows the elements available for you to use on this diagram. If you can't see it, open it by choosing Component Palette from the View menu. Now that you have a blank database diagram, you can directly import tables from the database connection by dragging them onto the diagram. Importing the tables creates the offline table definitions which you will work with before creating the DDL to create new tables in a database. To import tables from the connection you have to the database, click the Connections tab so that the Connections Navigator is visible, or choose View | Connection Navigator. Expand the Database, and HR nodes to see all the database elements available through this connection. Filter the list to make it easier to work with. Select the HR node, then click Filter. In the Filter Object Types dialog, move all the object types except Tables from the list of displayed object types to the list of available object types. Click OK. Expand the Tables node and select DEPARTMENTS, hold down the Ctrl key and select EMPLOYEES. Drag DEPARTMENTS and EMPLOYEES onto the diagram. In the Create from Tables dialog, ensure that Offline Tables is selected and click OK. JDeveloper connects to the database and creates offline table definitions based on the tables you have selected. There may be a short delay while this occurs. The offline tables and foreign keys are created and displayed on the diagram. You can see a thumbnail view of the diagram by clicking the Thumbnail tab in the Structure pane. The default position of this pane is at the lower left corner of JDeveloper. If you can't find it, choose View | Thumbnail. The offline tables also appear in the Application Navigator, in the Model project under the Database Objects node. Notice that they are grouped in an offline schema called model. The offline schema is a container for offline database objects. JDeveloper's modeling tools allow you to edit offline tables directly on the diagram, called in-place editing. You can change the name of a table, create new columns, edit existing columns, and edit constraints on the table. In the second compartment of the diagrammed table, click in the LAST_NAME column to select it, then click again so you can edit the line, and change the field size to 30. The changes are made when you press Enter or move the focus off the table. If you double click you will bring up the Edit Offline Table dialog. If this happens, cancel it and click on the table again, pause, and click again to edit the line. In the third compartment, select the check constraint that says <<Check>> EMP_SALARY_MIN:salary > 0 and change it to EMP_SALARY_MIN:salary > 10. Now try comparing in line editing with editing using the Edit Offline Tables dialog. Open the Edit Offline Tables dialog by doing one of the following: Right clicking the table you want to edit in the diagram and choose Properties from the context menu. Right clicking the table you want to edit in the Application Navigator and choose Properties from the context menu. Use the in line editing from the diagram Clicking on the component you wish to edit from modeled table on the diagram. In addition to importing existing tables from a database, you can create new tables directly on the diagram. In the component palette, click on Table, then click on the diagram. A new offline table is created on the diagram, and it appears in the Application Navigator in the model schema. Resize it so that it is easier to work with. Change the default name of the table to REGIONS. In the second compartment of the modeled table, create two columns by typing REGION_ID : CHAR(2) on one line, then REGION_NAME : VARCHAR2(40) on the next. In the third compartment, you can see that a primary key has been automatically created from the first column you created. We'll use this to link it to the Departments table. Make sure you can see both the Departments and Regions tables in the modeler. Use the Thumbnail pane and move the shape that shows the visible area to include both tables, or you can use click the Zoom Out button at the bottom right of the diagram pane. In the Component Palette, click on Mandatory Foreign Key, then click on the Regions table, then the Departments table. Whenever you create a foreign key in JDeveloper, you draw it from the table with the primary key to the table with the foreign key. In other words, create the foreign key beginning from the "master" and ending at the "detail" side of the relationship. Click OK. The foreign key relationship is displayed on the diagram, and the table with the foreign key, Departments, now has an extra column named REGIONS_REGION_ID : CHAR(2). In the previous steps, you have seen how to import tables from a database connection, as well as how to create new tables on a database diagram. In this step you will create a SQL file containing the DDL which you could use to create the tables in a database. JDeveloper also allows you to generate directly to a database, or to reconcile your changes against a database. To generate a SQL script: On the diagram, hold down the Ctrl key and select all three tables. You'll find that that this works best if you click on an area within the table shape, but not on a line of text. Right click and choose Generate | Data Definition Language from the context menu. This invokes the Generate SQL from Offline Database Objects wizard. Alternatively, you could select the tables in the Application Navigator and choose Generate or Reconcile Objects from the context If the first page of the wizard is displayed, review the information and click Next. On the Select Objects page, check that the Departments, Employees and Regions tables are in the list of selected objects and click Next. On the Generate Options page, ensure that just the following are selected: CREATE (or replace) the chosen objects Generate SQL scripts for the operation These will ensure that a script is created, and that it contains CREATE statements, rather than UPDATE statements. On the SQL Script Options page, change the SQL file name from untitled.sql to dbmodeling.sql. Select Generate SQL*Plus extensions. Click Next, then Finish. The file is dbmodeling.sql created in the default folder <jdev_home>/jdev/mywork/<workspace>/<project>/database, which in this case is <jdev_home>/jdev/mywork/DBModeler/Model/database. The SQL script is listed in the Application Navigator in the Model project under the Resources node. Double-click on dbmodeling.sql to open it in JDeveloper's SQL editor and view the CREATE and ALTER statements. This part of the tutorial shows you how you can customize database diagrams to suit your way of working. Try one or more of the following tasks. To change the way the diagram is viewed: Zoom in and out using the buttons at the bottom right corner of the diagram. You can see a lot of detail, or reduce the amount of detail shown. Right click on the diagram and choose View as | Compact to see the difference. Remember to change back to View as | Standard before proceeding to the next step of the tutorial. To resize and move diagram elements: Move one of the tables and the foreign keys move as well. If you end up with unnecessary points on the foreign keys, right click on a line and choose Straighten Lines from the context menu. Alternatively you can let JDeveloper automatically lay out the tables by choosing Lay Out Shapes from the context menu, followed by one of the available options. To change the colors of the diagram elements: Change the default colors that are used in the creation of new diagram elements, by choosing Preferences form the Tools menu. Select the Diagrams node, then Diagram, then Database. Continue selecting the nodes under database to change the color, font and shape of foreign keys and tables. Change the colors of individual existing diagram elements by right clicking a table or other element and choosing Display Properties from the context menu of the table or other element to open the Display Properties dialog. You can also change the font, the color of lines, fills and fonts, and the elements that are displayed. Summary Back to Topic List In this tutorial you've learned how to: Edit tables on the diagram using in-place editing. Related topics Installing the Sample Schemas and Establishing a Database Connection Move your mouse over this icon to hide all screenshots
http://www.oracle.com/technology/obe/obe9051jdev/dataModeling/lesson_dm.htm
crawl-002
refinedweb
2,003
62.68
Pike Series Release Notes¶ 7.4.17¶ 7.4.16¶ Upgrade Notes¶ Rotated logs of containerized services in /var/log/containers will be purged with the next containerized logrotate run triggered via cron, if the rotated logs have been kept longer than purge_after_days (defaults to a 14 days). The logrotate maxage parameter is set to purge_after_days as well. The size parameter does not honor time-based constraints and is disabled as not GDPR compliant. From now on, it configures maxsize instead. Minsize is set to a 1 byte to put all /var/log/containers logs under the containerized logrotate control. New param rotation additionally allows to alter logrotate rotation interval, like ‘hourly’ or ‘weekly’. Security Issues¶ Retention rules of files in /var/log/containers additionally defined in the containerized logrotate postrotate script and based on any of the listed criteria met: time of last access of contents (atime) exceeds purge_after_days, time of last modification of contents (mtime) exceeds purge_after_days, time of last modification of the inode (metadata, ctime) exceeds purge_after_days. Expired files will be purged forcibly with each containerized logrotate run triggered via cron. Note that the files creation time (the Birth attribute) is not taken into account as it cannot be accessed normally by system operators (depends on FS type). Retention policies based on the creation time must be managed elsewhere. Bug Fixes¶ Fixed how deprecated parameters for Cinder’s Netapp backend are handled so that empty strings are not misinterpreted. Fixes bug 1782376. 7.4.15¶ New Features¶ Added new parameter to tripleo::haproxy: activate_httplog This allows to activate the HTTP full logs in HAProxy. Bug Fixes¶ Fix deployment issue where neutron-server would crash on start on split-stack deployments when neutron-lbaas is enabled. Fixes bug 1733801 so we can activate haproxy logs. With the change in we need to make sure that the new port range get applied to the the qemu.conf file. 7.4.10¶ 7.4.9¶. 7.4.5¶ New Features¶ keystone notification topics are now configured via the keystone_notification_topics hiera key. Which aggregates all the keys that match this. It’s useful for dynamically configuring the topics and not always sending them. 7.4.3¶ 7.4.2¶ New Features¶ This new parameter allows to set/override HAProxy global options in a convenient way.. 7.4.1¶ 7.4.0¶ 7.3.0¶ New Features¶ When TLS everywhere is enabled, the HAProxy stats interface will also use TLS. This requires the user to access the interface through the ctlplane FQDN (which is configured by the CloudNameCtlplane parameter in tripleo-heat-templates). Note that one can still use the haproxy_stats_certificate parameter from the haproxy class, and that one will take precedence if set. Encryption is used for pacemaker traffic by default. This is achieved by using a pre shared key for all the pacemaker cluster nodes (same as the one that was used for the pacemaker remote communication). Enable innodb_buffer_pool_size configuration for all MySQL databases. Add support to configure Dell EMC VMAX Manila backend 7.2.0¶ New Features¶ The resource ::tripleo::certmonger::ca::crl was added. The purpose of this resource is to fetch a CRL file and set up a cron job to refresh that file. Added new parameter mysql_maxconn to the tripleo::haproxy class, allowing haproxy maxconn to be configured for the MySQL server. Added variables for endpoint_proxy_ironic_inspector, endpoint_config_ironic_inspector, and Apache mod_proxy configuration to proxy ironic-inspector service just like similar services This release allows to enable Contrail DPDK on the compute nodes. Enable innodb_flush_log_at_trx_commit configuration for Galera only. Added new parameter san_private_key to configure SSH Private Key for the PS Series cinder backend Added a new profile for the setup of the Swift dispersion tool. This will be executed in step 5 or later to ensure Swift and Keystone are already up and running. New profile for Veritas HyperScale Cinder backend. Support configurable backends Zaqar backends. Updates the Zaqar profile so that we have support for configuring alternate versions of the messaging and management backends. Known Issues¶ Ignore failures if nf_conntrack_proto_sctp module failed to load. Since RHEL 7.4, nf_conntrack_proto_sctp module is compiled into the kernel instead of as a module as the sctp support. TripleO will still try to load the module to support RHEL 7.3, but in the future will remove the module management and rely on the kernel provided in newer versions of RHEL. Upgrade Notes¶ Setting the innodb_flush_log_at_trx_commit flag to the value of “2” instead of its default value of “1” means that the underlying MySQL/MariaDB engine will no longer flush transactions to disk on a per-transaction basis; instead, flushes occur once per second. This leads to far fewer disk writes and can dramatically improve write performance, at the cost of durability (e.g. will lose the last second’s worth of transactions) if the database engine is ungracefully shut down. The clustered nature of Galera mitigates this risk in that transactions are replicated to other nodes before completion, and the setting of “2” is considered to be generally safe for a Galera cluster, with the exception case of simultaneous power loss for all nodes. Deprecation Notes¶ Deprecates and removes workaround OpenDaylight clustering function and class. Clustering config is now handled by puppet-opendaylight. Removes deprecated opendaylight parameter ‘ha_node_index’ which is no longer needed to configure clustering. Security Issues¶ If the crl_file parameter is given to the ::tripleo::haproxy resource and TLS is enabled in the internal network, it will configure the CRL file for all the nodes it’s proxying and thus properly handle revocation of the server certificates. Bug Fixes¶ Allow VF configuration files to be written for non-existent PCI devices to allow updates while physical functions are currently in use by a guest. Traffic between Contrail nodes used the public network. This release will move the traffic to the internal_api network per default and also allows to optionally use the storage_mgmt network. This is in preparation for for composable networks, where Contrail will have its own network. The mysql pacemaker profile now makes sure that the rsync package is installed since it configures wsrep_sst_method for galera to use rsync. See In order to avoid service restarts, all services deploy their httpd configuration at the same time. Thus, httpd now starts in step 3 for the bootstrap nodes, and step 4 for all other nodes. Fixes the step conditions in the Swift ring building process and also chains the tarball creation to the rebalance. Adds an option to disable the recon check before uploading modified rings. These fixes are required to properly manage rings when used in containerized environments. 7.1.0¶ New Features¶ Adds composable service interface for Neutron LBaaSv2 service. Add support for Mistral event engine. Restrict nova migration ssh tunnel * The ssh authorized_keys file is only writeable by root. * Creates a new user for migration instead of using root/nova. * Disables SSH forwarding for this user. * Restricts the networks that this user can connect from. * Uses an ssh wrapper command to whitelist the commands that this user can run over ssh. Adds new parameter “tripleo::profile::base::nova::migration_ssh_localaddrs” to specify which incoming IPs are allow for SSH tunnel connections. Added support for external swift proxy. Users may need to configure endpoints pointing to swift proxy service already available. Enable internal network TLS for etcd Move Mistral API to use mod_wsgi under Apache. Support HA for OVN db servers and ovn-northd using Pacemaker Support for Redfish hardware is enabled by default for overcloud Ironic via the redfishhardware type. Run the Zaqar WSGI service over httpd. Deprecation Notes¶ The redis_file_limit hiera parameter is now deprecated. Use the redis::ulimit parameter instead. Bug Fixes¶ With having package mod_ssl by default installed in images we introduced issue with mod_ssl package update. In case of SSL not being used or provided by HAproxy the puppet-apache module by default purges the ssl.conf file. The package update then recreates the file with default Listen 443 option. This causes conflict on 443 port during httpd restart. If we include ::apache::mod::ssl the ssl.conf file will be configured and the Listen option will be used only if there is vhost set to use SSL. For Heat API, increase the HAproxy timeout from 2 minutes to 10 minutes so we give a chance to Heat to use the rpc_response_timeout value which is set to 600 by default in TripleO. Since collector is deprecated, move the ceilo upgrade in step5 out of collector profile and into cielometer base. This way ceilo upgrade can run even when collector is disabled which is the default in pike. Moves bigswitch neutron agent configuration to a new tripleo profile tripleo::profile::base::neutron::agents::bigswitch 7.0.0¶ New Features¶ Add support for Bagpipe Neutron driver as backend in BGPVPN scenarios Add ML2 plugin configuration for Bagpipe BGPVPN extension Add support for BGPVPN Neutron service plugin Add support for ceilometer polling agent. The central, compute and ipmi agent services should use polling agent with namespace. This has been done in packaging already since few releases now. Let puppet do it correctly as well. Add keystone::ldap_backend call as resource when is trigged to setup a LDAP backend as keystone domain. This allows per-domain LDAP backends for keystone. Adds OpenDaylight HA support. Now when ODL is applied to three or more nodes ODL will be deployed as a cluster in HA, rather than the previous behavior of only running on the first node. Added Pure Storage FlashArray iSCSI and FC backend support for cinder Unless a non-default value is provided, the dhcp_agents_per_network neutron configuration variable is set to the number of deployed neutron dhcp agents. Configure ssh tunneling for nova cold-migration. Re-use the tunnel for libvirt live-migration unless TLS is enabled. Heat APIs (api, cfn and cloudwatch) are now deployed over httpd. Added a new profile to configure the docker service The undercloud UI is available in multiple languages, which can now be configured via the manifest. All available languages are enabled by default. Enabled httpdchk in HAProxy for http based services to reduce situtations where the port may be open but the service is not actively serving http requests. Add support for l2 gateway Neutron agent support. Add support for l2 gateway Neutron service plugin. Include the amqp messaging class when the oslo.messaging rpc protocol is enabled for AMQP 1.0. Sahara is now deployed with keystone_authtoken parameters and move forward with Keystone v3 version. Allows granular level of control over the /etc/securetty file. By allowing operators to specify the values in securetty, they can improve security by limiting root console access. Add profiles for VPP service. Vector Packet Processing (VPP) is a high performance packet processing stack that runs in user space in Linux. VPP is used as an alternative to kernel networking stack for accelerated network data path. Adds support for networking-vpp ML2 mechanism driver and agent. Upgrade Notes¶ Out-of-box support for Ironic *_sshdrivers was removed. These drivers were deprecated in the Newton release. Bug Fixes¶ Octavia is now properly registered with keystone when deployed. Add a tunnel timeout to the HAProxy tripleo-ui configuration to ensure Zaqar WebSocket tunnels persist longer than two minutes Bugfix 1664561. Removing the string cast when using the os_transport_url function. The rabbitmq user check is moved to step >= 2 from step >= 1. There is no guarantee that rabbitmq is running at step 1, especially if updating a failed stack that never made it past step 1 to begin with. Re-run gnocchi and ceilometer upgrade in step5. This is required for gnocchi resource types to be created in ceilometer and gnocchi to function properly. Add a way for mongodb to limit amount of memory it comsumes with systemd. A new param memory_limit has been added to tripleo::profile::base::database::mongodb class with default limit of 20G.
https://docs.openstack.org/releasenotes/puppet-tripleo/pike.html
CC-MAIN-2019-43
refinedweb
1,982
55.95
Microsoft Office A Guide to Customizing the Office 2007 Ribbon Stephanie Krieger At a Glance: - Architecture of an Office Open XML file - Steps to creating a custom Ribbon tab - Adding VBA macros to the Ribbon Contents What's involved in creating a customized Ribbon? What tools do you need to get started? Create a custom Ribbon tab Adding the customUI File to the ZIP Package Adding VBA Macros to the Ribbon Getting Creative Sharing your customizations Whether you manage a 2007 Microsoft Office system environment, you're a Microsoft Office power user who likes to customize the environment, or you write Visual Basic for Applications (VBA) macros, you'll want to see just how easy it can be to customize the Ribbon for 2007 Office system documents, templates, and add-ins. And all you need is Windows Notepad. In this article, I'm going to show you how. In order to jump right into creating a custom UI, I am making certain assumptions about your familiarity with the Office Open XML Formats and with VBA. You probably already know that an Office Open XML document is a ZIP package comprised of XML files (known as document parts), other files (such as any media files included in the document), and a handful of folders to organize all these elements. And you've probably seen Office Open XML markup or something similar (even if you've never actually written it). So, you already know that Office Open XML is written in fairly plain language—that is, you don't have to be a developer to get it. Note that I will also discuss VBA in this article because you will probably want to add your own macros (and not just built-in commands) to your custom Ribbon. If you are not yet familiar with Office Open XML documents, take a look at the structure before you begin customizing the Ribbon: - Create a simple Office Word 2007 document, save the file and close it. - Change the file extension for your new document to .zip. - Open that ZIP package and take a look around. When you first open the package, it should look pretty much like Figure 1. - Open the _rels folder and you'll see a file named .rels. This defines the relationships between the top-level document components that you see here. I'll be editing the .rels file later in this article. - Now open the word folder; you'll see that it contains such items as document.xml (that's the main document body), styles.xml, and other parts that are probably familiar. Figure 1 The Structure of an Office Open XML Document You might also see some additional files and folder names depending on the content in your file. For example, you'll see a media folder if your document contains pictures, sound files, or other media. What's involved in creating a customized Ribbon? You can make this much more complicated than what I'm about to discuss. But I'm a big fan of using the simplest solution for any task. To add customization to the Ribbon in a 2007 Office system Word, Excel, or PowerPoint file, all you need to do is the following: - Create a file named customUI.xml and add the markup to that file for your customization. - Create a file folder named customUI, place your customUI.xml file there, and then drop the folder into the top-level of your document's ZIP package. - Open the file named .rels and add one line of markup to it to tell the document about your customized Ribbon. - Open the document and bask in the beauty of your creation. That's all there is to it and I'll show you how to do all of it by the end of this article. What tools do you need to get started? You can write your customUI.xml file using Windows Notepad. There are also two downloads you should grab from the Microsoft Web site for reference: The first is the "2007 Office System Document: Lists of Control IDs", which contains the Ribbon control ID workbooks for all built-in commands in the Ribbon-enabled 2007 Office system programs. The second download is the "2007 Office System Add-In: Icons Gallery", which is a macro-driven workbook that contains the IDs for all of the Office 2007 built-in Ribbon icons. After you've edited the contents of the package, you need to change the file extension back from .zip to its original extension. But you don't have to keep changing the extension to .zip each time you want to edit the underlying package. Instead, you can use a utility that will recognize your Office Open XML Format document as a ZIP package without ever changing the extension in the first place. There are at least a few of these. One open source option that I like is 7-zip. After you install it, just right-click your Office Open XML Format document, point to 7-zip, and then click Open Archive. You can even edit XML document parts directly in the package, and the archive utility will prompt you to update the package after you save your changes. Before you begin, there is one more thing you might want to do. There's a setting in the Office applications that you can enable to prompt you if you open a file containing UI errors. Sometimes an error prevents the custom Ribbon from displaying, but not always, so it's helpful to get a warning right away. The error message you see tells you where the error is located, which can also be a timesaver. You can enable this setting in Word, Excel, or PowerPoint (or even Access) and it will apply to all. - In Word, Excel, or PowerPoint, click the Microsoft Office button and then, at the bottom of the menu, click <Program> Options. - On the Advanced tab, scroll to the bottom to find the General settings. Check the box labeled Show add-in user interface errors, and then click OK. Now go ahead and open Notepad to follow along with this article. Notepad is all you'll need to follow along with the rest of this article. But, if you happen to have Microsoft Visual Studio 2008 handy, don't be afraid to use that. You don't have to write any managed code (or even know what managed code is) to get some pretty cool benefits from using that software to edit Office Open XML document parts. I use Visual Studio 2008 because Visual Studio knows the customUI schema, so it provides IntelliSense menus and automatic syntax checking. This can save a lot of time, and the IntelliSense menus are handy when you're learning the terminology. Create a custom Ribbon tab The Ribbon in each applicable 2007 Office system application contains several tabs, each tab contains several groups, and each group may display several commands. Many types of controls are used to display commands, including buttons, galleries, split-buttons, menus, and others. You can customize any built-in tab (as well as the Microsoft Office Button menu), create your own custom tabs, or even start your own completely custom Ribbon from scratch. Of course, I can't explore every possible type of Ribbon customization in one article, but I will show you quite a lot of the things you can do. I'll start by creating a simple custom tab for Word that displays a few controls that run built-in commands. In this scenario, I need to create a document template for users and want to start the custom Ribbon with a group of commands that I know the users will frequently need. Of course, I could put them on the Quick Access Toolbar for the template without writing any XML, but I want these commands to be as large as any on the Ribbon and side-by-side with some other custom commands that I'll add to the tab in a bit. Figure 2 shows what the new custom group will look like. Here's the customUI.xml markup I used to create it: <?xml version="1.0" encoding="utf-8"?> <customUI xmlns=" office/2006/01/customui"> <Ribbon> <tabs> <tab id="customTab" label="My Custom Tab"> <group id="customGroup1" label="Helpful Tools"> <gallery idMso="QuickStylesGallery" visible="true" size="large" /> <button idMso="PasteSpecialDialog" visible="true" size="large" imageMso="Paste"/> <button idMso="CrossReferenceInsert" visible="true" size="large" label="Insert a Cross-Reference" /> </group> </tab> </tabs> </Ribbon> </customUI> Figure 2 A Simple Custom Tab Let's take a look at the XML structure in this markup. - If you open any Office Open XML document part, you'll see the same first line shown here (see the red markup). It's an indicator of the format being used. Just type it as you see it here. That second line is the tag that defines what type of data is being provided here. That's the customUI tag, and the underlined attribute (xmlns) is a namespace definition that indicates the schema being used. Again, just type it exactly as you see it. - Notice that many of the tags shown here are paired (see the blue markup). You have the start tags near the top: customUI, followed by ribbon, followed by tabs (referring to the set of all tabs on the Ribbon), tab (referring to the individual tab you're working on), and group (the group you are creating). Then, beneath the data for the commands in the new group, you see the end tags in reverse order for each. The paired tags are nested inside one another. Note that each tag is enclosed in angled brackets, the end tag for each pair of tags begins with a slash after the open bracket, and each attribute is followed immediately by an equal sign and then its value inside quotation marks. A small syntax error, such as a missing slash, can keep your UI customization from being displayed. - The commands in this custom group are each inside a standalone tag (see the green markup). They don't require end tags because all the data you need for the command is in this tag—there are no additional tags nested inside of them. So, the slash that indicates the end of the data for the tag comes at the end of each of these tags. Keep in mind, however, that not all Ribbon controls are standalone tags. For instance, if I create a custom gallery to which I add other controls, that would require a paired tag in order to nest other tags. Similarly, a custom menu control is a paired tag inside of which you can add buttons and other controls. Okay, let's look a bit closer. Every element you add to the structure of your custom UI needs a way to be uniquely identified: <tab id="customTab" label="My Custom Tab"> <group id="customGroup1" label="Helpful Tools"> Notice that the tag for my custom tab and the tag for the group I created each have an id attribute. You can name it just about whatever you like (but no spaces, please) as long as it's unique within the file. The only other attribute I customized for each of these tags was its label. Because the three commands on this custom tab are built-in Office 2007 commands, I needed to use the idMso attribute as identifiers, rather than id: <gallery idMso="QuickStylesGallery" visible="true" size="large" /> <button idMso="PasteSpecialDialog" visible="true" size="large" imageMso="Paste" /> <button idMso="CrossReferenceInsert" visible="true" size="large" label="Insert a Cross-Reference" /> I found these control IDs in the Word Ribbon Controls workbook. There are a few things worth noting about these tags and their attributes. The first command is a gallery, the other two are buttons. I know this because I've used the features, but you can also find this information in the Ribbon control workbooks for each program (the command type is listed right next to its ID). The visible attribute is true by default, so technically you don't have to add it, but it's a good idea. You may want to control visibility of commands at some point. The size command, on the other hand, defaults to "normal" (which looks, for example, like the Cut, Copy, or Format Painter commands on the Home tab in Word, Excel, and PowerPoint). If you want the commands to appear large, you have to add this attribute. If you take a look at the Paste Special command in one of the 2007 Office system programs, you'll see that it's a normal size command by default. Some commands displayed this way have icons that still look correct when displayed larger, but this isn't one of those. If you leave the custom icon for this control, it will look fuzzy. So, I added the image for the Paste command that you see on the Paste split button on the Home tab. That's the imageMso attribute that you see in the button tag for the Paste Special command. I also chose to adjust the label for Cross-Reference a bit, as you see in the button tag for that control. By default, it's just Cross-reference, but I wanted to add a bit more information since it doesn't appear on a tab that provides context. Adding the customUI File to the ZIP Package Now is the time, if you haven't already, to create a folder named customUI and place the customUI.xml file inside it. I'm going to add this customUI folder to a Word template. Because I also want to include macros in this template that I'll add to the Ribbon, I saved my template as a .dotm file (a macro-enabled Word 2007 template). Keep in mind that you can add a custom UI using the same steps shown here to any Office 2007 Open XML Format Word, Excel, or PowerPoint document, template, or add-in file. Open the Office Open XML package to which you're going to add your customUI folder and drop it right in. It goes on the top level, alongside the _rels, docProps, and program-specific document folder (i.e., word, xl, or ppt, depending on the document type you're customizing), and the [Content_Types].xml file. Now open the _rels folder and then open the file named .rels. (If you are not using a utility that enables you to edit the file while it's in the package, you may have to copy it out of the package first.) In this file, you see a nested structure similar to the one in the customUI.xml file. There is a set of relationships in the paired <Relationships … > tag and a standalone tag for each relationship. Each relationship tag contains three attributes: the Id, the Type, and the Target. Add the following tag for your customUI content to the .rels file, making sure that it falls between the start and end tag for the group of <Relationships …>: <Relationship Id="rId5" Type=" ui/extensibility" Target="customUI/customUI.xml"/> If the .rels file already contains a relationship tag with the ID rId5, use a different number. The ID needs to be unique. After you add that information to your file, the file should look something like that shown in Figure 3. If you're using Notepad as an editor and want to view your markup with structure (as shown in Figure 3), you can open the file in Internet Explorer. Figure 3 My Edited .rels File If you had to copy the .rels file out of the ZIP package to edit it, copy it back in. Then open the file in Word and check out your work. The new tab (named "My Custom Tab" if you used my example) appears at the end of the Ribbon. Adding VBA Macros to the Ribbon It was easy to add built-in commands to the ribbon, but what if you need to add your own tools? Here's what you do. Open that template file and press ALT+F11 to open the Visual Basic Editor (VBE). If you have not already done so, select your template in the Project Explorer that appears on the left side of the VBE. Then, on the Insert menu, click Module to add a code module to your template. You can then add a simple message box, as shown in Figure 4. (Of course, you can use whatever macro you want.) Figure 4 Adding a Code Module to the Template For those of you with more VBA experience, and those who plan to acquire it, note that there are other elements we really should add here for best practices. But none of those elements are critical for the task at hand (which is adding this macro to the ribbon), so I'll skip those tasks for simplicity. Before leaving the VBE, there is one more thing to add to this macro so that the Ribbon will recognize it. You have to declare it as a Ribbon control. To do that, just add the following text inside the parentheses that follow the procedure name: ByVal Control as IRibbonControl Now, the macro looks like this: Sub TakeABreak(ByVal control As IRibbonControl) MsgBox "Go get some coffee! You deserve it." End Sub Note the macro name, because you need to add that to the customUI.xml file. Then, save and close the template. You can now add this command to your customUI.xml file by adding the following markup wherever you'd like on your custom tab. I've created a new group for this command, which I'm going to place after the first group. <group id="customGroup2" label="Break Time" > <button id="myBreak" visible="true" size="large" label="Take a Break" imageMso="HappyFace" onAction="TakeABreak" /> </group> When you add this content, be sure to add it after the end tag for the previous group and before the end tag for the custom tab. Or, if you don't want to create a new group, you can just add the button information in its own tag within your existing group. There are a few things worth noting here. - Remember that if you're creating a new group, it needs its own unique ID. I also gave this group a unique label. - My new button uses a custom command, so the id attribute is used instead of idMso. In addition to the attributes you know from creating the first group, I've added an onAction attribute. That's the attribute I use to call my macro. The value for that attribute is the macro name. - The capitalization you see of any Office Open XML tag names, attribute names, and built-in 2007 Office control names is usually as much a requirement as any other part of the syntax. - I selected the HappyFace icon from the Icons Gallery workbook. After you add your new button, update the customUI.xml file in your ZIP package. There's no need to edit any other files in the package—just open your template. (You will likely need to enable macros when you do this.) Then go ahead and click your new button to give the macro a try. Getting Creative Once you have the basics down and have created a custom tab with built-in and custom commands, you can do quite a bit more just by adding various attributes. Here are some examples. If you want your tab to fall somewhere other than the end of the ribbon, specify that in the tab's start tag, with the attribute insertBeforeMso. For example, to make the tab you've just created the first tab in the Ribbon, place it before the Home tab, like so: <tab id="customTab" label="My Custom Tab" insertBeforeMso="TabHome"> You can find the correct name of any built-in tab in the Ribbon Control workbooks for the applicable program. To add a group to a built-in tab, just add the markup for that tab to your customUI.xml file. It doesn't matter which tab appears first in the customUI file; just be sure to nest the new markup properly. For example, if you place it after your custom tab, it should fall after the end tag for your custom tab and before the end tag for the group of tags ( between </tab> and </tabs>). Here I've added the Break Time group to the Insert tab: <tab idMso="TabInsert"> <group id="customGroup2" label="Break Time" insertAfterMso="GroupInsertTa bles" > <button id="myBreak" visible="true" size="large" label="Take a Break" imageMso="HappyFace" onAction="TakeABreak" /> </group> </tab> If you're creating a unique template with special requirements and you want to provide only custom commands to the user, you may want to create an entirely custom Ribbon for that template. To do this, in the start tag for the Ribbon (the <ribbon> tag) in customUI.xml, just add the attribute startFromScratch="True" as you see here. <ribbon startFromScratch="true"> To add a custom command other than a button, the syntax is always the same. If you want to add a split button menu, for example, just keep the rules for paired tags and nesting tags in mind and this customization will be very easy. Say you want to put all of the commands you've added so far onto a single split button menu instead of separate buttons. Try this: <splitButton id="customSplit1" visible="true" size="large"> <menu id="customMenu1" visible="true" > <button id="myBreak" visible="true" label="Take a Break" imageMso="HappyFace" onAction="TakeABreak" /> <button idMso="PasteSpecialDialog" visible="true" imageMso="Paste" /> <button idMso="CrossReferenceInsert" visible="true" label="Insert a Cross-Reference" /> <gallery idMso="QuickStylesGallery" visible="true" /> </menu> </splitButton> The result of this is shown in Figure 5. Note that the first button command in the menu becomes the split button default. That's why I reordered the commands for my happy face to be on top. The split button has to be a button control. If Quick Styles (which uses a gallery control) was first, it would have been skipped over for the split button control and that control would have used the first button control in the menu. Figure 5 A Single Split Button Menu This is just a sample of what you can do to customize the UI. You can find plenty of help online to take this further, like adding your own custom image to a command or using a VBA macro to conditionally control the behavior of some commands. Check out the Office Developer Center on MSDN for ideas. To search for help on conditionally controlling the Ribbon behavior, look up attributes such as getVisible and getLabel. The 'get' prefix is used before the attribute you already know when you want the Ribbon to look at a macro for direction on how to behave (referred to as a callback). Sharing your customizations You can save UI customizations in any 2007 Office system Word, Excel, or PowerPoint document, template, or add-in. What if you want to install your custom UI so it's available regardless of the document or template being used? This is also quite easy. In Word, just save the .dotm file that contains your macros and related customUI to the Word Startup folder and it will load automatically when Word starts. In Excel or PowerPoint, you need to save the file that contains your macros and custom UI settings as an add-in, and then load that add-in. Open the file in the applicable program (enable macros if prompted) and then use the Save As command to save a copy as an add-in. (The add-in file type for an Excel 2007 add-in is .xlam and for PowerPoint 2007 it is .ppam.) When you save the file with that format, it's automatically saved in the Microsoft AddIns folder. Now load it through the <Program> AddIns dialog box, which you find via the bottom of the <Program> Options, AddIns tab. You may be prompted to enable macros the first time you load your add-in–just click Enable Macros. After that, it should load automatically when the program opens. Stephanie Krieger is a Microsoft Office System MVP and the author of two books, Advanced Microsoft Office Documents 2007 Edition Inside Out and Microsoft Office Document Designer. She also frequently writes, presents, and creates content for Microsoft. You can reach Stephanie through her blog, arouet.net.
https://learn.microsoft.com/en-us/previous-versions/technet-magazine/dd633481(v=msdn.10)?redirectedfrom=MSDN
CC-MAIN-2022-40
refinedweb
4,099
69.52
[open] Libet's rotating spot clock - Intentional Binding Paradigm Hi. I'm trying to make a rotaing spot clock like the one used in Libet's volition expermient, to use it to measure the Intentional binding effect. I got lots of help on this forum, reading other entrie on the subject. here. I was able to make an inline code that displays the clock with a rotating red ball, marking the revolutions every 2560 ms and then to mark the time which a key is pressed ("z"). 1500 ms after the keypress, a synth sound plays, and the sound time is recorded. Then the clock is stopped a random range of time after. I'm missing the method to introduce the percieved time of the two events. Although my code does the job, i think it's rather rough. I would appreciate if someone could look in to my code and maybe help me find a more elegant solution. thanks! from openexp.canvas import canvas from openexp.keyboard import keyboard from openexp.synth import synth from math import radians, atan2, sin, cos, degrees # Trigonometry to build rotating spot import random, time #initialize synth, sine wave my_synth = synth(self.experiment, osc = "sine", freq = "b1", attack = 1, length = 200) #initialice canvas and path of clock image my_canvas = canvas(self.experiment) my_canvas.show() path = self.experiment.get_file("clock2.png") #initialize keyboard my_keyboard = keyboard(self.experiment, keylist = ["z"],timeout= 0) clock_radius = 75 #radius of the clock spot. speed = 140.625 # speed to make 1 turn of the clock in 2560 ms start_t = time.time() - random.randint(0, 2560) # needed to make the startinf position of the clock random. half_screen = 250.5 #had to do this to draw the circle relative to the center of the screen. I dont now if canvas can manage "center" relative coordinates. press_time = 100000000000 #set this variables high enough, to avoid entering the conditions. finish_time = 100000000000 delay = random.randint(2, 5) while True: #start the clock t = time.time() - start_t dy = clock_radius * sin(radians(t * speed)) dx = clock_radius * cos(radians(t * speed)) my_canvas.clear() my_canvas.circle(dx + half_screen,dy + half_screen,5, fill=True); my_canvas.image(path) my_canvas.show() mark = atan2(dy,dx)*10 + 15 # fix the result of the atan2 function to give clock marks if mark < 0: mark = (60 + mark) key, f_time = my_keyboard.get_key() if key==122: #mark the time of the key press key_mark=mark press_time=time.time() if time.time() - press_time > 1.5: #set a 1.5s interval before synth play my_synth.play() sound_mark=mark press_time = 100000000000000 finish_time=time.time() if time.time() - finish_time > delay: #set a random (delay) interval before breaking print key_mark, sound_mark break Hi Caiman, Your code looks pretty good (and works), but I take it you're not satisfied with it? I don't understand the following: What exactly do you want to achieve that the script isn't doing right now? Furthermore, two minor tips: Cheers, Sebastiaan Thanks Sebastiaan. The intentional binding effect is a "temporal compression" of the percieved time of the onset of an action and it's consequence. When a person is asked to retrospectively inform of the timing of 1.- an intentional movement and 2.- its consequence, in this case a sound , the movement is percieved later in time, and the sound is percieved before of their "real" timings. What's exiting about it, its that when there is no "intention" to move (as in passive movements), the effect is not seen, or you can see an inverse effect (the percieved time between the two conditions expand). Im building a script that can ask de users for the perceived timing of the two events. I'm using the mouse module and I think i can get it to work. The user is asked to mark the position on the clock, when they percieved the urge to move, and then when they percieved the sound. I would like to restrain de mouse movement to a certain area, maybe just the clock perimeter, for better accuracy. Is this possible? Sound timing is important, if the delay is more or less the same for each try, it should'nt be a problem. Do you know another method for a more precise sound stimule? maybe using the system sound, as it doesn't require sound card processing? here's the updated code. Regarding a better (restrained) way to get the response, I was thinking you could draw a straight line from the center in the direction of the cursor. So basically the participant controls the arm of a clock with his mouse. What do you think? Something like this would do the trick: Regarding the sound. There is a fixed delay and a random jitter. How big the jitter will be is hard to say (you'd need to test on a specific system), but it might be on the order of 20ms. You can reduce this (somewhat) by reducing the sound buffer size (see the back-end options in the general tab) to say 256, but you might get crackling in the sound. Using the system beep, or a device attached to the serial/ parallel port should give you essentially perfect timing. I don't have a system beep myself (it's kind of old fashioned), so I cannot be of much assistance here. But maybe this will get you started: Good luck! Thanks again Sebastiaan. I've finally made the script work with your help. I had to fix de atan2 function with a "degrees" because it was giving me the numbers in radians, but once that was fixed it all ran well. Now i'm trying to organize my expermient in order to run it in several blocks measuring different thing. One block that the user only estimates the time of key pressing, with no sound, other block with the estimation of only the sound, without the key press... etc. My question now is if i can make an inline script at the begining of the experiment, to define the variables that are the same for all the blocks (like the clock_radius, the speed, etc) and then call them on the specific blocks. Thanks for your help! Sure, the following command in an inline_script will set a variable that is accessible throughout the experiment: Alternatively you can edit the general script (General tab → Show script editor) and add something like the following to the top of the script: Both methods will do the same thing. Cheers! Hi Caiman. We have the same research interests, very well! Actually, I developed a quite different code to creating the intentional binding paradigm. I use the PsychoPy backend, since it seems to be more precise. Moreover, I prefere to create in advance the various clock hand positions, and then to show them in sequence for each frame rate. In this way, the rotation of the clock and the milliseconds precision seem to be improved (but this is just my opinion). For example, the rotation appears more fluid. With the Psycho backend, the canvas module doesn't work well, so I had to use the 'visual' modules. In my code, the subject judge the time by typing the seconds number. I use this method only because this is the same used by Haggard and coll. in their intentional binding studies. I also developed a code that allows the subject to manually positioning the clock hand at the disired position, but I don't use it for now. It would be interesting to verify if the two judgement methods determine different results (I guess not)... I attach my code, apologizing very much for its length (Sebastian, I hope this isn't a problem, I have to use more than one post). It's only for one condition, in which the subject presses a key, hear a tone and judges the time. I hope this may be useful for you, Caiman, and for who will want to study the intentional binding. I would appreciate any suggestions about my code, if someone has the opportunity to test it. Best, Andrea Hi Andrea, First of all, thanks for sharing your code. I am trying to make a Libet paradigm as well, I am really doing just a traditional Libet experiment but adding an electrophysiological intervention. Your code works well -- would you mind if I modify it and use it for my experiment? If so, would you mind sharing the code to manually position the clock hand to the desired position when reporting intention time? Thanks again! You saved me a lot of hard work Hi zak. Here the code you requested. For various reasons, I don't use this method. I think one problem is that manually positioning the clock hand requires that the subject has to wait until the clock hand reaches the choosen position. I don't now if this may be a possible bias. On the other hand, if you increase the clock hand rotation speed, the judgement becomes less precise and the clock hand "slips out". So, I now prefer to ask the subject to comunicate the seconds position. BTW, this is the code, let me know if it works well. Best, Andrea Thanks Andrea! I ended up coding something to use a mouse for the judgement phase, based on what Sebastiaan wrote but with psychopy mouse commands. It allows the subject to report the clock position by moving the mouse, but the hand is constrained to appropriate clock positions. Then it converts the x,y position of the hand at the click to clock position (this was slightly tricky). This method may be somewhat more accurate because the subject can report non-integer clock positions. It also meant I could avoid buying a $5000 EEG-compatible fiber optic keypad! (though the fiber optic mouse is still $2000 :S) Feel free to use it if you like, and thanks again for sharing. Some other changes I made you might have noticed: I use a red dot instead of a white line for the hand. I also draw the clock face to an image buffer before drawing it. There is some loss of image sharpness but this was necessary because I added 1s tick marks, which made it run very slowly. I did it like this: Hi Zak. In these days I'm attempting to improve the code that I used. Now, I also use BufferImageStim to draw the clock face, and it allows a faster presentation of the stimuli. This is the code that I use to create the clock face. I don't draw the 1s tick marks, but you can add them inside the loop. Then, I call the clock_face.draw()two consecutive times, when I have to draw it, because this make the clock face more clear. Best, Andrea Hi Andrea, I'm not sure if you are still doing this experiment but I noticed a bug since I have been using the code. When converting the start point from a value (0-11) to a clock face value (5-60), the code says if start_point == 0: start_point = 15 if start_point == 1: start_point = 10etc. The problem with this is it says if start_point == 1: start_point = 10and then later if start_point == 10: start_point = 25. This means that every time the start point is 10, it is being recorded as 25 instead. The same problem occurs if the original start point is 5. It becomes 50 instead. This means the converted_judgement calculations are incorrect or ambiguous on 1/3 of trials (anytime the start point was 5, 10, 25, or 50) Just thought you should know, in case you did not find this bug yourself. You can fix it by simply moving the commands for if start_point = 5 and if start_point = 10 to the top of the list. Hi zak. Thank you for reporting this bug. I had not noticed the problematic behavior of the code, because after I had posted here my experiment I modified it in order to make it more reliable. A change I made is just related to the selection of the start point of the clock hand and the subsequent conversion of the value in a clock mark number. I inserted a python dictionary with the various start points of the clock hand (the keys) and the relative converted clock marks (the values). So, the start point is every time randomly choosen: and used for the initial clock hand position. Then it is converted at the end of the code, before computing final data: This appears more elegant. Since they works well, I think I will share my final intentional binding experiments here in the next days. The only problem is that the instructions are in italian... Specifically, I have developed both the classic version (from Haggard et al. 2002) and the probability version (from Moore and Haggard, 2008), in which the probability of occurrence of the tone is manipulated in two blocks. I'm using this latter experiment for my current research, since it distinguishes both predictive and retrospective components of the feeling of agency. Cheers, Andrea Hi, I am interested in using the Intentional Binding task. Will one of you by any chance be willing to share the code of the task with me or refer me to someone who might be able to help me?. unfortunately, my programming skills are poor, therefore it will assist me greatly. Thanks a lot! Ela Hi ElaOren. Yes, of course, I can share the code with you once I get a bit of time. A question: are you interested in the original version of the intentional binding paradigm (Haggard et al. 2002) or in the modified version in which the probability of occurrence of the tone changes (Moore & Haggard, 2008)? Hi Andrea, I'm very interested to the Libet clock paradigm and I would like to use it for some researches. Unfortunately I'm naive of the opensesame scripts. Can you help me? Many thanks. Fabio Hi Fabio (are you italian, like me?). You can contact me at andreaepifani[at]gmail.com. I'll be glad to help you. I'm also interested in finding an implementation of the Libet paradigm and this is the only only one I've found that I've managed to get to work. Unfortunately my programming skills are non-existent so I'm finding this all extremely taxing. Hopefully embodiment doesn't mind if I send an email asking for the latest code, and if anyone else has used Opensesame for a Libet-style experiment I'd be really interested to hear about it! Hi everybody, I'm trying to replicate Libet's experiment using an openbci EEG, I tried embodiment's program using psychopy it gives me an error : My knowledge in programming is very limited, if anyone can help ? Thank you in advance. Hi all, I am hoping to do some simple (Haggard-style) Intentional Binding experiments with my final year dissertation students next academic year and I was wondering if any of you would be willing to share your OpenSesame script with me so I can edit it for my own ends? Many thanks in advance, Cai Hi Cai, Maybe you can email Fabian (email above). In case you haven't already done so. Good luck, Eduard
http://forum.cogsci.nl/discussion/comment/2925
CC-MAIN-2020-34
refinedweb
2,547
72.46
The this keyword points to the object for which the member function is called. I have always used it to explicitly point to the data members of the class. Consider the following function where a variable name occurs in another part of the program. If you remove the this pointer from the program below, it will still work correctly. #include <iostream> #include <string> using namespace std; class Rock { public: string name; string track; int Display(); Rock(string, string); //This is the constructor ~Rock(); //This is the destructor }; int Rock::Display() { cout << "This is " << this->name << " Singing " << track; cout << endl; return 0; } Rock::Rock(string name, string track) { this->name = name; this->track = track; } Rock::~Rock() { cout << "This is Rod Stewart Signing Off"; cout << endl; } int main() { string name= "Rod Stewart"; string track = "I was only Joking"; Rock rockstar(name, track); // instance declaration rockstar.Display(); return 0; }
https://codecrawl.com/2015/01/20/cplusplus-this-keyword/
CC-MAIN-2019-43
refinedweb
146
65.35
Is there any software available which can convert .doc/.docx/.odf file to redmine wiki the MediaWiki integration patch for Redmine and its reference page . The reference page says this about the patch: Here's a patch for 0.7 that will add a MediaWiki tab to your project settings and integrate it into the issues pages. You will also need to add: is_mediawiki tinyint(1) NOT NULL default '0', mediawikiurl varchar(255) NOT NULL default '', mediawikinamespace varchar(255) NOT NULL default '' To the projects table for this to work. If you wanted to import here is a rake file for importing MediaWiki pages into Redmine Source asked 3 years ago viewed 1957 times active
http://superuser.com/questions/557499/importing-data-from-microsoft-word-to-redmine-wiki
CC-MAIN-2016-22
refinedweb
115
61.67
// Test of Arduino using Telnet server.#include <Ethernet.h>#include <SPI.h>// Undefine this to get a working program.#define TELNET// the media access control (ethernet hardware) address for the Arduino:byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x92, 0x34 };// network configuration - all except mac are optional.// If the actual values aren't supplied, the default// is the local_ip with last octet 1.// void EthernetClass::begin(uint8_t *mac, IPAddress local_ip,// IPAddress dns_server, IPAddress gateway, IPAddress subnet)// The default Arduino board address:byte ip[] = { 192, 168, 1, 20 };// The DNS server address:byte dnss[] = { 192, 168, 1, 1 };// the gateway router address:byte gateway[] = { 192, 168, 1, 1 };// the subnet mask:byte subnet[] = { 255, 255, 255, 0 };// telnet defaults to port 23EthernetServer server(23);void setup(){ // Initialise the serial device. Serial.begin(9600); delay(2000); Serial.println("setup()"); // Disable SD SPI // Is this needed ??? pinMode(4, OUTPUT); digitalWrite(4, HIGH); // attempt a DHCP connection: Serial.println("Attempting to get an IP address using DHCP"); // This requires the DHCP server to be x.x.x.1 if (Ethernet.begin(mac) == 0) { // if DHCP fails, start with a hard-coded address: Serial.println("failed to get an IP address using DHCP, trying manually"); Ethernet.begin(mac, ip); // function returns void //Ethernet.begin(mac, ip, gateway, gateway, subnet); // function returns void } else Serial.println("got an IP address using DHCP"); // Start listening for clients. server.begin(); // Say who we think we are. Serial.println(Ethernet.localIP());}void loop(){ Serial.println("loop()"); // Initialise the client each pass ??? EthernetClient client = server.available(); // Read bytes from the incoming client and write them back // to any clients connected to the server.#ifdef TELNET if ( client ) { char c = client.read(); server.write(c); }#endif // Can help debugging. delay(2000);}// eof Thanks for the fast response.I think you're right but there is only the Arduino and the Ethernet Shield as shown. (3283.46 KB, 3648x2736 - viewed 6 times.) Serial.print("Starting ethernet..."); if(!Ethernet.begin(mac)) Serial.println("failed"); else Serial.println(Ethernet.localIP()); i think my router may be trying to assign an IP, but i am manually setting the IP in the sketch.... how do i avoid this? is there a way to set the shield to accept an IP from the router? i've resolved a problem with a mega 2560 and shield W5100. the ethernet was detected but The problem was serial port which was returning adress IP 0.0.0.0 . The problem was the pins were too long and the contact between mega and shield wasn't correct for the ICSP connector So just cut 2 millimeters to all of the shield W5100 pins to make sure the ICSP connection is well done between the 2 devices . Just after, an IP adress was available on the serial port monitor . I am using an arduino mega an an aliexpress lan shield (the normal cheap design).
http://forum.arduino.cc/index.php?topic=108592.msg815960
CC-MAIN-2017-39
refinedweb
481
59.19
Alexander Sack wrote: > Dennis, thanks for the tip. Kinda obvious too...damn... > > Okay, so can someone tell me what I need to do to FORCE it to use > junit4? I > specific junit-4.0 in my dependencies (scope is "test"). My parent dom of > the whole project has surefire plugin version set to 2.3. I mean what else > do I have to do at this point? I have this in my parent pom and @Before works for me: <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.3.1</version> <scope>test</scope> </dependency> IIRC early versions of junit 4 did not call @Before on subclasses. So if by any chance your MyTest class is a subclass of e.g. TestCase and this was really a bug in junit 4.0 then this might be the cause. FWIW: I noticed yesterday taht the junit4 runner in eclipse 3.2.2 does not call @Before on subclases of TestCase. maybe mvn -X ... gives more information? best regards Bernd > -aps > > On 5/23/07, Dennis Cook <dj_cook@yahoo.com> wrote: >> >> It looks like junit 3.8 is still being used. The reason the method name >> prefix with 'test' will be called by the older version. The >> annotation is >> probably ignored. Change the name of the test method to another >> prefix, and >> I bet it will not be executed. >> >> Alexander Sack <pisymbol@gmail.com> wrote: Btw, considering that @Test >> works, I'm pretty positive I'm using 2.3 at this >> point. The only issue is the @Before seems to never get called. >> >> Anyone run into this before? >> >> -aps >> >> On 5/23/07, Alexander Sack >> wrote: >> > >> > Tom, >> > >> > Thanks sorry. Yes I have specified in my root POM surefire-plugin >> 2.3but >> > not in my submodule one (I will try that right now). The test ource is >> the >> > one straight out of the FAQ regarding the colleciton, very simple test, >> > passes on 3.8.1 but fails when I move up to 4.0 using the surefire >> > plugin. I'm using Junit-4.0. >> > >> > Is suppose to work? The surefire report claims there is a null >> pointer: >> > >> > Here is my source: >> > >> > import static org.junit.Assert.* ; >> > >> > import java.util.ArrayList; >> > import java.util.Collection; >> > >> > import org.junit.Before; >> > import org.junit.Test; >> > >> > public class MyTest { >> > private Collection c; >> > >> > @Before >> > public void setUp() { >> > c = new ArrayList(); >> > } >> > >> > @Test >> > public void testSomeMethod() { >> > assertTrue(c.isEmpty()); >> > } >> > } >> > >> > Claims c is null which it isn't provided @Before runs (if I eliminate >> the >> > method and put it in my testSomeMethod() it passes. How can I tell >> what >> > version of surefire I'm running? The -e just says that test case has >> > failed, etc stack. >> > >> > What am I doing wrong? (man, I've used maven2 in all kinds of advanced >> > ways and I feel retarded that this is not working!). >> > >> > -aps >> > >> > On 5/23/07, Tom Huybrechts wrote: >> > > >> > > would you mind sharing some more information ? POMs, exceptions, test >> > > source, -X output ? >> > > >> > > As a general remark: make sure you have the latest surefire plugin... >> > > >> > > Tom >> > > >> > > On 5/23/07, Alexander Sack < pisymbol@gmail.com> wrote: >> > > > Hey folks, is this a known issue that if I use @Before it will fail >> my >> > > > test? I searched some of the archives and saw some threads go by >> > > about >> > > > this. Is this still an issue? >> > > > >> > > > Thanks! >> > > > >> > > > -a >> > > >> > > >> > >> > >> > -- >> > "What lies behind us and what lies in front of us is of little concern >> to >> > what lies within us." -Ralph Waldo Em
http://mail-archives.apache.org/mod_mbox/maven-users/200705.mbox/%3C46556D62.7070507@gmx.net%3E
CC-MAIN-2020-10
refinedweb
576
78.65
Subject: [boost] QVM library From: Emil Dotchevski (emildotchevski_at_[hidden]) Date: 2014-06-07 22:06:35 I've updated the QVM library (which hasn't been reviewed yet), including minor changes plus a workaround for what appears to be a parsing bug in msvc-12: -- Emil Dotchevski Reverge Studios, Inc. P.S. Perhaps STL can confirm, I'm guessing that the MSVC bug was introduced by the added rvalue reference support, which interfered with the heuristics MSVC uses to attempt to successfully parse non-conformant code that doesn't use mandatory "typename". This can be seen for example in q.hpp, which used to contain functions like: template <class A,class B> typename enable_if_c< is_q<A>::value && is_q<B>::value, A &>::type operator-=( A & a, B const & b ) which I had to change to: template <class A,class B> typename enable_if< msvc_parse_bug_workaround::quats<A,B>, A &>::type operator-=( A & a, B const & b ) where namespace msvc_parse_bug_workaround { template <class A,class B> struct quats { static bool const value=is_q<A>::value && is_q<B>::value; }; } 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/2014/06/214272.php
CC-MAIN-2021-49
refinedweb
195
56.59
This forum is closed. Thank you for your contributions. I have solution which implements in the PRISM pattern. All my modules use a certain Custom Button control. All these project are available under the same source tree and are grouped using solution folders. The problem i face is when i try and use blend to modify any of my control styles. Eventhough blend can successfully build and run my project. It always shows an error and the design view is blank: The name "MyCustomControl" doesnot exist in "clr-namespace: MyControls.MyCustomControl; assembly=MyControls" Hello , I am glad to see your question, similar solution is what I have blogged on my blog and that might help you a lot in doing very stuff Here is my blog, I hope it helps you out ! Regards, Microsoft Student Partner
https://social.msdn.microsoft.com/Forums/en-US/6e3a4c7e-9817-4665-a6f1-4430b469e91c/blend-designed-cannot-load-my-custom-control?forum=blend
CC-MAIN-2021-31
refinedweb
136
66.44
How How to set the setBounds for the buttons. And how to put the images on the frame . Please give some sample programs on that. image button please help me to make button an image icon and when you press more than one time the icon change to another picture java i would like to become java eeport can ableto help me plz Java This is really a fantastic site. It helps me a lot in solving my programming errors..... comment this website is very useful. it contains very good examples. Please, make a desciption about buttons. Dear Sir and Madam Thanks for the useful web site. I am a student from japanese college, who is studying programs hard, recent days. here i have a question. how do you use buttons with actions? I want to write a button program. which does some va java good example great Stuff Hey It was a great Stuff. Thanks a lot. I want some more codes 7 I will choosethis site for my java awt programs Button Pressing Example Button Pressing Example  ... with the button. That is a different action takes place on the click of each button. You.... Moreover, if you don't to check that which button was selected then in that case Java AWT Package Example will learn how to create Button on frame the topic of Java AWT package... Java AWT Package Example  ... will learn how to handle events in Java awt. Events are the integral part Swing Button Example Swing Button Example Hi, How to create an example of Swing button in Java? Thanks Hi, Check the example at How to Create Button on Frame?. Thanks awt - Swing AWT , For solving the problem visit to : Thanks... market chart this code made using "AWT" . in this chart one textbox when user Create a Container in Java awt Create a Container in Java awt Introduction This program illustrates you how to create...;panel.add(new Button("Button 1")); panel.add(new  Java Dialogs - Swing AWT /springlayout.html... visit the following links: Dialogs a) I wish to design a frame whose layout mimics how to set image in button using swing? - Swing AWT how to set image in button using swing? how to set the image in button using swing? Hi friend, import java.awt.*; import...:// Thanks add button to the frame - Swing AWT for more information. button to the frame i want to add button at the bottom... JFrame implements ActionListener { JButton button = new JButton("Button How to Create Button on Frame a command button on the Java Awt Frame. There is a program for the best... How to Create Button on Frame In this section, you will learn how to create Button on  AWT Tutorials AWT Tutorials How can i create multiple labels using AWT???? Java Applet Example multiple labels 1)AppletExample.java: import...; Button b1; int num1,num2, sum = 0; public void init
http://roseindia.net/tutorialhelp/allcomments/6003
CC-MAIN-2014-41
refinedweb
485
76.11
Introduction Cryptography and computer network security have always been side interests for me. While reading about the RSA encryption technique in cryptography, I thought about writing an article on this amazing algorithm. Python is one of my favorite programming languages because of its simplicity, and implementing RSA Encryption using python will be fun. Let’s dive into the concepts of RSA encryption. What is Encryption? Encryption means encoding information. In technical terms, encryption is converting human-readable plaintext to alternative text, also known as ciphertext. Only authorized parties can decipher a ciphertext back to plaintext and access the original information. What is RSA Encryption in python? RSA abbreviation is Rivest–Shamir–Adleman. This algorithm is used by many companies to encrypt and decrypt messages. It is an asymmetric cryptographic algorithm which means that there are two different keys i.e., the public key and the private key. This is also known as public-key cryptography because one of the keys can be given to anyone. Companies such as Acer, Asus, HP, Lenovo, etc., use encryption techniques in their products. Since this is asymmetric, nobody else except the browser can decrypt the data even if a third-party user has a public key in the browser. RSA Encryption Implementation Without Using Library in Python How does RSA algorith work? Let us learn the mechanism behind RSA algorithm : - How to generate Public Key for encryption: - Take two prime numbers such as 17 and 11. - multiply the prime numbers and assign them to a variable. n= 7*11=77 - Assume a small exponent e which will lie between 1 to phi(n). Let us assume e=3 Now, we are ready with our public key(n = 77 and e = 3) . Encryption: memod(n) = 893mod 77 = 166 = c import math message = int(input("Enter the message to be encrypted: ")) p = 11 q = 7 e = 3 n = p*q def encrypt(me): en = math.pow(me,e) c = en % n print("Encrypted Message is: ", c) return c print("Original Message is: ", message) c = encrypt(message) OUTPUT:- Enter the message to be encrypted: 89 Original Message is: 89 Encrypted Message is: 166 As you can see from the above, we have implemented the encryption of a message without using any library function. But as we are using python, we should take some advantage out of it. By this, I mean to say that we are having libraries available for the RSA implementation. Oh! Yeah, you heard it right. RSA Encryption Implementation Using Library in Python There are many libraries available in python for the encryption and decryption of a message, but today we will discuss an amazing library called pycryptodome. The RSA algorithm provides: - Key-pair generation: generate a random private key and public key (the size is 1024-4096 bits). - Encryption: It encrypts a secret message (integer in the range [0…key_length]) using the public key and decrypts it back using the secret key. - Digital signatures: sign messages (using the private key) and verify message signature (using the public key). - Key exchange: It securely transports a secret key used for encrypted communication. Before starting to code in python do not forget to install the library. pip install pycryptodome Now let’s understand how the RSA algorithms work by a simple example in Python. The below code will generate a random RSA key-pair, will encrypt a short message using the RSA-OAEP padding scheme. RSA key generation Now, let’s write the Python code. First, generate the RSA keys (1024-bit) and print them on the console as hex numbers and the PKCS#8 PEM ASN.1 format. pip install pycryptodome from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP import binascii keyPair = RSA.generate(3072) pubKey = keyPair.publickey() print(f"Public key: (n={hex(pubKey.n)}, e={hex(pubKey.e)})") pubKeyPEM = pubKey.exportKey() print(pubKeyPEM.decode('ascii')) print(f"Private key: (n={hex(pubKey.n)}, d={hex(keyPair.d)})") privKeyPEM = keyPair.exportKey() print(privKeyPEM.decode('ascii')) #encryption msg = 'A message for encryption' encryptor = PKCS1_OAEP.new(pubKey) encrypted = encryptor.encrypt(msg) print("Encrypted:", binascii.hexlify(encrypted)) OUTPUT:- Public key: (n=0x9a11485bccb9569410a848fb1afdf2a81b17c1fa9f9eb546fd1deb873b49b693a4edf20e36ffc3da9953657ef8bee80c49c2c12933c8a34804a00eb4c81248e01f, e=0x10001) -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCaEUhbzLlWlBCoSPsa/fKoGxfB +p+etUb9HeuHO0m2k -----END PUBLIC KEY----- Private key: (n=0x9a11485bccb9569410a848fb1afdf2a81b17c1fa9f9eb546fd1deb873b49b693a4edf20eb8362c085cd5b28ba109dbad2bd257a013f57f745402e245b0cc2d553c7b2b8dbba57ebda7f84cfb32b7d9c254f03dbd0188e4b8e40c47b64c1bd2572834b936ffc3da9953657ef8bee80c49c2c12933c8a34804a00eb4c81248e01f, d=0x318ab12be3cf0d4a1b7921cead454fcc42ba070462639483394d6fb9529547827e9c8d23517b5566dd3d3e5b16ec737987337a0e497fdba4b5ad97af41c1c3cdd87542a4637d81) -----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQCaEUhbzLlWlBCoSPsa/fKoGxfB+p+etUb9HeuHO0m2k6Tt8g64 NiwIXNWyi6EJ260r0legE/V/dFQC4kWwzC1VPHsrjbulfr2n+Ez7MrfZwlTwPb0B iOS45AxHtkwb0lcoNLk2/8PamVNlfvi+6AxJwsEpM8ijSASgDrTIEkjgHwIDAQAB AoGAMYqxK+PPDUobeSHOrUVPzEK6BwRiY5SDOU1vuVKVR4J+nI0jspSo4B+KEBna NONQ8jB3QOBqJwvvH+ZG5q0hPjG1KP3V9dA+YzwHxEdV7WIqYp156CLAlevfnMgO UXtVZt09PlsW7HN5hzN6Dkl/26S1rZevQcHDzdh1QqRjfYECQQDGDUIQXlOiAcGo d5YqAGpWe0wzJ0UypeqZcqS9MVe9OkjjopCkkYntifdN/1oG7S/1KUMtLoGHqntb c428zOO/AkEAxyV0cmuJbFdfM0x2XhZ+ge/7putIx76RHDOjBpM6VQXpLEFj54kB qGLAB7SXr7P4AFrEjfckJOp2YMI5BreboQJAb3EUZHt/WeDdJLutzpKPQ3x7oykM wfQkbxXYZvD16u96BkT6WO/gCb6hXs05zj32x1/hgfHyRvGCGjKKZdtwpwJBAJ74 y0g7h+wwoxJ0S1k4Y6yeQikxUVwCSBxXLCCnjr0ohsaJPJMrz2L30YtVInFkHOlL i/Q4AWZmtDDxWkx+bYECQG8e6bGoszuX5xjvhEBslIws9+nMzMuYBR8HvhLo58B5 N8dk3nIsLs3UncKLiiWubMAciU5jUxZoqWpRXXwECKE= -----END RSA PRIVATE KEY----- Encrypted: b'99b331c4e1c8f3fa227aacd57c85f38b7b7461574701b427758ee4f94b1e07d791ab70b55d672ff55dbe133ac0bea16fc23ea84636365f605a9b645e0861ee11d68a7550be8eb35e85a4bde6d73b0b956d000866425511c7920cdc8a3786a4f1cb1986a875373975e158d74e11ad751594de593a35de765fe329c0d3dfbbfedc' Explanation of the code - Installed pycryptodome. - As we are using the RSA algorithm, we need to import it from Crypto.PublicKey. - We are also using the OAEP-Padding scheme. We have imported PKCS1_OAEP from Crypto.cipher. - To convert binary to ASCII, we have imported binascii. - Generating keypair values using RSA.generate. - Generating publickey value - Entering a message that is needed to be encrypted. - Using encrypt function to encrypt the message. As you can see after installing a library our work became very simpler and more efficient. Also Read | Python SHA256: Implementation and Explanation Conclusion In today’s detailed discussion, we have covered almost everything about RSA encryption implementation using python. Starting from the basics to encryption, we have understood about RSA algorithm. We have implemented RSA using a library and without using a library. But I recommend using the library pycryptodome as it is more efficient. Nowadays, almost every MNC uses encryption for their information as hacking is quite easy in today’s world. However, encryption of the information makes it a difficult task for hackers to understand the data. If you have any doubts, feel free to comment down below. Till then, keep exploring our tutorials. Hi, there!! Thank you… Looks nice. How to use it on files in a directory? How to encrypt and decrypt the files? How to encrypt a file and send it to someone else to decrypt it? May you send me some examples, please. Regards, IOS Yes, you can easily do that with python. First of all, ask the receiver to generate RSA keys using publicKey, privateKey = rsa.newkeys(512). Then ask him for the public key and encrypt the file data using encMessage = rsa.encrypt(message.encode(), publicKey). Nextly, send him the encoded message where he’ll use his private key to decrypt the message. decMessage = rsa.decrypt(encMessage, privateKey).decode()can be used for the same. Please, note that after the creation of the private key, it shouldn’t be shared between sender and receiver to compromise the security. In the case of files, you can read the file contents using file.read() method and then encrypt the whole content. Hi, thank you for sharing this, just what i was looking for. I installed the lib and when running this code, i get an error at this line: encrypted = encryptor.encrypt(msg) The error reads: File “…..\PKCS1_OAEP.py”, line 121, in encrypt db = lHash + ps + b’\x01′ + _copy_bytes(None, None, message) TypeError: can’t concat str to bytes Would you be able to help with this? Best regards! This error is raised when there is a problem in converting strings to bytes. When you use a file as input, you can get this error more often due to different characters. You can use bytes of data to encrypt your message. The following example will help you – data = b'Text to encrypt' encryptor = PKCS1_OAEP.new(pubKey) encrypted = encryptor.encrypt(data) print("Encrypted:", binascii.hexlify(encrypted)) If you are taking input from a file, make sure you use ‘rb’ as file mode. I hope this clarifies everything. Let me know if you have any other doubt! Regards, Pratik I fix it by adding .encode() after msg in the encrypt() method. When I use an online RSA decryptor to try and decrypt the encrypted message with the private key is it never able to. How can I check the correctness of the encryption? Yes, .encode() also works as it converts strings to bytes. RSA has different Cipher methods (RSA/ECB/PKCS1Padding is the most used one) which may prevent proper encryption and decryption when you change systems. To check the correctness, you may have to first check the key size, and matching public and private keys. Generally, remember that a public key is used to encrypt and a private key is used to decrypt. Hope this helps. If not, please let me know! Regards, Pratik encrypted = encryptor.encrypt(msg.encode())
https://www.pythonpool.com/rsa-encryption-python/
CC-MAIN-2021-43
refinedweb
1,410
50.33
Solving JavaFX’s CSS problems with cljfx css We like to browse GitHub and occasionally shed some light on interesting or useful open source repositories. Today we are taking a closer look at a few projects written in Clojure: clfx and cljfx css. Cljfx css is “charmingly simple styling” for cljfx. What’s under the hood of this styling library for JavaFX? Find out how it simplifies CSS for JavaFX and what requirements you need to run it. JavaFX is a client application platform used for devices built on Java; the latest version landed in September. Today, we are highlighting two projects for JavaFX built with Clojure, both by the same creator. GitHub user vlaaad developed the Cljfx and Cljfx CSS repos. Cljfx Cljfx is a declarative, functional Clojure wrapper for JavaFX. It is dynamic and provides a reagent-like experience for JavaFX apps. Under the hood, it takes some design inspiration from different parts of React, re-frame, and fn-fx. From the README: Like react, it allows to specify only desired layout, and handles all actual changes underneath. Unlike react (and web in general) it does not impose xml-like structure of everything possibly having multiple children, thus it uses maps instead of hiccup for describing layout. Like reagent, it allows to specify component descriptions using simple constructs such as data and functions. Unlike reagent, it rejects using multiple stateful reactive atoms for state and instead prefers composing ui in more pure manner. Like re-frame, it provides an approach to building large applications using subscriptions and events to separate view from logic. Unlike re-frame, it has no hard-coded global state, and subscriptions work on referentially transparent values instead of ever-changing atoms. Like fn-fx, it wraps underlying JavaFX library so developer can describe everything with clojure data. Unlike fn-fx, it is more dynamic, allowing users to use maps and functions instead of macros and deftypes, and has more explicit and extensible lifecycle for components. SEE ALSO: Java & Co.: Clojure and Kotlin are a great fit for the JVM, report shows In order to extend cljfx to fill in the missing gaps, users can create extension lifecycles. Creating an extension lifecycle requires a deep knowledge of cljfx. Refer to the cljfx.lifecycle namespace for an example of how it is implemented. On November 5, 2019, it added support for Java 8 with version 1.6.0. Cljfx requires tools.deps, Clojure 1.10 or newer, and cljfx added as a maven dependency. Cljfx CSS Let’s take a look at a styling library for JavaFX built in Clojure. Cljfx css is a styling library for JavaFX. CSS (Charmingly Simple Styling) can be implemented with vanilla JavaFX or with cljfx. Thus, it can be used with all JavaFX apps built with Clojure. According to the Cljfx CSS’s README, the rationale for its creation came from a desire to fix the problems CSS causes in JavaFX. Unfortunately, CSS is unavoidable, because controls don’t provide access to their internal nodes, and they can be targeted only with CSS selectors. What’s worse, JavaFX does not allow loading CSS from strings or some other data structures, instead expecting an URL pointing to a CSS file. In addition to that, CSS is not always enough for styling JavaFX application: not every Node is styleable (for example, Shapes aren’t). All this leads to a slow iteration cycle on styling and also to duplication of styling information in CSS and code. The library fixes all of the aforementioned issues by using a set of recommendations. It does so by providing a way for users to configure application style using Clojure data structures. With it, users can rapidly iterate in a live app. Users can define styles, register them, and feed the constructed URL to JavaFX. SEE ALSO: OpenAI finally releases “dangerous” large-scale unsupervised language model GPT-2 The CSS guidelines for JavaFX can oftentimes be complicated and involves a few confusing priority rules. Thus, the creator of cljfx css recommends users have the official reference guide on hand when styling applications. Clojure version 1.10 is required for cljfx css. Be the First to Comment!
https://jaxenter.com/cljfx-css-javafx-164063.html
CC-MAIN-2020-05
refinedweb
698
65.12
Many scientific Python users are surprised when I tell them that ndarray.take is faster than __getitem__-based (a.k.a. "fancy" as I call it) indexing. import numpy as np import random arr = np.random.randn(10000, 5) indexer = np.arange(10000) random.shuffle(indexer) In [26]: timeit arr[indexer] 1000 loops, best of 3: 1.25 ms per loop In [27]: timeit arr.take(indexer, axis=0) 10000 loops, best of 3: 127 us per loop It's actually kind of unbelievable when you think about it. What's going on here that take is almost 10x faster? I really should take a closer at the internals of what __getitem__ does because this has always struck me as pretty bad. Maybe I shouldn't be complaining? I mean, R 2.13's indexing falls somewhere in the middle: mat <- matrix(rnorm(50000), nrow=10000, ncol=5) set.seed(12345) indexer <- sample(1:10000) > system.time(for (i in 1:1000) mat[indexer,]) user system elapsed 0.460 0.197 0.656 So 656 microseconds per iteration. (In an earlier version of this post I used rpy2 to do the benchmark and got 1.05 ms, but there was apparently some overhead from rpy2) Another peculiarity that I noticed with out = np.empty_like(arr) In [50]: timeit np.take(arr, indexer, axis=0, out=out) 10000 loops, best of 3: 200 us per loop EDIT: I've been informed that using mode='clip' or mode='wrap' makes this run as fast as without the out argument. Weird! I was dissatisfied by this, so I got curious how fast a hand-coded little Cython function can do this: @cython.wraparound(False) @cython.boundscheck(False) def take_axis0(ndarray[float64_t, ndim=2] values, ndarray[int32_t] indexer, out=None): cdef: Py_ssize_t i, j, k, n, idx ndarray[float64_t, ndim=2] outbuf if out is None: outbuf = np.empty_like(values) else: outbuf = out n = len(indexer) k = values.shape[1] for i from 0 <= i < n: idx = indexer[i] if idx == -1: for j from 0 <= j < k: outbuf[i, j] = NaN else: for j from 0 <= j < k: outbuf[i, j] = values[idx, j] Don't worry about the -1 thing— that's a specialization that I'm using inside pandas. Curiously, this function is a lot faster than take using out but faster than the regular take by a handful of microseconds. In [53]: timeit lib.take_axis0(arr, indexer) 10000 loops, best of 3: 115 us per loop In [54]: timeit lib.take_axis0(arr, indexer, out) 10000 loops, best of 3: 109 us per loop Very interesting. TL;DR - Use takenot []-based indexing to get best performance - Cython is just as fast for my specific application and a lot faster if you're passing an out array (which I will be for the application that I needed this for) - R's matrixindexing performance is better than NumPy's fancy indexing, but about 5-6x slower than ndarray.take. This can probably be improved.
https://wesmckinney.com/blog/numpy-indexing-peculiarities/
CC-MAIN-2021-31
refinedweb
501
65.73
Vampire 1.4 is now available. See the web site for information on what Vampire is all about. For those who have been tracking Vampire already, the main new things of interest in this release are: - Vampire can now be used to intercept handlers other than that for the PythonHandler directive and it will be directed to a specific module indicated within the handlers section of the Vampire config file. Thus, if in your ".htaccess" file you might have: PythonAccessHandler vampire In your ".vampire" config file you might then have: [Handlers] accesshandler = %(__config_root__)s/modules/access-handler.py The handler function in the specified file must be the default for the particular directive, it cannot be modified like it can using "::" in the ".htaccess" file. - Special conventions can now be used in form arguments to denote data which should be translated to dictionaries and list. Specifically:. The code to achieve this bit of magic courtesy of some code from the FormEncode/Validator package made available by Ian Bicking. - The XmlRpcHandler class has been discarded completely. Instead, a much more low level request handler is provided whose job is only to parse the inbound request and then format the response. The actual execution of the request is passed off to a supplied callback. This callback must work out how to then map the request to a specific method. This means that in the first instance the support for XML-RPC requests is not as useful and more work is required to use it, but it opens things up so that more powerful things can be done. For example, a means of optionally having the request object also passed through to methods could also be implemented. For example: import vampire import types config = vampire.loadConfig(__req__,".vampire") modules = config.get("Modules","common") module = vampire.importModule("python-utils",modules) def handler(req): def _callback(req,name,params): if name[0:1] != "_": if module.__dict__.has_key(name): method = module.__dict__[name] if type(method) == types.FunctionType: if len(method.func_code.co_varnames) != 0: if method.func_code.co_varnames[0] == "req": params = list(params) params.insert(0,req) return method(*params) raise Exception("Method Unavailable") return vampire.serviceRequest(req,_callback) - A cut down "req" object is now available when the Python code file for a handler is being imported. This will be stored in the module as "__req__". Once importing of the module has been completed it will be deleted out of the module. The cut down "req" object allows access to PythonOption variables using get_options(), other mod_python settings using get_config(), as well as attributes such as "interpreter" etc. The "uri" and "filename" are also supplied such that the cut down "req" object can be used on configuration file lookup during module importing. This is shown in practice in XML-RPC example above. Enjoy. -- Graham Dumpleton (grahamd at dscpl.com.au)
https://modpython.org/pipermail/mod_python/2005-January/017186.html
CC-MAIN-2022-21
refinedweb
475
58.38
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 If you're using multiple development frameworks in a single application, you'll want them to complement each other. For instance, it's hard to add stateful behavior to Spring beans -- but not when you put JBoss Seam to the task. Too many developers think of a development framework choice as some kind of irrevocable decision. If you choose a framework for its strengths, this thinking goes, you're stuck with its weaknesses, too. But in many cases, you can use multiple frameworks in the same applications to allow their strengths to complement each other. In the first article in this series ("Spring into Seam, Part 1: Build a Seam-Spring hybrid component"), you saw some of the details of how two popular Java development frameworks -- Spring and JBoss Seam -- can work together. You learned how to build a Spring-Seam hybrid component that serves as a citizen of both frameworks. In this article, you'll see how these components can bring the strengths of one framework to the other. Specifically, you'll see how Seam can add stateful behavior to Spring beans -- something that is still a challenge to accomplish with Spring alone. If there's one thing you noticed in the first article in this series, it's that creating Spring-Seam hybrid components meant typing <seam:component> an awful lot. That's kind of a downer; after all, the goal of Seam is to reduce typing, and this tag is just adding to the pile of XML mess in Spring. Fortunately, there is an easier way to achieve the same end that leverages another highly anticipated feature of Spring 2.0: custom scopes. Custom scopes expand the choices for where instances of Spring beans can be stored. While Spring added the mechanism to support custom scopes, the built-in implementations are stuck in the past, only covering the scopes in the Servlet API (request, session, and application), plus a stateless scope named prototype. These scopes are ill-suited for modern business applications. To bring Spring up with the times, Seam registers a custom scope handler that allows Spring beans to be stored in Seam contexts. Uses include the (temporary) conversation scope for implementing the redirect-after-post pattern (sometimes called a flash); the (long-running) conversation scope for single-user page flows; and the business process scope to support interactions from multiple users over an extended period of time. At last, Spring beans can be stateful without having to resort to the crutch of the HTTP session! As it turns out, specifying a Seam scope on a Spring bean has the same effect as applying a nested <seam:component> tag to the bean definition in that it results in a Spring-Seam hybrid component. A two-for-one deal! To take advantage of this feature, you first need to register the Seam scope handler in any one of the Spring configuration files (but not more than once) using the tag in Listing 1. That configuration file must also declare the Seam namespace on the root element, which was explained in the first article in this series. <seam:configure-scopes/> To assign a Seam scope to a Spring bean, thus creating a Spring-Seam hybrid component, you simply set the scope attribute on a Spring <bean> definition -- or any custom namespace element in the Spring configuration that supports the scope attribute -- to one of the Seam scopes. The name of the scope is not case-sensitive. Archived Discussions (Read only)
http://www.javaworld.com/javaworld/jw-04-2008/jw-04-spring-seam2.html
CC-MAIN-2013-48
refinedweb
607
58.21
IRC log of svg on 2011-03-02 Timestamps are in UTC. 20:04:08 [RRSAgent] RRSAgent has joined #svg 20:04:08 [RRSAgent] logging to 20:04:10 [trackbot] RRSAgent, make logs public 20:04:12 [trackbot] Zakim, this will be GA_SVGWG 20:04:12 [Zakim] ok, trackbot; I see GA_SVGWG(SVG1)2:30PM scheduled to start 34 minutes ago 20:04:13 [trackbot] Meeting: SVG Working Group Teleconference 20:04:13 [trackbot] Date: 02 March 2011 20:04:33 [heycam] RRSAgent, this meeting spans midnight 20:05:46 [Zakim] GA_SVGWG(SVG1)2:30PM has now started 20:05:53 [Zakim] + +1.649.363.aaaa 20:06:14 [jwatt] jwatt has joined #svg 20:07:02 [birtles] birtles has joined #svg 20:08:16 [shepazu] shepazu has joined #svg 20:08:52 [anthony_nz] anthony_nz has joined #svg 20:10:51 [birtles] 20:13:12 [Zakim] +tbah 20:13:33 [birtles] Presentation: 2 Animation.html 20:13:43 [birtles] Presentation: 20:15:19 [roc] roc has joined #svg 20:29:21 [AD] AD has joined #svg 20:29:40 [heycam] Scribe: Cameron 20:29:44 [heycam] ScribeNick: heycam 20:29:50 [heycam] Topic: overflow auto 20:29:59 [heycam] RO: the spec currently says that overflow:auto should be treated as visible 20:30:04 [heycam] ... that is incorrect 20:30:12 [heycam] ... in non SVG contexts, overflow:auto clips 20:30:17 [heycam] ... scrollbars if necessary, btu always clips 20:30:23 [heycam] ... for consistency, overflow:auto should be interpreted as clipping 20:30:29 [heycam] ... I don't think we should add scrollbars in SVG 20:30:32 [heycam] ... it's a pain 20:30:39 [heycam] ... we don't have that feature currently, don't want to add it now 20:30:46 [heycam] ... so we should make overflow:auto clip to be consistent with HTML 20:30:58 [heycam] ED: are the use cases for HTML and SVG different? 20:31:03 [heycam] ... for us, implementation wise it's cheaper to not clip 20:31:05 [heycam] ... but that's a detail 20:31:09 [heycam] ... in that sense I don't really care 20:31:16 [heycam] ... it makes it easier for people not to clip 20:31:19 [heycam] RO: auto is not the default value 20:31:22 [heycam] ... the default is visible 20:31:31 [heycam] ... so it only affects people who say overflow:auto 20:31:48 [heycam] ... people setting overflow:auto and expecting it to have no effect is unlikely 20:31:51 [heycam] DS: what about scroll? 20:31:59 [heycam] RO: the spec says treat it as hidden 20:32:20 [heycam] ... I'm saying treat overflow: auto, scroll, hidden all the same 20:32:43 [heycam] ... we provide scrollbars on the viewport 20:32:47 [heycam] ... but this is for a non-root element 20:32:50 [heycam] ... the root element is special 20:32:51 [heycam] DS: ah ok 20:33:07 [heycam] RO: css defines that, and we do that for svg 20:33:09 [heycam] ... which makes sense 20:33:13 [heycam] ... this is for non-root SVG elements 20:33:24 [heycam] CM: how does this relate to markers? 20:33:46 [heycam] ED: markers are overflow:hidden by default 20:34:07 [heycam] RO: so that would be totally unaffected 20:34:39 [heycam] ED: we probably need more tests around overflow 20:35:00 [heycam] RO: CSS is reinterpreting overflow as a shorthand for overflow-x and overflow-y 20:35:08 [heycam] ... if one of them is not visible, then the other one is treated as hidden 20:35:13 [heycam] ... so you can't clip in one axis only 20:35:24 [heycam] ... SVG should probably change that, but that's a separate issue 20:35:42 [heycam] ... so we need to add text to say that overflow: auto, hidden and scroll should all clip 20:36:24 [heycam] RESOLUTION: overflow:auto will be treated as hidden 20:38:33 [heycam] Topic: shorthand presentation attributes 20:40:10 [heycam] CM: if overflow becomes a shorthand, then what happens to the overflow="" presentation attribute? 20:40:24 [heycam] ... we have rules to say that we don't have presentation attributes for shorthands 20:40:27 [heycam] ... I think that should change 20:48:38 [heycam] ACTION: Cameron to write a proposal for allowing shorthand presentation attributes 20:48:38 [trackbot] Created ACTION-2992 - Write a proposal for allowing shorthand presentation attributes [on Cameron McCormack - due 2011-03-09]. 20:49:23 [anthony_nz] Scribe: Anthony 20:49:27 [anthony_nz] ScribeNick: anthony_nz 20:49:28 [birtles] 20:49:54 [birtles] Presentation: 20:49:56 [ed] Topic: Animation improvements 20:50:15 [anthony_nz] BB: The presentation is pretty much the same as what's on the wiki 20:50:28 [anthony_nz] ... The topic is "what we are going to do with SMIL" 20:50:33 [anthony_nz] ... want to keep it high level 20:50:43 [anthony_nz] ... and decide on what direction we want to head 20:51:00 [anthony_nz] ... What are we trying to solve with declarative animation? 20:51:14 [anthony_nz] ... The presentation is just to give some background 20:51:19 [anthony_nz] ... for discussion later on 20:51:38 [anthony_nz] ... the question is what we want to do with SMIL: drop it, patch it or something in between 20:52:00 [anthony_nz] ... [goes through presentation] 20:53:41 [anthony_nz] ROC: If you're creating the image from scratch, but if you want to import some other animated image and your tool doesn't understand the JS library that was used 20:53:44 [anthony_nz] ... then you're stuck 20:54:02 [anthony_nz] ... one thing that SMIL gives you is a standard vocabulary 20:54:23 [anthony_nz] BB: The trouble is what tools 20:54:30 [anthony_nz] ... and I don't think that hasn't been realised yet 20:54:38 [anthony_nz] DS: We know we need tools for animation 20:54:44 [anthony_nz] ... and that is going to emerge 20:54:56 [anthony_nz] ... and it is important that we keep the facility in there to keep that interchange 20:55:22 [anthony_nz] ED: Wanted to say something about the first point. There is small possibility to optimise things if you know what's going to happen in the document 20:55:30 [anthony_nz] ... with script it is a bit more difficult 20:55:47 [anthony_nz] ... in animation it is more possible to do some optimisations 20:56:33 [anthony_nz] CM: There is probably still more chances for bridges between JS and animation 20:56:38 [eseidel] eseidel has joined #svg 20:56:51 [anthony_nz] ... have the timing done in the animation but have the values fed by script 20:57:08 [anthony_nz] DS: That actually comes close to defining a script library defined by animation 20:57:25 [anthony_nz] BB: [continues with presentation] 20:58:01 [Zakim] -tbah 20:58:27 [eseidel] eseidel has joined #svg 20:58:28 [Zakim] +tbah 20:59:02 [anthony_nz] DS: One thing that SMIL can't do is get the mouse position. So perform animation based on mouse position 20:59:40 [anthony_nz] ... you frequently want to move something around with the mouse and you want to be able to do that declaratively 20:59:58 [anthony_nz] BB: [Continues with presentation] 21:00:20 [anthony_nz] ... [Slide: But SMIL isn't perfect...] 21:01:07 [anthony_nz] ... [Slide: SMIL is complicated by syncbase timing] 21:02:14 [anthony_nz] ED: Between fragments you mean between separate SVG paths? 21:02:26 [anthony_nz] ... I don't think it's defined in the spec or in CDF 21:02:33 [heycam] s/paths/files/ 21:02:51 [ed] s/svg paths/svg fragments/ 21:02:57 [anthony_nz] BB: [Slide: SMIL is complicated by syncbase timing contd.] 21:03:28 [anthony_nz] ... [Slide: Remove syncbase timing and replace with time containers] 21:03:55 [anthony_nz] ... [Slide: SMIL 3 time containers - <par>] 21:04:41 [anthony_nz] ... [Slide: SMIL 3 time containers - <excl>] 21:04:55 [anthony_nz] ... [Slide: SMIL 3 time containers - nested contd.] 21:05:08 [anthony_nz] ... [Slide: Wins] 21:05:37 [anthony_nz] DH: What do you mean cancel the group? 21:06:17 [anthony_nz] BB: If you have all these animations grouped together and you end that group then all the children will end as well 21:06:26 [anthony_nz] ... so allows you to cancel that chain which you previously couldn't do 21:06:44 [anthony_nz] ... so that's one of the advantages of having time containers and sync based timing 21:06:54 [anthony_nz] ... [Slide: Challenges] 21:07:04 [anthony_nz] ... [Slide: Challenges contd.] 21:07:47 [anthony_nz] AG: You mean deprecating? 21:08:29 [anthony_nz] BB: Might be a bit harsh, just say somethings don't work with the new containers 21:08:44 [anthony_nz] DS: I basically deprecating, means we recommend don't using this feature 21:09:26 [anthony_nz] BB: One of the issues with sync based timing you need to go through all the events when you do a sync 21:09:57 [anthony_nz] ... we can keep event based timing, because that would allow you to do a lot of the current use cases 21:09:59 [dholbert] s/do a sync/do a seek/ 21:10:41 [anthony_nz] DS: If you had them in the same time container, then you'd be guaranteed of syncronisation. I like that you can syncronise multiple resources 21:10:56 [anthony_nz] ... then if event based timing doesn't guarantee that, then I'd be worried 21:12:10 [anthony_nz] BB: You can still syncronise event based timing using a time stamp 21:13:18 [anthony_nz] ED: Another point with sync based thing, is that if you have an SVG image would that impose some restrictions 21:14:22 [anthony_nz] BB: Some complex interactions would not be supported 21:14:35 [anthony_nz] ... where two different elements can trigger the animation 21:15:25 [anthony_nz] ED: There is a repeat event which is event based 21:15:34 [anthony_nz] BB: But it describes a qualified repeat event 21:16:20 [ed] s/would that impose some restrictions/would that impose some restrictions, because it's being suggested that eventbase timing wouldn't be allowed in svg-in-img/ 21:16:52 [anthony_nz] BB: ... [Slide: Limiting the scope] 21:17:32 [anthony_nz] CM: In SVG you use structure alot to control the rendering. If you introduce the containers control the timing 21:17:39 [ed] s/There is a repeat event which is event based/There is a repeat event which is event based, but there's also repeat-value which isn't the same exactly as event-base/ 21:18:35 [anthony_nz] BB: As it stands that is an issue, and you would need to redo where you are putting all your animations and all that 21:19:16 [anthony_nz] DS: Bitflash based on one of their customers needs, added a state machine, I noticed one of the things you were going to talk about was reversing animations 21:19:22 [anthony_nz] ... specifically they added SCXML 21:19:44 [anthony_nz] ... the state machine was attractive because you could define how things interact under changed conditions 21:19:55 [anthony_nz] ... if you're in this state do this thing, etc 21:20:03 [anthony_nz] ... I authored to it and I found it very handy 21:20:18 [anthony_nz] ... their extension of it would allow you keep the history of what had gone one 21:20:44 [anthony_nz] ... navigating around a UI using the state machine would allow the reuse of animations 21:20:57 [anthony_nz] ... it was completely declarative 21:21:07 [anthony_nz] ... not sure where that fits with your proposal 21:21:30 [anthony_nz] BB: There is a whole bunch of stuff in the SMIL state and I was thinking about that recently 21:21:41 [anthony_nz] ... because I thought it would be good to be able to track state more 21:22:08 [anthony_nz] DS: When we are talking about the animation use case, I think the state machine would be very useful for handling the sync for UI stuff 21:22:21 [anthony_nz] ... I think we should take a serious look at it 21:22:56 [heycam] 21:23:07 [anthony_nz] BB: [Slide: Limiting the scope] 21:23:18 [pdengler] pdengler has joined #svg 21:23:37 [anthony_nz] ... [Slide: Structural manipulations need specification] 21:23:46 [anthony_nz] ... not defined in SMIL so we need to 21:23:54 [anthony_nz] DS: They didn't anticipate script 21:24:10 [anthony_nz] CL: They were very much looking at authoring tools, because of the people involved 21:26:05 [anthony_nz] ... One of the guys that really understands it has joined this working group now and he's interested in reworking it 21:26:23 [Zakim] -tbah 21:26:43 [Zakim] - +1.649.363.aaaa 21:26:44 [Zakim] GA_SVGWG(SVG1)2:30PM has ended 21:26:46 [Zakim] Attendees were +1.649.363.aaaa, tbah 21:26:53 [heycam] Zakim, room for 4 21:26:53 [Zakim] I don't understand 'room for 4', heycam 21:26:54 [heycam] Zakim, room for 4? 21:26:55 [Zakim] ok, heycam; conference Team_(svg)21:26Z scheduled with code 26631 (CONF1) for 60 minutes until 2226Z 21:27:03 [Zakim] Team_(svg)21:26Z has now started 21:27:10 [Zakim] + +1.649.363.aaaa 21:27:27 [Zakim] +tbah 21:28:34 [ed] (15min break) 21:28:41 [Zakim] -tbah 21:29:05 [anthony_nz] BB: [Slide: Structural manipulations need specifications] 21:31:22 [tbah] I'm done for the night so Patrick could dial in direct (it was a better connection than through the bridge). 21:37:03 [Zakim] - +1.649.363.aaaa 21:37:05 [Zakim] Team_(svg)21:26Z has ended 21:37:05 [Zakim] Attendees were +1.649.363.aaaa, tbah 21:37:34 [heycam] Zakim, room for 3? 21:37:36 [Zakim] ok, heycam; conference Team_(svg)21:37Z scheduled with code 26633 (CONF3) for 60 minutes until 2237Z 21:38:35 [Zakim] Team_(svg)21:37Z has now started 21:38:41 [Zakim] + +1.649.363.aaaa 21:41:53 [pdengler_home] pdengler_home has joined #svg 21:45:19 [heycam] Zakim, who is on the call? 21:45:19 [Zakim] On the phone I see +1.649.363.aaaa 21:45:38 [pdengler_home] that's me 21:47:27 [Zakim] + +1.425.868.aabb 21:47:56 [birtles] 21:48:00 [birtles] Presentation: 21:48:28 [anthony_nz] BB: [Slide: Structural manipulations need specification] 21:48:59 [ed] ed has left #svg 21:49:01 [anthony_nz] ... [Slide: Specify and test structural manipulations] 21:49:06 [ed] ed has joined #svg 21:49:37 [anthony_nz] ... [Slide: Discrete to-animation is counter-intuitive] 21:50:21 [anthony_nz] ... [Slide: Fix discrete to-animation] 21:50:39 [karl] karl has joined #svg 21:50:51 [anthony_nz] ... [Slide: Frozen to-animation is broken] 21:53:33 [anthony_nz] ... [Slide: The requirement for an end-instance time is confusing] 21:54:36 [Zakim] - +1.649.363.aaaa 21:55:11 [Zakim] + +1.649.363.aacc 21:55:23 [heycam] Zakim, who is on the call? 21:55:23 [Zakim] On the phone I see +1.425.868.aabb, +1.649.363.aacc 21:57:01 [anthony_nz] BB: Basically if doesn't find an end instance it just sits there 21:57:07 [anthony_nz] AD: It never starts 21:57:14 [anthony_nz] CM: Doesn't create the interval? 21:57:30 [anthony_nz] BB: After that first interval it will never find the end time 21:57:44 [anthony_nz] ... [Slide: Fix end-instance condition] 21:58:13 [anthony_nz] ... [Slide: min/max aren't necessary useful] 21:58:22 [anthony_nz] CM: Can you explain what the use cases are? 21:58:45 [anthony_nz] BB: Just put a cap on the length on your child animations without knowing anything about them 21:59:17 [anthony_nz] CL: If you have all these time animations and you want them to end a certain point then you specify the ending time for them 21:59:20 [anthony_nz] ... then they all stop 21:59:30 [anthony_nz] BB: [Slide: animateTransform] 22:00:47 [anthony_nz] DS: One of the things I hate is the term "fill" on animations 22:01:04 [anthony_nz] ... you had to determine by the context what "fill" meant 22:01:14 [anthony_nz] CM: In CSS it is animation-fill-mode 22:01:23 [anthony_nz] JW: What are the values? 22:01:28 [anthony_nz] CM: Before, after, both 22:01:41 [anthony_nz] ... both means to fill backwards before the animation 22:02:03 [anthony_nz] ... the property value you can't understand it in isolation 22:02:14 [anthony_nz] BB: [Slide: Reversing animations] 22:03:38 [anthony_nz] CL: So you had the mouse over the button and it grew as big as it could then went back to the original size 22:03:44 [anthony_nz] ... SMIL doesn't have this concept 22:04:01 [anthony_nz] ... [Slide: Add a reverse feature to time containers] 22:04:29 [anthony_nz] s/... [Slide: Add a reverse feature to time containers]/BB: [Slide: Add a reverse feature to time containers]/ 22:04:38 [anthony_nz] JW: Maybe call it rewind? 22:04:50 [anthony_nz] BB: [Slide: Add a reverse feature to time containers contd.] 22:06:12 [anthony_nz] ... need to work out if want to do an ease in then an ease out or an ease in then an ease in going in reverse 22:06:21 [anthony_nz] ... might need to do the exact reverse 22:06:28 [anthony_nz] AD: I think that would be the logical thing to do 22:06:43 [anthony_nz] ... running the clock backwards 22:07:54 [anthony_nz] ... would need to work out how to specify it 22:08:04 [anthony_nz] BB: [Slide: Re-use animations] 22:08:54 [anthony_nz] BB: [Slide: Re-use animations contd.] 22:09:38 [anthony_nz] ... [Slide: Brief overview of SMIL Timesheets] 22:10:18 [anthony_nz] CL: That would be really nice with :target 22:10:46 [anthony_nz] BB: [Slide: Selectors can be nested] 22:11:12 [anthony_nz] ... [Slide: Other features introduced by SMIL Timesheets] 22:12:12 [anthony_nz] DS: Can I trigger something manually for when I'm making a presentation 22:12:21 [anthony_nz] CL: You'd want two triggers in that case 22:12:35 [anthony_nz] ... When the time hits or when I press the mouse 22:12:38 [anthony_nz] BB: Not sure 22:12:59 [anthony_nz] ... [Slide: Consider integrating SMIL Timesheets] 22:14:20 [anthony_nz] CL: If you're animating class it's a discrete animation 22:14:38 [anthony_nz] BB: Need to define how it all gets resolved 22:14:55 [anthony_nz] ... [Slide: Migration path] 22:15:59 [anthony_nz] CL: So the first one has a slight risks regarding confusions 22:16:06 [anthony_nz] ... the second one is more what we are doing 22:16:18 [pdengler_home2] pdengler_home2 has joined #svg 22:16:34 [anthony_nz] ... the third seems somewhat drastic but if we are combining SMIL and CSS animation then we are harmonising it 22:16:48 [anthony_nz] ... At the end of the day it's also about animating HTML as well 22:17:18 [anthony_nz] ... So I can see the third option as long as it does right 22:17:57 [anthony_nz] DS: I think using the word SMIL is somewhat dangerous, because SMIL can mean different things to different people 22:18:42 [anthony_nz] ... There is also the case where people will compare it to SMIL 22:19:01 [anthony_nz] ... There are some people out there that dislike SMIL so it might not be as friendly to them 22:19:15 [anthony_nz] ... If we are going to change it dramatically, I'm not sure the second way makes sense 22:19:27 [anthony_nz] ... We could have backwards compatibility with SVG 1.1 22:19:34 [pdengler_home2] I don't think I have been bashful about this. This is a great presentation. I believe we should focus on one animation engine/syntax. I thought this is what we exited Lyon with. Why would we continue to enhance something that no web developer is looking at? Let's take these ideas/proposals to CSS :) 22:20:40 [AD] AD has joined #svg 22:20:49 [anthony_nz] DS: One concern I have is as flawed as it is, and if we are going to reinvent the wheel we should be careful about what we do 22:20:54 [anthony_nz] ... we may introduce new problems 22:21:04 [anthony_nz] ... so we need to be careful about what we do with the new stuff 22:21:05 [pdengler_home2] I don't disagree; just like in other areas (gradients, transforms, etc) this group has a lot of experience. We can contribute to a single effort and spread the knowledge more quickly. 22:22:11 [anthony_nz] AD: In terms of web animations 1.0. One of the things we want to achieve is harmony between CSS and SVG. We take the things that we think are good in SMIL 22:22:23 [anthony_nz] ... and add that to Web 1.0 along with the new stuff 22:22:49 [anthony_nz] ... I'm not talking about breaking with the syntax, I'm talking about taking a subset 22:22:58 [anthony_nz] ... and adding that to Web animation 1.0 22:23:38 [anthony_nz] ... We kind of deprecate the SMIL stuff we say is not useful but provide better alternatives 22:23:53 [anthony_nz] CL: It's a gradual already ramp up 22:24:01 [anthony_nz] ... to a certain extent the process has already started 22:24:11 [anthony_nz] ... it will be more widely available when we have first working draft 22:24:18 [anthony_nz] DS: I am curious about time lines 22:24:26 [anthony_nz] ... when do we realistically think this could be done 22:24:39 [anthony_nz] ... I'd like to see some of this stuff in the next releases of web browsers 22:24:44 [anthony_nz] ... these time lines are important 22:25:53 [heycam] Scribe: Cameron 22:25:55 [heycam] ScribeNick: heycam 22:26:23 [heycam] JW: if there are resources available in the css animation community, and those in smil, and can collaborate in the short term, maybe it can happen quickly 22:26:28 [heycam] ... but I don't know if that will happen 22:26:32 [heycam] AD: i really like the reverse stuff 22:26:49 [heycam] JW: i'm more concerned about if we're chopping up smil, or doing something else, we should do it pretty soon 22:27:05 [heycam] DS: i'm also concerned with having 3 major vendors here, with 1 mobile vendor, all on the same page 22:27:11 [heycam] ... we don't have google/webkit people here 22:27:18 [heycam] ... authoring tool people? 22:27:41 [heycam] CL: authoring tool people would be unwise to start now, if we're going to change things 22:27:47 [heycam] ... unless you're right in the discussions 22:27:53 [heycam] DS: so they should participate in the discussions 22:27:56 [heycam] ... content creators, too 22:30:16 [anthony_nz] Scribe: Anthony 22:30:21 [anthony_nz] ScribeNick: anthony_nz 22:39:37 [pdengler_home2] For this proposal, my key contributions are the scenarios and the properties/attributes that I think we need to animate to satisfy them. 22:39:58 [pdengler_home2] My approach is to keep the list of attributes/properties constrained also to simple types so as to no introduce complicated interpolation issues. 22:40:11 [ed] 22:40:14 [pdengler_home2] This should is consistent with my original proposal last year to keep SVG 2.0 scenario and use case driven, and incremental. 22:40:24 [anthony_nz] PD: This is to reduce complexity 22:40:24 [pdengler_home2] Also, supports Jonathon’s desire to move quickly. 22:40:35 [pdengler_home2] Further simplification attempts to avoid the discussion of animVal by using the CSS model. 22:40:47 [pdengler_home2] Though there is a recommended proposal for promoting attributes to properties I was sufficiently convinced for good reasons why this is not a wise idea and these are indicate by Cameron here: 22:41:10 [pdengler_home2] I like these proposals and could live with any that satisfy the scenarios put forth, and that don’t push us into a corner. 22:41:23 [pdengler_home2] The key is to also recognize the imperative need to coordinate with the CSS working group. I’ve tried contacting Dean with this proposal but I do not believe I got a response. 22:41:54 [pdengler_home2] As a group we should decide as to whether or not we should be doing this (obviously I think yes), if yes, then choose a model which does not paint us into a corner, and get it socialized quickly with CSS. 22:42:47 [anthony_nz] PD: I believe my proposal doesn't quite work given Cameron's comments 22:43:09 [heycam] 22:43:12 [anthony_nz] CM: All this is based on that you should be able to use the CSS Animation syntax to target things which are currently not properties in SVG 22:43:25 [anthony_nz] ... Section 1 presents a few different ways in achieving that goal 22:44:08 [anthony_nz] ... Simplest on the surface would be to convert all these attributes we think are worth animating into properties 22:44:09 [jwatt] jwatt has left #svg 22:44:11 [jwatt] jwatt has joined #svg 22:44:26 [anthony_nz] ... then naturally they will animatable with CSS animations 22:45:01 [anthony_nz] ... [Reads downsides from wiki] 22:45:46 [anthony_nz] CL: The definition in CSS 2.1 is very precise for width and height 22:46:00 [anthony_nz] ... could run into problems with inheriting 22:46:32 [anthony_nz] CM: So this proposal is promoting to properties and using the exact names we have for attributes 22:47:30 [anthony_nz] ... A major issue is that changes the distinction between attributes and properties 22:48:04 [anthony_nz] ... There is a chance here to allow that sort of distinction to say which are styling attributes and which are presentation attributes 22:48:57 [anthony_nz] CL: We were thinking about this and we'd ask what would make sense to re-style on a graphic 22:49:07 [anthony_nz] ... geometry ended up being content in that way 22:50:25 [anthony_nz] DS: One of the most important semantics about SVG is about how it is interpreted by accessibility agents 22:50:42 [anthony_nz] ... and how SVG can be made accessible is not defined 22:50:59 [anthony_nz] CM: The next point against this proposal is the whole SVG DOM interface 22:51:31 [anthony_nz] ROC: We can have them reflect the CSS animated values 22:51:35 [anthony_nz] ... and we can keep them 22:51:51 [anthony_nz] CM: Another issue is which particular set of attributes we'd promote to properties 22:52:07 [anthony_nz] ... in this proposal I think you should convert all the animatable attributes 22:52:18 [pdengler_home2] The only objection I have to that is staging/timing 22:52:21 [anthony_nz] ... this is so we have the same functionality between CSS animations 22:52:47 [anthony_nz] ... I think Patrick argument is starting with a smaller set is it is achievable goal 22:52:49 [homata_] homata_ has joined #svg 22:53:09 [pdengler_home2] Interopolation is the item I worry about, but they may already be well specified with SMIL 22:53:41 [anthony_nz] CL: If we do a certain subset and they don't scale across then we've painted ourselves into a corner 22:53:56 [anthony_nz] ... If we were going to promote things to properties then we'd do them all at once 22:53:56 [pdengler_home2] Either way we should nail the syntax that CSS animations and transitions need to pick up to target attributes and start there, yes? 22:54:01 [anthony_nz] ... but I still think that is a bad idea 22:54:10 [anthony_nz] ... because it has a lot problems 22:54:57 [anthony_nz] CM: This is probably the fundamental issue about how to target these attributes 22:55:11 [anthony_nz] ... the biggest argument against this proposal is the names these attributes have 22:55:29 [anthony_nz] ... we have attributes that have name as existing properties 22:55:41 [anthony_nz] ... and we may limit CSS from expanding into certain areas 22:56:27 [anthony_nz] CL: One of the other differences between properties and attributes 22:56:36 [anthony_nz] ... is properties can apply to all elements 22:56:51 [anthony_nz] ... so if we have a circle radius, it means that every element has a circle radius 22:57:08 [pdengler_home2] Isn't that already the case with stop-color for example? 22:57:12 [anthony_nz] ... it's pointless to have a radius on all elements 22:57:25 [anthony_nz] ... In CSS they want to restrict the property set 22:58:13 [anthony_nz] ... so if look at proposals they normally choose the proposal that has the least number of properties 22:58:38 [anthony_nz] ROC: We should actually check to see how many properties we have 22:58:42 [anthony_nz] ... and what can be grouped together 22:58:54 [anthony_nz] ... it is a lot of properties but you're adding more leverage to CSS 22:59:07 [anthony_nz] DS: Some people want to do more of what we do in SVG in CSS 23:00:35 [pdengler_home2] I thought it was generally agreed upon in Lyon that animating attributes in CSS was a goal. I agree that introducing more properties / aligning properties could take time. Could we start with attributes and worry about what’s a property and what does inheritance mean later (I realize this is against my proposal) 23:00:54 [anthony_nz] CM: So there already are CSS properties that only apply to certain SVG elements 23:00:58 [anthony_nz] ... and like wise for HTML 23:02:00 [anthony_nz] ... Second proposal is the same as the first 23:02:10 [anthony_nz] ... but giving new names 23:02:18 [anthony_nz] CL: So it's really an alias 23:02:37 [anthony_nz] CM: They are given unique names to avoid conflicts and short names e.g. "r' 23:02:46 [anthony_nz] s/"r'/"r"/ 23:03:21 [anthony_nz] CM: You could introduce a circle radius attribute to maintain consistency and say how they both work 23:03:41 [anthony_nz] ... and secondly you could break the naming correspondence 23:04:05 [anthony_nz] CL: I'd prefer to have a table that has the correspondence between the properties and the attributes 23:04:24 [anthony_nz] ... I guess people may start putting it in as an attribute and wondering why it's not working 23:04:33 [anthony_nz] CM: Third is to not do an promotion 23:04:38 [pdengler_home2] Me too! 23:04:54 [anthony_nz] ... and make attributes animatable by CSS Animations 23:05:01 [pdengler_home2] Yes, I changed my mind; I never came up with a syntax that worked but Cameron did. 23:06:10 [anthony_nz] CM: The simple way is to just allow the attribute names where you can put property name inside the key sets 23:06:23 [anthony_nz] ... then it's unclear if it's a property name or attribute name 23:06:52 [anthony_nz] ... you're stepping on the namespace area again 23:07:16 [pdengler_home2] YES! Perfect Chris! 23:07:52 [anthony_nz] CL: CSS has rect { transition: (attr x) 0.5s; animation: a 0.5s both infinite } 23:07:55 [AD] rect { transition: attr(x) 05.s ... 23:08:21 [pdengler_home2] ship it 23:08:49 [anthony_nz] ROC: attr() seems like the right thing to me 23:09:06 [anthony_nz] ... because it's existing syntax and it's already there 23:09:33 [anthony_nz] CM: Downside is the animation attributes is quite different about how you specify properties 23:10:20 [anthony_nz] ... The third code snippet is a different proposal in this domain 23:10:52 [anthony_nz] CL: How would you evaluate that one compared to attr() 23:11:51 [anthony_nz] ... currently attr is used on the right hand-side of the ":" 23:12:10 [anthony_nz] CM: I don't think CSS people would be happy with using that in normal rule sets 23:13:24 [anthony_nz] ... These last few code snippets have the same idea 23:13:59 [anthony_nz] ... Why do I prefer promoting properties - it seems less of a hack 23:14:03 [anthony_nz] ... doesn't require new syntax 23:14:14 [anthony_nz] ... I like the idea of extending the scope of properties 23:14:20 [anthony_nz] ... the downside is quite a small set 23:14:41 [anthony_nz] DS: I don't particularly care for the semantics argument 23:14:53 [anthony_nz] ... the semantics argument is not a strong one in my opinion 23:15:23 [anthony_nz] CM: If we can animate these things with CSS animations why wouldn't you want style these things regularly 23:15:39 [pdengler_home2] Whether or not we want to style them, IMHO is a seperate argument. I don't want to style stdDeviation 23:15:41 [anthony_nz] DS: Because of all the problems with promoting them to properties 23:16:51 [anthony_nz] CM: Rest of the page is timing and interpolation functions and features that are missing 23:17:05 [anthony_nz] ... and also how the sandwiches interact 23:17:19 [anthony_nz] ... and a lot more so questions rather specific answers 23:19:19 [anthony_nz] ROC: First of all, David Barron will be implementing CSS Animations in Gecko 23:19:32 [heycam] s/Barron/Baron/ 23:19:40 [anthony_nz] ... he's got a lot of knowledge in Transitions and Animations 23:20:12 [anthony_nz] DS: So Chris do you predict any issues with putting attr on the left-hand side 23:20:21 [anthony_nz] CL: Some 23:20:45 [anthony_nz] ROC: In the context of animations it's doable 23:21:03 [anthony_nz] ... in the context of actually doing it, it's probably not doable 23:21:10 [anthony_nz] CL: It depends on why we would be doing this 23:21:31 [anthony_nz] ... if the point is to get CSS Animation to work 23:21:39 [anthony_nz] ... if the point is to style anything 23:22:00 [anthony_nz] ROC: In the key frame stuff, it would work 23:22:04 [anthony_nz] ... not for general stuff 23:22:26 [anthony_nz] PD: Is this also Transitions? 23:22:29 [anthony_nz] CL: Yes 23:23:35 [anthony_nz] CM: So you don't have a problem with attr() on the left-hand side of the ":" 23:23:42 [anthony_nz] ... because you need that for Transitions 23:23:45 [anthony_nz] ROC: Why? 23:24:52 [anthony_nz] CL: Transitions are triggered by certain things - changes attribute 23:25:05 [anthony_nz] ROC: All Transitions says, when something changes make the change smooth 23:25:33 [anthony_nz] CM: [Writes on the board] 23:25:56 [anthony_nz] ... rect {transition: attr(x) 1s} 23:26:02 [homata_] homata_ has joined #svg 23:26:10 [anthony_nz] ... rect: hover {attr(x): 50x} 23:26:19 [anthony_nz] ROC: We shouldn't allow rect: hover 23:26:35 [anthony_nz] CM: So you're saying that CSS Transitions can never change attributes 23:27:53 [anthony_nz] ... Patrick do you have any thoughts about transitions not working CSS styled transition animations? 23:28:06 [anthony_nz] ... the second rule is a straight style rule 23:28:15 [anthony_nz] ... what if you change the x in the DOM 23:28:19 [anthony_nz] ... would that cause a Transition? 23:28:23 [anthony_nz] ROC: Yes 23:30:07 [anthony_nz] DS: If you already have the underlaying model, then changing the parser to set up the model seems trivial 23:30:12 [anthony_nz] CL: I agree 23:30:22 [anthony_nz] ... it's the core animation stuff and how you do your display 23:31:25 [pdengler_home2] so attr() works on transitions, animations and selectors? 23:31:32 [anthony_nz] ROC: I would like to run it by David Baron 23:31:37 [anthony_nz] ED: I will ask the people at Opera 23:32:54 [anthony_nz] CM: The result of this discussion is that putting attr() in regular style rules on the left-hand side wouldn't work 23:33:09 [anthony_nz] ... but the attr() in the Transition would still work 23:33:12 [pdengler_home2] rect:hover{attr(x): 50px} 23:33:21 [anthony_nz] PD: That's not supported? 23:33:24 [anthony_nz] CL: Correct 23:33:35 [anthony_nz] ... you'd thrash the DOM doing it that way 23:33:42 [anthony_nz] CM: The work around is to make a CSS Animation 23:34:05 [anthony_nz] ... because you can make the animation apply on the :hover 23:35:50 [anthony_nz] ... We can discuss the proposal at the next FX call 23:36:10 [anthony_nz] ... in two weeks 23:36:11 [ed] next fx telcon will be in two weeks time 23:36:27 [anthony_nz] CL: Get it finialised if we meet in June with CSS Working Group 23:38:56 [anthony_nz] RESOLUTION: We prefer to use the attr() solution that allows CSS animations to target SVG attributes directly rather promoting attributes to properties 23:39:08 [ed] (break for lunch) 23:39:57 [Zakim] - +1.425.868.aabb 23:40:04 [Zakim] - +1.649.363.aacc 23:40:06 [Zakim] Team_(svg)21:37Z has ended 23:40:07 [Zakim] Attendees were +1.649.363.aaaa, +1.425.868.aabb, +1.649.363.aacc 00:21:51 [pdengler_home2] I sent some of you an email with files to support our intrinsic sizing discussion. If I am late, please begin without me and I will catch up. See the agenda page for clear information about what we discovered. 00:22:03 [pdengler_home2] Jonathan has been working on this for a while and shared his tests with all of us a long time ago. 00:22:17 [pdengler_home2] We wanted to share some tests back and perhaps we can use them as a test bed for the test framework discussed on Monday. 00:22:23 [pdengler_home2] We believe that these tests are accurate to the specification and where we believe the spec to be ambiguous, is within the spirit of the specification and/or interoperable. 00:22:26 [pdengler_home2] So we can start with what we found ( ) and I can post a test page with images. 00:22:30 [pdengler_home2] For the tests, you will notice that indeed IE9 passes all of them; this is because we used these tests to develop our platform. 00:22:43 [pdengler_home2] As indicated on the email DL, after our latest platform preview we caught some sizing discrepancies between our implementation and the spec; we subsequently made adjustments 00:22:53 [pdengler_home2] At the time of the change we aligned with Firefox beta. I think Firefox made adjustments for interop based upon our implementation (I think that’s what Rob said). 00:22:59 [pdengler_home2] My apologies on this and my lack of communication on our last minute updates. They were fast and furious and as I promised these tests we want to contribute and believe that they accurately reflect the specification. 00:23:52 [pdengler_home2] (be back shortly0 00:37:40 [birtles] birtles has joined #svg 00:41:44 [heycam] Zakim, room for 3? 00:41:46 [Zakim] ok, heycam; conference Team_(svg)00:41Z scheduled with code 26631 (CONF1) for 60 minutes until 0141Z 00:42:11 [Zakim] Team_(svg)00:41Z has now started 00:42:17 [Zakim] + +1.649.363.aaaa 00:43:32 [ed] i see that the examples patrick mailed out uses preserveAspectRatio="None" (caveat being that svg attributes are case-sensitive) 00:44:01 [ed] the keyword value that is 00:45:45 [ed] just one of the files: test_svg_viewbox_preserveratio.svg 00:49:26 [jwatt] scribe: Jonathan Watt 00:49:29 [jwatt] scribenick: jwatt 00:50:01 [jwatt] topic: Animation Improvements 00:51:09 [jwatt] BB: do we want a new spec for Web Animations, or to continue work on SVG animation? 00:51:31 [jwatt] CM: so would Web Animations be an abstract spec about the model? 00:51:38 [jwatt] DS: I think a single spec 00:52:09 [jwatt] BB: I think we want this to apply to CSS properties in HTML, so have it separate to SVG 00:52:11 [Zakim] - +1.649.363.aaaa 00:52:12 [Zakim] Team_(svg)00:41Z has ended 00:52:12 [Zakim] Attendees were +1.649.363.aaaa 00:52:44 [Zakim] Team_(svg)00:41Z has now started 00:52:51 [Zakim] + +1.649.363.aaaa 00:53:38 [jwatt] CM: would that allow <animate> et. al. in HTML documents? 00:54:03 [jwatt] ...or just have those elements being in SVG fragments but being allowed to target CSS properties in HTML documents? 00:54:29 [jwatt] BB: defined in a way to allow HTML X to pull it in 00:54:58 [jwatt] ...to target attributes if they wanted to do that 00:55:20 [jwatt] DS: I think DOM bindings should be defined in that spec 00:56:06 [jwatt] CM: separate spec sounds similar to the way we have separate SMIL specs now 00:56:40 [jwatt] ...would it define elements that a host language can put it its own namespace? 00:58:05 [jwatt] BB: I don't want to make in so abstract that we're not giving elements with names 00:59:17 [jwatt] DH: it worries me slightly that we'll end up with four separate animation specs which people implement subsets of 00:59:33 [jwatt] ...it seems like it might make more sense to keep in in the SVG spec 00:59:49 [jwatt] s/in in/it in/ 01:00:38 [jwatt] ...to deserve the name "Web Animations" it would have to be a super-model to rule them all 01:01:01 [jwatt] BB: getting CSS animations in the same spec 01:02:35 [jwatt] DS: having a distinct and short name for the spec would have value 01:04:22 [jwatt] ...I suggest we put something on paper as a single spec, try that, and split it if we have to 01:07:41 [jwatt] ROC: first I want to get everyone together to figure out what browsers currently do with SMIL and CSS animation integration 01:08:05 [jwatt] ...and transitions 01:10:57 [jwatt] ...how they interact 01:10:58 [jwatt] DS: it seems like the CSS stuff should override 01:11:13 [jwatt] ROC: having CSS animations override SMIL animVals makes sense to me 01:11:27 [heycam] heycam has joined #svg 01:11:32 [anthony_nz] anthony_nz has joined #svg 01:11:32 [birtles] birtles has joined #svg 01:11:55 [roc] roc has joined #svg 01:12:30 [jwatt] ROC: I would put everything in one spec 01:12:57 [jwatt] DH: so scrap the CSS-animations spec its current incarnation? 01:13:11 [jwatt] ROC: I think so 01:13:54 [shepazu] s/so scrap the CSS-animations spec its current incarnation/so integrate the existing CSS animations spec into a single unified spec/ 01:14:31 [jwatt] ACTION: Jonathan to Get Daniel to talk to David about making a new harmonized animations spec 01:14:31 [trackbot] Created ACTION-2993 - Get Daniel to talk to David about making a new harmonized animations spec [on Jonathan Watt - due 2011-03-10]. 01:18:28 [jwatt] RESOLUTION: Try to bring the existing declarative animation spec work together into a single spec, with separate sections for CSS animation and SVG animation 01:20:31 [jwatt] ACTION: Erik to bring up the one true animation spec on the fx call 01:20:31 [trackbot] Created ACTION-2994 - Bring up the one true animation spec on the fx call [on Erik Dahlström - due 2011-03-10]. 01:26:09 [AD] AD has joined #svg 01:28:04 [Zakim] + +1.425.868.aabb 01:28:28 [birtles] scribenick: birtles 01:28:35 [birtles] Scribe: Brian 01:29:09 [pdengler_home2] can't understand 01:29:19 [pdengler_home2] Filters 01:29:31 [pdengler_home2] How about filters 01:29:41 [pdengler_home2] I have some text I wrote 01:29:53 [birtles] topic: SVG 2 / CSS Filters Module 01:30:35 [jwatt] jwatt has left #svg 01:34:33 [pdengler_home2] are we all on the same chat now? 01:34:44 [dholbert] I'm here 01:34:52 [dholbert] heycam, can you see me? :) 01:35:00 [heycam] ACTION: Cameron to bring up the CSS-animations-targetting-SVG-attribtues in the next FX telcon 01:35:01 [trackbot] Created ACTION-2995 - Bring up the CSS-animations-targetting-SVG-attribtues in the next FX telcon [on Cameron McCormack - due 2011-03-10]. 01:35:03 [dholbert] (heycam says 'yes') 01:36:30 [roc] roc has joined #svg 01:36:34 [jwatt] jwatt has joined #svg 01:36:46 [AD] AD has joined #svg 01:37:04 [birtles] birtles has joined #svg 01:37:04 [anthony_nz] anthony_nz has joined #svg 01:37:08 [birtles] scribenick: birtles 01:37:10 [ChrisL] ChrisL has joined #svg 01:37:11 [birtles] Scribe: Brian 01:37:18 [birtles] ED: I did some updates to the filter spec 01:37:18 [ed] 01:37:29 [ChrisL] rrsagent, here 01:37:29 [RRSAgent] See 01:37:32 [birtles] I added some wording for handling filters applied to HTML thru CSS 01:37:40 [homata_] homata_ has joined #svg 01:37:45 [birtles] ... based on what roc wrote up 01:37:55 [birtles] ... taking part of the spec from Mozilla and integrating it into this filter spec 01:38:10 [AD] AD has joined #svg 01:39:02 [pdengler_home2] We need to distinguish what the filter is being applied to. From my simple understanding, the SVG Filters apply to graphical elements and paint underneath. 01:39:10 [pdengler_home2] HTML “filters” (box-shadow, text-shadow) target different parts. 01:39:15 [pdengler_home2] I suggest we add a ‘filter-target’ property to target different things (“box|text”) or (“content|whole”). 01:39:42 [birtles] PD: need to differentiate between targetting background content vs content itself 01:40:22 [pdengler_home2] yes i can hear you 01:40:33 [birtles] RO: I think the best way to do that is to add new images 01:40:44 [birtles] ... right now you have SourceAlpha etc. 01:40:55 [birtles] ... ContentImage, ContentAlpha etc. 01:41:18 [birtles] ED: I added into the spec some wording in red about this 01:41:33 [birtles] RO: I don't think it's difficult to add new image names here 01:41:45 [birtles] ED: So what do we want to add Border? Background? 01:41:54 [birtles] RO: Border, Background, Outline are the 3 main ones 01:41:59 [birtles] ... Content would be everything else 01:42:07 [birtles] ... that includes everything their child can containa 01:42:16 [birtles] ... that would be really powerful, and easy to undersatnd 01:42:20 [birtles] ... let's do it 01:42:27 [birtles] ED: Does that map to something in SVG 01:42:30 [birtles] RO: no 01:42:46 [ChrisL] s/containa/contain, including their borders and backgrounds 01:43:46 [birtles] CM: What are you thinking of? 01:43:54 [birtles] CL: Of those, SVG only has Content 01:44:03 [birtles] ... Content would apply to SVG and HTML equally 01:44:13 [birtles] PD: So I want to be able to only target the background of a table 01:44:30 [birtles] ... I want to take a SVG filter and target it to the text in this page, the background in another 01:44:36 [birtles] ... so it shouldn't be on the filter 01:44:45 [pdengler_home2] filter-target="background" 01:44:53 [birtles] CM: So it should be on the property not the filter 01:45:12 [birtles] CL: But sometimes you want more than one 01:45:18 [birtles] CM: But for the simple case you only need one 01:45:49 [birtles] RO: one thing that's missing is how to interpret user space units 01:45:53 [pdengler_home2] filter-target="border|background|content(default)" 01:46:00 [birtles] ED: it's there 01:46:39 [birtles] PD: I'm talking about targetting a div 01:47:16 [birtles] CM: we're talking about things (1) inside the filter introduce new filter primitive keywords (2) targetting a whole filter to only one aspect of a box 01:47:23 [birtles] s/about things/about two things/ 01:47:42 [birtles] CL: there's always going to be a limit to what you can do with shorthand properties 01:47:49 [birtles] ED: keep the canned filters as simple as possible 01:47:59 [birtles] CM: I'd be happy with a feature like that 01:48:04 [birtles] PD: I agree 01:48:20 [birtles] ... the shorthand lets people doing something quickly 01:48:29 [birtles] ... but if you want to do something more complex you have to dig deeper 01:48:41 [birtles] ... and that's in a new spec where you start talking about new sources 01:49:09 [pdengler_home2] So how do we get that to the CSS working group? Next FX call 01:49:31 [birtles] ED: Dino has an action to come up with the proposed syntax for the shorthands 01:49:37 [birtles] ... he's the co-editor of the spec 01:49:44 [birtles] ... it's moved to the public fx taskforce 01:49:54 [birtles] ... I'll get in touch with him to see how it's going 01:50:02 [pdengler_home2] Sounds great, for my ability to track this can you create an issue on that 01:50:19 [birtles] ED: If he's too busy I'll propose something 01:50:28 [birtles] ... I'd like to remove the margin attribute 01:50:40 [birtles] ... and figure out the filter regions so we don't get clipping by default 01:50:57 [pdengler_home2] All of this sounds great Eric 01:51:12 [birtles] ... the margins were in the original SVG 1.1 which was suppose to address blur margins 01:51:24 [birtles] ... but all implementations are doing optimisations to address the slow cases anyway 01:51:31 [birtles] ... so they need to optimise the regions anyway 01:51:40 [birtles] CM: was there other stuff you'd like to rip out 01:51:46 [birtles] ED: they were the major things 01:51:47 [pdengler_home2] I was going to say we clamp, but....we don't do filters... 01:51:53 [birtles] ... the next step would be new filter primitive 01:52:02 [ed] 01:52:25 [birtles] CM: experience shows explicit clamping in there didn't prove to be a useful optimisation 01:52:31 [birtles] ... people don't do it properly 01:52:55 [birtles] PD: if we were to do clamping it would be nice to have specific properties 01:53:19 [birtles] ... e.g. to what extent to you extend to infinite regions 01:53:39 [birtles] ... i'd like a story that says you can shoot yourself in the foot, but this is as far as you can go 01:53:44 [birtles] RO: can you give us an example? 01:53:53 [birtles] ... what are you talking about clamping? 01:53:58 [pdengler_home2] i'm talking about clamping the combination of dx, stddeviation etc. don't worry 01:54:06 [pdengler_home2] i prefer the margin proposal 01:54:10 [birtles] CM: we're talking about different things 01:54:13 [pdengler_home2] Sorry 01:54:52 [birtles] ED: in those cases it might make sense to have limits 01:55:01 [birtles] ... although it needn't necessarily be in the spec 01:55:09 [birtles] ... but implementations should probably have limits 01:55:41 [birtles] CL: shorthand properties (canned filters) should say that here is an SVG filter that is equivalent 01:55:49 [birtles] ... but make clear you don't have to implement it like that 01:55:53 [birtles] ... as long as it has the same effect 01:56:03 [birtles] ... but authors shouldn't expect that SVG filter to show up in the DOM 01:56:13 [birtles] ... that allows hardware/platform acceleration to be used 01:56:28 [pdengler_home2] Sure 01:56:54 [ed] ED: could you explain a bit more about the point: "Support the inclusing of SVG <defs> as part of <link> in HTML" 01:57:21 [pdengler_home2] <link rel=”import” type=”image/xml+svg” href=”file.svg”>. 01:57:26 [birtles] PD: I often end up with fairly large filters which I'd like to link externally 01:57:49 [birtles] CM: the current way you reference filters is in this way: url # something 01:57:54 [pdengler_home2] <link rel="import" type="image/xml+svg" href="file.svg">. 01:58:02 [ChrisL] url() 01:58:13 [pdengler_home2] <filter="url(svg1.svg#mydef)" 01:58:27 [birtles] ED: how does import work? 01:58:59 [birtles] PD: it's difficult to import gradient, image definitions 01:59:10 [birtles] RO: you can reference all of those with URL # references 01:59:15 [birtles] ... what's wrong with that? 01:59:28 [birtles] PD: i don't have a bit complaint 01:59:33 [birtles] s/bit/big/ 02:00:17 [birtles] RO: there's one situation: people writing stylesheets would like to reference filters without requiring yet another document 02:00:27 [birtles] ... one proposal is allowing CSS to contain XML 02:00:37 [birtles] ... so you can put the filter directly in the stylesheet 02:00:44 [birtles] ... I don't think it's a bad idea 02:00:55 [birtles] ... but for now the URL syntax seems to work 02:01:06 [birtles] PD: yeah, that makes sense 02:01:14 [birtles] ... let's leave it 02:01:37 [AD] AD has joined #svg 02:01:38 [birtles] CL: in SVG we were very careful to use URI refs rather than ID ID-refs 02:01:46 [birtles] ... since that doesn't work for other docs 02:01:55 [birtles] ... so it gives us flexibility to address that 02:02:31 [birtles] ED: in this draft here I have one filter primitive that's not defined yet 02:02:35 [birtles] ... feCustom 02:02:47 [birtles] ... it's for defining shaders with SVG filters 02:03:04 [birtles] ... one possible way is to allow people to write filter primitives with open CL 02:03:10 [birtles] ... or perhaps WebGL 02:03:21 [birtles] ... it's lower level but gives you a lot of power 02:03:33 [birtles] CL: previously we proposed javascript callbacks for this 02:03:37 [birtles] ED: that would be slow 02:03:45 [birtles] CL: yeah, so this looks like more practical 02:03:57 [birtles] ED: so do you want to allow software-only engines to run shaders? 02:04:36 [birtles] PD: before we go to far down this path... is WebGL going to be brought into the W3C 02:04:38 [birtles] ? 02:04:48 [birtles] RO: WebGL may not be W3C but it is a standard 02:05:05 [pdengler_home2] Is webgl under the same patent policy as w3c? 02:05:23 [ChrisL] 02:05:35 [birtles] ... on any platform that can run WebGL you should be able to use WebGL in a shader 02:05:40 [birtles] ED: could be a feature string 02:05:48 [birtles] ... so if you can run this, do this, otherwise do that 02:06:03 [birtles] CL: or we could use another language feature 02:06:13 [birtles] DS: what's the license? 02:06:21 [birtles] RO: not sure 02:06:29 [birtles] ... but the Chronos group has dealt with IP a lot 02:06:52 [heycam] s/Chronos/Khronos/ 02:07:12 [birtles] ED: so if we do that it would be good to pull into filter input images 02:07:17 [birtles] ... and integrate with the rest of the filter spec 02:07:22 [ChrisL] 02:07:27 [birtles] ... means some definition of how it integrates with the shader language 02:07:35 [ChrisL] 02:07:37 [birtles] ... how SVG filters integrate 02:07:53 [birtles] ... otherwise you could have just the shader and some fallback 02:08:07 [birtles] CM: so you want 1/2 inputs just like you do with filter primitives? 02:08:14 [birtles] ED: what does the shader look for? 02:08:27 [birtles] CM: mapping from the SVG buffer to whatever the shader takes 02:08:33 [birtles] ED: same for the output from the shader too 02:08:53 [birtles] CL: Cg lang can output different types of shaders 02:09:04 [birtles] ... so it could provide different shaders depending on the platform 02:09:12 [birtles] RO: Google provide ANGLE 02:09:41 [pdengler_home2] "almost native" 02:10:12 [birtles] PD: will you pull that stuff out in the next week or so? 02:10:13 [ChrisL] 02:10:20 [birtles] ED: in the coming weeks 02:10:41 [birtles] CL: I want some language in the spec about the canned effects 02:10:55 [birtles] ... that you don't actually need the equivalent SVG in the DOM as long as you get the same result 02:11:15 [pdengler_home2] Did we solve the issue I brought up before with filter-target on HTML elements? 02:11:40 [birtles] ACTION: Erik to work on removing the margins and put some proposed text for how to deal with the proposed filter regions into the filters spec 02:11:41 [trackbot] Created ACTION-2996 - Work on removing the margins and put some proposed text for how to deal with the proposed filter regions into the filters spec [on Erik Dahlström - due 2011-03-10]. 02:12:17 [birtles] ACTION: Erik to follow up Dino about the shorthand syntax for filter effects 02:12:18 [trackbot] Created ACTION-2997 - Follow up Dino about the shorthand syntax for filter effects [on Erik Dahlström - due 2011-03-10]. 02:12:21 [ChrisL] actually is a better pointer for angle 02:13:06 [pdengler_home2] my phone failed 02:13:12 [Zakim] - +1.425.868.aabb 02:13:14 [pdengler_home2] I don't have my machine configured 02:13:18 [pdengler_home2] to check into W3C 02:13:34 [pdengler_home2] I emailed them, can someone please do that for me (my apologies) 02:13:40 [pdengler_home2] (Did you get them in email?) 02:13:54 [pdengler_home2] Ok I will get another phone and meet back after your break 02:14:16 [ChrisL] s/yes we did/yes at least erik did and he is checking them in/ 02:17:49 [ed] 02:18:12 [Zakim] disconnecting the lone participant, +1.649.363.aaaa, in Team_(svg)00:41Z 02:18:16 [Zakim] Team_(svg)00:41Z has ended 02:18:18 [Zakim] Attendees were +1.649.363.aaaa, +1.425.868.aabb 02:22:26 [dholbert] pdengler_home2, so it looks like your page ^ is pairs of [svg testcase] [raster expected-rendering], right? 02:30:28 [pdengler_home2] *should* be a test with the expected rendering next to it in a raster format 02:34:33 [heycam] Zakim, room for 3? 02:34:35 [Zakim] ok, heycam; conference Team_(svg)02:34Z scheduled with code 26631 (CONF1) for 60 minutes until 0334Z 02:34:56 [Zakim] Team_(svg)02:34Z has now started 02:35:03 [Zakim] + +1.649.363.aaaa 02:36:25 [Zakim] + +1.425.868.aabb 02:38:39 [pdengler_home2] we overloaded the server with .5MB? :) 02:50:51 [birtles] birtles has joined #svg 02:50:55 [anthony_] anthony_ has joined #svg 02:50:59 [heycam] Zakim, who is on the call? 02:51:00 [Zakim] On the phone I see +1.649.363.aaaa, +1.425.868.aabb 02:51:21 [birtles] scribenick: birtles 02:51:21 [anthony_nz] anthony_nz has joined #svg 02:51:25 [birtles] Scribe: Brian 02:51:28 [birtles] topic: Intrinsic sizing 02:51:36 [AD] AD has joined #svg 02:51:53 [jwatt] jwatt has joined #svg 02:52:36 [pdengler_home2] Jonathan has been working on this for a while and shared his tests with all of us a long time ago. 02:52:49 [birtles] 02:53:52 [birtles] ED: I've made some fixes (doctype, preserveAspectRatio="none" <-- lowercase "none") 02:55:56 [roc] roc has joined #svg 02:57:37 [ChrisL] ChrisL has joined #svg 02:57:51 [ChrisL] rrsagent, here 02:57:51 [RRSAgent] See 02:58:49 [jwatt] 03:00:11 [ed] (for completeness, here are the unmodified files from patrick: ) 03:00:19 [homata] homata has joined #svg 03:01:29 [pdengler_home2] We wanted to share some tests back and perhaps we can use them as a test bed for the framework discussed on Monday. 03:01:43 [pdengler_home2] We believe that these tests are accurate to the specification and where we believe the spec to be ambiguous, is within the spirit of the specification and/or interoperable. 03:02:19 [pdengler_home2] For the tests, you will notice that indeed IE9 passes all of them; this is because we used these tests to develop our platform. 03:02:46 [pdengler_home2] As indicated on the email DL, after our latest platform preview we caught some sizing discrepancies between our implementation and the spec; we subsequently made adjustments. 03:02:53 [pdengler_home2] At the time of the change we aligned with Firefox beta. I think Firefox made adjustments for interop based upon our implementation (I think that’s what Rob said). 03:03:05 [pdengler_home2] ( ) 03:04:23 [birtles] PD: Let's see if we can agree on what the spec says, or if the tests are wrong 03:04:36 [birtles] JW: I think the 7th and 8th images are not being sized correctly on IE 03:04:56 [jwatt] JW: "SVG sizing with 'viewbox' specified while 'width' and 'height' is percentage inside an 'object' tag." 03:05:16 [birtles] JW: the 4th set of images 03:05:47 [birtles] JW: from my understanding, the object element ends up with width 50%, height: auto because the containing block, the body, has height auto 03:06:07 [birtles] ... which gets you to section 10.6.2 of CSS 2 03:06:10 [jwatt] 03:06:49 [jwatt] JW: Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is: 03:06:51 [jwatt] JW: (used width) / (intrinsic ratio) 03:07:16 [birtles] ... since the height is not resolvable you end up using the intrinsic dimensions of SVG (100x100) --> ratio 1:1 03:07:27 [birtles] ... so the height of the object tag should be given the same computed value as its width 03:07:34 [birtles] ... so you should end up with square 03:07:42 [birtles] s/square/a square/ 03:08:26 [birtles] PD: so firefox ends up with a square on this one? 03:08:36 [birtles] JW: previously you might have been testing firefox in quirks mode 03:08:46 [birtles] ... but if you run the test again you'll see it is a square in firefox 03:09:28 [birtles] PD: Erik, what's your interpretation 03:09:36 [birtles] ED: Jwatt is probably right 03:09:44 [birtles] ... what does the P1, P2, P2 mean in the wiki page 03:09:54 [pdengler_3] pdengler_3 has joined #svg 03:09:58 [birtles] PD: ignore that 03:10:11 [jwatt] RRSAgent: make minutes 03:10:11 [RRSAgent] I have made the request to generate jwatt 03:10:34 [birtles] ED: The P3 might have only been wrong because of the capitilisation of preserveAspectRatio 03:10:45 [birtles] PD: do you agree with jwatt's assessment that it should be 1:1 03:10:48 [birtles] ED: yeah, I think so 03:10:53 [birtles] PD: what does Opera do? 03:11:19 [birtles] DH: Opera matches the bitmap on my computer 03:11:25 [birtles] PD: it's the same as IE9 on my computer 03:11:46 [birtles] DH: could it be that they're using the viewBox to generate an aspect ratio? 03:11:52 [birtles] ... in this case there's a width and a height 03:12:38 [birtles] ED: jwatt is probably correct here 03:12:48 [birtles] ... I think the spec says the width/height takes precedence in this case 03:12:57 [birtles] ... and viewBox is used if there's no width/height 03:13:07 [pdengler_3] My understanding is that the viewBox would take precidence as the percentage is 100% correct? 03:13:34 [dholbert] height/width are both 100px 03:13:40 [birtles] JW: I'm pretty sure I'm right 03:13:49 [dholbert] there's no percentage 100%, IIUC 03:14:07 [birtles] CL: 1.1F2 should have the same wording as Tiny 03:14:08 [birtles] ED: so width/height should have precedence 03:14:58 [birtles] PD: I want to make sure we're on the same page and it seems Erik and Jonathan are agreed 03:15:09 [birtles] ... I think this would be a good set of tests to formalise 03:15:18 [birtles] ... into the test bed 03:15:32 [birtles] ... where else do you think our interpretation might be incorrect? 03:16:19 [birtles] ... bear in mind that these tests are hot off the press 03:18:00 [jwatt] JW: I think FF currently handles "SVG sizing without 'viewbox' specified while 'width' and 'height' is percentage inside an 'object' tag." incorrectly 03:18:06 [dholbert] I agree 03:18:34 [birtles] JW: it doesn't override the width/height on the SVG tag 03:18:37 [ed] "SVG sizing with 'viewbox' specified while 'width' and 'height' is percentage inside an 'object' tag." 03:18:56 [birtles] ED: the first example says the width/height is % but the test case doesn't use % -- was the test case wrong 03:19:00 [birtles] ... oh it refers to the object element 03:20:21 [pdengler_3] Eric, do you mean the very first test? 03:20:44 [ed] 03:21:16 [birtles] ED: yes, so I just wasn't sure where the percentages were, but it's ok 03:22:35 [pdengler_home5] pdengler_home5 has joined #svg 03:23:27 [birtles] ED: So, is Firefox's handling of the first case is incorrect? 03:23:30 [birtles] JW: no not the first case 03:24:15 [jwatt] JW: "SVG sizing without 'viewbox' specified while 'width' and 'height' is percentage inside an 'object' tag." - half way down the page 03:25:05 [ed] ED: sorry, misread it, a bit confused by the similar text descriptions 03:25:27 [birtles] JW: So those are the only two cases I would point out 03:25:36 [birtles] DH: Looks like we match the reference on everything else 03:25:40 [pdengler_home5] Ok, and that's the same issue as the 4th one right? 03:25:56 [birtles] ED: you mean just the SVG part, not the dotted lines 03:26:10 [birtles] DH: I mean including the dotted lines 03:26:18 [birtles] ... but ignoring the padding 03:26:35 [birtles] JW: Are the images supposed to match in size and position as well? 03:26:51 [birtles] PD: I believe Opera had some differences with the stylesheet 03:27:12 [birtles] JW: In IE9 after adding the doctype the rendering and bitmaps don't seem to be the same 03:27:26 [pdengler_home5] That' because we made changes since PPB7 in RC to match Firefox :) 03:27:39 [pdengler_home5] and the spirit and letter of the spec (I hope) 03:28:16 [birtles] PD: They all match for me on my build 03:28:46 [pdengler_home5] SVG sizing without 'viewbox' specified while 'width' and 'height' is percentage inside an 'object' tag." 03:29:19 [birtles] JW: Mozilla needs to fix that 03:29:30 [birtles] DH: Firefox does that incorrectly 03:29:33 [pdengler_home5] The only issue is then that we have #4 incorrect 03:29:52 [pdengler_home5] (aside from the preserveAspectRatio casing) 03:30:07 [birtles] JW: For the examples on this page, the first one I pointed out you don't do correctly, but the second one you and Opera do correctly and Mozilla does not 03:30:31 [birtles] ED: I think we should try to forward this to the WebKit guys 03:31:00 [birtles] ... our next step would be to try to collect these test cases into a test framework 03:31:09 [birtles] ... but it sounds like we're mostly on the same page 03:31:22 [birtles] PD: maybe contact with WebKit will really get us online 03:32:01 [birtles] JW: on the wiki page, under Firefox 4 there are 5 bullet points 03:32:24 [birtles] ... referring to the third one 03:32:43 [birtles] ... I think this is the correct thing to do 03:33:12 [birtles] ... did you remove viewBox logic? 03:33:44 [birtles] ... talking about it in terms of a viewBox is just to get the desired result 03:33:51 [birtles] ... to give the same effect as for raster images 03:34:22 [birtles] The point in question is "Next Firefox 4 beta will have Opera’s <img> viewBox logic." 03:34:36 [birtles] DH: I think the problem is when you have a non-percent width/height and NO viewbox 03:34:46 [birtles] ... we've changed it to synthesize a viewBox in that case 03:34:46 [pdengler_home5] I think we all recognize that this is probably desirable, but I definitely want to raise the issue that injecting a missing attribute might be considered "quirks" 03:34:50 [birtles] ... that's what Opera does 03:35:32 [birtles] ... this is for scaling 03:36:05 [birtles] ... the straightforward thing to do is to clip but what Opera does and what we think authors expect is to have the image scale 03:36:09 [birtles] ... like with a raster image 03:36:16 [birtles] ... an author can add a viewBox to get that behaviour 03:36:26 [birtles] ... but authoring tools generally don't do that 03:36:45 [birtles] CL: but then you can't get the image to be the size you desire anymore 03:37:04 [birtles] JW: if that's what you want just put width/height auto on your image tag 03:37:22 [birtles] DH: it's only when the SVG width/height doesn't match the image width/height 03:37:33 [shepazu] shepazu has joined #svg 03:37:40 [pdengler_home5] That was our concern; it may make sense, but it is assuming an attribute that is not there 03:37:47 [birtles] ... we do it on the image tag, list style image (CSS images), but not on the SVG:image tag because it's well defined there 03:37:52 [birtles] ED: we don't do it there either 03:38:23 [birtles] DS: Tab Atkins wrote on www-style that he found the intrinsic sizing discussion a bit confusing 03:38:55 [birtles] ... we sorted out what was confusing him -- it wasn't clear to him that the SVG canvas extended infinitely on all sides 03:39:06 [birtles] ... he thought we could make that more clear 03:39:23 [birtles] ... and that if we talked about % width/height as a transformation 03:39:32 [birtles] CL: it's fairly easy to explain 03:39:37 [shepazu] q+ 03:39:42 [birtles] ... e.g. 30% each transform="scale(0.3)" 03:41:02 [birtles] DS: I thought it would be harmless to explain in those terms 03:41:27 [birtles] ACTION: Doug to add some additional clarification to the intrinsic sizing part of the spec 03:41:27 [trackbot] Created ACTION-2998 - Add some additional clarification to the intrinsic sizing part of the spec [on Doug Schepers - due 2011-03-10]. 03:42:20 [eseidel_] eseidel_ has joined #svg 03:42:34 [birtles] CL: (re Patrick's concern about the "quirk" of adding a viewBox attribute) 03:42:53 [birtles] DH: it doesn't match object 03:43:00 [birtles] PD: it doesn't match the spec 03:43:11 [birtles] DH: it doesn't match the spirit of the spec 03:43:22 [birtles] CL: is there anything in the HTML spec regarding this behaviour for PNG images etc. 03:43:32 [birtles] ... we could see if we're consistent with that 03:43:42 [birtles] DH: I'm sure it's in the CSS spec for raster images / replaced elements 03:43:59 [birtles] ... but I think a lot of the CSS spec text about this stuff doesn't expect images that react to their viewport 03:44:13 [birtles] JW: the bottom line is that without this viewBox insertion behaviour is unexpected for authors 03:44:15 [ChrisL] until recently, that was certainly true 03:44:28 [birtles] ... with this they get what they expect 03:44:48 [birtles] PD: I'm not sure, it's tough 03:44:59 ... 03:45:01 [jwatt] ...(ignoring any preserveAspectRatio on the <svg>)" 03:45:11 [birtles] DH: I acknowledge our current behaviour makes me uncomfortable given the lack of clarity in the spec 03:45:19 [birtles] ... I'd be more comfortable if we had something in the spec 03:45:27 [birtles] PD: it does say that for image 03:45:39 [birtles] ... but not when used as an <img> 03:46:39 [birtles] DH: the SVG image has different behaviour than the HTML <img> element for raster images 03:46:49 [birtles] ... so it's not unexpected that it would be different for SVG images either 03:48:20 [birtles] CL: Well we shouldn't define it in terms of faking a viewBox, but rather by analogue with raster images 03:48:39 [birtles] JW: maybe we can express it in terms of inserting an extra transform 03:48:47 [birtles] ... actually that's what we do 03:49:10 [birtles] ... we talk about viewBox to make it easier for an author to understand 03:49:54 [birtles] CL: if an image has an intrinsic size / fixed size and you want to make it bigger 03:50:09 [birtles] ... for raster images you scale it up 03:50:16 [birtles] ... and same for SVG but it just happens to scale nicely 03:50:32 [birtles] ... it's not SVG, it's about CSS replaced content 03:50:45 [birtles] ... it has an intrinsic size and we scale it up because the context in which it's being used says to 03:50:59 [birtles] DH: but you can find tune that scaling with a viewBox and preserveAspectRatio 03:51:06 [birtles] ... that's why we "add a viewBox" 03:51:17 [birtles] s/find tune/fine tune/ 03:51:35 [birtles] JW: we'd say more than just scaling, but some other wording that didn't mention "viewBox" 03:52:01 [birtles] ... which will be more complicated but avoids talking about fake viewBoxs 03:52:07 [birtles] ED: as long as we get the same behaviour 03:52:22 [birtles] ... I think jwatt's text is more clear 03:55:47 [birtles] ACTION: Patrick to consider intrinsic sizing behavior (particularly when a viewBox is not provided) and follow-up test cases 03:55:48 [trackbot] Created ACTION-2999 - Consider intrinsic sizing behavior (particularly when a viewBox is not provided) and follow-up test cases [on Patrick Dengler - due 2011-03-10]. 03:56:05 [jwatt] JW: another set of tests for sizing: 03:56:30 [birtles] JW: we seem to diverge widely on these tests 03:57:10 [birtles] ED: can we put these in the UA sizing? 03:57:17 [birtles] JW: yes 03:58:05 [birtles] ... Patrick, those tests seem to show that IE's implementation of the CSS replaced elements stuff seems wrong 03:58:15 [birtles] ... especially further down where everything just collapses to nothing 03:59:10 [birtles] ... we've run out of time to talk about individual ones there 03:59:22 [birtles] ... but if you disagree with our implementation on any of those can you get back to me and I'll explain 04:01:11 [ed] Topic: Automatic image sizing 04:02:06 [birtles] JW: currently the SVG <image> tag if you don't specify width/height they default to 0 and nothing is shown 04:02:11 [birtles] ... they're required 04:02:15 [Zakim] - +1.425.868.aabb 04:02:21 [birtles] ... no way to get the width/height to automatically resize to the image you're embedding 04:02:31 [birtles] ... we should do what CSS embedding algorithm 04:02:33 [birtles] ... but simpler 04:02:52 [birtles] ... one or both of width/height can be specified and we determine the width/height 04:03:03 [birtles] CL: is this for SVG 2nd ed or 2? 04:03:07 [birtles] JW: SVG2 04:03:20 [birtles] JW: I'd like the attributes to be optional 04:03:48 [birtles] ... we use the image aspect ratio to calculate the width/height 04:03:56 [birtles] DS: it's a breaking change 04:04:15 [birtles] CL: only if you're linking to images without specifying width/height 04:04:22 [birtles] DS: which I've done 04:04:41 [birtles] JW: I think the value of this is high enough that we should just go ahead and do this 04:05:02 [ChrisL] DS: I did that to force preload of images 04:05:19 [ChrisL] JW: Use visibility: hidden in future 04:05:56 [birtles] CM: I can imagine someone relying on that behaviour because they're going to animate it out 04:06:16 [birtles] ... (i.e. relying on it becoming 0, 0) 04:06:30 [birtles] DS: I usually make the attributes 0, 0 04:07:15 [Zakim] disconnecting the lone participant, +1.649.363.aaaa, in Team_(svg)02:34Z 04:07:16 [birtles] ... this does break the idea of a rect with no width/height is 0,0 04:07:19 [Zakim] Team_(svg)02:34Z has ended 04:07:21 [Zakim] Attendees were +1.649.363.aaaa, +1.425.868.aabb 04:07:38 [heycam] Zakim, room for 3? 04:07:40 [Zakim] ok, heycam; conference Team_(svg)04:07Z scheduled with code 26631 (CONF1) for 60 minutes until 0507Z 04:07:46 [birtles] JW: but rectangles don't embed resources 04:08:00 [birtles] DS: I think your rationale is perfectly reasonable 04:08:20 [birtles] ... I think this will be much more user-friendly 04:08:22 [birtles] CM: I agree 04:08:32 [birtles] ... is this for rasters and SVGs? 04:08:44 [birtles] JW: anything that can be embedded by an image tag that has an intrinsic size 04:08:47 [AD] AD has joined #svg 04:08:55 [birtles] DS: how about an SVG with % width/height 04:09:02 [birtles] ... would it act the same as an HTML img element? 04:09:09 [birtles] JW: yes, but I need to look into it 04:09:14 [birtles] ... I want to simplify what CSS is doing 04:09:29 [birtles] ED: what does Tiny say about %s, are they intrinsic? 04:10:01 [birtles] s/ED: what/JW: what/ 04:10:43 [birtles] JW: I don't particularly like the idea of resources that don't know what they're getting put into 04:10:55 [birtles] ACTION: Jonathan to come up with text for automatic image sizing 04:10:55 [trackbot] Created ACTION-3000 - Come up with text for automatic image sizing [on Jonathan Watt - due 2011-03-10]. 04:11:14 [ChrisL] kiriban! 04:13:15 [birtles] RESOLUTION: For SVG <image> missing an explicit width/height we will take in account the intrinsic dimensions/aspect ratio of the resource being embedded 04:13:31 [birtles] ED: this is not just for image 04:13:38 [birtles] ... there's feImage and potentially other places 04:13:42 [birtles] ... animation element 04:14:16 [birtles] DS: so bbox will clearly get the width/height 04:14:18 [ed] foreignObject too 04:14:33 [birtles] ... however, what about getting the attribute 04:14:38 [birtles] ... 0? null? undefined? 04:14:51 [birtles] CM: you'd get empty 04:14:58 [birtles] ... it wouldn't affect the DOM 04:15:39 [birtles] ... it should do whatever we do for other automatic values 04:16:18 [birtles] ED: currently we'd just create an object on the fly for cases like that 04:16:48 [birtles] DS: if you change the href if would also change 04:16:57 [birtles] ... do we need to put that in the spec? 04:17:01 [ed] s/cases like that/cases like image without width, and you tried to fetch image.width.baseVal.../ 04:17:18 [birtles] JW: I don't think that's necessary but it might be helpful as a note 04:17:30 [birtles] ... but you should apply the same rule with a new image 04:17:41 [birtles] DS: "even if the resource should change" 04:18:19 [ed] trackbot, end telcon 04:18:19 [trackbot] Zakim, list attendees 04:18:19 [Zakim] sorry, trackbot, I don't know what conference this is 04:18:20 [trackbot] RRSAgent, please draft minutes 04:18:20 [RRSAgent] I have made the request to generate trackbot 04:18:21 [trackbot] RRSAgent, bye 04:18:21 [RRSAgent] I see 9 open action items saved in : 04:18:21 [RRSAgent] ACTION: Cameron to write a proposal for allowing shorthand presentation attributes [1] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Jonathan to Get Daniel to talk to David about making a new harmonized animations spec [2] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Erik to bring up the one true animation spec on the fx call [3] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Cameron to bring up the CSS-animations-targetting-SVG-attribtues in the next FX telcon [4] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Erik to work on removing the margins and put some proposed text for how to deal with the proposed filter regions into the filters spec [5] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Erik to follow up Dino about the shorthand syntax for filter effects [6] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Doug to add some additional clarification to the intrinsic sizing part of the spec [7] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Patrick to consider intrinsic sizing behavior (particularly when a viewBox is not provided) and follow-up test cases [8] 04:18:21 [RRSAgent] recorded in 04:18:21 [RRSAgent] ACTION: Jonathan to come up with text for automatic image sizing [9] 04:18:21 [RRSAgent] recorded in
http://www.w3.org/2011/03/02-svg-irc
CC-MAIN-2017-04
refinedweb
13,880
65.56
Re: Assigning a drive letter to com port - From: "Doron Holan [MS]" <doronh@xxxxxxxxxxxxxxxxxxxx> - Date: Sat, 9 Apr 2005 11:15:15 -0700 if you just want this to work in explorer, you can write a shell namespace extension, no FS filter. if you want this to work on the command line, a driver which exposes itself as a disk (no need for an FS filter) should work. d -- Please do not send e-mail directly to this alias. this alias is for newsgroup purposes only. This posting is provided "AS IS" with no warranties, and confers no rights. "h.wulff" <zuhause@xxxxxxx> wrote in message news:MPG.1cc08f0adbdc47859896b4@xxxxxxxxxxxxxxxxxxx > Hello, > > I don't know whether this is possible, but if you want to make a file > system driver you should get Rajeev Nagars book "Windows NT File System > Internals: A Developer's Guide" > > In article <unhL6hCPFHA.904@xxxxxxxxxxxxxxxxxxxx>, umut_ozden@xxxxxxxxx > says... >> Hi, >> I would like to write a program: >> In Windows Explorer, after drag&drop a file to >> a pre-defined drive letter (for example F:) the file >> should be sent through the COM port to an >> external device(digital satellite receiver). >> Where should I start? >> Do I have to write a device driver?(So, is it >> right place to ask the question?) >> I'm using Borland C++ Builder 5. >> Do I have to use VC++ or can non-Microsoft >> compilers do the job? >> >> Thanks... >> >> >> > > -- > > h.wulff > [dont send me an email] . - References: - Assigning a drive letter to com port - From: Umut Ozden - Re: Assigning a drive letter to com port - From: h . wulff - Prev by Date: Re: Starting a driver within a driver... - Next by Date: Re: 25 microseconds? - Previous by thread: Re: Assigning a drive letter to com port - Next by thread: Re: Assigning a drive letter to com port - Index(es):
http://www.tech-archive.net/Archive/Development/microsoft.public.development.device.drivers/2005-04/msg00469.html
crawl-002
refinedweb
305
73.27
26 November 2010 23:59 [Source: ICIS news] VALENCIA, Spain (ICIS)--European October purified terephthalic acid (PTA) contract prices moved down by €3/tonne ($4/tonne) in line with movements in upstream paraxylene (PX), buyers and sellers said on Friday. “For October… the price changed by the equivalent of PX pass versus September,” a major producer said. Producers of PTA were trying to improve margins by up to €30/tonne and one said it had achieved a €10/tonne increase from the third quarter to the fourth quarter. Prices were moving up towards the end of the year because what was happening upstream. By November, the value of PTA could rise above €800/tonne based purely on calculations made with the PX pass-through. The market was tight because of a pull on downstream polyethylene terephthalate (PET) and this was likely to continue into December, suppliers said. However, customers said they were receiving their contracted volumes and they were not feeling the much-publicised tightness in the market. PKN Orlen in ?xml:namespace> PKN was not available for comment. ($1 = €0.75) For more on PTA, PX
http://www.icis.com/Articles/2010/11/26/9414427/europe-october-pta-price-falls-in-line-with-upstream-px.html
CC-MAIN-2014-35
refinedweb
187
62.07
. using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { // The position on of the scrolling viewport public Vector2 scrollPosition = Vector2.zero; void OnGUI() { // An absolute-positioned example: We make a scrollview that has a really large client // rect and put it in a small rect on the screen. scrollPosition = GUI.BeginScrollView(new Rect(10, 300, 100, 100), scrollPosition, new Rect(0, 0, 220, 200)); // Make four buttons - one in each corner. The coordinate system is defined // by the last parameter to BeginScrollView. GUI.Button(new Rect(0, 0, 100, 20), "Top-left"); GUI.Button(new Rect(120, 0, 100, 20), "Top-right"); GUI.Button(new Rect(0, 180, 100, 20), "Bottom-left"); GUI.Button(new Rect(120, 180, 100, 20), "Bottom-right"); // End the scroll view that we began above. GUI.EndScrollView(); } } Did you find this page useful? Please give it a rating:
https://docs.unity3d.com/ScriptReference/GUI.BeginScrollView.html
CC-MAIN-2018-39
refinedweb
143
60.51
Created on 2018-05-15 16:35 by rad164, last changed 2019-05-17 20:54 by cheryl.sabella. This issue is now closed. Python 3.6.5 has trouble on folding email messages: Trace28, in _fold_as_ew first_part = to_encode[:text_space] TypeError: slice indices must be integers or None or have an __index__ method The message has non-ascii characters in header and set max_line_length=0, regardless length of the header. Here is the code to reproduce. from email.message import EmailMessage from email.policy import default policy = default.clone(max_line_length=0) msg = EmailMessage() msg["Subject"] = "á" policy.fold("Subject", msg["Subject"]) I first found this issue on Maildir.add, which saves the message to a file without word wrap. Oh, interesting. I could argue that that's a missing feature in Python's slice handling. The value of text_space at that point is '+inf', and I obviously incorrectly assumed that slicing would treat that as if it were [:]. The counter argument, of course, is that inf is a float not an integer. I suppose we'll have to use sys.maxsize instead. See this issue as a duplicata of this one: New changeset feac6cd7753425fba006e97e2d9b74a0c0c75894 by R. David Murray (Abhilash Raj) in branch 'master': bpo-33524: Fix the folding of email header when max_line_length is 0 or None (#13391) New changeset 5386aaf07835889e90fb33e95b6d37197f8cfea0 by Miss Islington (bot) in branch '3.7': bpo-33524: Fix the folding of email header when max_line_length is 0 or None (GH-13391) Thank you, @licht-t for the original patch and @maxking for the rebase. Also, thank you, @r.david.murray for the review and merge.
https://bugs.python.org/issue33524
CC-MAIN-2019-22
refinedweb
269
66.64
Forum Index On 03/23/12 20:11, Adam D. Ruppe wrote: > > > > if the name isn't on a list of approved virtuals, > static assert fail. And you could probably do it in a clean and unintrusive way, by, for example, extending Object, or doing it on a per-module basis. If it actually worked... The obvious problem is that the 'virtual' check pretty much has to *prevent* devirtualization, or lie about it and always report the functions as virtual -- otherwise devirtualization has to happen before the checks, and this could change their results. Also, my gdc (which i haven't updated for a while) does not even devirtualize this simple case: ------------------------------------------------------- private class C { int bar() { return 42; } } pragma(attribute, externally_visible) int main() { C c = new C; //writeln(__traits(isVirtualFunction, c.bar)); return c.bar(); } ------------------------------------------------------- It needs at least the class or method marked as 'final' to do the right thing. Note that the isVirtualFunction check returns true even for the cases where bar() does get inlined. (*VirtualMethod* do not exist here) artur On Saturday, 24 March 2012 at 14:43:21 UTC, Artur Skawina wrote: > It needs at least the class or method marked as 'final' to do the right thing. Indeed, that's what I'm after. I'm making another post with an implementation in reply to manu in a minute. bottom part of that is reusable, the top part is my test data. Run it through the compiler with the test code added: $ dmd test13 -unittest Warning: A.lol is an unauthorized virtual function Warning: B.amazing is an unauthorized virtual function And it greps for virtuals for you, and reports it at compile time. If it turns out you want one of them to be virtual, you add the name to the authorizedVirtuals list. How would you validate a virtual in C++? If you have a list of functions you're OK with, that's exactly what this is! If you look at the source of each virtual your grep finds, to ensure it absolutely needs to be virtual... well, you can do that here too. Between the warnings and the authorized virtuals list, you know all the virts here and can review them. The best way to silence a warning btw is to just write "final" on the method. Your code review process can keep the authorized virtual list to themselves, so most developers either add final or break the build. Either way, no virtuals slip in without review. Also from an old post: "Aside from that, I want a compile error if someone tries to randomly override stuff." Warning: C.goodVirtual is an unauthorized virtual function the code below checks on a per class level, so if you don't authorize the override, it gets a warning to. (You can change these to errors by making it static assert or something instead of pragma(msg).) > Who maintains these tables? Who decides who can write "virtual" in C++? Example follows: === module test13; class A { void goodVirtual() {} void lol() {} } class B { int amazing() { return 0; } } class C : A { override void goodVirtual() {} final void drox() {} } template isClass(alias T) if(!is(T)) { enum bool isClass = false; } template isClass(alias T) if(is(T)) { enum bool isClass = is(T == class); } unittest { enum string[][string] authorizedVirtuals = [ "A" : ["goodVirtual"], "B" : [], "C" : ["goodVirtual"], ]; import algore = std.algorithm; foreach(member; __traits(allMembers, test13)) { static if(isClass!(__traits(getMember, test13, member))) { foreach(possibleVirt; __traits(derivedMembers, __traits(getMember, test13, member))) { static if( __traits(isVirtualMethod, __traits(getMember, __traits(getMember, test13, member), possibleVirt)) && !algore.canFind(authorizedVirtuals[member], possibleVirt)) { pragma(msg, "Warning: " ~ member ~ "." ~ possibleVirt ~ " is an unauthorized virtual function"); } } } } } void main() {} === I think a better system would be to explicitly mark functions are virtual, and then use unittesting to catch virtual functions that don't need to be. On 3/24/12 3:03 AM, Manu wrote: > On 23 March 2012 17:24, Ary Manzana <ary@esperanto.org.ar > <mailto. Interesting. I spend most of my work time programming in Ruby, where everything is virtual+ :-P It's good to know that virtual-ness can be a bottleneck. On 03/24/12 16:16, Adam D. Ruppe wrote: > question is -- are there false positives? (Ie situations where the compiler managed to devirtualize methods which __traits reported earlier as being virtual) artur On Saturday, 24 March 2012 at 16:27:41 UTC, Artur Skawina wrote: > The question is -- are there false positives? Yes, almost certainly. This only looks at the function definition; it is run well before the optimizer.
http://forum.dlang.org/thread/mailman.840.1332033836.4860.digitalmars-d@puremagic.com?page=8
CC-MAIN-2016-44
refinedweb
753
55.13
Kubernetes Docker QA's - q-uest/notes-doc-k8s-docker-jenkins-all-else Wiki #PV#PVC#PERSISTENT VOLUME#PERSISTENT VOLUME CLAIMS# QA's related to Storage/PV/PVC's #secret# A key's value of a secret object has just been updated/changed. Can you get this updated value from a Pod which is already using the secret object? No, it is not possible. The Pod needs to be recreated after updating the secret object. #pod behaviour#restart pod# Can you restart a failed POD in kubernetes? Can not be done directly. Delete and recreate if yaml file is available. if the pod is not created as a result of a ReplicaSet or a Deployment object and the pod's spec is not available, use the below method: - Extract the spec (yaml) & use replace command to recreate it as below: kubectl get pod/sonarqube-ui-test -o yaml| kubectl replace --force -f - What is init containers in Kubernetes? The containers that are started up to complete certain prerequisite conditions before starting up those regular/app containers in a POD. The one or more init containers will run sequentially. Each init container must succeed before the next can run. When all of the init containers have run to completion, kubelet initializes the application containers for the pod and runs them as usual. The usage examples of init containers: - Starting the application containers only after confirming the required database & application services are started up. - Clone the static web application files from a SCM like Github to a shared volumes before starting up the web server container to serve the same. Are existing labels assigned to a Pod are modifiable? yes, they're modifiable with "--overwrite" option as in the below example. kubectl label po kubia-manual-v2 env=debug --overwrite What is canary release? A canary release is when you deploy a new version of an application next to a stable version, and only let a small fraction of users hit the new version to see how it behaves befor rolling out to all users. This prevents a bad release from being exposed to too many users. How do you list pods that do not have a particular label,for example env included? kubectl get po -l "|env" How do you list all the pods categerized by providing 2 different values using labels? kubectl get po -l env in (prod,devel) How do you schedule a pod on specific nodes? Nodes also could be labeled like Pods. So, adding a label to the concerned nodes and specifying it in the "nodeSelector" clause while creating the pod will do. How do you schedule a pod to a specific node? Each node has a unique label with the key kubernetes.io/hostname and value set to the actual hostname of the node. But, setting the nodeSelector to a specific node by using this may lead to pod being unscheduleable if the node is offline. Hence, it is recomended to use label selectors which logically group the nodes. Can annotations be used in place labels? No, though annotations are similar to labels but they are not mean for that. Annotations can hold much larger information and primarily meant to be used by tools. What is the need for namespaces? It is used to split complex systems with numerous components into smaller distinct groups. They can also be used to separate resources in a multi-tenant environment, splitting up resources into production,development, and QA environments, or in any other way needed. What are those different mechanisms that Kubernetes adopt to do liveness probe against a container? a) HTTP GET : Performs an HTTP GET request on the container's IP address, a port and path. If it receives a response and the response code does not represent an error, the probe is considered successful. b) TCP socket probe: If the TCP connection to the specied port of the container is established successfully, the probe is successful. c) EXEC Probe: Executes an arbitrary command inside the container and checks the command's exit status code. If it is 0, the probe is successful, else it's considered as a failure. What are the additional properties that can be used for liveness probe? The main ones are DELAY, TIMEOUT,PERIOD, FAILURE & initialDelaySeconds. For example, Setting the DELAY=0 dictates the probing begins immediately after the container is started. The TIMEOUT=1 dictates the container must returns the response in 1 second, otherwise the probe is considered as a failure. The PERIOD=10 dictates the probe should occur for every 10 seconds. The FAILURE=3 dictates, the container gets restarted after 3 consecutive failures. And, the INITIALDELAYSECONDS to set intial delay, to avoid the starting of probing as soon as the container starts . How do you obtain the log of a crashed container? kubectl logs <POD> --previous What happens to the existing Pods when you change the label selector such that those Pods fall out of the scope of a replication controller? The replication controller stops caring about those pods. It will continue to create and manage the pods as per the changed label. What are the use cases for Daemon set? Log collector and resource monitor on every node. What do you do if you want to run a batch job for every 30 minutes? Create a cronjob (kind) providing schedule in the spec like how a typical cronjobs are setup in Linux and all. Is it possible to make a service to support multiple port numbers? Yes, it is. The required ports that a Pod listens on could be configured to support in a service. What is the advantage of defining names for ports in a service? It enables you to change the port number in a Pod without having to change the service spec. Example: apiVersion: v1 kind: Service metadata: name: kubia spec: ports: - name: http port: 80 targetPort: http - name: https port: 443 targetPort: https How do you use your service with FQDN to access your application, instead of using Service's Cluster-IP? Use the following format: <SERVICE_NAME>. Look for domain suffixes inside a container in /etc/resolv.conf. example: kubia.default.svc.cluster.local Use it as below in a command: kubectl exec -it kubiars-ltpmv -- curl Why a curl command works with the service name & domain suffix combo while ssh or ping do not work ? It is because the service's cluster IP is virtual IP, and only has meaning when it is combined with the service port. What happens when a new Pod/ReplicaSet is created with the same selector that an existing service is supporting? For example, while a service was configured to support a replicaset with 2 replicas having selector label as "myname: kubia", another replicaset with 2 replicas with the same label is configured. The service goes by the selector label and will start supporting the new replicasets too. It will include the end points of both the replicasets and eventually will have 4 end points. Hence, we should exercise caution while providing selector labels to the objects. How will the front-end pods connect/reach to the backend database pod? The database backend pod is exposed by a service which is used by the frontend pods. The front-end pods will get the IP address and port of the backend service via environment variables or DNS lookups. The DNS is configured in /etc/resolv.conf file inside the pod's container. How a service redirects the incoming connections to the corresponding pods? Although the pod selector is configured in the service spec, it's not used directly when redirecting incoming connections. Instead, the selector is used to build a list of IPs and ports, which is then stored in the endpoints resource. When a client connects to the service, the service proxy selects one of those IP and port pairs and redirects to the corresponding server. Is it possible to create a service without pod selector? Yes, in that case, you will need to create the Endpoints resource and include the list of endpoints the service would need to support. A service without pod selector: apiVersion: v1 kind: Service metadata: name: external-service spec: ports: - port: 80 The Endpoint resource having the same name as the service would look like as below: apiVersion: v1 kind: Endpoints metadata: name: external-service subsets: - addresses: - ip: 11.11.11.11 - ip: 22.22.22.22 ports: - port: 80 ``` What are the ways to expose your services, for example your web application, to the external world? - NodePort 2) LoadBalancer 3) Ingress resource. A LoadBalancer service is nothing but a NodePort service with a load balancer. How does the NodePort service work? Each node in the cluster opens a port on it and redirects traffic to the underlying service. There is no guarantee that NodePort/LoadBalancer services would direct the incoming connections to the pod's running on the same node. Is there a way to use the Pod's on the same node, instead of letting it making another hop to pod's on different nodes? Including the "externalTrafficPolicy: Local" in a service definition will do. When set, the service proxy will choose the locally running pod for the external connection opened through the service's node port. But, if there is no local pod's, the connection will hang. Therefore, you need to ensure that the LoadBalancer forwards connections only to nodes that has atleast one such pod. What are the drawbacks of setting "externalTrafficPolicy: Local"? - The connection distribution will occur on node basis only now, rather than pod's. It will be fine if all the nodes in the cluster have equal number of pod's only. Otherwise, the load won't be spread evenly across the Pod's as intended. - It does not preserve the source IP of the client the connections originating from. Hence, it does not suit to the applications that are logging the source IP. What is the use of readiness probe?. When the pod becomes ready again, it's re-added. What is the difference between readiness probe and liveness probe? If a pod's readiness probe fails, the pod is removed from the Endpoints object so that it won't have to handle any requests. If a liveness probe fails, it will kill the unhealthy pod and replace it with new, healthy ones. Why are readiness probes important? A readiness probe ensures that clients only talk to those healthy pods and never notice of any issues with the system. Imagine that a group of pod's (for example, pods running application servers), depends on a service provided by another pod (a backend database, for example). If at any point one of the foreground pods experiences any connectivity issue with the database, it may be wise for its readiness probe to signal to Kubernetes that the pod is not ready to serve any requests at that time. If the other pod's are not experiencing the same issues, they will continue to serve. Are readiness probes recommended to configure always? Yes. It is recommended to configure readiness probes as simple as sending HTTP requests to the base URL's. Where you will need to use headless services? - The client needs to connect to all the pods. 2) Each pod needs to connect to all the other pods. What is the difference between a regular service and a headless service? The regular service returns the CLUSTER IP such that the client will eventually connect to a single pod whereas a headless service will return multiple IPs. Configuration wise, the only addition to the headless services is setting the ClusterIP field to none. What volume types are available in kubernetes? emptyDir - A simple empty directory used for storing transient data. Created on the node where a pod is created on and gets deleted when the pod is deleted. All containers in the Pod can read and write the same files in the emptyDir volume, though that volume can be mounted at the same or different paths in each container. hostPath - used for mounting directories from the worker node's filesystem into the pod. NFS - An NFS share mounted into the pod. Cloud Storage: gcePersistentDisk (Google), awsElasticBlockStore (AWS),azureDisk (MicroSoft) configMap,secret,downwardAPI : Special types of volumes used to expose certain Kubernetes resources and cluster information to the pod. persistentVolumeClaim : A way to use pre-provisioned or dynamically provisioned persistent storage. What are sidecar containers? A sidecar container is a container that augments the operation of the main container of the pod. Use case: A static website whose contents are stored in GitHub repo. And, everytime the pod is started, it should clone the repo and start the webserver to serve the contents. instead of having both the logic together in a single container, have an init/sidecar container which does the cloning part in a volume shared with the web server container. What option do you set for persistentReclaimPolicy? The available options are, Retain, Recycle, and Delete. The scenario where it comes into the picture is while deleting a persistent volume claim. If you want to retain the underlying volume of the claim, you should set it to "Retain", to reuse it or make it available for a different claim, set it to "Recycle" and if you want to delete the volume itself, set it to "Delete". With the “Retain” policy, if a user deletes a PersistentVolumeClaim, the corresponding PersistentVolume is not be deleted. Instead, it is moved to the Released phase, where all of its data can be manually recovered. What access modes are available for a persistent volume? RWO - ReadWriteOnce - Only a single node can mount the volume for reading and writing. ROX - ReadOnlyMany - Multiple nodes can mount the volume for reading. RWX - ReadWriteMany - Multiple nodes can mount If the use case is such that you want to retain the contents of a persistent volume after deleting the persistent volume claim which is using it, set it to "Retain", else if you want to.... minikube start --extra-config=apiserver.cloud-provider=aws --extra-config=controller-manager.cloud-provider=aws What is the difference between the below Dockerfile commands? - ENTRYPOINT node app.js - ENTRYPOINT ["node", "app.js"] The first one runs the given command inside a shell only, while the second one runs it directly. The first type of running the command is called shell form and the second one is called exec form. The shell process is unnecessary, hence using the second command is recommended. In Kubernetes, how do you override the given ENTRYPOINT & CMD of the container/image? Set the properties command and args in the container specification to override ENTRYPOINT and CMD respectively. The command and args field can not be updated after the pod is created. What is the use of configMaps? It is to decouple the configuration information from the pod definition, so that the same pod definition could be shared between different environments, for example, ofcourse with an environment specific configuration defined in configMaps for each environment involved. What will happen if the referenced configMap in the pod does not exist while creating it? The container referencing the non-existing configMap will fail to start, but the other containers, if any, will start normally. If you then create the missing configMap, the failed container is started without requiring you to recreate the pod. What happens if the given key in the configMap is invalid (for example, "CONFIG_FOO-BAR", having "-" as part of the key name is not accepted as a valid)? It skips the key but records an event informing it skipped it. How do you ensure that Kubernetes pull only the latest updated image for pod's? - Set "imagePullPolicy" property to "Always". 2) Change the tag everytime the image is updated. 3) Tag the image "latest". What strategies are available to follow for Deployments? - Rolling update 2) Recreate What's the use case for Recreate Strategy? When your application does not support running multiple versions in parallel and requires the old version to be stopped completely before the new one is started. What's the use case for RollingUpdate strategy for deployments? Use it to ensure the availability and maintain the same performance level of the application, provided your application supports both the old and the new versions running in parallel. Is it possible to update the existing image in a pod? Yes, use the below command to modify a container of any resource types, such as, replication set, deployments and so on..... kubectl set image <RESOURCE_TYPE> pod_name container_name=image_new_version Example: kubectl set image deployment kubia nodejs=luksa/kubia:v2 If it is a Deployment object, it will trigger rollouts, and the existing pods with the older version will be replaced with the new ones one by one. Is there a way to control the speed of rollouts? Set "minReadySeconds" to the Deployment object. It is used to slow down the rollouts so that you can prevent deploying malfunctioning versions by pausing or blocking the progression of rollouts. What kinds of applications a ReplicationSet can not support? The multiple replicas of a pod in a ReplicaSet share the same volumes only. A replicaSet will not support an application whose pods need to have their own volumes. For such requirements, StatfulSets are used. Why does StatefulSets scale down only one pod at a time? Certain stateful applications do not handle rapid scale-down nicely. For example, if a distributed data store is configured to store 2 copies of data, in cases where those 2 nodes go down at the same time, a new data just entered that is not written yet into any of those replicas will be lost. Why StatefulSets do not allow scale down operations if any of the existing instances is unhealthy? For the same reason as above. What will the scheduler check while scheduling a pod which has resource requests? It will decide whether to schedule a pod on a particular node based on the sum of resources requested by all the deployed pods on the node, not the current resource usage. What will be the values of "resource requests", when you set only "resource limits" for containers in a pod? The resource requests will be set to the same values as the given "resource limits". What happens when a process running in a container/pod exceeds the memory limit set? Kubernetes will kill the pod, and restart it if the restart policy is set to Always or OnFailure. It restarts it every time when the condition recurs. After a few more such re-starts, Kubernetes will be restarting it with increased delays between restarts. ++stateful set++stateful pod++stateful pod not moving to another node++ failover++stateful pod failover++ Node failure++ Why is a Stateful set pod not shifting/failing-over to another node, when the current node where it is fails? This is by design. When a node goes "down", the master does not know whether it was a safe down (deliberate shutdown) or a network partition. Thus PVC with that node remains on the same node and master mark the pods on that node as Unknown By default, Kubernetes always tries to create the pod on the same node where PVC is provisioned, which is the reason the pod always comes up on the same node when deleted. This PVC goes onto another node only when you cordon the node, drain the node and delete the node from the cluster. Now the master knows this node doesn't exist in the cluster. Hence master moves PVC to another node and pod comes up on that node. ++deleted node++deleted node back++getting deleted node back++ Is it possible to get the deleted node back? The command - “kubectl uncordon <node_name>” shows even the deleted node before. ##important##must-know##statefulset failover++ Why are StatefulSet Pods not failing over to another node and waiting indefinitely? Excerpts from - After a node becomes Unknown or NotReady and pods are ready to be evicted, the statefulset pods too will become Unknown … and they will stay that way “forever” (i.e. until the node is able to re-establish communication with the master). For example, when datastore-statefulset-1 enters an Unknown state, the master will not spin up a replacement as it would a deployment. Remember that the pod and node cannot communicate with the master, and statefulsets have a guarantee that there will be at most one pod per index . The Kubernetes master cannot verify the existence of datastore-statefulset-1, therefore it does not have enough information to be certain that spinning up a new pod would not violate the “at most one” guarantee. This is not a bug, it is a feature that the designers of Kubernetes built to protect the integrity of state and associated stateful resources like hard disks. If you are certain that your stateful resources will not be affected by a statefulset pod being replaced like a deployment pod, there is a modification that you can make to have it act as such. Simply set the terminationGracePeriod of the statefulset pod to 0. With this change, the Kubernetes master is now ensured that the statefulset pod will be forcefully killed when connection is re-established, and therefore it need not await any kind of status check regarding the pod. Now if the statefulset pod is rescheduled while the node is partitioned and the previous pod is in Unknown state, the master would not be violating “at most one” guarantee.But remember that those partitioned pods may still be running! From the official documentation regarding nodes:. Where Kubernetes keeps track of everything relating to Pods? It has everything related to a Pod at the below directories/files on the respective host where a Pod is running on, main path: /var/lib/kubelet/pods/<pod_id> drwxr-x--- 5 root root 4096 Apr 8 06:04 containers -rw-r--r-- 1 root root 250 Apr 8 06:04 etc-hosts drwxr-x--- 3 root root 4096 Apr 8 03:14 plugins drwxr-x--- 3 root root 4096 Apr 8 06:04 volume-subpaths drwxr-x--- 7 root root 4096 Apr 8 03:14 volumes How do you see the contents of emptyDir volume of a Pod on the node? -- Get PodID kubectl get pods -n <namespace> <pod-name> -o jsonpath='{.metadata.uid}' e.g: kubectl get pod jenkins-0 -o jsonpath='{.metadata.uid}' -- The path where ALL of a Pod's volumes (Well, except "hostPath" volume type) are mounted on to the host: Path: /var/lib/kubelet/pods/<pod_id>/volumes kubernetes.io~configmap kubernetes.io~empty-dir kubernetes.io~nfs kubernetes.io~projected kubernetes.io~secret What will happen to those running pods when you drain node after cordoning it? -- When you try to drain a node, you will get a warning like the below, kubectl drain k8s-node2 node/k8s-node2 already cordoned error: unable to drain node "k8s-node2", aborting command... There are pending nodes to be drained: k8s-node2 cannot delete Pods with local storage (use --delete-emptydir-data to override): jenkins/jenkins-0, jenkins/sonarqube-postgresql-0, jenkins/sonarqube-sonarqube-b5fc958c-bpd4k cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/kube-flannel-ds-2mtlk, kube-system/kube-proxy-w2m72 -- if you still want to proceed besides the above warning: kubectl drain k8s-node2 --delete-emptydir-data --ignore-daemonsets The node is drained and pods are switched over to a different node now. What is the difference between executing "cordon" & "drain" on a node? "cordon": Prevents new pods getting scheduled on to the node. "drain": Evicts ALL those running Pods & creates them back (except the standalone pods & one created by Daemon sets) on other available nodes. How do you put a node back into service which was cordoned and drained before? The current status of a node, post cordoning and draining: NAME STATUS ROLES AGE VERSION k8s-node2 Ready,SchedulingDisabled <none> 7d15h v1.23.5 kubectl uncordon node k8s-node2 The current status of the node: kubectl get node k8s-node2 NAME STATUS ROLES AGE VERSION k8s-node2 Ready <none> 7d16h v1.23.5 When will you have to drain & evict pods on a node? Before shutting down a node for maintenance or for purposes such as upgrade, it is necessary to evict the Pods running on the node safely. The ‘kubectl drain’ command comes handy during this situation. Check for more info on cordon/drain: The scenario is such that you do not have the manifest file of a deployment available (say, a restart of a mongodb pod/deployment is required) so you can not delete the existing and re-create the deployment. How do you handle it? kubectl rollout restart deployment/mongo This command deletes the existing deployment and creates a new one. kubectl rollout status deployment/mongo Waiting for deployment "mongo" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "mongo" rollout to finish: 1 old replicas are pending termination... deployment "mongo" successfully rolled out Can you specify your own IP address to a service?. What will happen if you try to create a PV pointed to a non-existing path (in hostPath)? It does NOT throw any errors but the PV gets created. But, at the time of creating pods in the PV/C only, it will throw the error, for example, in case if it is not able to create the path, like the below: "Error: failed to generate container "1285929e2fa2f3f99054364fd2961d95aac35c66ce01433c6fed1e6b e8302920" spec: failed to generate spec: failed to mkdir "/data/mongo": mkdir /data: read-only file system" What does the Pod's status "Completed" say? It means, the container(s) in the pod are successfully completed and there are no more process to complete. e.g. apiVersion: apps/v1 kind: Deployment metadata: name: busybox-deployment labels: app: busybox spec: replicas: 1 strategy: type: RollingUpdate selector: matchLabels: app: busybox template: metadata: labels: app: busybox spec: containers: - name: busybox image: busybox imagePullPolicy: IfNotPresent command: ['sh', '-c', 'echo Container 1 is Running ; sleep 10'] The above Pod is showed as "Completed" when the busybox container in it has executed the given commands (echo & sleep). NAME READY STATUS RESTARTS AGE busybox-deployment-757bdd75f5-mv4qh 0/1 Completed 0 13s Would it be possible to update a Pod's spec with out re-creating? What is the Patch command used for? And, how? Use kubectl patch to update an API object in place. "Patch" command can be used to update an existing Pod's spec or update an existing service from ClusterIP to LoadBalancer , for example. Note that these could be accomplished by editing the Pod/Service also. ** Update Service Type:** kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}' ** Add another container to an exiting Pod ** Deployment.yml: apiVersion: apps/v1 kind: Deployment metadata: name: patch-demo spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: patch-demo-ctr image: nginx ** patch-file.yaml:** spec: template: spec: containers: - name: patch-demo-ctr-2 image: redis Patch the deployment: kubectl patch deployment patch-demo --patch-file patch-file.yaml Pods Before Patch (only a single container shows up under READY column) : NAME READY STATUS RESTARTS AGE patch-demo-28633765-670qr 1/1 Running 0 23s patch-demo-28633765-j5qs3 1/1 Running 0 23s Pods After Patch( 2 containers show up under READY column now): NAME READY STATUS RESTARTS AGE patch-demo-1081991389-2wrn5 2/2 Running 0 1m patch-demo-1081991389-jmg7b 2/2 Running 0 1m How do you debug/fix an issue with a Pod which is getting restarted by the Liveness probe configured with it? For debugging, we can increase the Liveness check initialization time or remove the check for some time and see what the problem is by going through the pod logs. How to arrive at what values to set for Resource Limits/Requests? To get idea of the behavior of container in terms of memory /cpu usage/limit, this solely depends on the application type, load its handling, heap memory it uses etc. After observations on the fluctuation by load testing and performance analysis, the limits & requests has to be set. What is the difference between Liveness probe & Readiness Probe in terms of their responsive/corrective action when they get failure response from the configured probe? The readiness probe will take out the Pod from service while the Liveness probe will try to fix the issue by restarting the container/pod. When do you get to see "CrashLoopBackOff" as a status of a Pod? When a Pod restarts a container (for example, a container with Alpine unix image without any daemon/command running inside) multiple-times and still the container keeps stopping/failing, the status of the pod will be set as "CrashLoopBackOff". What the status of Pod "ImagePullBackoff" says? It means, Kubernetes is not able to pull the image, and the issue is nothing but something to do with the given image only. What is the order you following while creating objects for a deployment? - ConfigMap 2) Secrets 3) Services 4) Deployment A Pod is using deriving value from a configMap object. When the variable's value is changed in the configMap, will it affect the value in the running pod? No, it does not change the value of the variable referred in the Pod. Is having Labels mandatory for all the objects? No, it is not mandatory, but specifying one is a good practice.
https://github-wiki-see.page/m/q-uest/notes-doc-k8s-docker-jenkins-all-else/wiki/Kubernetes-Docker-QA%27s
CC-MAIN-2022-27
refinedweb
4,919
62.27
The simplest Observable<T> implementation for Functional Reactive Programming you will ever find. This library does not use the term FRP (Functional Reactive Programming) in the way it was defined by Conal Elliot, but as a paradigm that is both functional and reactive. Read more about the difference at Why I cannot say FRP but I just did. FeaturesFeatures - Lightweight, simple, cross plattform FRP - Multithreading with GCD becomes a breeze - Most of your methods will conform to the needed syntax anyway. - Swift 3 and 4 compatibility - Multithreading with GCD becomes a breeze via WarpDrive - Supports Linux and swift build - BYOR™-technology (Bring Your Own Result<T>) RequirementsRequirements - iOS 7.0+ / Mac OS X 10.10+ / Ubuntu 14.10 - Xcode 8 UsageUsage For a full guide on how this implementation works see the series of blog posts about Functional Reactive Programming in Swift or the talk at UIKonf 2015 How to use Functional Reactive Programming without Black Magic. Creating and updating a signalCreating and updating a signal let text = Observable<String>() text.subscribe { string in print("Hello \(string)") } text.update("World") Mapping and transforming observablesMapping and transforming observables let text = Observable<String>() let greeting = text.map { subject in return "Hello \(subject)" } greeting.subscribe { text in print(text) } text.update("World") Use functions as transformsUse functions as transforms let text = Observable<String>() let greet: (String)->String = { subject in return "Hello \(subject)" } text .map(greet) .subscribe { text in print(text) } text.update("World") Handle errors in sequences of functionsHandle errors in sequences of functions let text = Observable<String>() func greetMaybe(subject: String) throws -> String { if subject.characters.count % 2 == 0 { return "Hello \(subject)" } else { throw NSError(domain: "Don't feel like greeting you.", code: 401, userInfo: nil) } } text .map(greetMaybe) .then { text in print(text) } .error { error in print("There was a greeting error") } text.update("World") This also works for asynchronous functionsThis also works for asynchronous functions let text = Observable<String>() func greetMaybe(subject: String) -> Observable<Result<String>> { if subject.characters.count % 2 == 0 { return Observable(.success("Hello \(subject)")) } else { let error = NSError(domain: "Don't feel like greeting you.", code: 401, userInfo: nil) return Observable(.error(error)) } } text .flatMap(greetMaybe) .then { text in print(text) } .error { _ in print("There was a greeting error") } text.update(.success("World")) Flatmap is also available on observablesFlatmap is also available on observables let baseCost = Observable<Int>() let total = baseCost .flatMap { base in // Marks up the price return Observable(base * 2) } .map { amount in // Adds sales tax return Double(amount) * 1.09 } total.subscribe { total in print("Your total is: \(total)") } baseCost.update(10) // prints "Your total is: 21.8" baseCost.update(122) // prints "Your total is: 265.96" CommunicationCommunication - If you found a bug, open an issue. - If you have a feature request, open an issue. - If you want to contribute, open an issue or submit a pull request. InstallationInstallation Dynamic frameworks on iOS require a minimum deployment target of iOS 8 or later. To use Interstellar with a project targeting iOS 7, you must include all Swift files directly in your project. CocoaPodsCocoaPods CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command: $ gem install cocoapods To integrate Interstellar into your Xcode project using CocoaPods, specify it in your Podfile: source '' platform :ios, '8.0' use_frameworks! pod 'Interstellar' Then, run the following command: $ pod install swift buildswift build Add Interstellar to your Package.swift: import PackageDescription let package = Package( name: "Your Awesome App", targets: [], dependencies: [ .Package(url: "", majorVersion: 2), ] ) CarthageCarthage Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application. You can install Carthage with Homebrew using the following command: $ brew update $ brew install carthage To integrate Interstellar into your Xcode project using Carthage, specify it in your Cartfile: github "JensRavens/Interstellar" FAQFAQ Why use Interstellar instead of [insert your favorite FRP framework here]?Why use Interstellar instead of [insert your favorite FRP framework here]? Interstellar is meant to be lightweight. There are no UIKit bindings, no heavy constructs - just a simple Observable<T>. Therefore it's easy to understand and portable (there is no dependency except Foundation). Also Interstellar is supporting BYOR (bring your own Result<T>). Due to its protocol based implementation you can use result types from other frameworks directly with Interstellar methods. CreditsCredits Interstellar is owned and maintained by Jens Ravens. ChangelogChangelog - 1.1 added compability with Swift 2. Also renamed bind to flatMap to be consistent with Optionaland Array. - 1.2 Threadwas moved to a new project called WarpDrive - 1.3 WarpDrive has been merged into Interstellar. Also Interstellar is now divided into subspecs via cocoapods to make it easy to just select the needed components. The basic signal library is now "Interstellar/Core". - 1.4 Support swift buildand the new Swift package manager, including support for Linux. Also removed deprecated bind methods. - 2 Introducing Observable<T>, the successor of Signal. Use the observableproperty on signals to migrate your code from Signal<T>. Also adding Linux support for Warpdrive and introduce BYOR™-technology (Bring Your Own Result<T>). - 2.1 Update to Swift 3.2 to make it compatible with Swift 4. - 2.2 Update to Swift 4.1, fixing build warnings on Xcode 9.3 (Maintains backwards compatibility with Swift 3.3 projects). LicenseLicense Interstellar is released under the MIT license. See LICENSE for details.
http://www.alexruperez.com/entries/4648-jensravens-interstellar
CC-MAIN-2019-09
refinedweb
891
51.04
Impressive .NET API DWG/DWF Compatibility When talking about file format compatibility, it is important to note and understand exactly what ZWCAD+ is trying being compatible with. With the origins of DWG and DWF file formats firmly rooted with the Autodesk AutoCAD product, this is what will be used as the benchmark for what is expected from DWG and DWF files. DWG– Entities The first and most obvious thing for me to check is that DWG files opened in ZWCAD+ contain the same basic list of entities that are contained within AutoCAD. With my software developer hat on, I know that reading data from a file format such as DWG is fraught with obstacles. The software needs to be written in such a way that it can cope with and understand all the possible varying ways in which the DWG file can validly be structured. If it is structured in a way that the software does not understand, it might result in entities being omitted, or converted to other more generic types. Therefore my first test is to open up a range of drawings, and simply perform a count of the various entity types that my test drawings contain.I have four drawings, each of which contains various types of entities. Below I have created a table showing the entity types and count of each. Figure 1 - Entity Counts While this is at its core a very basic test, we are indirectly testing quite a wide range of features, and it is a good way to establish compatibility of many of the fundamentals in one simple process. ZWCAD+ matches AutoCAD exactly, which is a pretty good start. DWG - File Sizes Another way to see if AutoCAD and ZWCAD+ are doing different things with the file format is to compare file sizes. Below is another table showing the file sizes of the same four files, when saved by AutoCAD vs. ZWCAD+. Figure 2 - DWG File Sizes ZWCAD+ gets pretty close to the file size AutoCAD creates, but it is not a 100% match. It’s reasonable to have some degree of variance though, and I’d say this is well within what I’d call acceptable. We can infer that ZWCAD+ is saving the data in a very similar way to AutoCAD. DWF – File Sizes As with DWG, comparison of the DWF file sizes created by both AutoCAD and ZWCAD+ can be revealing. Here is a comparison of two sets of files created using the same DWF plot configuration. Figure 3 - DWF File Sizes Interestingly, ZWCAD+ produces files that are in some cases smaller than AutoCAD, and in some cases larger. While not necessarily an indication that the file has compatibility issues, it is certainly worth bearing in mind. The real test will be visually inspecting them in Autodesk Design Review. DWF – Appearance Visual inspection of the two DWF version shows that ZWCAD+ imitates the AutoCAD DWF format with impressive likeness. Line weights and types are spot on. Hatching is the same, and annotation and dimensioning is indistinguishable from a true AutoCAD DWF. Essentially, except for the slight difference in the margin (which incidentally was probably my fault in the first place…), I cannot visually tell the two DWF files apart. Figure 4 – DWF ZWCAD Screenshot Figure5 - DWF AutoCAD Screenshot Cloud Workflow Configuration Initially I thought I would be optimistic and click on the “Online” tab on the ribbon, and click Save to Cloud. Of course, some configuration is required, and I was quickly presented with a message stating that “ZWCAD+ Syble” was not enabled. Helpfully though, right under my mouse was an “Open and Configure” button. I clicked the button, and was immediately taken to the Online tab in the Options dialog box. Right at the top is an obvious checkbox saying “Enable cloud storage”, which enabled all the other options for setting up a cloud storage provider. I have a Dropbox account, so I selected that, and clicked the “Authorise” button. The Dropbox website then popped up. After entering my username and password, ZWCAD had been authorised to use my account. The configuration process was very, very simple. Working on the Cloud Once configured, working on the cloud is surprisingly easy. From the Online tab, I can simply click “Save to Cloud”, which then presents the “Save As” dialog that you’d normally get when saving a drawing. Automatically selected is a local folder, named “ZWCAD+ Syble”. Clicking “Save” waits for a moment as if it’s just saving the file, and then just closes, with nothing particularly indicating it had been uploaded to a cloud service. The process is very transparent, to the point where I felt the need to check it had really worked. I then logged into my Dropbox account to verify it had saved, and sure enough there it was, in a new directory created for my ZWCAD+ work. I can see this feature being an effective backup solution, and an excellent way to share up to date versions of the same drawings with others. .NET API Compatibility Being one of my speciality subjects, this is the part of this review I have been looking forward to. Porting an Existing Project For this, I thought I would go all-out and port over one of my most popular developments, my survey fixing utility. Essentially the purpose of this tool is to convert a 2D survey drawing into a 3D survey drawing (if you want to find out more, visit). Thinking about the process of porting over my AutoCAD .NET projects, I originally figured this would involve re-writing some code, so that I am using the type libraries of the ZWCAD+ application.I supposed that it would probably involve modifying a few properties and methods here and there to suit what is required by ZWCAD+. However, I had helpfully been given a document that sets out how to migrate projects from AutoCAD .NET projects to ZWCAD+ .NET projects, and I was amazed to find that the process is claimed to be surprisingly simple. The first step is to set the .NET build version to 4.0, and replace any references to AcMgd.dll and AcDbMgd.dll with the ZWCAD+ versions of the same files. This is of course pretty easy to do. Next, it is necessary to update the relevant namespaces. For example, my survey fixing utility was written in VB.NET, and required the following changes to the imports statements at the top of the application: Figure 6 - Namespace Changes There were a few other instances throughout the project that required tweaking, but again this was only modifying namespaces as shown above. Apart from these very minor changes, amazingly, nothing else is required at all. All of the properties and methods that I was using in the original AutoCAD API appear to have a valid corresponding ZWCAD+ equivalent, because there were no highlighted errors in the IDE. Building the project also yielded no errors – at this point I have to confess I was thinking to myself “there is no way it is that simple…” However, calling the NETLOAD command from ZWCAD+ and selecting the project actually worked first time. Running my SURVEYFIX command, which is how my program is executed, worked first time. The whole conversion process worked first time, and my software works exactly as expected in ZWCAD+. I cannot overstate how impressed I am with the ZWCAD+ API. It mimics the AutoCAD API very accurately, allowing developers such as myself to reuse existing code, essentially without changing anything except the project references. To convert my project over to the ZWCAD+ .NET API, there were only had a handful of things to change, all of which took roughly 5 minutes to update. The other big plus is that people who have learnt to develop for AutoCAD have no need to re-learn the API for ZWCAD+, as I might have expected. Because ZWCAD+ has imitated AutoCAD so well, all learning of the AutoCAD API automatically means you can also develop for ZWCAD+ as well. Developers for ZWCAD+ will also be able to benefit from the wealth of information already out there for developing .NET applications for AutoCAD. Summary I am a huge fan of the Autodesk AutoCAD application, but I have always been intrigued by alternatives that essentially do the same type of thing. I have never seriously considered changing my application to an alternative, but with the product quality of ZWCAD+, and the incredibly accurate likeness to AutoCAD, both in its impressive compatibility and development API, I will most certainly be considering ZWCAD+ when I want to upgrade next. William Forty has 10 years experience working in both the mechanical and civil engineering industry, primarily working with AutoCAD and Civil 3D. With a keen interest in software development, and having a 1st class honors degree in computing, he is proficient in most mainstream programming languages and web technologies.
http://www.zwsoft.com/zwcad/expert_reviews/great_compatibility/
CC-MAIN-2014-49
refinedweb
1,486
60.24
Need to Modify my codes to include a function for both A and B. The function for A should have the quantity of numbers passed in as a parameter and needs to return the largest number. The function for B should have no parameters and return the smallest number. What i have so far is this. #include <iostream> using namespace std; double larger(double x, double y); int main() { char response; int num = 0; int newNumber = 0; int max = -9999; int min = 9999; do{ max = -9999; min = 9999; cout << "A - Find the largest number with a known quantity of numbers." << endl; cout << "B - Find the smallest number with an unknown quantity of numbers." << endl; cout << "C - Quit" << endl; cin >> response; switch (response){ case 'a': case 'A': cout << "How many numbers do you want to enter?" << endl; cin >> num; cout << "Start entering numbers." << endl; for (int count = 0; count < num; count++){ cin >> newNumber; if (newNumber > max) max = newNumber; } cout << "The largest number is: " << max << endl; break; case 'b': case 'B': cout << "Start entering numbers. -99 to quit" << endl; do{ cin >> newNumber; if ((newNumber < min) && (newNumber != -99)) min = newNumber; }while (newNumber != -99); cout << "The smallest number is: " << min << endl; break; } } while ((response != 'C') && (response != 'c')); return 0; } now the steps i took to write this code was: 1. do{ 2. Present Menu 3. Get User Choice 4. Switch statement -> If user choice matches case A, go to 5, if it matches case B, go to 11, if C go to 18 5. Ask how many numbers they want to enter 6. Run for loop. If number of times is less than or equal to user entry, go to step 7, else go to step 10 7. Ask user for input 8. Calculate 9. Go back to 6 10. break to line 17 11. Run while loop 12. Get user entry 13. If user entry is not -99, calculate 14. If user entry is -99, go to line 16 15. Go to step 11 16. break to line 17 17. Loop back to line 1 18. end program And the next step I need to take steps 6-9 above, create a function for what it is doing and pass the data gathered in step 5 above as a parameter. But honestly lost in exactly how to start the process.... I am not asking for all the answers but some help to get started.
https://www.daniweb.com/programming/software-development/threads/98270/user-defined-functions-i-jumpstart-help
CC-MAIN-2018-17
refinedweb
401
84.17
In the previous article, we studied how can use MATLAB C API to solve engineering problems. In this article I will show you how can use MATLAB C++ math library. The MATLAB� C++ Math Library serves two separate constituencies: MATLAB programmers seeking more speed or complete independence from interpreted MATLAB, and C++ programmers who need a fast, easy-to-use matrix math library. To each, it offers distinct advantages. MATLAB is abbreviation of Matrix Laboratory. This means every computation was performed in matrix form. In other hand every data type wrapped in matrix form and every function take these matrix as an input argument. For example you want to multiply to polynomial as follow: A = (3x2 + 5x + 7) (4x5 + 3x3 - x2 + 1) You can use two matrices for coefficients of any polynomials: [3 5 7] for (3x2 + 5x + 7) and [4 0 3 -1 0 1] for (4x5 + 3x3 - x2 + 1), using conv function, we can obtain coefficients of result: conv([3 5 7], [4 0 3 -1 0 1]): A = [12 20 37 12 16 -4 5 7] means: A = 12x7 + 20x6 + 37x5 + 12x4 + 16x3 - 4x2 + 5x + 7 The MATLAB C++ Math Library consists of approximately 400. The MATLAB C++ Math Library is firmly rooted in the traditions of the MATLAB runtime environment. Programming with the MATLAB C++ Math Library is very much like writing M-files in MATLAB. While the C++ language imposes several differences, the syntax used by the MATLAB C++ Math Library is very similar to the syntax of the MATLAB language. Like MATLAB, the MATLAB C++ Math Library provides automatic memory management, which protects the programmer from memory leaks. Every matrices represented by mwArray class, a data type introduced by MATLAB for constructing a matrix. As I said before, every data must be wrapped in a matrix form in other hand: mwArray. One C++ prototype supports all the possible ways to call a particular MATLAB C++ Math Library function. You can reconstruct the C++ prototype by examining the MATLAB syntax for a function. In the following procedure, the MATLAB function svd() is used to illustrate the process. s = svd (X) [U, S, V] = svd (X) [U, S, V] = svd (X, 0) In this example, the prototype that corresponds to [U, S, V] = svd (X, 0) is constructed step-by-step. Until the last step, the prototype is incomplete. mwArray. mwArray svd( mwArray*. mwArray svd (mwArray* S, mwArray* V, mwArray. mwArray svd (mwArray* S, mwArray* V, const mwArray& X, const mwArray& Zero); The prototype is complete. This procedure translates the MATLAB call [U, S, V] = svd (X, 0) into a C++ call. The procedure applies to library functions in general. Note that within a call to a MATLAB C++ Math Library function, an output argument is preceded by &; an input argument is not. mwArrayvariables, and assign values to the input variables. U = svd ( U = svd (&S, &V, U = svd (&S, &V, X, 0); The translation is complete. Note that if you see [] as a MATLAB input argument, you should pass mwArray() as the C++ argument. For example, B = cplxpair (A, [], dim) becomes B = cplxpair (A, mwArray(), dim); The mwArray class public interface is relatively small, consisting of constructors and destructor, overloaded new and delete operators, one user-defined conversion, four indexing operators, the assignment operator, input and output operators, and array size query routines. The mwArray�s public interface does not contain any mathematical operators or functions. The mwArray interface provides many useful constructors. You can construct a mwArray object from the following types of data: a numerical scalar, an array of scalars, a string, an mxArray*, or another mwArray = NULL) Create a mwArray from either one or two arrays of double-precision floating-point numbers. If two arrays are specified, the constructor creates a complex array; both input arrays must be the same size. The data in the input arrays must be in column-major order, the reverse of C++�s usual row-major order. This constructor copies the input arrays. Note that the last argument, imag, is assigned a value of NULL in the constructor. imag is an optional argument. When you call this constructor, you do not need to specify the optional argument. mwArray (const mwArray& mtrx) Copy. Table 1 shows mwArray constructors in brief. Below is a list of useful mathematical functions of MATLAB C++ math library: To add support of MATLAB C++ Math Library follow these instructions:\ #include <matlab.hpp> matlab.hpp is interface of MATLAB C++ math library. Add directory of MATLAB interface files (*.hpp) to Visual Studio (Tools -> Options -> Directories). For example: x:\matlab\extern\include\cpp, where x is drive letter of matlab path. #include "stdafx.h" #include "matlab.hpp" //Interface of MATLAB CPP Math Library //Add C++ Math Library to project #pragma comment(lib, "libmatpm.lib") #pragma comment(lib, "libmx.lib") #pragma comment(lib, "libmatlb.lib") #pragma comment(lib, "libmat.lib") #pragma comment(lib, "libmmfile.lib") #pragma comment(lib, "libmatpm.lib") int main(int argc, char* argv[]) { mwArray A, B, C; A = magic(mwArray(5)); B = transpose(A); //B=A' C = plus(A,B); //C = A + B; C = minus(A,B); //C = A - B; C = mtimes(A,B); //C = A * B; double arr1[]={3.0, 2.0, 5.0, -1.0}; double arr2[]={8.0, 1.0, 3.0, -2.0}; mwArray D(1, 4, arr1); mwArray E(4, 1, arr2); C = D * E; //4*4 matrix mwArray F(0.0, 0.1, 5.0); //create double ramp F = F * transpose(F); A.Print("A"); //Magic Matrix, Order=5 C.Print("C"); D.Print("D"); return 0; } c:\matlab\extern\include\cpp\matmtxif.h (16): fatal error C1083: Cannot open include file strstream.h. No such file or directory. This error is due to missing preprocessor definitions in the MSVC environments. In order to alleviate this problem, the following definitions must be added to the project file for the application: Add these preprocessors to your project: Project->Settings->C/C++->Preprocessor definitions. LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFUALTLIB:library .\ex1.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe To resolve this problem change project settings to build a Multithread Dll in the Runtime Library. Do this by following these instructions: Enjoy! General News Question Answer Joke Rant Admin
http://www.codeproject.com/KB/cpp/matlab_cpp.aspx
crawl-002
refinedweb
1,055
56.76
one sqlite database to multiple autoit users By alexlimlexart, in AutoIt General Help and Support Recommended Posts Similar Content - Seminko Hey, I have a script that uses SQLite. It worked without a hiccup on my W7 system. However, last week I bought a new machine, installed W10 and autoit, and now I'm getting an error during _SQLite_Startup. Can anyone advise on how to find what's wrong? Tried checking $__g_hPrintCallback_SQLite but that returns nothing. Tried downloading the latest version of the dll from the link in the function page and I also replaced the default SQLite.dll.au3 that came with AutoIt with the one that came with the latest SQLite version zip. Relevant parts of my script: #include <SQLite.au3> #include <SQLite.dll.au3> _SQLite_Startup(@ScriptDir & " Thanks S. - By FrancescoDiMuro Good evening everyone I am building a management for the company I work with, and I just imported a real amount of rows ( about 29000 ), in my SQLite DB. The thing I am not understanding, is the time that the script takes to build this amount of rows in the ListView. I didn't measure it, but I think it took 2 minutes or so to create each ListView item... It is normal that it takes so much time? What can I do to improve the creation of the items? Here's the code I am using to query and to create ListView items... ; Articles ListView: Global $lvwArticles = GUICtrlCreateList Thanks in advance Best Regards. -.
https://www.autoitscript.com/forum/topic/136430-one-sqlite-database-to-multiple-autoit-users/
CC-MAIN-2018-39
refinedweb
246
74.29
My apologies, the correct settings command is: settings set target.experimental.swift-create-module-contexts-in-parallel false My apologies, the correct settings command is: After chatting with a few folks, they suggested the core issue is the transitive closure of any Swift modules which depend on Objective-C code with headers. This particular (very large) project has a main.swift module, which transitively depends on thousands of Objective-C headers, which I assume all have to be parsed by lldb. I changed main.swift to main.m and then lldb was able to more or less function. I wonder if this is related? Hi Ben! Does lldb work reliably when you set a breakpoint not in main.m, but in some deeper Swift code, e.g. within closure? In my case I have main.m and breakpoints work fast in any objc/c code, but they are slow in Swift code. Nice to run into you again. @beefon. In my case, the breakpoint is not in main; it's the default signal handler handling SIGABRT with a break. (I've also seen it on the break -E ObjC and break -E c++ breakpoints.) I've tried both true and false values for settings set target.experimental.swift-create-module-contexts-in-parallel. With false value, it is 3 seconds faster. that should address this contention I can see lldb-rpc-server loads a single CPU core (100%). Disk I/O is zero to 50 kilobytes/sec most of the time, 0 to ~20 IOPS in Activity Monitor. Does this sound like file system contention? UPD: Instruments shows that lldb-rpc-server reads only 140Mb of data during 1 minute of breakpoint 'processing time'. Disk activity is low during this time according to Instruments. UPD: System Call Trace shows for 16 seconds capture stat takes around 1.9 seconds. I guess if I extrapolate this to 60 seconds, this means ~10 seconds for stat calls. Same problem here I took some time to measure how lldb scales with a number of targets with debug symbols enabled. Apparently, the workaround would be to set GCC_GENERATE_DEBUGGING_SYMBOLS to NO for targets that I don't want to debug most of the time. This will somehow limit lldb experience but will keep it under control especially when you incrementally build your app. I took another look at the sample you posted in. I don't know how I arrived my initial conclusion that this wasn't clang-related, that sample is spending at least 50% in compiling Clang sources. Since you mentioned that you had a bridging header, this means we are compiling the bridging header from source for every dylib in your program. Fundamentally, bridging headers cannot be cached, because they aren't modular, so they have to be recompiled each time. I believe that you might be able to improve the load time significantly by modularizing as much of your Clang dependencies as possible. This can be as easy as writing module.modulemap files () for your header files but may involve some reorganization in case you have complicated cyclic dependencies. @pykaso A "Same here" comment by itself without any specifics doesn't contribute anything useful to the conversation. Did you mean to say that you took a sample and it looks similar, and you also have large bridging headers? I'm sorry for my previous useless comment. I was just frustrated by staring at the endless loading animation. We're facing the same issue for our mid-size project with features separated into 10 subprojects. There are no bridging headers in our project. The debugger will attach quickly, line with the breakpoint is highlighted but variables evaluation takes from tens of seconds to minutes. Today I removed all Xcode related files, clear the carthage cache, install the last Xcode beta but the issue still remains. log enable lldb default: lldb-rpc-server sample Thanks Adrian! That said, my bridging header is 2 lines long actually: #import "Application.h" #import "CrashReportingSchedulerObjC.h" and Application.h defines a single ObjC class with a single @import of UIKit, and CrashReportingSchedulerObjC.h has protocol + class definitions with two @import-s of Foundation and Crashlytics. FWIW, I've just replaced a legacy #import <Foundation/Foundation.h> with modern @import Foundation; and improved breakpoint time by 18 seconds, so now it takes 43 seconds, which is better, but its still 43 seconds on non-incremental non-clean build app start. @Adrian_Prantl Could you please elaborate a bit more for me. What is Clang dependency? If that is ObjC code, then I currently have 3 ObjC files in main target (I've mentioned two above + main.m), and the main target is the only one that has SWIFT_OBJC_BRIDGING_HEADER set. I can try to move that code off the main target to a separate framework, is this what you mean by 'modularizing as much of your Clang dependencies as possible'? UPD: I've completely removed bridging header and wiped SWIFT_OBJC_BRIDGING_HEADER build setting, leaving a single non-swift file main.m in my main target, but it is still 43 seconds. @pykaso Thanks for providing the detailed data. Your sample appears to spend most of its time compiling textual Swift interfaces. That could be because of a bug I recently fixed in dsymutil. Are you debugging with .dSYM debug info? You can list all loaded .dSYMs using "image list" in the debugger console. If yes, do any of the loaded .dSYMs contain a *.dSYM/Contents/Resources/Swift/[x86_64|arm64|...]/Swift.swiftinterface file? If yes, does deleting this file improve the load time? Could you please elaborate a bit more for me. What is Clang dependency? That is any Clang module or bridging header directly or indirectly imported by a Swift module you are debugging. Objective-C code as in .m files does not count here. You can have as much Clang-compiled code in your project as you want. It's only the interfaces that get imported into Swift that are relevant, because LLDB's integrated Swift compiler needs to import them to make sense of the types in the Swift module you are debugging. If your bridging header is that simple I'd highly recommend just replacing it with Clang modules. There is no need to import Foundation via a bridging header, you can just write import Foundation in Swift. You are just defeating the Clang's caching mechanism by importing it through the bridging header. Next step is to write a module map for your other header, you can use this as a starting point module CrashReportingScheduler { header "CrashReportingSchedulerObjC.h" export * } I don't know what your header imports, so you may need to do this through multiple layers of dependencies... To reiterate, there is no performance problem with importing Objective-C code as long as you are doing it through import ObjCModuleName in Swift and not through a bridging header. I've completely removed bridging header and wiped SWIFT_OBJC_BRIDGING_HEADERbuild setting, leaving a single non-swift file main.min my main target, but it is still 43 seconds. Can you take another sample? Can you double-check that you aren't also running into the same issue as @pykaso? Yes, there were circa 100 files with this name. When I deleted these files, the debugger displayed local variables within 10 sec instead of minutes! Thank you so much! Thanks for explanation, Andrian. I've set MODULEMAP_FILE build setting to a newly created file with contents as you provided, but Xcode doesn't like import CrashReportingScheduler: No such module 'CrashReportingScheduler'. I wonder if anything else must be done in order to use clang modules. I'd rather use them instead of bridging header. I can see MODULEMAP_PRIVATE_FILE , SWIFT_INCLUDE_PATHS, should I point any to my modulemap file? I've captured 4 samples - one at the lldb pause on breakpoint, 2 later on, and the last one right before Xcode would show up local variables. They are without bridging header and without module map file. Sorry, github gist fails to attach 4x4mb files. And regards swiftinterface files, find . -name "*.swiftinterface" returns 0 paths when I search in derived data The module.modulemap file must be in the same directory as the header files it lists, and the search path to the module.modulemap file must be listed via -I (or -Xcc -I). I'm not sure what Xcode setting translates best to that, but I'd suspect something with INCLUDE in the name. Can you verify that the performance issue caused by the extra Swift.swiftinterface file in the dSYM is fixed in Xcode 11.4 beta 3? In particular, that the new dsymutil will not copy that file into the .dSYM bundle? For the reference, we use CocoaPods. And it generates modulemap for every module (local dev pod and usual pods). Currently there are 194 module map files in total. I've removed most of .modulemap files (and MODULEMAP_FILE build settings), leaving only 23 of them. This shortened lldb time to display local variables down to 36 seconds (from 54). This is a good progress for us. Does it mean lldb unwraps all headers when it attempts to resolve vars for the first time? For the reference, CocoaPods generates the following structure e.g. for AttributedString target: AttributedString.modulemap: framework module AttributedString { umbrella header "AttributedString-umbrella.h" export * module * { export * } } AttributedString-umbrella.h #ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double AttributedStringVersionNumber; FOUNDATION_EXPORT const unsigned char AttributedStringVersionString[]; AttributedString-prefix.pch: similar to AttributedString-umbrella.h but without FOUNDATION_EXPORT (last 2 lines). I've started from scratch and modified CocoaPods to add @import UIKit; instead. I also went through all headers being imported in umbrella headers and replaced legacy #import <> calls with @import ;. This gave no obvious impact in terms of performance though. Does it mean even if modulemap contains in fact a reference to just @import UIKit;, lldb slows down simply because the number of these module maps is large enough? Because, as I said, when I remove most of modulemap-s, lldb runs faster quite a bit. For the reference, we use CocoaPods. And it generates modulemap for every module (local dev pod and usual pods). Currently there are 194 module map files in total. I've removed most of .modulemapfiles (and MODULEMAP_FILEbuild settings), leaving only 23 of them. I'm not sure I understand what you mean here. Why are you removing module map files? They should be desirable, right? To reiterate, you should want all of you Clang dependencies that you import into Swift imported through modules, not bridging headers. Does it mean lldb unwraps all headers when it attempts to resolve vars for the first time? I do not understand what you mean with "unwrap" here. What LLDB does is import the Swift module of the context you are stopped at with all its dependencies, the same way the Swift compiler or REPL would do. In fact, it's the same code. For the reference, CocoaPods generates the following structure e.g. for AttributedStringtarget: There seems to be a misconception here. For the most part, it does not matter to Clang whether you import a module by saying "@import UIKit" or by saying "#import <UIKit/UIKit.h". Usually both will trigger a modular import, but "@import" will fail if no module map can be found, whereas "#import" will fall back on a textual include. So there is no need for you to replace #import with @import. That said, and here it gets tricky, if you are inside a bridging header, or PCH, "#import" will always be a textual include. However, instead of rewriting your dependencies to use "@import" so you can keep using a bridging header, you should strive to just make everything a Clang module and import that from Swift and remove the bridging header entirely. Only if this really isn't possible you can start rewriting "#import" to "@import". That should be your last resort, not your first attempt. I hope that clarifies things a bit.
https://forums.swift.org/t/lldb-is-slow-to-resolve-local-vars/32517?page=2
CC-MAIN-2020-24
refinedweb
2,018
66.84
Details - Type: Bug - Status: Resolved - Priority: Major - Resolution: Fixed - Affects Version/s: 2.1.1Release - Fix Version/s: 2.5.2.Release - Component/s: Compiler Integration - Labels:None - Number of attachments : Description Inner classes compiled in groovy cause compile errors in java in eclipse. The errors go away when doing a full project clean but come right back as soon as the java file that is referencing the inner class is changed (rebuilt). This basically makes it impossible to use inner classes in joint java/groovy projects See the following example: //groovy code class Outer { static class Inner {} } //java code public class Client { { new Outer.Inner(); } } As I said if I do a project clean everything compiles. As soon as I edit and save Client.java eclipse gives me the following error: Outer.Inner cannot be resolved to a type Client.java /GroovyTest/src/main/java line 3 Java Problem Activity I open the following jira with the groovy project: the related issue GROOVY-4649 is now closed we'll pick up the fix when we move to 1.7.9 I was hoping that this was fixed after the upgrade to 1.7.10. But, this is only kind of working now from inside Eclipse. When I use the code above exactly, I get this compile problem: The constructor Outer.Inner() is undefined Client.java /GroovyTest/src/foo line 4 Java Problem The problem goes away when I add an explicit constructor to the inner class: class Outer { static class Inner { Inner() {} } } I get the same behavior for both 1.7.10 and 1.8.0. However, when I compile the original code from the command line, there are no compile errors (I was using 1.8.0 from the command line). I will lower the priority here since this is partially fixed. Well there is another issue I noticed the other day with Groovy 1.8 and static inner classes. When you have multiple static inner classes you get compile errors. If I recall the error is something to do with duplicate classes or something... I'll try to do some more testing on my end when I get a chance. This might be something to test on your end if your working on this.... The case is something like: class Outer { static class Inner1 { } static class Inner2 { } } Still a problem, or at least the original comment is still a problem. Travis, have you been able to narrow down the problem described in your comment? I have not been able to reproduce. I have not had a chance to give this a test. Most of our team has switched to using Intellij so I haven't heard any complaints of this lately... We do plan on using the eclipse compiler via maven at that point so this could affect us then. The original issue had to do with the core groovy compiler not compiling static inner classes correctly. Now it seems that is fixed but maybe there is a problem with multiple static inner classes. Could this be a problem in the core groovy compiler too? I'm not sure how greclipse uses the groovy compiler.... The "The constructor Outer.Inner() is undefined" is also a groovy 'bug'. I just raised - groovy incorrectly tags the generated constructor as synthetic. You won't see it on the command line if you compile the java and groovy together in one step, you need to do a two part compile, the groovy and then java. That more closely mirrors the eclipse incremental build that shows the problem. An eclipse full build won't show the problem. As for this: class Outer { static class Inner1 { } static class Inner2 { } } Can't get it to fail for me, maybe we've picked up some fix in 1.8.3 that addressed something in this area. please open a new bug if you see something in this area. Oh, and I've committed the fix for the groovy bug 5080 into our copy of groovyc, so that under greclipse we won't tag the constructors incorrectly. This fails for me with the following code (all code in .groovy files): package com.company.somepackage public interface SomeInterface { SomeGroovyObject doSomething(SomeOtherGroovyObject param) } package com.company.somepackage class SomeTestClass { void setup() { testObject.someProperty = new SomeInterface() { return new SomeGroovyObject() } } } The compiler gives an error like: SomeTestClass.groovy (at line 1) package com.company.somepackage ^ The type com.company.somepackage.SomeInterface$1 cannot be resolved. It is indirectly referenced from required .class files I've tried this from Maven on both 2.5.2-01 and 2.6.0-SNAPSHOT of groovy-eclipse-compiler. I've also checked out groovy-eclipse-compiler from svn and built but it fails with the same error. Hi Peter, Can you maybe give me a complete failing project that shows this problem? The code above is missing SomeOtherGroovyObject and SomeGroovyObject - but even when I supply stub implementations of them, the setup() method shows a problem: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: SomeTestClass.groovy: 13: unexpected token: return @ line 13, column 5. return new SomeGroovyObject() I dont get as far as a resolution error. IntelliJ IDEA has the same problem. See
http://jira.codehaus.org/browse/GRECLIPSE-983
CC-MAIN-2013-48
refinedweb
867
67.35
Hi all, I have been playing around with Nick O'leary's PubSubClient for MQTT (Arduino based) and now have it running on the . Only a small number of mods to get it up and running. For the broker I used Mosquitto (mosquitto.org) which supports several OS's and is very quick to get up and running. I have the library working for unauthenticated pub/sub to the broker as well as user id and password based authentication. Once connected it is very simple to publish to a queue using client.publish("Spark Status","I'm Alive..."); Or subscribe to an exiting queue / topic using client.subscribe("led"); There is a call back function that is used to trap incoming messages for a subscribed topic which can be tailored to do what you need. I have attached the libary and an sample with callback below. Right now all it does is allow you to control the led on D7. Send a mesage to topic led and use on, off or flash as the payload. To post a message to a topic you can use the mosquitto_pub tool and specify the topic and payload as follows mosquitto_pub -h 192.168.0.50 led -m flash or if using authentication mosquitto_pub -h 192.168.0.50 -u userid -P password -t led -m flash You can the mosquitto_sub program as a method to listen to topics - this might be a reasonable alternative to printing via the serial port for logging purposed. # is all topics. mosquitto_sub -h 192.168.0.50 -t "#" -v Code below - you need to amend the ip address (byte arrange ip[]) and the client.connect call for your own use. /* PubSubClient.cpp - A simple client for MQTT. Original Code - Nicholas O'Leary Adapted for Spark Core by Chris Howard - chris@kitard.com Based on PubSubClient 1.9.1 Changes - Added gcc pragma to avoid warnings being thrown as errors (deprecated conversion from string constant to 'char*') - publish_P function removed due to lack of Arduino PROGMEN support on the Spark Core - Obvious includes commented out - Using Spark TCPClient instead of Arduino EthernetClient */ #pragma GCC diagnostic ignored "-Wwrite-strings" // #include "PubSubClient.h" // #include <Arduino.h> #define ARDUINO_H #include <stdint.h> #include <stddef.h> #include <stdlib.h> //#include "Client.h" // MQTT_MAX_PACKET_SIZE : Maximum packet size #define MQTT_MAX_PACKET_SIZE 128 // MQTT_KEEPALIVE : keepAlive interval in Seconds #define MQTT_KEEPALIVE 15 #define MQTTPROTOCOLVERSION 3 #define MQTTCONNECT 1 << 4 // Client request to connect to Server #define MQTTCONNACK 2 << 4 // Connect Acknowledgment #define MQTTPUBLISH 3 << 4 // Publish message #define MQTTPUBACK 4 << 4 // Publish Acknowledgment #define MQTTPUBREC 5 << 4 // Publish Received (assured delivery part 1) #define MQTTPUBREL 6 << 4 // Publish Release (assured delivery part 2) #define MQTTPUBCOMP 7 << 4 // Publish Complete (assured delivery part 3) #define MQTTSUBSCRIBE 8 << 4 // Client Subscribe request #define MQTTSUBACK 9 << 4 // Subscribe Acknowledgment #define MQTTUNSUBSCRIBE 10 << 4 // Client Unsubscribe request #define MQTTUNSUBACK 11 << 4 // Unsubscribe Acknowledgment #define MQTTPINGREQ 12 << 4 // PING Request #define MQTTPINGRESP 13 << 4 // PING Response #define MQTTDISCONNECT 14 << 4 // Client is Disconnecting #define MQTTReserved 15 << 4 // Reserved #define MQTTQOS0 (0 << 1) #define MQTTQOS1 (1 << 1) #define MQTTQOS2 (2 << 1) class PubSubClient { private: //Client* _client; TCPClient* _client; // CH 14Jan2014 - changed Client* to TCPClient* uint8_t buffer[MQTT_MAX_PACKET_SIZE]; uint16_t nextMsgId; unsigned long lastOutActivity; unsigned long lastInActivity; bool pingOutstanding; void (*callback)(char*,uint8_t*,unsigned int); uint16_t readPacket(uint8_t*); uint8_t readByte(); bool write(uint8_t header, uint8_t* buf, uint16_t length); uint16_t writeString(char* string, uint8_t* buf, uint16_t pos); uint8_t *ip; char* domain; uint16_t port; public: PubSubClient(); PubSubClient(uint8_t *, uint16_t, void(*)(char*,uint8_t*,unsigned int),TCPClient& client); // CH 14Jan2014 - changed Client& to TCPClient& PubSubClient(char *, uint16_t, void(*)(char *,uint8_t*,unsigned int),TCPClient& client); // CH 14Jan2014 - changed Client& to TCPClient& //bool connect(const char *); bool connect(char *); bool connect(char *, char *, char *); bool connect(char *, char *, uint8_t, uint8_t, char *); bool connect(char *, char *, char *, char *, uint8_t, uint8_t, char *); void disconnect(); bool publish(char *, char *); bool publish(char *, uint8_t *, unsigned int); bool publish(char *, uint8_t *, unsigned int, bool); bool subscribe(char *); bool subscribe(char *, uint8_t qos); bool unsubscribe(char *); bool puback(uint16_t msgId); bool loop(); bool connected(); }; #include <string.h> PubSubClient::PubSubClient() { this->_client = NULL; } PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, void (*callback)(char*,uint8_t*,unsigned int), TCPClient& client) { // CH 14Jan2014 - Changed Client& to TCPClient& this->_client = &client; this->callback = callback; this->ip = ip; this->port = port; this->domain = NULL; } PubSubClient::PubSubClient(char* domain, uint16_t port, void (*callback)(char*,uint8_t*,unsigned int), TCPClient& client) { // CH 14Jan2014 - Changed Client& to TCPClient& this->_client = &client; this->callback = callback; this->domain = domain; this->port = port; } // CONNECT //bool PubSubClient::connect(const char *id) { bool PubSubClient::connect(char *id) { return connect(id,NULL,NULL,0,0,0,0); } bool PubSubClient::connect(char *id, char *user, char *pass) { return connect(id,user,pass,0,0,0,0); } bool PubSubClient::connect(char *id, char* willTopic, uint8_t willQos, uint8_t willRetain, char* willMessage) { return connect(id,NULL,NULL,willTopic,willQos,willRetain,willMessage); } bool PubSubClient::connect(char *id, char *user, char *pass, char* willTopic, uint8_t willQos, uint8_t willRetain, char* willMessage) { if (!connected()) { int result = 0; if (domain != NULL) { result = _client->connect(this->domain, this->port); } else { result = _client->connect(this->ip, this->port); } if (result) { nextMsgId = 1; uint8_t d[9] = {0x00,0x06,'M','Q','I','s','d','p',MQTTPROTOCOLVERSION}; // Leave room in the buffer for header and variable length field uint16_t length = 5; unsigned int j; for (j = 0;j<9;j++) { buffer[length++] = d[j]; } uint8_t v; if (willTopic) { v = 0x06|(willQos<<3)|(willRetain<<5); } else { v = 0x02; } if(user != NULL) { v = v|0x80; if(pass != NULL) { v = v|(0x80>>1); } } buffer[length++] = v; buffer[length++] = ((MQTT_KEEPALIVE) >> 8); buffer[length++] = ((MQTT_KEEPALIVE) & 0xFF); length = writeString(id,buffer,length); if (willTopic) { length = writeString(willTopic,buffer,length); length = writeString(willMessage,buffer,length); } if(user != NULL) { length = writeString(user,buffer,length); if(pass != NULL) { length = writeString(pass,buffer,length); } } write(MQTTCONNECT,buffer,length-5); lastInActivity = lastOutActivity = millis(); while (!_client->available()) { unsigned long t = millis(); if (t-lastInActivity > MQTT_KEEPALIVE*1000UL) { _client->stop(); return false; } } uint8_t llen; uint16_t len = readPacket(&llen); if (len == 4 && buffer[3] == 0) { lastInActivity = millis(); pingOutstanding = false; return true; } } _client->stop(); } return false; } uint8_t PubSubClient::readByte() { while(!_client->available()) {} return _client->read(); } uint16_t PubSubClient::readPacket(uint8_t* lengthLength) { uint16_t len = 0; buffer[len++] = readByte(); uint32_t multiplier = 1; uint16_t length = 0; uint8_t digit = 0; do { digit = readByte(); buffer[len++] = digit; length += (digit & 127) * multiplier; multiplier *= 128; } while ((digit & 128) != 0); *lengthLength = len-1; for (uint16_t i = 0;i<length;i++) { if (len < MQTT_MAX_PACKET_SIZE) { buffer[len++] = readByte(); } else { readByte(); len = 0; // This will cause the packet to be ignored. } } return len; } bool PubSubClient::loop() { if (connected()) { unsigned long t = millis(); if ((t - lastInActivity > MQTT_KEEPALIVE*1000UL) || (t - lastOutActivity > MQTT_KEEPALIVE*1000UL)) { if (pingOutstanding) { _client->stop(); return false; } else { buffer[0] = MQTTPINGREQ; buffer[1] = 0; _client->write(buffer,2); lastOutActivity = t; lastInActivity = t; pingOutstanding = true; } } if (_client->available()) { uint8_t llen; uint16_t len = readPacket(&llen); uint16_t msgId = 0; uint8_t *payload; if (len > 0) { lastInActivity = t; uint8_t type = buffer[0]&0xF0; if (type == MQTTPUBLISH) { if (callback) { uint16_t tl = (buffer[llen+1]<<8)+buffer[llen+2]; char topic[tl+1]; for (uint16_t i=0;i<tl;i++) { topic[i] = buffer[llen+3+i]; } topic[tl] = 0; // msgId only present for QOS>0 if (buffer[0]&MQTTQOS1) { msgId = (buffer[llen+3+tl]<<8)+buffer[llen+3+tl+1]; payload = buffer+llen+3+tl+2; callback(topic,payload,len-llen-3-tl-2); puback(msgId); } else { payload = buffer+llen+3+tl; callback(topic,payload,len-llen-3-tl); } } } else if (type == MQTTPINGREQ) { buffer[0] = MQTTPINGRESP; buffer[1] = 0; _client->write(buffer,2); } else if (type == MQTTPINGRESP) { pingOutstanding = false; } } } return true; } return false; } // PUBLISH bool PubSubClient::publish(char* topic, char* payload) { return publish(topic,(uint8_t*)payload,strlen(payload),false); } bool PubSubClient::publish(char* topic, uint8_t* payload, unsigned int plength) { return publish(topic, payload, plength, false); } bool PubSubClient::publish(char* topic, uint8_t* payload, unsigned int plength, bool retained) { if (connected()) { // Leave room in the buffer for header and variable length field uint16_t length = 5; length = writeString(topic,buffer,length); uint16_t i; for (i=0;i<plength;i++) { buffer[length++] = payload[i]; } uint8_t header = MQTTPUBLISH; if (retained) { header |= 1; } return write(header,buffer,length-5); } return false; } bool PubSubClient::write(uint8_t header, uint8_t* buf, uint16_t length) { uint8_t lenBuf[4]; uint8_t llen = 0; uint8_t digit; uint8_t pos = 0; uint8_t rc; uint8_t len = length; do { digit = len % 128; len = len / 128; if (len > 0) { digit |= 0x80; } lenBuf[pos++] = digit; llen++; } while(len>0); buf[4-llen] = header; for (int i=0;i<llen;i++) { buf[5-llen+i] = lenBuf[i]; } rc = _client->write(buf+(4-llen),length+1+llen); lastOutActivity = millis(); return (rc == 1+llen+length); } bool PubSubClient::subscribe(char* topic) { return subscribe(topic, 0); } // SUBSCRIBE bool PubSubClient::subscribe(char* topic, uint8_t qos) { if (qos < 0 || qos > 1) return false; if (connected()) { // Leave room in the buffer for header and variable length field uint16_t length = 5; nextMsgId++; if (nextMsgId == 0) { nextMsgId = 1; } buffer[length++] = (nextMsgId >> 8); buffer[length++] = (nextMsgId & 0xFF); length = writeString(topic, buffer,length); buffer[length++] = qos; return write(MQTTSUBSCRIBE|MQTTQOS1,buffer,length-5); } return false; } bool PubSubClient::puback(uint16_t msgId) { if(connected()) { // Leave room in the buffer for header and variable length field uint16_t length = 5; buffer[length++] = (msgId >> 8); buffer[length++] = (msgId & 0xFF); return write(MQTTPUBACK,buffer,length-5); } return false; } // HELPERS //bool PubSubClient::unsubscribe(char* topic) { bool PubSubClient::unsubscribe(char* topic) { if (connected()) { uint16_t length = 5; nextMsgId++; if (nextMsgId == 0) { nextMsgId = 1; } buffer[length++] = (nextMsgId >> 8); buffer[length++] = (nextMsgId & 0xFF); length = writeString(topic, buffer,length); return write(MQTTUNSUBSCRIBE|MQTTQOS1,buffer,length-5); } return false; } void PubSubClient::disconnect() { buffer[0] = MQTTDISCONNECT; buffer[1] = 0; _client->write(buffer,2); _client->stop(); lastInActivity = lastOutActivity = millis(); } uint16_t PubSubClient::writeString(char* string, uint8_t* buf, uint16_t pos) { char* idp = string; uint16_t i = 0; pos += 2; while (*idp) { buf[pos++] = *idp++; i++; } buf[pos-i-2] = (i >> 8); buf[pos-i-1] = (i & 0xFF); return pos; } bool PubSubClient::connected() { bool rc; if (_client == NULL ) { rc = false; } else { rc = (int)_client->connected(); if (!rc) _client->stop(); } return rc; } // MAIN APPLICATOIN CODE STARTS HERE // Update these with values suitable for your network. byte ip[] = { 192, 168, 0, 50 }; int LED = D7; // for demo only void callback(char* topic, byte* payload, unsigned int length) { // handle message arrived - we are only subscribing to one topic so assume all are led related byte ledOn[] = {0x6F, 0x6E}; // hex for on byte ledOff[] = {0x6F, 0x66, 0x66}; // hex for off byte ledFlash[] ={0x66, 0x6C, 0x61, 0x73, 0x68}; // hex for flash if (!memcmp(ledOn, payload, sizeof(ledOn))) digitalWrite(LED, HIGH); if (!memcmp(ledOff, payload, sizeof(ledOff))) digitalWrite(LED, LOW); if (!memcmp(ledFlash, payload, sizeof(ledFlash))) { for (int flashLoop=0;flashLoop < 3; flashLoop++) { digitalWrite(LED, HIGH); delay(250); digitalWrite(LED, LOW); delay(250); } } } TCPClient tcpClient; PubSubClient client(ip, 1883, callback, tcpClient); // Simple MQTT demo to allow the blue led (D7) to be turned on or off. Send message to topic "led" with payload of "on" or "off" void setup() { pinMode(LED, OUTPUT); // Use for a simple test of the led on or off by subscribing to a topical called led //if (client.connect("Spark")) { // Anonymous authentication enabled if (client.connect("spark", "userid", "password")) { // uid:pwd based authentication client.publish("Spark Status","I'm Alive..."); client.subscribe("led"); } } void loop() { client.loop(); } I am sure the callback can be improved on by somebody with more experience, but it works for now. Full credit to Nick for his original MQTT library. CheersChris Massive thank you! I'm building some home automation software (yes, another one), and have been using MQTT to communicate between "things" and the server. It was my goal to use MQTT on the spark. Yes, another massive Thanks for your work.Looking forward to trying this out...... My Mosquitto broker is out on the net, should this code work as is with a real world IP address? (Sorry if this is a basic Core question rather than an MQTT question). Thanks again for the code, no way I could have worked all this out. Cheers. Hi TBG - as far as I know there should be no issue connecting to a public broker, you might need to allow incoming port 1883 on your router. To set the IP address just change the line byte ip[] = { 192, 168, 0, 50 }; PubSubClient is overloaded and "should" accept either a byte array in dot decimal format as above or alternatively as a char array to pass in a server / domain name. If domain is !null then it will attempt to connect using domain name or drop through to IP address. if (domain != NULL) { result = _client->connect(this->domain, this->port); } else { result = _client->connect(this->ip, this->port); } I have also tried this with IBM's MQTT broker with no issues, and MyMQTT on Android, which is a simple MQTT client that can be set up to send a pub message to the core, or receive on a sub topic. Hope this helps - let me know if you have any issues. TxsChris Hey. First off, amazing job!I was wondering though if you've had any problems with the Spark Core timing out? After about three hours of publishing, I get a "Client Spark has exceeded timeout, disconnecting." in the Mosquitto broker window. I don't know if it matters, but I'm publishing about 75 times a second. Hi @Shadow6363 - sorry traveling the last couple of days so just getting to his now. Is the core losing wifi during the three hours (flashing green to re-connect) ? This maybe routed in the underlying issue that exists with the TI wifi chip in use on the core. I haven't check on the progress the team have been making to address this. As for the publish rate I don't think this is a major issue - unless you are blocking long enough for the core to think it has lost connectivity (doesn't sound like). @Kitard: That's the strange thing, when I go and check on it, it's still "breathing" cyan. Here's the relevant code: // MAIN APPLICATOIN CODE STARTS HERE #define address 0x1E // Address of HMC5883L byte ip[] = { 192, 168, 1, 100 }; void callback(char* topic, byte* payload, unsigned int length) {} TCPClient tcpClient; PubSubClient client(ip, 1883, callback, tcpClient); int16_t y; void setup() { Wire.begin(); Wire.beginTransmission(address); // Open communication with HMC5883 Wire.write(0x00); // Select Configuration Register A Wire.write(0x38); // 2 Averaged Samples at 75Hz Wire.endTransmission(); Wire.beginTransmission(address); // Open communication with HMC5883 Wire.write(0x01); // Select Configuration Register B Wire.write(0x00); // Set Highest Gain Wire.endTransmission(); Wire.beginTransmission(address); // Open communication with HMC5883 Wire.write(0x02); // Select Mode Register Wire.write(0x00); // Continuous Measurement Mode Wire.endTransmission(); } void loop() { if(client.loop()) { // Tell the HMC5883L where to begin reading data Wire.beginTransmission(address); Wire.write(0x03); // Select register 3, X MSB Register Wire.endTransmission(); Wire.requestFrom(address, 6); if(Wire.available() == 6) { Wire.read(); Wire.read(); Wire.read(); Wire.read(); // Ignore X and Z Registers y = Wire.read() << 8; // Y MSB y |= Wire.read(); // Y LSB } char buffer [6]; sprintf(buffer, "%d", map(y, -1500, -500, -512, 512)); if(!client.publish("magnetometer", buffer)) { client.disconnect(); client.connect("Spark"); } else { delay(10); } } else { client.disconnect(); client.connect("Spark"); } } I wasn't too certain what would happen in an error situation which is why you see a bunch of the disconnect and reconnect blocks hoping one of them would fix the problem, but so far none of them have. I would think as long as the loop is still running and there's a Wi-Fi connection (given the light, there should be), it would inevitably reconnect at some point. Anyway, do you happen to know if there's some way to log the status of the Spark Core itself? Some way to indicate if it's lost the Wi-Fi connection or has stopped running the main loop? Thanks for any help and again for your library! Hey Guys! Just wanted to pop in and mention there was a firmware release earlier this last week that includes a bunch of improvements for recovering after dropped connections. If you were going to upgrade -- make sure you modify some small part of your program (add a space, or something), to force it to re-compile, and then flash. Thanks!David Thanks for the update @Dave; however, it sadly doesn't seem to have made a difference for me. :/ Hoping my problem might be due to whatever you guys are working with TI to fix and it'll resolve itself once that's been implemented. Thanks @Kitard for adapting this for the Core! I got it up and running pretty easily. But I'm stuck trying to figure out how to use the callback in a way that makes sense. Converting all of the possible payloads to hex to do a memory comparison is really unappealing. Is there a cleaner method? My C++ is awful and I'm just cobbling things together. Is there a way to convert that byte* payload into something closer to a string or char for comparison? /* pseudo code */ if (topic == "control/power") { if (payload == "on") { powerOn(); } else if (payload == "off") { powerOff(); } } Hey @Kitard thanks for the work. It works all fine for me as long as I am connected to the spark cloud. But I do have a few queries here. Thanks,Gaurav Hi Chris, nice work you have done, thank you. I am trying to connect my Core to cloudMQTT.com, but I am having trouble with the authentication. Looking at your code, the client.connect function requires a uid, username and password. MQTT doesn't seem to allow for a uid, or at least I can't figure out how to use this field properly. I can connect fine through a Ruby script using my cloudMQTT username and password, on a non-SSL port. Could you perhaps steer me towards the right direction to get authentication to succeed? Thank you! Hi @gaurav Just a comment on the above: the last big patch from TI to the WiFi chip (CC3000) removed the ability to autonomously answer ping requests, so it is not unusual that you cannot ping your core. @futureshocked: uncomment the anonymous authentication and comment the next line. Cheers!!Gaurav Hello,Please pardon the newbie question. I'm coming from the Arduino world. The code sample that Kitard posted seems to be the entire MQTT library plus the setup and loop routine at the end. So, if I wanted to use MQTT, does my spark code actually have the entire MQTT library in the code just like Kitard posted, or do I use a #include somehow? Not sure where Spark goes to look for the #include libraries, since it's being programmed from the cloud. Thanks, and pardon again for the newbie question. [edit] It works! Hello @butters, You are absolutely right. The code Kitard posted is the Library+Main Application on a single file. It is an adaptation from Nick O'leary's MQTT library for Arduino where you have a separate library (a .h and a .cpp file) + the main application. Since spark core is using the same wiring cpp wrapper, hence the code is almost the same apart from a few minor changes. You can make separate .h files for declaration and .cpp file for the definitions and the main application if you want to. You have the complete Spark core library available here Spark @Github. Only you might have to modify the makefile to include the added libraries to compile along with your main application. You can have a taste of it if you can test the MQTT on an Arduino board because the Arduino IDE does it all for you, just add the libraries in the appropriate folder and the IDE with take it from there. For Spark if you are using the cloud based IDE, I think the core libraries are added by default. I am sorry I never used it much, so I am a little short of knowledge on this. Spark elites will be able to enlighten you properly. However I got a new mail from the spark team about the development of a Spark IDE but haven't had the time to really check it out. Here's the URL for the same @Spark-Dev. Cheers !!Gaurav Holy crap! It works! Hahaha. Thanks! Sparkcores rock. Hello,I've been playing with MQTT some more. I noticed two behaivors, one of which has been a show stopper for me. 1) If I do Serial.begin(9600) in setup, it prevents MQTT subscribe and publish from working. No idea why. I was using the serial to get Serial.println(), but found out it was interring with MQTT. 2) This one is a major roadblock for me. I need to subscribe to multiple topics and be able to extract topic names (integers) and messages (floats). This works fine with Arduino and ethernet shield, but the same code has issues with Spark: void callback(char* topic, byte* payload, unsigned int length) { int mytopic = atoi (topic); payload[length] = '\0'; float msg = atof( (const char *) payload);} The "mytopic" comes out correct. I'm using integer topic names. But the float "msg" doesn't seem to be working. I can't tell what the atof function is evaluating payload into. Since I can't do Serial.println, it's been difficult to debug. I know that if ((msg > 0) && (msg <100)) evaluates to false even though I published a message that's 50.1, for example. For those who are wondering, on the Arduino side, the byte* payload looks like this: client.publish("999", "555");topic=999payload=555999 Which is why a character return '\0' is added at location "length(payload)", so that the atof cuts off at the boundary between 5's and 9's. The guy who wrote this is pretty smart, so there's probably a reason why payload has the topic appended to the end of it. I just don't know why. Perhaps there's something different about the Spark implementation? Or perhaps '\0' is not the correct end of line character? Something about endians maybe? Note, I've also tried assuming payload is really just the message itself, and not append the \0, but that didn't work either. EDIT: Looking at the example, it looks like payload contains only the actual message. Sorry about the confusion. First MQTT Libraries in general. I've been using Chris Howard's library but struggling with reliability the core would crash after around 23 hours. Not knowing if it's a problem with the library or with the underling Spark Core TCP stack i was just scheduling a core reboot every 12 hours. Also with almost 24 hours in each run it's a pain to debug even if i knew where to look. But recently I ran into another bug, when subscribing to a topic that has been set with a retain flag the core will crash shortly after when the retained messages are sent to the core. So I spent a few hours on this last night and have moved over to the hirotakaster MQTT library it's publicly in the build interface and also over here.. It's also a port of Nicholas O'Leary Arduino library but appears to have more Spark specific changes. It seems to not have the retained message bug i recently discovered, as far as overall reliability go's i'll get back to you on that in a day or two. Your issues specifically. 1) Haven't come across the serial problem. 2) Not sure why your float code isn't working i've got something similar for longs that works fine. payload[length] = '\0'; char* cstring = (char *) payload; long n = atol(cstring); you could try sending a float from the mosquitto command line, to see if it's your sending rather than the receiving code and you could also monitor the same topic with another mqtt client to see what your are getting sent. mosquitto_pub -t 999 -m 50.1 Hi,Thanks for the input. I'll see if I could get the other library running. I'm pretty certain my MQTT publishes are coming in right. I'm using command line to publish, and another command window to monitor what I'm publishing. Also, I know my regular Arduino work, so my test method is pretty sound. I might try your char *(cstring) = (char *) payload. I don't do that before running atof. I really think Spark should work on the MQTT library. The platform hardware is so well suited for IoT, but there's these glaring deficiencies - MQTT support being a big one.
https://community.particle.io/t/submission-mqtt-library-and-sample/2111
CC-MAIN-2017-26
refinedweb
4,107
61.87
Modules are one of the most important features of any programming language. Sadly, JavaScript lacks this very basic feature. But, that doesn’t stop us from writing modular code. We have two important standards, namely CommonJS and Asynchronous Module Definition (AMD) which let developers use modules in JavaScript. But, the next JavaScript version, known as ECMAScript 6, brings modules into JavaScript officially. Yes, modules are first class citizens in ES6. So, this article will give you a basic overview of how modules are used in ES6. In the end we will also see how to transpile your ES6 modules to ES5 so that they work in today’s browsers. Basics In ES6 each module is defined in its own file. The functions or variables defined in a module are not visible outside unless you explicitly export them. This means that you can write code in your module and only export those values which should be accessed by other parts of your app. ES6 modules are declarative in nature. To export certain variables from a module you just use the keyword export. Similarly, to consume the exported variables in a different module you use import. Working With a Simple Module Let’s create a simple module that has two utility functions: generateRandom(): Generates a random number. sum(): Adds two numbers. Next, let’s create a file named utility.js for the module: utility.js function generateRandom() { return Math.random(); } function sum(a, b) { return a + b; } export { generateRandom, sum } That’s it! The export keyword on the last line exports the two functions. As you can see, the exported functions are listed in curly braces separated by a comma. You can also rename the values while exporting like this: export {generateRandom as random, sum as doSum} Now, let’s see how to consume the exported values in a different module. app.js import { generateRandom, sum } from 'utility'; console.log(generateRandom()); //logs a random number console.log(sum(1, 2)); //3 Note the first line. This imports the exported values from the module utility. If you want to import a single value (for example sum), you can do it by writing the following: import { sum } from 'utility'; You can also import the entire module as an object and access exported values as properties. So, we can modify our code as following: import 'utility' as utils; console.log(utils.generateRandom()); //logs a random number console.log(utils.sum(1, 2)); //3 Pretty simple, right? This was all about named exports. Now let’s see how to work with default exports. Default Exports and Re-exporting If you want to export a single value from the module then you can use default export. To demonstrate the usage of default exports let’s modify the utility module as shown below: utility.js var utils = { generateRandom: function() { return Math.random(); }, sum: function(a, b) { return a + b; } }; export default utils; The last line just exports the object utils. It can be consumed as following in a different module: app.js import utils from 'utility'; console.log(utils.generateRandom()); //logs a random number console.log(utils.sum(1, 2)); //3 export default utils; //exports the imported value The first line simply imports the utils object exported previously. Once you import a value you can also re-export it. The last line in the above code does that. This was the basic overview of ES6 modules. Now let’s see how to transpile the above ES6 modules to ES5 code so that we can run and test the code. Using the ES6 Module Transpiler The ES6 Module Transpiler is a tool that takes your ES6 module and compiles it into ES5 compatible code in the CommonJS or AMD style. You can install it via npm using the following command: npm install -g es6-module-transpiler Before proceeding grab our demo module’s source code from GitHub. The project structure is shown below: es6-modules scripts/ app.js utility.js out/ The directory scripts holds our ES6 modules. We will compile these modules and place them into the out directory. Go to the es6-modules directory in the terminal and type: compile-modules convert -I scripts -o out app.js utility.js --format commonjs The above command instructs the transpiler to compile the modules into CommonJS format and place them in the out directory. Once compilation is done the compiled modules will look like this: out/app.js Object.seal(exports); var utility$$ = require("utility"); //logs a random number console.log(utility$$.generateRandom()); console.log(utility$$.sum(1,2)); out/utility.js Object.seal(Object.defineProperties(exports, { generateRandom: { get: function() { return generateRandom; }, enumerable: true }, sum: { get: function() { return sum; }, enumerable: true } })); function generateRandom(){ return Math.random(); } function sum(a,b){ return a+b; } To run this with node you need to do the following minor tweak in app.js so that Node can discover the module utility: Change require("utility"); to require("./utility.js");. Now you can just type the following in terminal and check out the output: cd out node app.js You may also try compiling the modules into RequireJS (AMD) format and run in the browser. Conclusion ES6 modules are definitely powerful. Although support is not available everywhere yet, you can play with ES6 code today and transpile into ES5. You can also use Grunt, Gulp, or something similar to compile the modules during a build process. Further source maps can be used to debug the apps easily.
https://www.sitepoint.com/understanding-es6-modules/?aref=cbuckler
CC-MAIN-2017-47
refinedweb
912
57.98
Building. If you’re new to ironpythion then i suggest you to check the following tutorials before working on this tutorial. Simple Ironpython Hello World Windows Form – This tutorial will show you simple code to display hello world graphical window. Ironpython Labels on Windows forms – In this tutorial you’ll learn how to use label control on windows form. Ironpython Textbox Widget – This is very simple tutorial that shows you how to add textbox tutorial in your ironpython windows tutorial. Let’s cut some code for our Counter demo program. Step 1 : In this step we’ll write code to import Sys, CLR and will add references to System.Drawing and System.Windows.Forms. You’ll get the following code after this : import sys import clr clr.AddReference("System.Drawing") clr.AddReference("System.Windows.Forms") Step 2: In this step we’ll declare the controls that are going to be used in the program. from System.Drawing import Point from System.Windows.Forms import Application, Button, Form, Label Step 3: Now you need to write the class and the controls in your program. You’ll get code something like this : class CountForm(Form): def __init__(self): self.Text = 'Counter Demo' //code goes here form = CountForm() Application.Run(form) Step 4: You have initial empty windows form in previous step. You need to add the controls in the program, so let’s start with label control. self.label = Label() self.label.Text = "Counter 0" self.label.Location = Point(100, 150) self.label.Height = 50 self.label.Width = 250 This code will add label ‘counter 0’ to your control. This control is fixed at location (100,150) with height (50) and width (250). Step 5: Now it’s time to add the Button widget box to our program. button = Button() button.Text = "Start Count" button.Location = Point(100, 200) This code will add button widget box to our program at location (100,200) with label text ‘start count’. Our button has event of pressing in order to work this example. So let’s add the buttonPressed function to button widget. button.Click += self.buttonPressed You also need to add a counter that counts the value for buttonPressed. Add the counter variable ‘count’ and add the controls to windows form. self.count = 0 self.Controls.Add(self.label) self.Controls.Add(button) Now you’ve windows form with these control but there is no button pressed event working on the control. In order for button control to work you need to define the buttonPressed function. def buttonPressed(self, sender, args): self.count += 1 self.label.Text = "Count %s" % self.count After putting this code you can compile and run this program. Your program will allow you to click on button and after clicking it label text counter will increase it’s value. The complete source code of the program is as follows : import sys import clr clr.AddReference("System.Drawing") clr.AddReference("System.Windows.Forms") from System.Drawing import Point from System.Windows.Forms import Application, Button, Form, Label class CountForm(Form): def __init__(self): self.Text = 'Counter Demo' self.label = Label() self.label.Text = "Counter 0" self.label.Location = Point(100, 150) self.label.Height = 50 self.label.Width = 250 self.count = 0 button = Button() button.Text = "Start Counter" button.Location = Point(100, 200) button.Click += self.buttonPressed self.Controls.Add(self.label) self.Controls.Add(button) def buttonPressed(self, sender, args): self.count += 1 self.label.Text = "Count %s" % self.count form = CountForm() Application.Run(form) Note : You need to pay attention to indentation or else there is likely to be error thrown while compilation of this program.
https://onecore.net/ironpython-windows-forms-event-handling.htm
CC-MAIN-2020-10
refinedweb
607
62.14
When you are working on a frontend project in technologies like React, Angular, Vue there are several options of tools and platforms that could be used to deploy your web page application. One of those tools is GitHub Pages. GitHub Pages is a static site hosting service provided by GitHub that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process and publishes a website. GitHub Pages provide Free HTTPS and Custom Domain. You can configure the GitHub pages with some simple steps. During this post, we will see how to deploy your React App to GitHub Pages step by step. Create the project First of all, we need a GitHub repository to use the GitHub Pages so we need to create the repository and after that clone it (The repository can be linked manually also) Once we have a repository we need to create a React App with the next command npx create-react-app example-project Note: In the folder name need to be the same as the repository name, because the main idea is overriding the folder content with our React application. Code We could apply a change to our React App on the App.js file to display the message Hello from GitHub Pages when the page is loaded. App.js import logo from './logo.svg'; import './App.css'; function App() { return ( <div className="App"> <header className="App-header"> <img src={logo} <p> Hello from GitHub Pages </p> </header> </div> ); } export default App; Dependencies First of all, we need to install gh-pages npm package as devDependencies. gh-pages package helps with the deploying process of the application and it creates a branch where we want to deploy our code. That is why there is no need to create a branch manually. npm install --save-dev gh-pages Setup Once we have installed the dependencies need to set up the project the first step is to add the homepage to the package.json file. That will be used as the URL of the project homepage. { "homepage": "https://<GITHUB_USER>.github.io/<GITHUB_REPOSITORY_NAME>" } Note: We need to replace the GITHUB_USER and GITHUB_REPOSITORY_NAME with the correct expected values. After that, we need to add the following npm scripts in package.json. { "predeploy": "npm run build", "deploy": "gh-pages -b gh-deploy -d build", } - predeploy: Npm script used to be executed before the deployment to generate the build of our application - deploy: Npm script that will create and push to the gh-deploy branch the source files in the build directory - -b: Name of the branch to push, the default branch is gh-pages - -d: The build directory of our application Once you execute the command npm run deploy you will see that after the build is generated the branch will be published in your repository. The message looks similar to how-to-deploy-your-react-app-to-github-pages@0.1.0 deploy /Users/brayanarrieta/Documents/Blogs/how-to-deploy-your-react-app-to-github-pages > gh-pages -b gh-deploy -d build Published Publish the GitHub Page To publish the GitHub Page, first of all, we need to open the GitHub repository and select the Settings tab After that select Pages in the sidebar Once loaded we need to select the gh-deploy branch from the dropdown. Just click on the Save button After that, you will see something like that includes the URL of our application Open the link page and you will see something similar to Deploy your new changes In the case that needs to re-deploy some new changes, for example, we could apply a change to our React App on the App.js file to display the message Hello from GitHub Pages #2. App.js import logo from './logo.svg'; import './App.css'; function App() { return ( <div className="App"> <header className="App-header"> <img src={logo} <p> Hello from GitHub Pages #2 </p> </header> </div> ); } export default App; After that, we just need to execute the command npm run deploy and in a little time, the page will be updated with the new changes. Conclusion Github Pages is an awesome option that we can use to host our React applications, as you see during this post the process is easier and quicker to implement, so don't be afraid to put it into practice you learned it. I hope it will be useful for everyone. Also in this repository, you can find all the code described during the post. Let me know in the comments recommendations or something else that can be added, I will update the post based on that thanks! 👍
https://brayanarrieta.hashnode.dev/how-to-deploy-your-react-app-to-github-pages
CC-MAIN-2022-05
refinedweb
779
53.95
David Kron (MTD(f)), Matt Renzelmann (NegaScout), Eric Richmond (SSS-2), Todd Ritland (Alpha/Beta with Transposition Table) Download everything related to this project here: pente.zip. Click here to download a copy of our presentation in PowerPoint format. Click here for PDF. Pente is pretty simple. The version of it we use is even simpler. Play alternates between two players on a board (default 13x13 grid in size). One player is red, the other green. Play consists of choosing a square on the board. Once chosen, the square changes to the player's color, and it becomes the other player's turn. The goal is to get several squares in a row (default 5) either horizontally, vertically, or diagonally. The only twist is that the first player must move in the center of the board. The first player's second move must be outside of a small box around the center. This rule is necessary to negate the first player's otherwise substantial advantage. In this project, we examine the following game tree search algorithms: MiniMax, MiniMax with Alpha-Beta pruning, NegaScout, MiniMax with Alpha-Beta pruning and a transposition table, SSS-2, and MTD(f). These search algorithms are well-suited to zero-sum, perfect information, two player games like Chess, Checkers, Tic-Tac-Toe, and of course, Pente. They operate by searching the "game tree" and choosing the best possible move. A node in a game tree represents the state of the game (i.e. the board layout), while an edge in the tree represents the move a player could make to transform the game state from the source node to the destination. Because the players alternate turns, the tree is divided into neat layers, with alternating rows of nodes corresponding to the positions the players will need to consider. Technical detail: Please view this page in something other than IE6, since it doesn't support PNG transparency. Sorry for the inconvenience. If you'd like to play a game against the computer using a Java applet, use the settings below to customize the game, and then click "Go!" Alternatively, download the code above, and execute "javac Pente.java" followed by "java Pente" to play a command line version of the game. The command line version of the program has a number of features not found in the applet version. In this section, we'll discuss how to run the command line version, and the various features it offers. First, to run the command line version of the program, compile it via "javac Pente.java". To execute it, run "java Pente". It will prompt you for various parameters. To play the game against the computer on the command line, execute one of the following commands: If the second command line parameter is a number, the program interprets this to be a board size. The board size should be an odd number, and should be fairly large (e.g. 9, 11, 13 etc). Alternately, if the second command line is anything other than a number, the program interprets this as a filename. The file contains a board that has already been setup. Play always begins with the first player, regardless of how many squares are occupied on the board. This mode is handy for testing the program's behaviour in various scenarios. The third command line parameter is simply how many squares in a row are needed to win. Normal Pente rules set this value at 5. The fourth parameter is the number of milliseconds allotted per turn. The human player always gets unlimited time, but the computer opponents are required to make a move after this amount of time has passed. We use an iterative deepening search to ensure the result provided by the computer is always meaningful. The fifth and sixth parameters control who or what is playing the game. Values include: minimax, alphabeta, negascout, sss2, mtdf, tt, or human. Any kind of player can be player 1 or player 2. Since playing the game doesn't lend itself to easy algorithm debugging, we've included a second mode in which the user supplies a sample game tree, like those covered in class or on homework. The program then runs on this tree, and shows which nodes it examined. Using this mode, it's possible to see easily how the algorithms compare to one another. This mode was also used to construct many of the examples seen later on this page. To run the various algorithms on such a tree, execute the command: "java Pente 2 <filename> <algorithm>". The second parameter specifies the file containing the game tree to examine. The format is demonstrated by the following example. The format is pretty simple: a string with only characters and no integer represents an internal node, whereas a string with an integer at the represents a leaf node. This particular example is from homework 2, in which we were asked to run the Alpha/Beta pruning algorithm on a provided game tree. The output from the program is shown below. It seems to match the solution to the assignment. MiniMax represents the classic game search algorithm. Assuming the game has two players who alternate turns, and assuming both players have complete knowledge of the state of the game, minimax is a simple, but effective means of deciding what move to make. The idea behind its operation is as follows: the player who is currently choosing which move to make needs to consider which move his opponent will make in response, and the move he will make in response to his opponent's, and so on. By assuming his opponent will play perfectly, the player who is moving can make the best choice possible. Below is an outline of the minimax algorithm in pseudocode. int miniMax (int depth, boolean myMinFlag) { // Check if the game is over, and the depth limit if (gameOver) { return utility(); } else if (depth > depthLimit) { return staticBoardEvaluator (); } // Get next moves nextMoves = getNextMoves (); if (myMinFlag == true) { int value = INFINITY; // Iterate over possible moves for that player. for (int i = 0; i < numNextMoves; i++) { // Modify the board makeMove(nextMoves[i], PLAYER2); // Run miniMax on the modified board value = min(value, miniMax (depth + 1, !myMinFlag)); // Reset board back to reality. undoMove(nextMoves[i], PLAYER2); } // Return the minimum value seen. return value; } else { // maximizing int value = -INFINITY; // Iterate over possible moves for that player. for (int i = 0; i < numNextMoves; i++) { // Modify the board makeMove(nextMoves[i], PLAYER1); // Run miniMax on the modified board value = max(value, miniMax (depth + 1, !myMinFlag)); // Reset board back to reality. undoMove(nextMoves[i], PLAYER1); } // Return the maximum value seen. return value; } } The image below shows an example game tree. Assume the bottom nodes are terminal states, and the numbers inside each node represent the utility of that game state. Thus, the game will end in just three moves. In this example, the first player is attempting to maximize the game state's utility, while the second player is attempting to minimize the game state's utility. The initial state of the game is represented by the node at the root of the tree. At the start of this game, the first player has 3 choices. He examines his opponent's response to each of these three choices. His opponent, recall, is trying to minimize the game state's utility. Therefore, he assumes his opponent will move according to this goal. Therefore, the game will play out as follows: the first player will choose node B, and the second player will choose node E. One of the main problems with MiniMax is its performance in practice. Although it will generate the optimal solution to a game given an infinite amount of time, this is insufficient for most practical applications. Consequently, researchers have attempted to modify MiniMax in ways which allow it to skip the examination of certain moves, while still producing the optimal solution. MiniMax with Alpha-Beta pruning is the result of one such effort. The idea is as follows. While a player examines his available moves, he also keeps track of the best and worst values seen so far. These values are called Alpha and Beta. Below is a description of the MiniMax with Alpha-Beta Pruning algorithm in pseudocode. int alphaBeta (int depth, boolean myMinFlag, int alpha, int beta) { // Check if the game is over, and the depth limit if (gameOver) { return utility(); } else if (depth > depthLimit) { return staticBoardEvaluator (); } // Get next moves nextMoves = getNextMoves (); if (myMinFlag == true) { // Iterate over possible moves for that player. for (int i = 0; i < numNextMoves; i++) { // Modify the board makeMove(nextMoves[i], PLAYER2); // Run alphaBeta on the modified board beta = min(beta, alphaBeta (depth + 1, !myMinFlag, alpha, beta)); // Reset board back to reality. undoMove(nextMoves[i], PLAYER2); // Alpha beta if (beta <= alpha) { return alpha; } } // Return the minimum value seen. return beta; } else { // maximizing // Iterate over possible moves for that player. for (int i = 0; i < numNextMoves; i++) { // Modify the board makeMove(nextMoves[i], PLAYER1); // Run alphaBeta on the modified board alpha = max(alpha, alphaBeta (depth + 1, !myMinFlag, alpha, beta)); // Reset board back to reality. undoMove(nextMoves[i], PLAYER1); // Alpha beta if (beta <= alpha) { return beta; } } // Return the maximum value seen. return alpha; } } The following list outlines how the AlphaBeta algorithm proceeds on the game tree below. The important thing to get out of this example is that with Alpha/Beta pruning, the computer does not need to examine every node of the game tree. It can prune entire branches, thereby saving considerable time. Another thing to note is that if the computer examines the nodes in the best order possible, it can prune many more branches than it could otherwise. Indeed, in the worst case, Alpha/Beta pruning doesn't prune anything, making it identical to plain MiniMax (luckily, the worst case is, in general, very unlikely in practice). Below is a description of the NegaScout algorithm in pseudocode. NegaScout was designed with assumption that the moves would be well ordered, like alpha beta. The difference is that NegaScout tries to take better advantage of "somewhat" well ordered moves than AlphaBeta. It does this by using what's called a "null window", that is, a window whose values are of the form (x, x + 1). Such a window could not contain an actual value, instead, it will cause the algorithm to stop immediately (with a value that's either too high or too low). The trouble with NegaScout is that sometimes the next move list is not well ordered. As a consequence, NegaScout will actually perform a re-search of an entire subtree. Consequently, NegaScout performs best when it has at its disposal a transposition table, or a means of spotting such redundant searches. int negaScout (int depth, boolean myMinFlag, int alpha, int beta) { // Check if the game is over, and the depth limit if (gameOver) { return utility(); } else if (depth > depthLimit) { return staticBoardEvaluator (); } // Get next moves nextMoves = getNextMoves (); // Initialize additional NegaScout variables int g = 0; int startAt = 1; char whoseMove = myMinFlag ? PLAYER2 : PLAYER1; // Find starting point // Make first move makeMove(nextMoves[0], whoseMove); // Run negaScout on the modified board g = negaScout (depth + 1, !myMinFlag, alpha, beta); // Reset board back to reality. undoMove(nextMoves[0], whose_move); if (myMinFlag == true) { int newBeta = beta; // Iterate over possible moves for that player. for (int i = startAt; i < numNextMoves && g > curAlpha; i++) { // Modify the board makeMove(nextMoves[i], PLAYER2); // Run negaScout on the modified board newBeta = min(g, newBeta); int t = negaScout (depth + 1, !myMinFlag, newBeta - 1, newBeta); if (t < newBeta && t > alpha) { t = negaScout (depth + 1, !myMinFlag, alpha, t); } // Reset board back to reality. undoMove(nextMoves[i], PLAYER2); // Save best value g = min (g, t); } } else { // maximizing int newAlpha = alpha; // Iterate over possible moves for that player. for (int i = startAt; i < numNextMoves && g > curBeta; i++) { // Modify the board makeMove(nextMoves[i], PLAYER1); // Run negaScout on the modified board newAlpha = max(g, newAlpha); int t = negaScout (depth + 1, !myMinFlag, newAlpha, newAlpha + 1); if (t > newAlpha && t < beta) { t = negaScout (depth + 1, !myMinFlag, t, beta); } // Reset board back to reality. undoMove(nextMoves[i], PLAYER1); // Save best value g = max (g, t); } } return g; } The following example tree demonstrates a situation in which NegaScout outperforms Alpha-Beta, although the difference is very small due to the size of the example. The first tree shows the resultant game tree after performing MiniMax with Alpha-Beta pruning. The recursive calls to AlphaBeta proceed as follows: The second tree shows the result of running NegaScout. Note that the values of alpha and beta are all the same: it can be proven that a call to NegaScout returns the same value as a call to AlphaBeta, and that every node visited by a call to NegaScout must also be visited by a call to AlphaBeta. As a final example, the tree below demonstrates the possibility that NegaScout visits the same node more than once. This property suggests that NegaScout performance is at its highest when a transposition table is also used. Transposition tables are used to store the values of a game state so they don't need to be recalculated should they occur again during a search. In this case, the exact same node is considered, making a transposition table more important. Our implementation does not include a transposition table with NegaScout. A transposition table is simply a hash table that stores previously calculated board configurations. When Alpha-Beta starts to run on a given board, the algorithm checks to see if this board is in the hash table (and therefore, has already been computed). If the board IS in the hash table, the result is simply drawn from the table. If the board ISN'T in the hash table, alpha-beta minimax continues as usual, and the result is stored in the table. So this looks like this: for (all possible moves){ if (board with this move is in hash table){ get alphabeta value from table; } else { alphabeta(this table); store result in hash table; } } The basic hash function is to look at some set of positions on the board as a string of: 0 if not occupied 1 if occupied by player 1 2 if occupied by player 2 This string is considered a base 3 number, and is calculated as such. Here is the code: hashForwardDiag(BoardInterface board){ int[] position = new int[2]; double value = 0; char temp; for(int i = 0; i < this.size; i++){ position[0] = i; position[1] = i; temp = ((Board)board).getPosition(position); if(temp == 1) value += Math.pow(3, (double)i); else if(temp == 2) value += 2 * Math.pow(3, (double)i); } return ((int)value/divisor); } The hash table that I decided to use is a 3 dimensional array that stores "HashList" objects, which can hold as many table configurations as needed. The first dimension of the hash table is the hash function on just the middle row. The second dimension is the hash function on the middle column. The 3rd dimension is the hash function on the diagonal from the upper left of the board, to the lower right of the board. If the size of the possible base 3 numbers associated with each of these is too large (larger than 20,000), a divisor is used to divide the result of the hash function. The reason the hash table was made in 3 dimensions is that most of the possible base 3 strings will not occur, so most of the arrays will never be initialized, greatly reducing the amount of space the hash table occupies. However, this means that the more entries that are added to the hash table, the larger it becomes. The SSS-2 algorithm is a variant of an algorithm called SSS*. Minimax and Alpha-Beta searches typically proceed in a depth-first fashion, from "left" to "right" in the game tree. The order of the nodes visited in this way seems arbitrary, and so SSS-2 attempts to perform a "best-first" search. To do this, it generates a solution tree using a function called expand and then refines/updates this solution tree using a function called diminish. The algorithm maintains this solution tree globally, as well as the "best-so-far" value of the tree. The algorithm for SSS-2 is as follows: G = {root}; //The global solution tree g = expand(root, +inf); //The "best-so-far" value do { temp = g; g = diminish(root, temp); } until (g >= temp); Only a few lines of code -- seems simple, eh? The fun has just begun. I decided including pseudocode for the expand and diminish functions would only confuse matters more than they are about to become. Therefore, I instead include detailed descriptions of these two functions. Expand takes two values as input: the node that is being visited (n), and the current "best-so-far" value of the global solution tree (v). When the node being visited is a MAX node, it visits each of its children, adding them to the global solution tree. When the MAX node finds in its children a single value greater than the "best-so-far" value, all of that node's children are purged from the global solution tree and that new, better value is returned. If it does not find a value better than v after checking all of its children, it will return the greatest value of all of its children. When the node (n) being visited is a MIN node, its children are visited one at a time, maintaining only the child currently being visited in the global solution tree. When a MIN node finds in its children a single value less than the "best-so-far" value, it drops everything and returns that new, better value. If it doesn't find a better value, it will return the least value of all of its children. To get an initial "best-so-far" value, SSS-2 makes a call to expand(root, +inf). The MAX nodes won't find any children with values greater than infinity, so all children of all visited MAX nodes will be added to the global solution tree. On the other hand, the values of the children of the MIN nodes will all be less than infinity, so the first child visited of every MIN node will be added to the global solution tree. Diminish will recurse down to the leaf node that contains the "best-so-far" value, v. If the parent of this node is a MAX node, then the node and all of its "siblings" are purged from G. Otherwise, if the parent of this node is a MIN node, the "siblings" of this node are searched for a smaller (better) "best-so-far" value. If one is found, this new, smaller (better) node remains in G and its value is returned. If no smaller value is found, the same old "best-so-far" value is returned. Next, diminish works its way back up the tree in the following way. Maximizing: If a better (smaller -- better for the child node) value is found by the child (minimizing) node which contains the "best-so-far" value, this node re-evaluates its children and returns the value of its child that NOW has the greatest value. If no better value is found by the child (minimizing) node which contains the "best-so-far" value, all of this node's children get purged from G, and the same old "best-so-far" value is returned. Minimizing: If this node's single child in the solution tree (G) returns a value smaller than v through a recursive call to diminish, the node returns this new value. Otherwise the child node that contains the old "best-so-far" value is removed from the global solution tree. The node's next child is added to the global solution tree and inspected using the expand function. If this call finds a new, smaller "best-so-far" value, this value is returned immediately. If not, the node removes this child from the solution tree, and repeats this process for all of its children. If no child has a smaller value, the same old "best-so-far" value is returned. The idea behind MTD(f) is that it is simpler than other new minimax algorithms such as NegaScout. It gets it's efficiency from doing only zero-window alpha-beta searches. This means that instead of sending an alpha and beta as -/+ infinity it sends a value of beta-1 for alpha. They use these approximate values to hopefully approach the real MiniMax value. The algorithm is the following: MTDF(pos, depth, f) { int score = f; upperBound = +INFINITY; lowerBound = -INFINITY; while(upperBound > lowerBound) do { if(score ==lowerBound) then beta = score+1; else beta = score; score = AlphaBeta(pos,beta-1,beta,d); if(score < beta) then upperBound = score; else lowerBound = score; } return score; } f is the estimate of the final score. The algorithm works better when f is close to the final score so when using iterative deepening it's a good idea to start by using the f of the previous depth. Another way to make MTD(f) perform as the current best algorithm is by instead of using AlphaBeta in the algorithm, to use AlphaBeta with transposition Tables (see AlphaBeta w/ Transposition Tables). After running each algorithm against every other algorithm, we obtained the following results. Since this experiment included running each algorithm against itself one time, every algorithm is guaranteed at least one win. Here are some papers we used for reference while implementing these algorithms:
http://pages.cs.wisc.edu/~mjr/Pente/index.html
crawl-003
refinedweb
3,593
61.26
May 2009 Volume 24 Number 05 CLR Inside Out - Understanding The CLR Binder By Aarthi Ramamurthy | May 2009 Contents Always Use Fully Specified Assembly Names Avoid Partial Binds Use Fusion Log Viewer Understand the Context When All Else Fails, AssemblyResolve! Know When to Use the GAC The CLR Binder is responsible for locating necessary assemblies at run time and binding to them, so it's an important piece of .NET code. To ensure that binding is working efficiently and correctly, there are a few best practices you should follow, and we'll present them here. Some practices are simple, yet crucial. Proper assembly naming is one such task, and we'll tackle it first. Always Use Fully Specified Assembly Names Since the distinction between assembly and file names is often a source of confusion, let's take a closer look. A filename is the name of a file in the filesystem (such as System.dll). An assembly name, on the other hand, is a name given to an assembly to establish its unique identity. In managed code, assemblies provide identity to the code that resides in it. Two assemblies representing the same identity can have the same name (and different versions, signatures, and so forth). A filesystem is simply one of the locations from which to load assemblies—assemblies can also, for example, be loaded from byte arrays. It's best to keep the file name the same as the assembly name. While the most obvious reason is convenience, it is also because assemblies are mostly loaded by assembly names and keeping the names consistent makes it easier for the loader to find the assembly. A fully qualified assembly identity consists of four fields: the simple name of the assembly, the version, the culture, and the public key token. One way to make effective use of the Binder and its various features is to avoid partial binds (unless you really know what you're doing). A partial bind occurs when the user specified only part of the assembly identity. For example, let's assume that the user tries to load an assembly whose simple name is MySampleAssembly as follows: Assembly.Load("MySampleAssembly"); In this case, the user failed to specify the other three fields that are a part of the assembly's identity. This is a partial bind. Another instance is when the user loads the assembly using Assembly.LoadWithPartialName(). Assembly.LoadWithPartialName also uses partial binding. It exists for an extremely specific scenario and should not be used for normal binding. This is why it is marked obsolete in current versions of the framework. Avoid Partial Binds Partial binds are a problem because they can lead to nondeterministic Binder behavior, since the Binder does not have the complete information to load the correct assembly. In the case of LoadWithPartialName(), the Binder simply tries Load() and if that fails, it then picks up the highest version of the assembly in the GAC. This may not be the version that is compatible with the current application. If a servicing update of a different application installs a higher version of this assembly in the GAC, one with which the current application is not compatible, LoadWithPartialName() will choose this newer assembly and load it, potentially breaking the current application. Also, not specifying important attributes such as the public key token can lead to binding and loading the incorrect assembly since there is no guarantee that the assembly was provided by the expected publisher. So, if partial binds are bad, you're probably wondering why they are supported in the CLR in the first place. Well, while LoadWithPartialName() is deprecated in CLR 2.0, loading an assembly with partially specified reference is still supported. Partial binds can be advantageous if their purpose is well understood, and they are used judiciously. At the very least, you should provide the public key token of the assembly to load. Otherwise, this process may return an assembly from a completely different publisher. Also, if you need to load a particular assembly multiple times or do not wish to hard-code assembly versions into your strings, you can specify the fully qualified assembly name as a part of the <qualifyAssembly> element in the application configuration file and then specify only a partial reference for the assembly in Assembly.Load(). This keeps the code simple, and at the same time ensures that the desired assembly gets loaded. It is to be noted that in such cases each application should have its own application configuration file containing the <qualifyAssembly> element. In general, it is always safer to specify the fully specified reference of the desired assembly to ensure that binds are predictable. Use Fusion Log Viewer There are times when assembly binding fails, typically with an exception (usually, FileNotFoundException, FileLoadException, or BadImageFormatException). Often, a little insight into the internals of the Binder can help you debug the issue at hand. The Microsoft .NET Framework SDK includes a tool called Assembly Binding Log Viewer (fuslogvw.exe), often referred to as Fusion Log Viewer. This tool logs specific Binding steps in .html files that can be viewed using the Fusion Log Viewer's user interface. Figure 1 contains a code snippet that demonstrates loading an assembly that does not actually exist. When this code is executed, a FileNotFoundException is thrown. If the user has turned on the ability to log binding failures, the Fusion Log Viewer logs the failure. Figure 1 Some Misbehaving Code using System; using System.Reflection; class FusLogSample { public static void Main() { try { Assembly.Load("TheNonExistentAssembly"); } catch (Exception e) { Console.WriteLine(e.ToString()); } } } By default, logging to disk is turned off, since logging is generally expensive and causes the running application to take a performance hit. To debug the bind failure, click on the Settings button and then turn on "Log bind failures to disk." To turn on logging for all binds, select "Log all binds to disk." Clicking on the highlighted text in the resulting dialog box, leads you to the actual log itself (as shown in Figure 2). The first two lines tell you that the attempt to load the assembly failed and provides the HRESULT. The next two lines indicate where the CLR was loaded from (the specific directory) and the name of the executable that caused the assembly load to be initiated. Figure 2 Fusion Log Generated While Executing Code in Figure 1 *** Assembly Binder Log Entry (2/23/2009 @ 12:29:19 PM)** * The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll Running under executable \\TKZAW-PRO-15\MYDOCS5\aarthir\My Documents\Visual Studio 2008\ Projects\Sample\Sample\bin\Debug\Sample.vshost.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = REDMOND\aarthir LOG: DisplayName = TheNonExistantAssembly (Partial) LOG: Appbase = Documents/Visual Studio 2008/Projects/Sample/Sample/bin/Debug/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : Sample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. === Documents/Visual Studio 2008/Projects/Sample/Sample/bin/Debug/TheNonExistantAssembly.DLL. LOG: Attempting download of new URL Documents/Visual Studio 2008/Projects/Sample/Sample/bin/Debug/TheNonExistantAssembly/TheNonExistantAssembly.DLL. LOG: Attempting download of new URL Documents/Visual Studio 2008/Projects/Sample/Sample/bin/Debug/TheNonExistantAssembly.EXE. LOG: Attempting download of new URL Documents/Visual Studio 2008/Projects/Sample/Sample/bin/Debug/TheNonExistantAssembly/TheNonExistantAssembly.EXE. LOG: All probing URLs attempted and failed. Under the "Pre-bind state information" section, the first line indicates the user name under which the code was executed. The next line provides the identity of the assembly. Note that the log indicates "partial" because the reference was only partially specified. The next line shows the ApplicationBase directory (the directory under which the executable is present) for the application domain. The next four fields (Private Path, Dynamic Base, App Name, and Cache Base) are application domain-specific properties that affect binding in different ways. For example, the privatePath attribute specifies subdirectories of the ApplicationBase directory to search while loading assemblies. The next line gives you the name of the parent assembly from which Assembly.Load() was initiated. The following line specifies the loader context where this bind began (you'll read more on loader contexts in the next section). The next three lines deal with policy files—policy files such as application configuration, publisher policy files, and machine configuration files are different means to configure assembly binding behavior (you can read more about these configuration files on MSDN, "Step 1: Examining the Configuration Files)." The final lines show that the Binder looks for the desired assembly in different subdirectories (within the AppBase). In the end, the Binder declares that the assembly could not be found. Thus, the Fusion log provides information useful for debugging bind failures. In the .NET Framework 4.0, the Binder explicitly warns about partial binds. Figure 3 shows a snippet from a Fusion log covering partial binds. Figure 3 Partial Binds in the Log *** Assembly Binder Log Entry (1/7/2009 @ 10:17:05 PM)** * The operation was successful. Bind result: hr = 0x0. The operation completed successfully. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.AMD64chk\clr.dll Running under executable E:\tests\LoggingDCR\PartialNames\LoadPartial.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = SampleUser LOG: DisplayName = Lib (Partial) WRN: Partial binding information was supplied for an assembly.. WRN: Detected case of partial bind: WRN: Assembly Name: Lib | Domain ID: 1 The warnings here indicate that partial bind information was specified for the assembly. The Binder also warns about loading the same assembly into multiple contexts, as shown below. We'll cover loader contexts later. WRN: The same assembly was loaded into multiple contexts of an application domain. WRN: This might lead to runtime failures. WRN: It is recommended to inspect your application on whether this is intentional or not. Overall, fusion logs are a very valuable resource, both to debug bind failures and to understand how the runtime locates and loads assemblies. Understand the Context No article on the Binder is complete without addressing loader contexts and the reason for their existence. Loader contexts are often the source of confusion. Think of loader contexts as logical buckets within an application domain that hold assemblies. Depending on how the assemblies were being loaded, they fall into one of three loader contexts. Load context To put it simply, all assemblies that are present either in the GAC, or in the ApplicationBase, or in the PrivateBinPath under the ApplicationBase, that are loaded using Assembly.Load will be loaded in the Load context. Assemblies resolved using the AssemblyResolve event also fall in this category. LoadFrom context If you are attempting to load an assembly by providing a specific path that is outside the ApplicationBase, and the assembly would not have been found in the Load context, then the assembly is loaded in the LoadFrom context. Neither context If you are attempting to load an assembly using Assembly.LoadFile(), Assembly.Load(byte[]), or Reflection.Emit, those assemblies are loaded into the Neither context. In the case of assemblies loaded into the LoadFrom context, the Binder first checks to see if the exact assembly (same identity and location) is already present in the Load context. If it is, it discards the assembly information in the LoadFrom context and uses the assembly information from the Load context. In determining whether it is the same assembly, the location information is important, and we'll cover this shortly. In .NET Framework 1.1, this was known as LoadFrom's second bind, since the Binder used to perform two steps—first to place the assembly in the LoadFrom context, and then promote it over to the Load context if it found a matching assembly identity and location in the Load context. Make sure that the assembly is loaded into the Load context as much as possible. For this, the assembly should be locatable from the GAC, the ApplicationBase, or the PrivateBinPath of the AppDomain. Assemblies loaded into this context automatically get benefits of NGen and the assembly's dependencies present in this context are automatically picked up. Loading assemblies into the LoadFrom context has its own advantages—it allows multiple assemblies outside the ApplicationBase to be loaded by specifying their paths. Now, let's talk about the location of the assembly, while identifying if the assembly loaded via LoadFrom() is the same as the Assembly loaded via Load(). Even if the types in two assemblies are identical, if the two assemblies are loaded from different paths, they are not considered identical as far as loader contexts are concerned. This leads to situations where the same assembly is loaded repeatedly in the same application domain, but into different contexts (Load and LoadFrom) and a type in the assembly in the Load context will not be allowed to be the same type in the LoadFrom context (even if they are the same assemblies as far as the assembly identities are concerned). This is one of the disadvantages of LoadFrom. Also, assemblies in the LoadFrom context do not automatically reap the benefits of NGen. As for the Neither context, assemblies in this context cannot be bound to, unless the application subscribes to the AssemblyResolve event. This context should generally be avoided. So why does the CLR have loader contexts in the first place? Loader contexts help ensure load-order independence while loading assemblies. In addition, they provide a measure of isolation to assemblies and their dependencies when they are loaded into different contexts. When All Else Fails, AssemblyResolve! The CLR follows a series of steps (described in the article "How the Runtime Locates Assemblies") to locate and bind to the desired assembly. When the assembly cannot be located at the end of all of these steps, the Binder raises an AssemblyResolve event. In order to load an assembly that could not be resolved earlier, it is possible to subscribe to the AssemblyResolve event. In .NET Framework 4.0, the CLR is extending the AssemblyResolve event to indicate which parent assembly or RequestingAssembly was causing the load of the dependent assembly. This is very useful in cases where an assembly has a reference to another assembly, and an AssemblyResolve Event occurs for the referenced assembly. As of .NET Framework 3.5, there was no means to determine the identity of the parent assembly (or the referencing assembly). This means that when the AssemblyResolve event is fired, apart from the current assembly (which could not be located by the Binder by normal probing means), the parent assembly is also provided so that the user knows which assembly caused the load event and the event handler can now make use of the parent assembly that is passed. This makes it easier to leverage the Neither context to provide binding isolation when needed. The RequestingAssembly field is now another member exposed by ResolveEventArgs. Know When to Use the GAC The Global Assembly Cache (known as the GAC) is a machine-wide repository of managed assemblies. The primary goal of the GAC is to enable sharing of assemblies across several managed applications installed on a machine. For example, when writing add-ins you can simply place the common code of the add-ins into one assembly and place this assembly in the GAC. The add-in developer can now ensure that all the add-ins (written by him) share this assembly, instead of having to redeploy the shared component every time a new add-in is installed. This also provides the benefit of central servicing—the add-in developer can now service the common assembly present in the GAC without having to re-deploy servicing updates individually for all add-ins. This is not to say that only add-in developers can make use of the GAC—all managed developers can install assemblies to the GAC and share them across applications. So when should an assembly be installed in the GAC as opposed to leaving the assembly as a part of the application (within the ApplicationBase)? If you have any assembly that must be shared across multiple applications and hence need to be centrally serviced, you should consider placing them in the GAC. Shared frameworks and components typically fall under this category. When shouldn't an assembly be placed in the GAC? If you need the application to be xcopy deployable (deployed using the xcopy command to copy the directory containing the application) on different machines, placing the assembly in the GAC is probably not the best idea. In such scenarios, assemblies in the GAC will also need to be moved across machines. In any case, the Binder follows the "GAC always wins" policy. This might play a role in deciding whether or not an assembly needs to be placed in the GAC. A short digression: If you aren't familiar already, GACUtil is a tool used to install, uninstall, and enumerate assemblies to and from the GAC. This tool ships as a part of the .NET Framework SDK. You can read more about GACUtil online. In .NET Framework 4.0, the GAC went through a few changes. The concept of placing assemblies into a global directory began in CLR v1.1. In case of .NET Framework 1.1 (which had CLR v1.1) and .NET Framework 2.0 (which had CLR 2.0), the GAC was split into two, one for each CLR. This avoided the leaking of assemblies across CLR versions. For example, if both .NET 1.1 and .NET 2.0 shared the same GAC, then a .NET 1.1 application, loading an assembly from this shared GAC, could get .NET 2.0 assemblies, thereby breaking the .NET 1.1 application. The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0. As a result of this, there was no need in the previous two framework releases to split the GAC. The problem of breaking older (in this case, .NET 2.0) applications resurfaces in Net Framework 4.0 at which point CLR 4.0 released. Hence, to avoid interference issues between CLR 2.0 and CLR 4.0, the GAC is now split into private GACs for each runtime. Tools such as GACUtil and Shfusion will behave exactly the same as they did in pre–.NET Framework 4.0 scenarios. Also, the behavior of publisher policy (explicitly mentioned, since it is required to install these policy files to the GAC) will not change. The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC. To conclude, we covered some of the ways in which you can get the best out of the CLR Binder, while also looking at some of the improvements made in the Binder for .NET Framework 4.0. Send your questions and comments to clrinout@microsoft.com. Aarthi Ramamurthy is a Program Manager for CLR at Microsoft and primarily works on the the assembly binding and loading aspects of the runtime. She can be reached at aarthi@microsoft.com. Mark Miller is a Software Development Engineer in Test for the CLR team and works on many of the unmanaged areas of the framework. He can be reached at markmil@microsoft.com.
https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/may/understanding-the-clr-binder
CC-MAIN-2022-27
refinedweb
3,231
55.74
We noticed that since TIP 538 became integrated into core-8-branch, our NSF builds started failing because tommath.h cannot be picked up anymore. See > In file included from ./generic/nsf.c:16655: > > /home/travis/tcl/generic/tclTomMath.h:11:10: fatal error: 'tommath.h' file not found > > #include "tommath.h" NSF includes tclTomMath.h explicitly, to access mp_int at one spot. TIP 538 advertises that Tcl extensions should be able to include either tommath.h directly, or tclTomMath.h (as NSF does). How should an extension properly include tclTomMath.h (which unconditionally includes tommath.h) when built against a Tcl core not using a systemwide libtommath? Apparently, tommath.h is not provided to extensions that way (anymore)? Thank you! > do you plan to merge the "fix" any time soon? just curious. I just wanted to wait for your confirmation that it helps. Got that now (Thanks!), so it's merged now. > I wondered: It would be nice to add a hint reflecting TCL_WITH_EXTERNAL_TOMMATH to tcl::pkgconfig (to figure out the LTM nature of Tcl's from within a script), wouldn't it? The real way to discover this is the TCL_DEFS macro in tclConfig.sh. It works, but it is hardly used by any extension. The TEA tcl.m4 has a macro to discover which libraries Tcl is linked with. libz and libtommath were never taken into account, but I added that now. > Why did TIP 538 propose a --with-system-libtommath switch ... Well, I didn't really like that either: If libtommath is available, I see no reason to use the internal libtommath nevertheless. But it still appears people want that. I think that - as soon as Tcl 8.7 gets final - more distro's will start providing libtommath as standard packages, the main ones already have it. So this will become less and less a problem. Thanks for all the feedback. I'll keep it like it is now for a while, let's see what more feedback arises when the next Tcl 8.7 alpha is out. > Well, I hope you meant LTM 1.2, since LTM 2.0 is not released yet and far from final, not even alpha.... Yeah, my bad, I meant 1.2, certainly. > I would recommend the homebrew version on MacOS, it works for me out-of-the-box thanks for the hint. actually, the standard makefile of ltm 1.2 works for me, but it is difficult to redirect to another installation directory. homebrew is not attempting such a redirection (as opposed to macports), therefore, it works out of the box, as you write. do you plan to merge the "fix" any time soon? just curious. > Took me a while to get LTM 2.0 installed and recognized by Tcl under macOS, no homebrew Well, I hope you meant LTM 1.2, since LTM 2.0 is not released yet and far from final, not even alpha.... I would recommend the homebrew version on MacOS, it works for me out-of-the-box Hi Jan, Thanks again for your help and sry for getting back to it with much of a delay: * I use #if TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6 #define TCL_NO_TOMMATH_H 1 #endif #include <tclTomMath.h> and tested it against a Tcl at [1baf516ed4f18e08] with embedded LTM and with a system-wide LTM. All looks good. (Took me a while to get LTM 2.0 installed and recognized by Tcl under macOS, no homebrew.) * I wondered: It would be nice to add a hint reflecting TCL_WITH_EXTERNAL_TOMMATH to tcl::pkgconfig (to figure out the LTM nature of Tcl's from within a script), wouldn't it? * Why did TIP 538 propose a --with-system-libtommath switch, rather than a --with-libtommath=/optional/path/to/ltm/installation ... ? This would be useful if ltm is not provided in a standard location (/opt/local etc.) and could still default to standard paths, if omitted? This is more in line with what others (e.g. tDOM) do in similar situations (system-wide expat). * A TEA_TOMMATH macro would be still appreciated, because this way not every TEA compliant extension needs to be manually fixed to add includes and link-time flags on its own (iff build against a Tcl with external LTM). Thx, Stefan I was confused, in this case, mp_clear is provided as a macro pointing into the stub table, I just realized. Thanks for this move, I will give it a try tonight! Till then, one question: To avoid the dependency on mp_clear (which is not exposed including tommath.h) , and rather than using a throw-away Tcl_Obj as you suggested, I would like to maintain one Tcl_Obj and keep invalidating its intrep: Will TclFreeIntRep() also trigger mp_clear on a bignum Tcl_Obj, reliably? Thank you! @mr_calvin: So, how about [1baf516ed4f18e08] ?? :-) > so injecting a dependency with TEA helping with it should read: with*out* TEA Thanks for taking the time to discuss with me. :) > Since libtommath is now an external library, just as zlib. I see that, but an important difference between libtommath and zlib is, though, Tcl's public API does not expose native data types of zlib (z_stream) directly, but proper wrappers (Tcl_ZlibStream). This is different for libtommath (mp_int). There is no Tcl_MpInt, unfortunately. > why would you still want to build a stripped-down version into Tcl???? This does not apply to NSF, twapi and others (as proper Tcl extensions), but I might want to use Tcl as my C utility library of choice (Tcl is heavily underestimated in this role), maybe, and why then entertain two dependencies if I could just work with one = Tcl with internal libtommath? > I could imagine TEA providing a TEA_TOMMATH macro That would certainly help, and was actually what I meant by my -I rumbling in the earlier post. Nevertheless, I agree that directly depending on tommath.h is likely to best step for NSF, twapi etc. but it does not feel right re Tcl's public API exposing libtommath data types directly (so injecting a dependency with TEA helping with it). I hope I could make my point clearer? Thanks for your continued support! > Why doesn't Tcl provide this compat/tommath.h ... Since libtommath is now an external library, just as zlib. The provided <tommath.h> is - starting with 8.7 - maintained externally. As soon as libtommath 1.3 is released, Tcl can be compiled with it instead of the built-in. My hope is that - in the coming years - libtommath 1.2 will be provided by more (Linux) distributions (MacOS already has it in homebrew now), so installation of libtommath will become less of a burden. I - actually - don't see the need for the --without-system-libtommath option: If a suitable external libtommath is available, why would you still want to build a stripped-down version into Tcl???? So, yes, it's a burden. I don't think Tcl should take care of installing <tommath.h>, since whenever a newer libtommath version is released the newer version has preference. libtommath's maintenance is extenally now, Tcl should follow it. Tcl providing a stripped-down internal version is just a service. The <tommath.h> included by Tcl is just a fallback in case someone doesn't want to get it somewhere else. I could imagine TEA providing a TEA_TOMMATH macro, which determines the include/linker flags depending on how Tcl is built. But there are not so many extensions with this problem, NSF is about the only one I know of. Well, searching for it, I found "tclral" and "twapi" too, so that makes 3. Depending on an external libtommath would make things a lot easier. I'll think about what can be done to improve the situation. > + typedef size_t mp_int[4]; > Tcl_DecrRefCount(Tcl_NewBignumObj(&bignumValue)); Thanks for this suggestion, I was entertaining a similar thought. Still, I am wondering about TIP 538 and the public Tcl API (please correct me if I am mistaken): Tcl_GetBignumFromObj & friends build on mp_int, functions offered by Tcl as part of its public API but starting with TIP 538, there are no mp_* definitions provided by Tcl itself anymore. An extension or a program integrating with Tcl need to provide a compat definition as a drop-in replacement (as you describe). Is this really necessary and as intended? > Well, Tcl doesn't install <tommath.h> because it could lead to a conflict with the official libtommath version. The alternative being that every tclTomMath.h integrator is on its own regarding tommath.h? If my program or extension was built against Tcl with embedded tommath, it should provide the necessary definitions, doesn't it? Why doesn't Tcl provide this compat/tommath.h (taken from the bundled libtommath sources) if a systemwide libtommath is not available or overriden by --without-system-libtommath (the latter is described in the TIP, at least): So, a TEA-based program or extension would be set up in a way so that, when built against a Tcl with TCL_WITH_EXTERNAL_TOMMATH undefined, it receives compiler flags incl. -I</path/to/tcl/includes/compat/> so it picks up the tommath.h matching the built-in tommath sources. If TCL_WITH_EXTERNAL_TOMMATH was defined, TEA would not deliver this extra -I flag, so the systemwide tommath.h would get picked up. I don't see how this would introduce conflicts (unless a developer messes with the flags on her own, not using TEA, resorting to Tcl's compat/tommath.h on false grounds). What do you think? Another (little bit hacky) idea: The only libtommath function used is: mp_clear() This is the same as: Tcl_DecrRefCount(Tcl_NewBignumObj(&bignumValue)); (Just transfer the bignum to a temporary Tcl_Obj, and clear that one....) So, this way, you event don't need <tclTomMath.h> any more. The only thing you have to provide for Tcl 8.7 is the mp_int definition, but just some big enough storage is enough. Here is the patch for nsf: <pre> diff --git a/generic/nsf.c b/generic/nsf.c index 99a2f55c..43242487 100644 --- a/generic/nsf.c +++ b/generic/nsf.c @@ -16652,7 +16652,6 @@ Nsf_ConvertToInt32(Tcl_Interp *interp, Tcl_Obj *objPtr, const Nsf_Param *pPtr, *---------------------------------------------------------------------- */ -#include <tclTomMath.h> int Nsf_ConvertToInteger(Tcl_Interp *interp, Tcl_Obj *objPtr, const Nsf_Param *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) nonnull(1) nonnull(2) nonnull(3) nonnull(4) nonnull(5); @@ -16682,6 +16681,9 @@ Nsf_ConvertToInteger(Tcl_Interp *interp, Tcl_Obj *objPtr, const Nsf_Param *pPtr */ result = TCL_ERROR; } else { +#if TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6 + typedef size_t mp_int[4]; +#endif mp_int bignumValue; /* @@ -16696,7 +16698,7 @@ Nsf_ConvertToInteger(Tcl_Interp *interp, Tcl_Obj *objPtr, const Nsf_Param *pPtr }*/ if ((result = Tcl_GetBignumFromObj(interp, objPtr, &bignumValue)) == TCL_OK) { - mp_clear(&bignumValue); + Tcl_DecrRefCount(Tcl_NewBignumObj(&bignumValue)); } } @@ -35458,9 +35460,6 @@ Nsf_Init( if (Tcl_InitStubs(interp, "8.5", 0) == NULL) { return TCL_ERROR; } - if (Tcl_TomMath_InitStubs(interp, "8.5") == NULL) { - return TCL_ERROR; - } stubsInitialized = 1; } #endif </pre> Hi Jan! Thanks for the informative reply, first time I fully realize why there are so many "void *"s in Tcl's public API :) Sounds like a lot fuzz managing this dependency, just for for checking whether Tcl_BigBignumFromObj suceeds or fails (NSF is not interested in its actual mp_int value). I'd wish there would be Tcl_*BignumFromObj variant for that, or bigValue accepting null (so that mp_* memory management would be taken from the shoulders of the caller). Thanks, Stefan, for this report. The first problem with TIP #538 is that <tommath.h> is binary incompatible in Tcl 8.7 compared to Tcl 8.6. This is mainly due to Tcl's bad decision to make the mp_digit type 32-bit always: On 64bit platforms this is not optimal, and it's different from how libtommath's build scripts work. So, TIP #538 fixes this: The libtommath included by Tcl is now binary compatible with an externally-built libtommath. The recommended way for extensions would be to do the same thing as Tcl does. So, if Tcl is compiled against an external libtommath, the extension should be linked to that external libtommath as well. There is a symbol TCL_WITH_EXTERNAL_TOMMATH you can use to detect the difference. On many Linux systems (e.g. Ubuntu 20.4 LTS, Focal Fossa) libtommath can be used by "sudo apt-get install libtommath-dev". That shouldn't be too difficult. I expect that Tcl 8.7 - once included in Ubunto - will use this libtommath in stead of it's own version. So, nsf.c should do: <pre> ifdef TCL_WITH_EXTERNAL_TOMMATH # include <tommath.h> #else # include <tclTomMath.h> #endif </pre> and later in the code: <pre> #ifndef TCL_WITH_EXTERNAL_TOMMATH if (Tcl_TomMath_InitStubs(interp, "8.5") == NULL) { return TCL_ERROR; } #endif </pre> When linking the library, use "-ltommath" as additional link option. Of course, NSF could decide to keep it as-is, no problem. The only limitation is that using <tclTommath.h>, only the functions included by Tcl are usable. Using <tommath.h> the full list of libtommath functions can be used. So, in the long run, using an external libtommath is better always. That doesn't solve the problem described here. Well, Tcl doesn't install <tommath.h> because it could lead to a conflict with the official libtommath version. So, if you want to use the Tcl-provided libtommath, one way to do that is add a "compat" directory to NSF and put Tcl's <tommath.h> there. Just add "-I ../compat" to the compiler options and everything should work. It would have been nice when Tcl could provide the "mp_int" type from tcl.h. But that would cause a conflict between tcl.h and the external tommath.h. A tiny patch to tommath.h would fix this (See [ libtommath's PR 473]), but this PR was rejected with the remark: "No, such patches, which are only useful for Tcl won't happen.". The tommath.h provided in NSF's "/compat" directory could be a stripped-down version, if you like. Only providing "mp_int" and "mp_digit" is already enough (I didn't test that). Hope this helps. I'll keep this ticket open, so you can ask more questions if you like. That could be useful for other extensions too.
https://core.tcl-lang.org/tcl/tktview/4663e0636f7a24b9363e67c7a3dd25e9e495be17?plaintext
CC-MAIN-2021-10
refinedweb
2,330
67.15
There are many examples on CodeProject illustrating using thread pooling to manage work or job queues. These all assign the work item to a free thread, and thus the work is done concurrently. I, instead, needed the ability to queue work items that would be processed in a single thread. The typical scenario that I'm using this class for is to process activities that must occur on the WinForm main application thread, such as updating UI elements. Concurrent processing serves no purpose since using Invoke blocks until the main application thread becomes idle. The following sections describe some of the architectural decisions I made in the implementation of this class. The class, ProcessingQueue<T>, is a generic class, allowing you to specify the work type as either a value or reference type, for example: processQueue = new ProcessingQueue<int>(); Of course, this means that each ProcessingQueue<T> instance is restricted to one type of work item, which suits me. There are two events that are called from overridable methods to do the work and handle work exceptions. To do the actual work, I implemented the event DoWork, which is called for each work item in the queue. If you would prefer not to use events, you can derive a class from ProcessingQueue<T> and override the OnDoWork method. The work item is contained in the ProcessingQueueEventArgs<T> class. Exceptions that occur in the worker code (your application) are usually silently caught by a worker thread. To help expose exceptions to the application, you can use the WorkException event, or you can override the OnWorkException method in your own derived class. Both of these pass a ProcessingQueueExceptionEventArgs instance that wraps the Exception instance. I considered using semaphores for this implementation because you can release the semaphore for each work item in the queue, and the thread, which implements WaitOne, will release for the total release counts in the semaphore. However, a semaphore requires a maximum release count, because it's actually designed to release multiple threads, not a single thread. And if you release more than the maximum release count, the semaphore throws an exception, which isn't what I wanted. Since the queue depth is unknown, I didn't want to hardcode some arbitrary upper limit to the semaphore's maximum release count. It's the wrong tool for the job, basically. So, I chose the simpler EventWaitHandle using automatic reset. The concern here is that work may be queued while a work item is being processed. While this signals the wait event, it does so only once (there's no release count like in a Semaphore), so the worker thread has to process all the work currently in the queue, which also means it needs to check if it was signaled by having work put into the queue, which it processed, and therefore the queue is now empty. So, the code got complicated enough that I figured a nice generic class to support this feature would be useful, and hence this article. I still can't believe there isn't something similar already here on Code Project. Maybe it's too simple! The following sections describe the usage. To create a ProcessingQueue<T> instance for a specific work type, instantiate the class: processQueue = new ProcessingQueue<int>(); Wire up the work event to a method that will perform the work on the work item, and wire up the exception event if you so desire: processQueue.DoWork += new ProcessingQueue<int>.DoWorkDlgt(OnDoWork); processQueue.WorkException += new ProcessingQueue<int>.WorkExceptionDlgt(OnWorkException); Queuing work is straightforward--call the QueueForWork method: processQueue.QueueForWork(1); To exit the thread waiting for work, call the Stop method: processQueue.Stop(); This is a non-blocking call, and it will also finish any remaining work in the queue before the work thread terminates. Here's the worker thread. It should be pretty straightforward from the comments and my description above as to what's going on. protected void ProcessQueueWork() { while (!stop) { // Wait for some work. waitProcess.WaitOne(); bool haveWork; // Finish remaining work before stopping. do { // Initialize to the default work value. T work = default(T); // Assume no work. haveWork = false; // Prevent enqueing from a different thread. lock (workQueue) { // Do we have work? This might be 0 if stopping or if all // work is processed. if (workQueue.Count > 0) { // Get the work. work = workQueue.Dequeue(); // Yes, we have work. haveWork = true; } } // If we have work... if (haveWork) { try { // Try processing it. OnDoWork(new ProcessingQueueEventArgs<T>(work)); } catch (Exception e) { // Oops, inform application of a work error. OnWorkException(new ProcessingQueueExceptionEventArgs(e)); } } } while (haveWork); // continue processing if there was work. } } I wrote a couple really simple unit tests to verify the functionality, but certainly isn't a rigorous test: [TestFixture] public class ProcessThreadTests { protected ProcessingQueue<int> processQueue; protected bool exceptionRaised; protected bool workRaised; [TestFixtureSetUp] public void FixtureSetup() { processQueue = new ProcessingQueue<int>(); processQueue.DoWork += new ProcessingQueue<int>.DoWorkDlgt(OnDoWork); processQueue.WorkException += new ProcessingQueue<int>.WorkExceptionDlgt(OnWorkException); } [Test] public void QueueWorkTest() { processQueue.QueueForWork(1); while (!workRaised) { } } [Test] public void WorkExceptionTest() { processQueue.QueueForWork(2); while (!exceptionRaised) { } } void OnDoWork(object sender, ProcessingQueueEventArgs<int> args) { switch (args.Work) { case 1: workRaised = true; break; case 2: throw new ApplicationException("Exception"); } } void OnWorkException(object sender, ProcessingQueueExceptionEventArgs args) { exceptionRaised = true; } } Hopefully, you will find this class useful and my implementation without error! History Updated on 9/13 as I discovered I wasn't clearing a flag, and the code never returned to the WaitOne instruction! Fixing this also eliminated one of the flags. General News Question Answer Joke Rant Admin
http://www.codeproject.com/KB/threads/ProcessQueue.aspx
crawl-002
refinedweb
920
56.45
I have been spending a lot of my free time the last few months learning Kubernetes. Currently most implementations of Kubernetes use Docker as their container runtime. I wanted to share some of my knowledge gained as I learned. Since I claim to be a architecture I wanted to share the basic architecture of Docker. What is a container? It is a segmented process that contains only the required elements to complete it’s expected job. While a normal operating system has many libraries available to make it flexible container only has the required runtime and libraries to do it’s function. This reduced scope makes containers small and independent from operating systems. The segmentation is enforced by the container server. The container server runs as a process on another operating system. Architecture of Docker Docker is a server that runs a process called dockerd. This server provides a REST API for the creation, management and running of containers. For ease of management docker provides the docker command line interface to interact with the REST API. There is a company called Docker that provide a supported version of Docker called Docker Enterprise. Most people seem to use Docker community edition which is licensed under the Apache 2.0 license. What is a registry? Registry is a place to store container images. Docker maintains Docker Hub a huge public registry. Anyone can provide a image to Docker Hub allowing anyone else to consume it. Many companies choose to use a private registry to protect their company data and applications. Docker has two functions for registry a push and a pull: - Push – sends a local image to the registry - Pull – asks for the image to be stored locally What is a docker image? Docker images are built using layers and are read-only. Each layer in an image could be based upon a previous image or some unique customization. Images are compiled sets of instructions stored in a file called Dockerfile. This Dockerfile defines a basic image that does nothing but ping google.com forever. When compiled this image has three layers: Layer 1: FROM ubuntu:latest - Use the ubuntu base operating system with the tag of latest Layer 2: RUN apt-get update -q && apt-get install -qy iputils-ping - Execute the command listed above that updates the operating system and installs iputils-ping Layer 3: CMD [“ping”, “google.com”] - Run the command ping google.com forever Once compiled this new image can be uploaded to a repository as a new container. What is a container? It is a runable image. They can be stored locally or in a remote repository. Once you start running an image is becomes a unique container and writable. All changes are unique to that instance of the container and not changed on the image. You can spawn hundreds or thousands of containers from a single image. What about isolation? Isolation is critical otherwise the container is just a process on an operating system. This isolation in docker is provided by three things: - namespaces – makes a container look and feel like a separate machine - cgroups – A way to group processes together and apply resource limits - capabilities – superuser privileges that can be enabled or disabled for a process So cgroups are used to group together processes into namespaces. Namespaces creates isolated instances of different resources like network etc.. This provided the impression of being isolated. What about networking? For containers to talk to the outside world is critical networking is implemented along with the other seven namespaces as part of Docker. Initial docker networking was very limited. As an active open source project it continues to get better. I will skip the deep dive on Docker networking since it is mostly not part of Kubernetes. Why do I care? An honest question. Containers enable very rapid deployment of new code. They allow the implementation of micro-services which in turn should improve the rate of new features in code. So it’s really about speed. A simple comparison is the fact that I could setup this wordpress blog in 15 seconds with docker should help you understand the speed capabilities.
https://blog.jgriffiths.org/architecture-of-docker/
CC-MAIN-2020-40
refinedweb
693
57.67
Chris recently put out a neat CodePen Embed Block for the Gutenberg editor in WordPress. It allows you to embed a Pen just by dropping in its URL. From there, you get access to control the size, theme, and the default tabs that render on initial load. Super neat! But it got me thinking: How difficult would it be to recreate it with Sanity Studio’s Portable Text editor? (Spoiler: Not that difficult). Since I already knew how to do it, it took me under seven minutes from start to finish. This tutorial takes you through how to get up and running with a studio, and how to add the schemas and the custom preview component for a CodePen embed. So this is me recreating @chriscoyier’s CodePen Gutenberg Block for @sanity_io’s rich text editor in less than 7min (3x video). Best thing is, you actually just store the structured data, making it queryable, future proof, and easy to integrate with whatever frontend you prefer. pic.twitter.com/6aSGKerHfO— knut (in SF 🇺🇸) (@kmelve) January 18, 2020 That felt so cool that I want to teach you how to do it as well. Let’s dive right into it. Getting Sanity Studio up and running locally First, you’ll need to install Sanity Studio locally on your machine. In this tutorial we will be using the blog studio that you can initiate from the command line, but you can also check out the different starters on sanity.io/create. You should be able to tag along with one of those too. This tutorial assumes that you have a bit of knowledge of JavaScript. It will use a bit of React, but only a small part. You should have installed node and npm if you haven’t already. Oh, and you’ll want the Sanity CLI, which you can snag with the command line: npm install --global @sanity/cli Once the installation is done, you can initiate a new Sanity Studio with a new project by running the command sanity init. It will let you log in with your Google or GitHub account (or make a new account with an email/password). Give your project a name and follow the instructions. When given the options for a project template, choose the blog one: ? Select project template Movie project (schema + sample data) E-commerce (schema + sample data) ❯ Blog (schema) Clean project with no predefined schemas After completing the steps, change directory ( cd) into the new project folder and open it in your favorite code editor. To start the developer server that will also hot reload your studio when you make changes, run sanity start. To stop this server, you press ctrl + C in most command line tools. Adding the schemas for a CodePen embed Schemas define which document types that are available in the Studio, and which input fields they have. These schemas are defined in JavaScript objects that you import into the schemas.js file, where they are exported as a function that the Studio translates into its UI. There’s a lot you can do with these schemas, but in this tutorial, we will keep it reasonably simple. Start with adding a new file inside /yourproject/schemas called codepen.js. Then type in this code: export default { name: "codepen", type: "object", title: "CodePen Embed", fields: [ { name: "url", type: "url", title: "CodePen URL" } ] }; Then you can go to /yourproject/schemas/schema.js and add the following two lines of code to it: import createSchema from "part:@sanity/base/schema-creator"; import schemaTypes from "all:part:@sanity/base/schema-type"; import blockContent from "./blockContent"; import category from "./category"; import post from "./post"; import author from "./author"; import codepen from "/codepen.js"; // <= first import the object export default createSchema({ name: "default", types: schemaTypes.concat([ post, author, category, blockContent, codepen // <= add it to the schema types array ]) }); So what did we just do? Well, we have now made this CodePen object available as a type in other schemas in the Studio. In other words, you can now add type: 'codepen' to get those fields anywhere else in the schema code where you add fields. Adding this type to the rich text field is also our next step. Hang on! Adding the CodePen field to the rich text editorAdding the CodePen field to the rich text editor Before diving into the code bit, let us take a step back and look at what is going on in terms of the data formats we operate with, and how WordPress and Sanity differ slightly. While Gutenberg stores rich text as JSON in its runtime (which is great!), what developers end up dealing with is mostly this content as HTML and JSON objects inside of HTML comments. Sanity stores and distributes rich text content as Portable Text, which developers then serializes in their frontends. That means that you get fine-grained control over how rich text content is rendered by letting you use custom components for your favorite framework, either it's React, Vue, Svelte, or .NET, PHP, or even Markdown. In other words, you store your content as structured data in Sanity’s backend, and then decide how you want to use the data inside your frontend components. But enough exposition, let's get back to the code! Open /schemas/blockContent.js and notice that it's of the type array. Yes, rich text is an array of different types, where one of them has to be of the block type (in which text paragraphs are stored). So the simplest way of making rich text is the following schema definition: export default { name: "body", type: "array", title: "Body", of: [ { type: "block" } ] }; Now, blockContent.js has a bunch of more stuff. You can see styles, lists, marks, and so on. All defining which properties should be available for the author. In the top array, there are two types block and image. We are going to add the third one, codepen: export default { title: "Block Content", name: "blockContent", type: "array", of: [ { type: "block" // ... }, { type: "image", options: { hotspot: true } }, { type: "codepen" } ] }; Save the file, and that's it! If you now run sanity start in your command line (assuming you haven't already), and open the Studio on, you should be able to find your new field in the rich text editor under the "post" type: If you try out the new button, you'll get a modal with the URL field that you defined in the previous section. Feel free to add the URL from a cool CodePen that you have found. We will use this one from the legendary Sara Drasner; it's pretty cool. Just showing the URL value in the editor isn't especially inspiring, though. So let's go ahead and add the actual CodePen embed so we can interact with it directly in the editor! Adding the CodePen embed as a preview Open /yourproject/schemas/codepen.js again. Now we are going to make a small React component for our preview. Start by importing React in the top, and the boilerplate for the React component that we will turn into the embed: import React from "react"; const CodePenPreview = ({ value }) => { return <pre>{JSON.stringify(value, null, 2)}</pre>; }; export default { name: "codepen", type: "object", title: "CodePen Embed", fields: [ { name: "url", type: "url", title: "CodePen URL" } ] }; The JSON.stringify stuff is a temporary little way of outputting the incoming data in a readable manner. You could also use console.log(value), but who has time to open the developer console? Now you must tell Sanity how to use this component for the preview. As well as which of the fields in the object it should select for the value in the preview component. import React from "react"; const CodePenPreview = ({ value }) => { return <pre>{JSON.stringify(value, null, 2)}</pre>; }; export default { name: "codepen", type: "object", title: "CodePen Embed", preview: { select: { url: "url" }, component: CodePenPreview }, fields: [ { name: "url", type: "url", title: "CodePen URL" } ] }; The editor should look something like this after you saved your changes: Cool! Now we want to take the url value and somehow integrate it with a CodePen embed. The easiest way to go about this is to fit the markup for CodePen’s iFrame embed, and fit into our preview component in React. The original iFrame element will look like this: <iframe height="265" style="width: 100%;" scrolling="no" title="React Animated Page Transitions" src="" frameborder="no" allowtransparency="true" allowfullscreen="true"> See the Pen <a href=''>React Animated Page Transitions</a> by Sarah Drasner (<a href=''>@sdras</a>) on <a href=''>CodePen</a>. </iframe> If we paste this snippet into our preview component, it will almost work. In order to make it JSX-compatible you'll have to some few changes to some of the HTML-attributes. Make sure that you change: style="width: 100%;"to style={{width: "100%"}} frameborder="no"to frameBorder="no" allow-transparency="true"to allowTransparency allow-fullscreen="true"to allowFullScreen You can remove the content (links, etc.) inside of the iframe, because it isn't particularly useful inside the studio. What we should end up with is something like this: import React from "react"; import Codepen from "react-codepen-embed"; const CodePenPreview = ({ value }) => { return ( <iframe height="265" style={{ width: '100%' }} scrolling="no" title="React Animated Page Transitions" src="" frameBorder="no" allowTransparency allowFullScreen />); }; // ... When saved, we should be able to see the CodePen embed inside the rich text editor: Notice that the iFrame has an embed URL with some parameters for how it should be displayed. Of course, we could've asked someone to dive into CodePen to obtain this URL, but it's probably better for to use the regular one. We'll take the effort to reassemble into what we need: The last part is to take the URL from the field, and get the hash and user out of it. We split the URL string on forward slashes into an array. Then we use array destructuring to assign the different array elements to a variable. Since we only need the user and the hash we leave the other positions empty. This method isn't bulletproof, as it assumed a specific format for the URL, but it works for this example. Then we reassemble the embedUrl by using template literals. import React from "react"; const CodePenPreview = ({ value }) => { const { url } = value; if (!url) { return (<div>Add a CodePen URL</div>) } const splitURL = url.split("/"); // [ 'https:', '', 'codepen.io', 'sdras', 'pen', 'gWWQgb' ] const [, , , user, , hash] = splitURL; const embedUrl = `{user}/embed/${hash}?height=370&theme-id=dark&default-tab=result`; return ( <iframe height="370" style={{ width: '100%' }} scrolling="no" title="CodePen Embed" src={embedUrl} frameBorder="no" allowTransparency allowFullScreen /> ); }; // ... Save the changes and voilá; we're pretty much done with the custom CodePen block! Taking it further Now, you probably noticed that Chris had put more settings into his custom block. Nothing is stopping us from doing the same! If we look up the documentation for the React CodePen embed component that we installed, we'll find a table of properties that it can take. We can add these as fields in the schema definition. For example, if we wanted to add the themeId, we could do it as follows: import React from "react"; import Codepen from "react-codepen-embed"; const CodePenPreview = ({ value }) => { const { url, themeId = "dark" } = value; // <= add themeId here, default it to "dark" if (!url) { return (<div>Add a CodePen URL</div>) } const splitURL = url.split("/"); // [ 'https:', '', 'codepen.io', 'sdras', 'pen', 'gWWQgb' ] const [, , , user, , hash] = splitURL; const embedUrl = `{user}/embed/${hash}?height=370&theme-id=${themeId}&default-tab=result`; // <= add themeId here return ( <iframe height="370" style={{ width: '100%' }} scrolling="no" title="CodePen Embed" src={embedUrl} frameBorder="no" allowTransparency allowFullScreen /> ); }; export default { name: "codepen", type: "object", title: "CodePen Embed", preview: { select: { url: "url", themeId: "themeId" // <= add themeId here }, component: CodePenPreview }, fields: [ { name: "url", type: "url", title: "CodePen URL" }, // Add the new field below { name: "themeId", type: "string", title: "Theme ID", description: 'You can use "light" and "dark" also.' } ] }; Conclusion We just looked at how schemas for Sanity Studio work, and learned how to make previews for custom components to boot! Hopefully, you now know enough to make pretty much any custom component with a preview using these same principles. If you do, I would love to know about it either on Twitter or in the comments. Cool! Do u have any idea how to support table in block?
https://css-tricks.com/recreating-the-codepen-gutenberg-embed-block-for-sanity-io/
CC-MAIN-2021-10
refinedweb
2,066
61.87
You are given query of range an integer array. You will be asked to determine the sum of all the numbers that come in the range of given query. The query given is of two types, that are – Update: (index, value) is given as a query, where you need to update the value of the array at position index with the ‘value’. Sum: (left, right) is given a query, sum up all the numbers that come in the range. Example Input arr[] = {2,4,7,1,5,8,9,10,3,6} Sum Query(0, 3) Sum Query(4, 9) Update(5, 8) Sum Query(3, 7) Output 14 ⇒ the sum of numbers within the range 0 and 3, is 14 (2 + 4 + 7 + 1) 41 ⇒ the sum of numbers within the range 4 and 9, is 41 (5 + 8 + 9 + 10 + 3 + 6) Updating the value at array[5] as 8. 33 ⇒ the sum of numbers within the range 0 and 3, is 14 (1 + 5 + 8 + 9 + 10) Algorithm - Get the square root value of n as a blocksize and traverse the array. - Copy the value of input array to the array we created and check if any of the indexes is divisible by blocksize if it then increases the value of blockindex by 1 and adds the value of arr[i] to the blockArray at blockindex. - To sum up the value in the given range, set the value of sum to 0. - Follow the three while loops, until the left is less than the value of the right, left should not be zero and left should not be the corner case of any block, then add the value of array[left] to the sum and increase the value of left. - In this, left plus blocksize should be less than the right, then add the value of blockArray at the index as the division of left and blocksize, and add the value of blocksize to the left. - In this, left is less than the right, add the value of array[left] to the sum and increase the value of left by 1, and return the value of the sum. - For any update query, get the division of index and blocksize, and add the value which was given to update and subtract the array[index]. At last update the ‘value’ at array[index]. Explanation Square root decomposition is a technique to solve the questions to reduce the complexity in terms of the square root of sqrt(n). Given an array and the query range to find the sum of all the numbers which are in the given range of each query and another task is to update the value at the given index. So in this we are given some queries, and we need to solve that, we can solve it by using naïve approach. In that approach we will solve it by iterating over each element in the array within the given range of left and right, and sum all of the values present in range, but here for this approach time complexity for each approach will be O(n). So to optimize the queries most efficiently, we will use square root decomposition, helping us to reduce the time complexity. We can assume that an array of size n consisting n elements. We will divide the array into small chunks or blocks of size sqrt(n). for every perfect square as a number, we will have precise sqrt(n) chunks. With this decomposition of the array, we will have sqrt(n) blocks and in each block. We will be having sqrt(n) elements if n is a perfect square, where n is a size of an array. Suppose we have an sqrt(16) blocks since 16 is a perfect square. We will have exactly 4 blocks and each block will be containing exactly 4 elements. Each block we will have the sum of all the elements lying in each block. So if we ask to find out the sum of any range query. We can easily find the sum by using blocks sum. Implementation in C++ for Sqrt (or Square Root) Decomposition Technique #include<iostream> #include<math.h> using namespace std; int arr[10000]; int blockArray[100]; int blockSize; void buildArray(int input[], int n) { int blockIndex = -1; blockSize = sqrt(n); for (int i=0; i<n; i++) { arr[i] = input[i]; if (i%blockSize == 0) { blockIndex++; } blockArray[blockIndex] += arr[i]; } } void update(int index, int value) { int blockNumber = index / blockSize; blockArray[blockNumber] += value - arr[index]; arr[index] = value; } int solveQuery(int left, int right) { int sum = 0; while (left<right and left%blockSize!=0 and left!=0) { sum += arr[left]; left++; } while (left+blockSize <= right) { sum += blockArray[left/blockSize]; left += blockSize; } while (left<=right) { sum += arr[left]; left++; } return sum; } int main() { int inputArray[] = {2,4,7,1,5,8,9,10,3,6}; int n = sizeof(inputArray)/sizeof(inputArray[0]); buildArray(inputArray, n); cout << "first Query : " << solveQuery(0, 3) << endl; cout << "second Query : " << solveQuery(4, 9) << endl; update(5, 8); cout << "third Query : " << solveQuery(3, 7) << endl; return 0; } first Query : 14 second Query : 41 third Query : 33 Implementation in Java for Sqrt (or Square Root) Decomposition Technique class SquareRootDecomposition { static int []arr = new int[10000]; static int []blockArray = new int[100]; static int blockSize; static void buildArray(int input[], int n) { int blockIndex = -1; blockSize = (int) Math.sqrt(n); for (int i = 0; i < n; i++) { arr[i] = input[i]; if (i % blockSize == 0) { blockIndex++; } blockArray[blockIndex] += arr[i]; } } static void update(int idx, int val) { int blockNumber = idx / blockSize; blockArray[blockNumber] += val - arr[idx]; arr[idx] = val; } static int solveQuery(int left, int right) { int sum = 0; while (left<right && left%blockSize!=0 && left!=0) { sum += arr[left]; left++; } while (left+blockSize <= right) { sum += blockArray[left/blockSize]; left += blockSize; } while (left<=right) { sum += arr[left]; left++; } return sum; } public static void main(String[] args) { int input[] = {2,4,7,1,5,8,9,10,3,6}; int n = input.length; buildArray(input, n); System.out.println("first Query: " + solveQuery(0, 3)); System.out.println("second Query : " + solveQuery(4, 9)); update(5, 8); System.out.println("third Query : " + solveQuery(3, 7)); } } first Query: 14 second Query : 41 third Query : 33 Complexity Analysis for Sqrt (or Square Root) Decomposition Technique Time Complexity O(sqrt(n)) where “n” is the number of elements in the array. Space Complexity O(sqrt(n)) where “n” is the number of elements in the array.
https://www.tutorialcup.com/interview/sqrt-or-square-root-decomposition-technique.htm
CC-MAIN-2021-04
refinedweb
1,084
63.43
This example shows how to sort data about patients into lists of smokers and nonsmokers in Python® and plot blood pressure readings for the patients with MATLAB®. Start the engine, and read data about a set of patients into a MATLAB table. MATLAB provides a sample comma-delimited file, patients.dat, which contains information on 100 different patients. import matlab.engine eng = matlab.engine.start_matlab() eng.eval("T = readtable('patients.dat');",nargout=0) The MATLAB readtable function reads the data into a table. The engine does not support the MATLAB table data type. However, with the MATLAB table2struct function you can convert the table to a scalar structure, which is a data type the engine does support. eng.eval("S = table2struct(T,'ToScalar',true);",nargout=0) eng.eval("disp(S)",nargout=0) LastName: {100x1 cell} Gender: {100x1 cell} Age: [100x1 double] Location: {100x1 cell} Height: [100x1 double] Weight: [100x1 double] Smoker: [100x1 double] Systolic: [100x1 double] Diastolic: [100x1 double] SelfAssessedHealthStatus: {100x1 cell} You can pass S from the MATLAB workspace into your Python session. The engine converts S to a Python dictionary, D. D = eng.workspace["S"] S has fields that contain arrays. The engine converts cell arrays to Python list variables, and numeric arrays to MATLAB arrays. Therefore, D["LastName"] is of data type list, and D["Age"] is of data type matlab.double. Sort blood pressure readings into lists of smokers and nonsmokers. In patients.dat, the column Smoker indicated a smoker with logical 1 (true), and a nonsmoker with a logical 0 (false). Convert D["Smoker"] to a matlab.logical array for sorting. smoker = matlab.logical(D["Smoker"]) Convert the Diastolic blood pressure readings and Smoker indicators into 1-by-100 MATLAB arrays for sorting. pressure = D["Diastolic"] pressure.reshape((1,100)) pressure = pressure[0] smoker.reshape((1,100)) smoker = smoker[0] Sort the pressure array into lists of blood pressure readings for smokers and nonskmokers. Python list comprehensions provide a compact method for iterating over sequences. With the Python zip function, you can iterate over multiple sequences in a single for loop. sp = [p for (p,s) in zip(pressure,smoker) if s is True] nsp = [p for (p,s) in zip(pressure,smoker) if s is False] Display the length of sp, the blood pressure readings for smokers in a list. print(len(sp)) 34 Display the length of nsp, the list of readings for nonsmokers. print(len(nsp)) 66 Calculate the mean blood pressure readings for smokers and nonsmokers. Convert sp and nsp to MATLAB arrays before passing them to the MATLAB mean function. sp = matlab.double(sp) nsp = matlab.double(nsp) print(eng.mean(sp)) 89.9117647059 Display the mean blood pressure for the nonsmokers. print(eng.mean(nsp)) 79.3787878788 Plot blood pressure readings for the smokers and nonsmokers. Call the MATLAB linspace function to define two x-axes for plotting. You can plot the 34 smokers and 66 nonsmokers on the same scatter plot. sdx = eng.linspace(1.0,34.0,34) nsdx = eng.linspace(1.0,34.0,66) Show the axes boundaries with the box function. eng.figure(nargout=0) eng.hold("on",nargout=0) eng.box("on",nargout=0) You must call the figure, hold, and box functions with nargout=0, because these functions do not return output arguments. Plot the blood pressure readings for the smokers and nonsmokers, and label the plot. For many MATLAB functions, the engine can return a handle to a MATLAB graphics object. You can store a handle to a MATLAB object in a Python variable, but you cannot manipulate the object properties in Python. You can pass MATLAB objects as input arguments to other MATLAB functions. eng.scatter(sdx,sp,10,'blue') <matlab.object object at 0x22d1510> In the rest of this example, assign the output argument of MATLAB functions to h as a placeholder. h = eng.scatter(nsdx,nsp,10,'red') h = eng.xlabel("Patient (Anonymized)") h = eng.ylabel("Diastolic Blood Pressure (mm Hg)") h = eng.title("Blood Pressure Readings for All Patients") h = eng.legend("Smokers","Nonsmokers") Draw lines to show the average blood pressure readings for smokers and nonsmokers. x = matlab.double([0,35]) y = matlab.double([89.9,89.9]) h = eng.line(x,y,"Color","blue") h = eng.text(21.0,88.5,"89.9 (Smoker avg.)","Color","blue") y = matlab.double([79.4,79.4]) h = eng.line(x,y,"Color","red") h = eng.text(5.0,81.0,"79.4 (Nonsmoker avg.)","Color","red")
https://www.mathworks.com/help/matlab/matlab_external/sort-and-plot-matlab-data-from-python.html?requestedDomain=true&nocookie=true
CC-MAIN-2018-05
refinedweb
749
51.85
These are chat archives for FreeCodeCamp/HelpJavaScript Get help on our basic JavaScript and Algorithms Challenges. If you are posting code that is large use Gist - paste the link here. this.props classNameon React elements classis a reserved word in JavaScript Anything look inherently wrong here <span id={name} onClick={selectable ? breadcrumbClicked : undefined} > <i className={icon} /> {name} </span> The click function only gets event.target.id if you click on the name but not on the icon even though they're in the same span... import React, { Component } from "react"; class Navbar extends Component { constructor(props) { super(props); } render() { return ( <div> <Navbar bsStyle="pills"> <NavItem>Home</NavItem> </Navbar> </div> ); } } export default Navbar; currentTargetmaybe event.target.idis ""if clicking the icon, but {name}(whatever name is) if clicking the text spanthough? bsStyleprop - "default", "inverse" [{name: 'Lois'},{name: 'Liza'},{name: 'Petter'},{name: 'Homer'},{name: 'Mario'}]how do i get all the names in a different array? like ['Lois', 'Liza' //etc]? cause i prolly did it wrong and it doesnt work ["Lois" , "Peter" , "Bart", "&", "Lisa"]and make it into this ["Lois" , "Peter" , "Bart & Lisa"]in other words merge the last 3 strings into 1 string {name: '&'}? Looks like a problem at an earlier stage, which you now try to cover with this join operation. &to merge the last two strings ["Lois" , "Peter" , "Bart", "Lisa"]without the &i just thought that i first need to add the &in the array at the right position and then i have to merge the last three strings array1 = ["Lois" , "Peter" , "Bart", "Lisa"]; array2 = array1.slice(0, -2).concat(array1.slice(-2).join(" & ")) console.log(array2); // [ 'Lois', 'Peter', 'Bart & Lisa' ] _getJobs = () => { const url=""; return fetch(url) .then(response => response.json()) .then(responseJson => { console.log(responseJson.origin); }) .catch(error => { console.error(error); }); }; _getJobs(); hey folks… i’m on the last cash register challenge in js algorithms and i think i got it working (with the worst code and syntax but w/e !! please ignore how many loops I have going lol) but I’ve got some sort of rounding issue?? its always 1penny short or something? or if i’m fundamentally wrong please let me know… thanks if anyone has time :) challenge: Math.round()s everywhere or in the conditions but it still seems to evaluate to the same incorrect answers… also one of the tests only needs 0.5 in change … if i were to get rid of the decimals and then add them on, i would need to write a function for just that anyway right? @jesskxuan Change line 78, from: if (count + arr[1]/reversedEach[index] < changeNeeded) To if (count + arr[1]/reversedEach[index] <= changeNeeded) And it should fix. ok just failing one now… checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]) should return {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]} i'm literally 1 penny off lol i'm gonna keep working at it but also i feel like this is okay cause people should not use js for this anyway or somethng right Thats not JS problem tbh, almost all programming languages have this follows IEEE 754 standard 0.1 + 0.2 = 0.30000000000000004 const flattenArray = arr => arr.reduce((a, c) => Array.isArray(c) ? a.concat(flattenArray(c)): a.concat(c), []); flattenArray([1, 2, 3, [4, 5, 6], 7, 8, 9]); const { active, inProgress, upcoming } = momentBriefs.reduce( (obj, brief, index) => { console.log('index', index, 'brief', brief, obj); if (brief.status === 'COMPLETE' && brief.startDate.isSame(todayMoment, 'week')) { obj.active.push(brief); } else if (brief.status === 'COMPLETE' && !brief.startDate.isSame(todayMoment, 'week')) { obj.upcoming.push(brief); } else if (brief.status === 'PUBLISHED') { obj.inProgress.push(brief); } }, { active: [], inProgress: [], upcoming: [], }, ); objto be for the next iteration return objat the end of the if else chain Oh its fixed!only to find something else is broken or still broken lol !!myArray.lengthas opposed to just myArray.lengthwhen determining a boolean from that result?
https://gitter.im/FreeCodeCamp/HelpJavaScript/archives/2018/12/12
CC-MAIN-2019-13
refinedweb
676
58.28
also doing about the same thing as you. i am using applet to servlet communication with the servlet doing the connection to the database via JDBC. i am not using the signed applet way coz i am doing this application for intranet use and i dun want to end up paying for nothing. I am still developing the program. Links You can reach me at opabc@rocketmail.com you need a configured ODBC datasource on the client machine and probably permissions to execute native code This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers. that's ODBC - not magic. Hi, 1.first sign the applet. From: vladi21 Date: Tuesday, November 16 1999 - 08:46PM CST Code signing resources: Creating Signed, Persistent Java Applets MS: NN: NN: Bypass the need for a certificate. will enable JAR. Another way is to lower general security setting to more allow more freedom when running applets locally. Add or modify the following entries in the prefs.js: user_pref("unsigned.applet user_pref("signed.applets. user_pref("signed.applets. user_pref("signed.applets. Then you don't need to asked for privileges for local classes. When adding or modifying the file prefs.js, Netscape must not be running because your modification will be overwritten. So shut down Netscape, edit the prefs.js and then restart Netscape. 2.Create a dsn on client machine as told by heyhey. a. Assume that your databse server(i.e the system whch contain database ) is abc. b.Assume that your database ( data.mdb was presented in abc system def sirectory. c.Create a dsn (assume myDsn) on every client connected to lan as 1. net use somedrivername(assume f:) as database server. Eg: net use f: \\abc\c; ("c" driectory). 2.Create a dsn in start ->settings ->control panel ->odbc->msaccessdatabase-> GIve dsn name as myDsn. give the path as f:\def\data.mdb. That's all. Best of luck! A sample code for rmi and jdbc In sun site, you will get sample examples //Remote Interface import java.rmi.*; public class RMIJdbc extends Remote { public String getDataFromServerDatabase( } // Implementation class (SERVER) import java.rmi.*; import java.rmi.server.*; public class RMIJdbcImpl extends UnicastRemoteObject implements RMIJdbc { Connection con; PreparedStatement pst; ResultSet rs; String hostname="localhost"; // where you run the rmi registry int port = 1099; // the port of the rmiregistry (by default it takes 1099) String objectname="server"; // your object name in the naming service(rmiregistry) public RMIJdbcImpl() { try { Class.forName("sun.jdbc.od con = DriverManager.getConnectio } catch ( Exception ee) { ee.printStackTrace(); } public String getDataFromServerDatabase( { String toReturn = ""; try { pst = con.prepareStatement("sele pst.setInt(1,100) //Assume yourtable contains like 100 as empno and //Rameshaa as ename rs = pst.executeQuery(); if ( rs.next()) toReturn = rs.getString(1); retrun toReturn; } public static void main(String args[]) { RMIJdbcImpl server = new RMIJdbcImpl(); server.bindInNamingService } public void bindInNamingService(){ try { Naming.rebind("rmi://"+hos } Catch ( Exception eee) { eee.printStackTrace(); } } } // CLient class import java.rmi.server.*; import java.rmi.*; public class RMIClient { public static void main(String args[]) { try { RMIJdbc obj = Naming.lookup("rmi://"+arg System.out.println(getData }catch(Exception e){ e.printStackTrace(); } } } Compiling: javac RMIJdbc.java javac RMIJdbcImpl.java rmic RMIJdbcImpl javac RMIClient.java Running: SERVER: start rmiregistry ( you should keep the window open until you need your server) java RMIJdbcImpl CLIENT: java RMIClient localhost 1099 server ( you can give the hostname where rmiregistry is running for your server the port is rmiregistry port these params must be the same as you give in your server); Best of luck Experts Exchange Solution brought to you by Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.Start your 7-day free trial Thanks Pankaj But i expected minimum B grade. Ok.
https://www.experts-exchange.com/questions/10249119/Applet-direcrtly-accessing-a-database.html
CC-MAIN-2018-39
refinedweb
652
51.55
Windows Communication Foundation From the Inside The documentation for configuring a port with an SSL certificate shows example commands using the httpcfg.exe program. Starting with Windows Vista, httpcfg.exe was replaced in function by the netsh program that comes with the operating system. This is more convenient than having to download a separate tool, but it means that the syntax that you need to use changes slightly. Let's assume that you've created a certificate and have already installed it using either the command line or the MMC certificate snap-in. Now, through the MMC snap-in, get the thumbprint of the certificate you want to install to a port if you don't already know what the thumbprint is. This process hasn't changed much so your existing directions should continue to work. The thumbprint for the test certificate I generated was 45d08a92798460d84e4ce157f31662b36c4edbff. When you copy the thumbprint from the snap-in, don't forget to remove all of the spaces. You'll need to run netsh from an elevated command prompt. This first command installs my generated test certificate to port 8000 for the wildcard IP address. netsh http add sslcert ipport=0.0.0.0:8000 certhash=45d08a92798460d84e4ce157f31662b36c4edbff appid={00112233-4455-6677-8899-AABBCCDDEEFF} The only new thing here is the appid, which is a guid that can be used to associate the certificate with a particular application. You can check the installed certificates with the following command. netsh http show sslcert That gives me the following certificate description. SSL Certificate bindings:------------------------- IP:port : 0.0.0.0:8000 Certificate Hash : 45d08a92798460d84e4ce157f31662b36c4edbff Application ID : {00112233-4455-6677-8899-aabbccddeeff} Certificate Store Name : (null) Verify Client Certificate Revocation : Enabled Verify Revocation Using Cached Client Certificate Only : Disabled Usage Check : Enabled Revocation Freshness Time : 0 URL Retrieval Timeout : 0 Ctl Identifier : (null) Ctl Store Name : (null) DS Mapper Usage : Disabled Negotiate Client Certificate : Disabled Finally, you can remove the certificate associated with a particular address to undo the earlier changes. netsh http delete sslcert ipport=0.0.0.0:8000 Next time: Shutting Down a Channel Back when I did an overview of custom namespaces , I omitted any namespace declarations that wouldn't Hi Nicholas, I've been struggling with trying to get authentication to work with a webhttpbinding. I want to do Custom validation against by data base to ensure that only authenticated users can use my rest service. Do you know of a sample that works with Cassini that i can refer to? Thanks Matt Btw, The issue i am running into is that even though I specify a custom validator in my config file, the validate function never gets called. thanks Hi Matt, If you're trying to use custom validation with HTTPS then you'll have to wait until the final version of Orcas comes out for that to work. I work remotely and am now using a new Sony Vaio with Windows Vista Home Premium installed. I'm trying to access a doctor's office software online but end up with a "Certificate Security" issue no matter what I do. Microsoft has a Hotfix but NOT for Windows Vista. They directed me to call Sony, which I did. They walked me through a reconfiguration of my Sony but it still won't download for me. Can someone help? My email address is: tangledroses@sbcglobal.net My URL I included in order to leave a comment here has nothing to do with my problem. Thanks so much, Remi
http://blogs.msdn.com/drnick/archive/2007/10/15/configuring-ssl-certificates-for-vista.aspx
crawl-002
refinedweb
585
62.78
Hi everyone, I have two images on a dynamic page and I want one to disappear when certain conditions on image width are met. My dataset is called #dyanmicDataset and the image is in a column with reference logo. I am new to coding and have no idea how to make this work. Image6 and Image5 are the placeholders that overlap and I want them to appear or disappear as needed. Right now it is saying logo cant be found on dynamicDataset although it is certainty in there. Thanks for the help! import wixData from 'wix-data'; $w.onReady(() => { if($w('#dynamicDataset').logo.logoWidth > 129) { $w('#image6').show(); $w('#image5').hide(); } else { $w('#image6').hide(); $w('#image5').show(); } }); Hi, You need to wrap your condition with $w('#dynamicDataaset').onReady function. Roi.
https://www.wix.com/corvid/forum/community-discussion/images-on-dynamic-pages-code-help
CC-MAIN-2020-05
refinedweb
131
68.26
Details Description HBASE-4057 adds processlist and it shows in the RS UI. This issue is about getting the processlist to show in the shell, like it does in mysql. Labelling it noob; this is a pretty substantial issue but it shouldn't be too hard – it'd mostly be plumbing from RS into the shell. Activity - All - Work Log - History - Activity - Transitions This looks very nice. How do I query a single server? hbase(main):017:0> processlist 'all', 'c2024.halxg.cloudera.com,16020,1422392840119' ERROR: cannot convert instance of class org.jruby.RubyString to class org.apache.hadoop.hbase.ServerName The help is not clear. Says 'localhost': hbase> processlist 'all','localhost' Looks like it takes hostname only but but everywhere else we take servername so should say hostname instead of localhost. Might want to do servername rather than hostname or be able to take both for case where machine has restarted or there are two hosts on one node. Regards patch, it looks good. I like how you reuse formatter. Nice one Talat UYARER That works: hbase(main):002:0> processlist 1 tasks as of: 2015-01-26 22:35:35 +-----------------+---------------------+----------+----------------------------------+--------------------------------------+ | Host | Start Time | State | Description | Status | +-----------------+---------------------+----------+----------------------------------+--------------------------------------+ | c2022.halxg.... | 2015-01-26 22:34:09 | COMPLETE | Compacting meta in Integratio... | Compaction complete (since 57 sec... | +-----------------+---------------------+----------+----------------------------------+--------------------------------------+ In shell I addressed to processlist command. Can you use processlist ? I installed the patch but I see nothing in the general help listing. Should I? hbase(main):010:0* help HBase Shell, version 2.0.0-SNAPSHOT, raaeafca9206341761094b1bcd27580f3978356bb, Mon Jan 26 22:27:55 PST 2015 Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command. Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group. COMMAND GROUPS: Group name: general Commands: processlist, status, table_help, version, whoami Group name: ddl Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, get_table, is_disabled, is_enabled, list, show_filters Group name: namespace Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables Group name: dml Commands: append, count, delete, deleteall, get, get_counter, incr, put, scan, truncate, truncate_preserve Group name: tools Commands: assign, balance_switch, balancer, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, close_region, compact, compact_rs, flush, major_compact, merge_region, move, split, trace, unassign, wal_roll, zk_dump Group name: replication Commands: add_peer, append_peer_tableCFs, disable_peer, enable_peer, list_peers, list_replicated_tables, remove_peer, remove_peer_tableCFs, set_peer_tableCFs, show_peer_tableCFs Group name: snapshots Commands: clone_snapshot, delete_all_snapshot, delete_snapshot, list_snapshots, restore_snapshot, snapshot Group name: configuration Commands: update_all_config, update_config Group name: quotas Commands: list_quotas, set_quota Group name: security Commands: grant, revoke, user_permission Group name: visibility labels Commands: add_labels, clear_auths, get_auths, list_labels, set_auths, set_visibility I tried tasksOnHost... that don't work either. Am I doing it wrong? Hope this is final patch for master branch. it is works in my environment. Can you review it ? BTW Enis Soztutar IMHO this is useful feature for shell. If everything is OK, can we add Hbase 1.0 ? Hi Folks, I fixed it some problem and wrote a basic unit test. But I need open Regionserver Web ui of MiniHbaseCluster during unittest. I tried every ways however it does not open. Do you have any idea ? BTW Code is working on my computer But test fails because of the problem. I wait your reviews. Thanks i just converted to our current master. When i started to writing test, i realized it had some problem. Today i am planning this issue with fixed coding bug I tried it and get this: hbase(main):010:0> processlist 'rpc' ERROR: undefined method `taskmonitor' for #<Hbase::Hbase:0x54ee5a15> Am I doing something wrong (doing it against master). Thanks Talat. Sean Busbey, I started to work the issue. Now I am update patch for current master. I uploaded that version. I will write unit test for the path. Sean Busbey: Nope, I'm no longer working with HBase. Thanks for the heads up. Shahin Saneinejad, are you still interested in working on this issue? If so, could you update it to work with current master? I'm planning on adding unit tests modelled on admin_test.rb as soon as I figure out how to run individual jruby unit tests (is there a maven option?). You can run just the shell tests with mvn -Dtest=TestShell test, but there is no option to only run a subset of them. Attached a patch, I'd appreciate any feedback. I'm planning on adding unit tests modelled on admin_test.rb as soon as I figure out how to run individual jruby unit tests (is there a maven option?). Is it called processlist in mysql? Should we use that name instead? Otherwise, 'tasks' sounds good to me. For the info port, you can read from Configuration the value of the int hbase.regionserver.info.port: i.e. conf.getInt("hbase.regionserver.info.port", 60030); Its not a guarantee that server out on cluster has something up on this port but its better than a hardcoded 60030. Yeah, GET-ing JSON seems the most straightforward since regionservers already provide it. Let me know if there's a preferable alternative. Cluster status works for regionserver names, thanks for the suggestion. I'll assume Jetty is on the default port 60030 for now. I haven't found a good way to get the hbase.regionserver.info.port setting for each regionserver, yet. I imagine the command will look something like: > tasks [lists tasks using the default 'general' filter, on all regionservers] > tasks 'all' [lists tasks using 'all' filter, on all regionservers] > tasks 'all','rs-host' [lists tasks using 'all' filter, on the regionserver rs-host only] > tasks 'rs-host' [lists tasks using the default 'general' filter, on the regionserver rs-host only] Go for it Shanin. You thinking of making an http GET asking for json from each regionserver? You may be able to get the list of regionservers by getting cluster status first and then iterate on the servers returned? Hi. I'd like to give this a shot. I think I qualify as a noob. My plan is to request a JSON task list from the endpoint defined by regionserver.info in the shell's HBase::HBase::configuration. A new tasks.rb command would retrieve a list of tasks and print them to the shell in a table, displaying the same information as in the RS HTML dashboard. Please let me know if this sounds crazy, or if it precludes any significant use cases. Thanks. Hi stack, Now it works for you request. It accept hostname, hostname and port, servername type strings. Thanks for reviewing.
https://issues.apache.org/jira/browse/HBASE-4368
CC-MAIN-2015-35
refinedweb
1,088
67.15
Question: I have some code I would like to execute very early in the lifecycle of a call to an ASMX function. For our ASPX pages, this code is in the Page_Init() function on a base class, from which all our ASPX pages inherit. Is there an ASMX equivalent to the ASPX's Page_Init() function? Better yet, is there an ASMX lifecycle diagram like the ASPX one? If there is an ASMX equivalent to Page_Init(), I assume I can implement code in a common base class, from which all my ASMX classes can inherit, correct? EDIT: Great responses - thanks for your help! Solution:1 There isn't really such a thing in an asmx web service, System.Web.Services.WebService has no events. Your best bet is to create a default constructor and put it in there. e.g. [WebService(Namespace = "")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class WebService1 : System.Web.Services.WebService { private string strRetVal; public WebService1() { strRetVal = "Hello World"; } [WebMethod] public string HelloWorld() { return strRetVal; } } Solution:2 Very good question! Not entirely sure, but i believe that execution of ASMX Web Services is slightly different to ASPX Pages - there is no "Page Lifecycle" (i.e there is no initialization of controls in order to render HTML - as the response is generally XML). Your only options would be to hook into one of the Application events in Global.asax - the only suitable event would be Application_PreRequestHandlerExecute. You can try Application_BeginRequest, but i believe this is only for ASP.NET Page Requests, not Web Service calls. You're other option (as you said) is to create a base class for your web services, then call the common base method in all of your web methods at the very first line. You would have to repeat this call in ALL of your web methods. Or if you have all your web methods in a single web service file (ASMX), then just create a regular static method (dont decorate it with the WebMethod attribute) and call that. Solution:3 They do not have similar 'life cycles' The only 2 'events' are the Request and the Response. Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com EmoticonEmoticon
http://www.toontricks.com/2019/05/tutorial-asmx-equivalent-of-pageinit.html
CC-MAIN-2019-22
refinedweb
377
55.95
Custom Augmentations with Arithmetic Operations¶ This section shows you how to implement a custom augmentation by using expressions with arithmetic operations in the DALI Pipeline. Blending Images¶ We will create a pipeline that blends images in a few different ways. To easily visualize the results, we created the following file lists that contain pictures of cats and dogs: cats.txt dogs.txt Imports¶ Start with the necessary imports. [1]: from nvidia.dali.pipeline import Pipeline import nvidia.dali.fn as fn import nvidia.dali.types as types from nvidia.dali.types import Constant Explicitly Used Operators¶ The pipeline will use two FileReadersto create two batches of tensors, one with cats and one with dogs. We also need an ImageDecoderto decode the loaded images. You need the Resizeoperator for both inputs. The arithmetic operators apply pointwise operations between tensors and require them to have matching shapes and sizes. For this example, 400 x 400 images have been used. The final operator that we may want to declare in the pipeline is a Castoperator to convert the data back into desired type. The Graph with Custom Augmentation¶ Here are initial steps: Load both input batches. Decode both inputs. Resize the inputs to equal sizes. Now, we have two variables dogs and cats that represent two batches of equal-sized images. We can blend those images with some weights and reduce the pixel intensities by half by using this formula: (0.4 * cats + 0.6 * dogs) / 2 Here, we used Python immediate values as the constant inputs in the arithmetic expression. Using dali.types.Constant to Indicate the Type¶ We can also be more careful about the types that we use, and do all of the computations in uint16. The inputs are in uint8, and doing the computations with a constant that is marked as uint16 promotes the results to uint16. See the “DALI binary arithmetic operators - type promotions” tutorial for more information. We can also use the //division that allows us to keep the integer type of the result. (Constant(4).uint16() * cats + Constant(6).uint16() * dogs) // Constant(20).uint16() We return both of the inputs and the results have been casted back to uint8. [2]: pipe = Pipeline(batch_size=1, num_threads=4, device_id=0, seed=42) with pipe: cats_jpegs, _ = fn.file_reader(device="cpu", file_root="../../data/images", file_list="cats.txt") dogs_jpegs, _ = fn.file_reader(device="cpu", file_root="../../data/images", file_list="dogs.txt") images = fn.image_decoder([cats_jpegs, dogs_jpegs], device="cpu", output_type=types.RGB) cats, dogs = fn.resize(images, resize_x=400, resize_y=400) blend_float = (0.4 * cats + 0.6 * dogs) / 2 blend_uint16 = (Constant(4).uint16() * cats + Constant(6).uint16() * dogs) // Constant(20).uint16() pipe.set_outputs( cats, dogs, fn.cast(blend_float, dtype=types.DALIDataType.UINT8), fn.cast(blend_uint16, dtype=types.DALIDataType.UINT8)) Running the Pipeline¶ Create an instance of the pipeline and build it. We use batch_size = 1for simplicity of showing the result. [3]: pipe.build() We will use a simple helper function to show the images. For larger batches, data_idx can be adjusted to show different samples. The output_titles will be used to set the titles of the pipeline output. [4]: import matplotlib.pyplot as plt def display(output, titles, cpu = True): data_idx = 0 fig, axes = plt.subplots(len(output) // 2, 2, figsize=(15, 15)) if len(output) == 1: axes = [axes] for i, out in enumerate(output): img = out.at(data_idx) if cpu else out.as_cpu().at(data_idx) axes[i // 2, i % 2].imshow(img); axes[i // 2, i % 2].axis('off') axes[i // 2, i % 2].set_title(titles[i]) output_titles = [ "Cat", "Dog", "(0.4 * Cat + 0.6 * Dog) / 2", "(Constant(4).uint16() * Cat + Constant(6).uint16() * Dog) // Constant(20).uint16()"] We will run and display the results. You can play this cell several times to see the result for different images. [5]: output = pipe.run() display(output, output_titles)
https://docs.nvidia.com/deeplearning/dali/master-user-guide/docs/examples/general/expressions/expr_blend_image.html
CC-MAIN-2021-04
refinedweb
635
53.98
Board index » realbasic All times are UTC The Application "RealBasic" has unexpectedly quit, because an error of type 3 occurred" and sometimes it crashes the Mac. As a test in the script, I am doing a: on run short version of ( info for (choose file)) as string return result end run in RB: Sub open () dim output as string output = scriptnamecall() msgbox output window1.close end sub IS there something I am missing in RB? regards, Anthony > on run > short version of ( info for (choose file)) as string > return result use shorter: return (version of ( info for (choose file)) as string) > end run > in RB: > Sub open () > dim output as string > output = scriptnamecall() > msgbox output > window1.close > end sub > IS there something I am missing in RB? Mfg Christian -- Trefft den Realbasic Guru auf dem Stand von Application Systems Heidelberg (ASH) auf der Maxpo in K?ln! (Kostenlose Mac/Win Software) 1. RB and AppleScript question again. 2. Applescript/RB Question. 3. Hot to run AppleScript within my RB prog? 4. Question about RB and AppleScript 5. Start running an uncompiled AppleScript by RB app 6. RB and AppleScript 7. Applescript/RB help 8. Scheme vs ML again and again and again and again 9. Scheme vs ML again and again and again and again 10. AppleScript Toolbox call under Carbon 11. Transparency in RB 3D again 12. Reading PDF from RB (Again)
http://computer-programming-forum.com/14-realbasic/6221348b49a327f1.htm
CC-MAIN-2019-51
refinedweb
233
67.15
But - jokes aside - computers all around us are growing ever more intelligent (so we hear). They can play chess. Drive cars. Some might even do these things at the same time. Without crashing (quite literally). Likewise, we've been making steady progress equipping Rosie Patrol with some useful skills. Skills needed to bring much needed law and order to the world. She can move. She can see. She can sense. And in our last episode, she began to read. With a little helping hand from some (considerably) bigger computers at the mothership that is Google. But can she really read? You know. Read out aloud? True to our style, there is only one way to find out. It's time to invoke Code: All superheroes need: - One Raspberry Pi 3, running Raspbian OS. Connected to the Internet. - Computer from which you are connecting to the Raspberry Pi. Do we have to keep reminding you about this one? - Yes, you'll need a speaker. Clearly, because we want the Pi to make some noise (that we can hear). We used one from Betron. Already completed these missions?You'll need to have completed the Rosie series. Then: - Lights in shining armour - I'm just angling around - Eye would like to have some I's - Eh, P.I? - Lights, camera, satisfaction - Beam me up, Rosie! - a, b, see, d Your mission, should you accept it, is to: - Connect your speaker to the Pi. We used the Pi's headphone jack. Other methods of connectivity are possible. - Download and install the Python Google Text-to-Speech (gTTS) module. This helpful Python module allows us to convert text into a mp3 file of it being spoken. Pretty much the whole point of this task really. - Play the mp3 file back through the speaker using omxplayer - Write some Python code to read out aloud a Moomin book. Other children's books are available. The brief:Text-to-Speech (TTS) is Speech Synthesis technology that allows computers to say human words - funnily enough, like humans. Idea being that computers can interpret text, and generate audio of 'human-like' speech with the appropriate intonation. And with the ability to speak back to us (potentially in many different languages), robots can tell us what they think. Acknowledge our wholly irresponsible commands. Or tease us for making them. All human-like behaviour that we like robots to And like most things that are useful, people far cleverer than us have already had a go at this. A very good go, in fact. So like with Optical Character Recognition (OCR), our best chances of success (in the time available) rely on using something that someone else has developed, using a REST API, to generate the speech from our text, on our behalf. Thankfully, Google comes to the rescue (again). Because the Python Google Text-to-Speech (gTTS) module allows us to do just that. It allows us to interact with Google's Text-to-Speech service, and usefully generate a mp3 file in Python that we can play back through the speaker. So here's our basic blueprint: Raspberry Pi Camera -> Google Cloud Vision API (for OCR) -> Google Text-to-Speech -> Play back using speaker. All sounds rather plausible, doesn't it? The devil is in the detail:We helped Rosie Patrol read in our previous task, using Google Cloud Vision API and a Raspberry Pi Camera. But we now want to take this obsession of ours further. Specifically, we want her to read out aloud. And in order to do this, first of all, we need a device that produces sound. One that allows us to play back audio from the Pi. Thankfully, there is little actual work required to get this to work. Raspberry Pi 3 has a number of ways it can be hooked up to some speakers: via HDMI cable, Bluetooth or headphone jack to name a few. We have a USB-powered speaker from Betron, which can be connected to the headphone jack. And we've decided to proceed with this simple setup. In short, there is a USB cable to power our little speaker. And a connection to the headphone jack for the audio. With the speaker set to 'aux' mode, we can play back sounds (using the omxplayer command). Not at all complicated so far. Next, we install gTTS using pip3. sudo pip3 install gtts...installs the Google Text-to-Speech (gTTS) library using pip3 Why? Because gTTS is the clever bit that we actually need for this mission. It basically allows us to create audio files (in mp3), based on text that we want to have spoken. gTTS stands for Google Text-to-Speech so the clue was actually in the name. Behind the scenes, gTTS is yet another API that allows us to interact with a useful Google service living somewhere out there in the Cloud. Only this time, this library does most of the work for us (without us having to manually construct our REST API calls using the Requests module). We'll see how this works in a minute. But for now, let's get it installed. Once installed, we can test it out. And what better way to test it than to use IPython. With just 4 lines of code, we can use gTTS to produce a mp3 audio file based on the contents of a string that we'd like to have spoken. From importing the gTTS module, to creating a gTTS object (tts) from the content of the speech string, everything is fairly self-explanatory. The very final thing we do is to save() the gTTS object to a mp3 file. Because that's how we play them back later. from gtts import gTTS speech = "Hello, my name is Rosie Patrol. Nice to meet you!" tts = gTTS(text=speech, lang="en") tts.save("speech/speech.mp3") To play the mp3 file in Raspbian OS, we'll use omxplayer. There are other audio players out there - as you can imagine - if you decide to choose a different tool for whatever reason (we couldn't think of any). If the speaker is correctly attached, and audio is working, you'll hear a soothing voice say the words that you've had stored in your speech string variable. omxplayer speech/speech.mp3...plays the mp3 file using omxplayer Hello, my name is Rosie Patrol. Nice to meet you! Can speech be extracted from a text file instead? Sure. Here's a little masterpiece that has been written for this experiment. It's about a gingerbread man. And (spoiler alert) it doesn't end well for the little brown biscuit. Here's the cover, that plays no part in this experiment. The story has been typed in by the talented author, and content stored in a text file. Once it's uploaded to the Pi, we're ready to use gTTS to have the Pi read these words out aloud. We use open() and read() to read in the content of the text file. Once this is stored in our speech string variable, we can use gTTS to store the resulting audio as a mp3 file, just like before. Notice that we remove the \n new-line character using replace(). This is done so that we end up with one long string variable. from gtts import gTTS with open("speech/gingerbreadman.txt", "r") as file: speech = file.read().replace("\n", "") tts = gTTS(text=speech, lang="en") tts.save("speech/speech.mp3") We can now play the mp3 file using omxplayer, and sit back and listen to the adventures of the gingerbread man. And how he (apparently) meets his dreadful end. Did we promise that Rosie Patrol would be reading pages from a Moomin picture book? We think we did. Once you've fully recovered from learning the fate of our biscuit hero, let's look at what we need to build to get Rosie Patrol to narrate to us the goings-on in Moomin Valley. Aim is to combine our gTTS code with our little Python application from before. The one which used Google Cloud Vision API and picamera to get Rosie Patrol to recognise the text in front of the camera, using OCR. Remember that? Good. Well, with a few new lines of code, we can store the result from the OCR task as a string variable, and use gTTS to produce the audio in mp3, exactly like we did before. ...Which means, at regular intervals that we think is the most appropriate, photos are taken of our Moomin book's pages using the Raspberry Pi Camera and picamera. This image is being base64 encoded and sent to Google Cloud Vision API for OCR using Requests, and we are storing the results as a string variable - discovered. Here is an example of a photo taken by the Raspberry Pi Camera. Finally, we use gTTS to have Google Text-to-Speech API convert our discovered string into a mp3 audio file. And, of course, we play it back using omxplayer. We repeat this for every page. And with luck, we can observe Rosie Patrol appearing to read the text in front of her out aloud, albeit with a slight delay while photos are being taken, and API calls are being made to Google (for both OCR and Text-to-Speech). The results can be a little hit and miss, depending on the quality of the photos and legibility of the text. Nonetheless, our little Python application seems to trundle through our Moomin picture book relatively well. Of course, behind the scenes, we're using using API calls to Google. Specifically, our Google Cloud Vision API call is linked to our Google Compute Platform account. Don't forget to stop your script when finished, and to monitor usage of the API through the GCP Console, so that you don't exceed your quota. Does Rosie Patrol now read books? She sure can!
https://www.rosietheredrobot.com/2017/11/code-read.html
CC-MAIN-2018-09
refinedweb
1,661
74.9
Op 26-10-10 23:29, Roland Clobus schreef: >>>> +#if (GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 18 && >>>> GTK_MICRO_VERSION < 2) >>>> GtkWidget *button; >>>> +#endif >>>> >>> That check seems broken, it will consider, say, 2.12.12 as fixed. ... >> Roland, I think it's best if I make any required changes for this Debian >> package, and we include them in the next release (which will not go into >> squeeze) separately. What do you think? > > The patch for gtkbugs.c was included because Debian Testing (at some > time Debian Stable) includes a version that is new enough that this code > doesn't need to be present. The #if part can be removed from the patch, > it should work anyway. Indeed, 2.20 is in testing now. However, users may only upgrade pioneers if they want to, and not libgtk+. According to the package, this is allowed; it requires 2.12.0. So if we don't do a run-time check, I need to manually demand 2.18.2 or larger. I can do this; the question remains if these changes are small enough to be allowed a freeze exception (which is why debian-release is still in the loop; sorry for the noise). > I still think 0.12.3.1 could be included in the new Debian Stable > release. The translations are better, and a bug that renders half the > themes unusable is fixed. Yes, I will push those things in anyway. The question is if I should do this as a Debian-specific patch to 0.12.3, or by packaging 0.12.3.1. I'd like an answer from the release team to that. > A few hours ago I announced a string freeze for 0.12.4, so the next > release of Debian can include that updated version, I hope the new > Debian Stable can include 0.12.3.1. Indeed. The translation and theme fixes should go into squeeze (currently testing); 0.12.4 will go into wheezy (testing after the release of squeeze). Thanks, Bas Wijnen Attachment: signature.asc Description: OpenPGP digital signature
https://lists.debian.org/debian-release/2010/10/msg01459.html
CC-MAIN-2015-11
refinedweb
341
76.42
ab C API function. PyImport_AppendInittab int PyImport_AppendInittab(char* name,void (*initfunc)(void)) name is the module name, which Python scripts use in import statements must be called before Py_Initialize. You may want to set the program name and arguments, which Python scripts can access as sys.argv, by calling either or both of the following C API functions. Py_SetPro-gramName void Py_SetProgramName(char* name) Sets the program name, which Python scripts can access as sys.argv[0]. Must be called before Py_Initialize. PySys_SetArgv void PySys_SetArgv(int argc,char** argv) Sets the program arguments, which Python scripts can access as sys.argv[1:], to the argc 0-terminated strings in array argv. Must be called after Py_Initialize. After installing extra built-in modules and optionally setting the program name, your application initializes Python. At the end, when Python is no longer needed, your application finalizes Python. The relevant functions in the C API are as follows. Py_Finalize void Py_Finalize(void) Frees all memory and other resources that Python is able to free. You should not make any other Python C API call after calling this function. Py_Initialize void Py_Initialize(void) Initializes the Python environment. Make no other Python C API call before this one, except PyImport_AppendInittab and Py_SetProgramName, covered in "PyImport_ AppendInittab" on page 647 and "Py_SetPro-gramName" on page 647. Your application can run Python source code from a character string or from a file. To run or compile Python source code, choose the mode of execution as one of the following three constants defined in Python.h: Py_eval_input The code is an expression to evaluate (like passing 'eval' to Python built-in function compile). Py_file_input The code is a block of one or more statements to execute (like 'exec' for compile; just like in that case, a trailing '\n' must close compound statements). Py_single_input The code is a single statement for interactive execution (like 'single' for compile; implicitly outputs the results of expression statements). Running Python source code directly is similar to passing a source code string to Python statement exec or built-in function eval, or a source code file to built-in function execfile. Two general functions you can use for this task are the following. PyRun_File PyObject* PyRun_File(FILE* fp,char* filename,int start, PyObject* globals,PyObject* locals) fp is a file of source code open for reading. filename is the name of the file, to use in error messages. start is one of the constants Py_..._input that define execution mode. globals and locals are dictionaries (may be the same dictionary twice) to use as global and local namespace for the execution. Returns the result of the expression when start is Py_eval_input, a new reference to Py_None otherwise, or NULL to indicate that an exception has been raised (often, but not always, due to a syntax error). PyRun_String PyObject* PyRun_String(char* astring,int start, PyObject* globals,PyObject* locals) Like PyRun_File, but the source code is in null-terminated string astring. Dictionaries locals and globals are often new, empty dictionaries (most conveniently built by Py_BuildValue("{}")) or the dictionary of a module. PyImport_Import is a convenient way to obtain an existing module object; PyModule_GetDict obtains a module's dictionary. Sometimes you want to create a new module object on the fly and populate it with PyRun_ calls. To create a new, empty module, you can use the PyModule_New C API function. PyModule_New PyObject* PyModule_New(char* name) Returns a new, empty module object for a module named name. Before the new object is usable, you must add to the object a string attribute named _ _file_ _. For example: PyObject* newmod = PyModule_New("mymodule"); PyModule_AddStringConstant(newmod, "_ _file_ _", "<synthetic>"); After this code runs, module object newmod is ready; you can obtain the module's dictionary with PyModule_GetDict(newmod) and pass the dict to such functions as PyRun_String as the globals and possibly the locals argument. To run Python code repeatedly, and to separate the diagnosis of syntax errors from that of runtime exceptions raised by the code when it runs, you can compile the Python source to a code object, then keep the code object and run it repeatedly. This is just as true when using the C API as when dynamically executing in Python, as covered in "Dynamic Execution and the exec Statement" on page 328. Two C API functions you can use for this task are the following. Py_CompileString PyObject* Py_CompileString(char* code,char* filename,int start) code is a null-terminated string of source code. filename is the name of the file to use in error messages. start is one of the constants that define execution mode. Returns the Python code object that contains the bytecode, or NULL for syntax errors. PyEval_EvalCode PyObject* PyEval_EvalCode(PyObject* co,PyObject* globals, PyObject* locals) co is a Python code object, as returned by Py_CompileString, for example. globals and locals are dictionaries (may be the same dictionary twice) to use as global and local namespace for the execution. Returns the result of the expression when co was compiled with Py_eval_input, a new reference to Py_None otherwise, or NULL to indicate the execution has raised an exception.
http://books.gigatux.nl/mirror/pythoninanutshell/0596100469/pythonian-CHP-25-SECT-3.html
CC-MAIN-2018-22
refinedweb
856
53.92
make generate-plist Number of commits found: 25/R-cran-data.table: Update to 1.14.2 Remove # $FreeBSD$ from Makefiles. - Update to 1.14.0 - Unbreak build on i386 PR: 247631 Submitted by: wen@(myself) Approved by: tota@(maintainer) math/R: Update to version 4.0.0 Upstream changes: Also bump PORTREVISION of ports that depend on math/R. Submitted by: wen (in part) Reviewed by: jwb, Rainer Hurling <rhurlin@gwdg.de>, thierry Differential Revision: Drop dependency on devel/openmp - Drop if devel/llvm* was used as a substitute Approved by: yuri, rene (earlier version) Differential Revision: - Update to 1.12.8 - Update to 1.12.6 - Update to 1.12.4 - Update to 1.12: - Mark as BROKEN on 13 i386: unable to load datatable.so - Update to 1.11.8 - Update to 1.11.6 - Update to 1.11.4 - Mark as BROKEN on 11+ i386: unable to load datatable.so ** testing if installed package can be loaded Error: package or namespace load failed for 'data.table' in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object - Update to 1.11.2 - Update LICENSE section Bump PORTREVISIONs of all users of math/mpc that we just updated to version 1.1.0 (via revision 464079). - Update to 1.10.4-3 - Update to 1.10.4 - Update to 1.10.0 - Change LICENSE from GPLv2+ to GPLv3 - Add new port: devel/R-cran-data.table Fast aggregation of large data (e.g. 100GB in RAM), fast ordered joins, fast add/modify/delete of columns by group using no copies at all, list columns and a fast file reader (fread). Offers a natural and flexible syntax, for faster development. WWW: Servers and bandwidth provided by New York Internet, iXsystems, and RootBSD 10 vulnerabilities affecting 66 ports have been reported in the past 14 days * - modified, not new All vulnerabilities Last updated:2022-01-28 18:54:55
https://www.freshports.org/devel/R-cran-data.table/
CC-MAIN-2022-05
refinedweb
320
62.75
Ok, I have a homework problem that I'm needing some help with. The program has to Allow the user to specify the number of integers to be inputted into the array read a data set of number of integers into the array Determine the sum find the largest integer and deturmine how many times the largest number is in the array. I'm having the most trouble with find the largest number, I know how to do it with a really long if, else statement, but there has to be an easier way. import java.util.Scanner; public class lab10a_Killackey { public static void main(String args[]) { Scanner input = new Scanner (System.in); int dataset; int [] integers = new int[dataset] ; int total = 0; System.out.println("How many integers are in the data set? "); dataset = input.nextInt(); System.out.println("Enter the integers in the dataset 1 per line"); int [dataset] integers = {input.nextInt()}; if ( dataset != 0) { for (int number: integers ); total += number; System.out.printf("Sum of integers is: %d\n",total); for (int number: integers); //This is where the code for finding the largest integer is supposed to be! for (int largest = 1; largest<= dataset; dataset++ ) System.out.printf("This number appered %d times\n"); } else System.out.print("The dataset is empty"); } }
https://www.daniweb.com/programming/software-development/threads/183748/array-homework-help
CC-MAIN-2017-26
refinedweb
215
56.76
If -else statements, need help with understanding the main method and scope before the main method can someone help me understand the main method? I see that calculateShipping is using a method outside of the method scope but still within the class scop. You can call other methods within the same class scope? Meaning before the main method all methods can call on each other? I am so confused, and I apologize if my explanation is confusing. You’re pretty close! So, (pretty much) all methods within a class can call other methods within the same class. That way, you can have helper functions called within other functions: public class main{ public int helpFunc(){ return 5; } public int mainFunc(int a){ int someVar = helpFunc(); return a * someVar; } } The main function is a little different to most other functions. It is the entry point when you run your code on a terminal. That means if you’re running a program using the terminal (like you do in Codecademy lessons), then you need a main function. This StackOverflow thread is definitely worth a read. I hope that’s answered your questions! 1 Like Thank you, yeah that makes sense. 1 Like
https://discuss.codecademy.com/t/if-else-statements-need-help-with-understanding-the-main-method-and-scope-before-the-main-method/645240
CC-MAIN-2022-21
refinedweb
199
73.17
LocomotiveCMS search Setup Open your Gemfile and add locomotive-cms search to it: gem 'locomotivecms-search', require: 'locomotive/search/mongoid' Check out the Activesearch gem to know which backends are available and how to configure them. Run bundle install Adding the search results page [New way] {% search_for params.query, per_page: 10, page: params.page %} <p>{{ search.total_entries }} elements found.</p> <ul> {% for result in search.results %} <li><a href="/{{result.slug}}">{{ result.title }}</a></li> {% endfor %} </ul> {% if search.total_pages > params.page %} <p> <a href="?page={{ params.page | plus: 1 }}&query={{ params.query }}">Next page</a> </p> {% endif %} {% endsearch_for %} [Old way] Create a new page that will display your search results. Its code might be something like this: {% for result in site.search %} <li><a href="/{{result.slug}}">{{ result.title }}</a></li> {% endfor %} As you can see, when a search string is passed in the URL, you can fetch the results by using site.search. Choose a good slug, like "search". Adding the search form Anywhere on your site you can add a simple form to fire a search. This could be done on the homepage, on a page you are inheriting from, on even on a snippet. Just add this code: <form action="/{{ locale }}/search" method="GET"> <label for="search">Search</label> <input type="text" name="search" id="search"> <input type="submit" value="Search"> </form> The important part is the action parameter, since it must point to the slug of your search results page. Also, the name of the search input must be "search". Search from the back-office From the 0.3.0 version, this gem includes a search bar for your LocomotiveCMS back-office. This search bar uses the typeahead javascript plugin. The only requirement is to have the LocomotiveCMS 2.5.x version installed. In your LocomotiveCMS main application (the one embedding LocomotiveCMS), you need to add 2 files (or edit them if they already exist). In the app/views/locomotive/shared/_main_app_head.html.haml file, add these 2 lines: = javascript_include_tag 'locomotive/search_bar' = stylesheet_link_tag 'locomotive/search_bar' In the app/views/locomotive/shared/_main_app_header.html.haml file, add this line: = render 'locomotive/shared/search_bar' Note for mongoid 2.x users If you are using the mongoid engine and still on 2.x, you must use locomotivecms-search version ~> 0.0.5 This project rocks and uses MIT-LICENSE.
http://www.rubydoc.info/gems/locomotivecms-search/frames
CC-MAIN-2018-17
refinedweb
391
60.82
Java has a final keyword that serves three purposes. When you use final with a variable, it creates a constant whose value can't be changed after it has been initialized. The other two uses of the final keyword are to create final methods and final classes. A final method is a method that can't be overridden by a subclass. To create a final method, you simply add the keyword final to the method declaration. For example: public class Car { public final int getVelocity() { return this.velocity; } } Here the method getVelocity is declared as final. Thus, any class that uses the Car class as a base class can't override the getVelocity() method. If it tries, the compiler issues the error message:"Overridden method is final". Here are some additional details about final methods: Final methods execute more efficiently than nonfinal methods because the compiler knows at compile time that a call to a final method won't be overridden by some other method. Private methods are automatically considered to be final because you can't override a method you can't see. to be final, all of its methods are considered to be final as well. Because you can't use a final class as the base class for another class, no class can possibly override any of the methods in the final class. Thus all the methods of a final class are final methods.PreviousNext
https://www.demo2s.com/java/java-final-keyword.html
CC-MAIN-2021-04
refinedweb
238
63.39
Top & Trending I' News Top & Trending I'm trying to run Repair Geometries on shapefiles using ArcPy in Spyder. The tool description states that it can be run on .shps but the code provided by Esri requires you to first run Check Geometry and then Repair Geometry, and the table output from Check doesn't appear to be correct for Repair. Does anyone have ideas for code that would Top & Trending Hi Everyone, I followed the lesson Use deep learning to assess Palm tree health, everything went well except when I was about to run the Detect Objects Using Deep Learning tool. "The below error came up after browsing to the esri model definition file. I have read another thread on the same topic Here, but ended up with the Deep Learning Object Detection:ERROR 002667 Unable to initialize python raster function with scalar arguments. Top & Trending import arcpy from arcpy import da import os attachTable = 'C:\users\user\Test2\pictures.gdb\pictures__ATTACH' # Table in GDB holding attatchments origTable = 'C:\Users\user\Test2\pictures.gdb\pictures' # Layer in GDB holding features to which attatchments belong nameField = 'Name' # Field where you want to save the photos fileLocation =
https://community.esri.com/news
CC-MAIN-2019-26
refinedweb
196
51.07
gluedtomyseat - Home tag: Mephisto Noh-Varr 2009-01-21T15:55:57Z collin tag: 2009-01-21T15:55:00Z 2009-01-21T15:55:57Z Blog is moving to NimbleTechnique <p>It’s been a while since I updated—I’ve been busy putting the final touches on the new company site blog <a href=""></a> . I’ll continue to blog there but will leave this site up.</p> collin tag: 2008-10-23T19:57:00Z 2008-10-23T19:57:57Z The Office is Painted <script type="text/javascript"><!-- QT_WritePoster_XHTML('Click to Play', '', '', '640', '496', '', 'controller', 'true', 'autoplay', 'true', 'bgcolor', 'black', 'scale', 'aspect'); //--> </script> <noscript> <object height="496"="496" target="myself" width="640"> </embed> </object> </noscript> collin tag: 2008-09-06T13:56:00Z 2008-09-06T13:59:40Z Welcome to the Family, Devon! <p> Congrats to Chris and Michelle! </p> <script type="text/javascript"> QT_WritePoster_XHTML('Click to Play', '', '', '640', '376', '', 'controller', 'true', 'autoplay', 'true', 'bgcolor', 'black', 'scale', 'aspect'); </script> <noscript> <object height="376"="376" target="myself" width="640"> </embed> </object> </noscript> collin tag: 2008-08-19T13:20:00Z 2008-09-03T20:05:14Z A companion to Enumerable#inject : Enumerable#build <p>This was a patch idea I had for Rails. Enumerable#inject is great, but there is a little extra bit of code cruft that I see popping up everywhere with regards to using #inject to create a new array or hash. Since the return value of the block passed into #inject becomes the next value of the accumulator, you often see this:</p> <pre class="ruby"> result = (1..10).inject([]) do |array, element| array << element if element % 2 == 0 array end puts result.inspect # => [2, 4, 6, 8, 10] </pre> <p>I’d like to see another method added to Enumerable, something like:</p> <pre class="ruby"> module Enumerable def build(accumulator) each do |item| if result = yield(accumulator, item) accumulator = result end end accumulator end end </pre> <p>The #build method would essentially reassign the accumulator only if the return value of #yield was non-false. This would shorten the above example into:</p> <pre class="ruby"> result = (1..10).build([]) do |array, element| array << element if element % 2 == 0 end puts result.inspect # => [2, 4, 6, 8, 10] </pre> <p>So yes, one line of savings, but I feel the meaning here is much more clear than the first case using #inject.</p> collin tag: 2008-07-29T15:39:00Z 2008-09-03T20:05:07Z Configure OS X speech voice in growl-glue 1.0.3 <p>Little small update for my small, but loyal <a href="">growl-glue</a> user base. 1.0.3 released today, giving you the ability to use a different <span class="caps">OS X</span> voice for each status.</p> <pre class="ruby"> GrowlGlue::Autotest.initialize do |config| config.notification :use_network_notifications => true config.sound :success => "Glass.aiff" config.sound :pending => "Glass.aiff" config.say :failure => "PANIC PANIC PANIC" config.voice :failure => "Hysterical" config.sound :failure => "Basso.aiff" end </pre> <p>And of course, to update:</p> <pre>% sudo gem install growl-glue</pre> collin tag: 2008-07-29T12:27:00Z 2008-09-03T20:04:54Z Implied types in Ruby's rescue clause <p>There are two different ways in which you’ll see people using <strong>rescue</strong> in Ruby:</p> <pre class="ruby"> begin # do something terrible rescue # handle error in $! end </pre> <p>And the more explicit way:</p> <pre class="ruby"> begin # do something terrible rescue StandardError => e # handle error using e end </pre> <p>These two are actually equivalent, as the former, shorter version <strong>implies</strong> that you are catching any error that is or is a subclass of StandardError. The problem is that while StandardError does encompass a large number of different exception types, it still lives under the broader umbrella of <strong>Exception</strong>:</p> <pre> % cheat exceptions exceptions: Exception </pre> <p>The more aggressive way to rescue from error conditions is, then, to:</p> <pre class="ruby"> begin # the most terrible code rescue Exception => e # whew end </pre> collin tag: 2008-07-27T18:16:00Z 2008-09-03T20:04:45Z Growl-glue update now supports the RSpec "pending" status <p><a href="">Growl-glue 1.0.2</a> was released today. The update adds support for a “pending” status. Without any extra configuration, the gem will use a yellow graphic to match the text in the terminal and will also output a unique title for the growl notification.</p> <p><img src="" alt="" /></p> <p>The “pending” status is configured similarly to the “failure” and “success” statuses:</p> <pre class="ruby"> GrowlGlue::Autotest.initialize do |config| config.notification :use_network_notifications => true config.title :success => "Love", :failure => "Hate", :pending => "Keep Going!" config.say :failure => "Something is horribly wrong!" config.say :pending => "I know you can do it!" end </pre> <p>To update, simply:</p> <pre> % sudo gem install growl-glue </pre> <p>If you’re wondering what growl-glue is, read the <a href="">introductory post</a> or the <a href=""><span class="caps">README</span></a>.</p> collin tag: 2008-07-24T13:59:00Z 2008-09-03T20:04:37Z Some specs not being run by rspec-rails? Fix it here. <p>Rspec and the Rspec-Rails plugin are awesome. Made even more awesome by using Autotest. Which is made even more awesome by using <a href="">growl-glue</a> :)</p> <p>We’ve noticed on a couple of our projects that Autotest will not run all of our specs that would normally be run by ”% rake spec”. Looking into it further, I saw that the rspec-rails plugin sets up a number of Autotest “mappings”, which are ways of telling the Autotest loop of not only the files that should be tested, but also which specs to run when a source file is modified.</p> <p>The default mappings can be found in:</p> <p><span class="caps">RAILS</span>_ROOT/vendor/plugins/rspec-rails/lib/autotest</p> <p><strong>Autotest#add_mapping</strong> takes a regular expression that, if it matches a source file path, can either then return a path or a list of paths that point to the specs that correspond to the source file. If you wanted to return a glob of files, you can use <strong>Autotest#files_matching</strong>, which takes a regular expression that will return a set of specs that match.</p> <p>In my case, there are some files in “app/filters” that I want to link up to some specs in “spec/filters”. So, in my .autotest file inside of the project root, I include the following:</p> <pre> Autotest.add_hook :initialize do |autotest| autotest.add_mapping(%r%^app/filters/(.*)\.rb$%) { |_, m| autotest.files_matching %r%^spec/filters/.*_spec.rb$% } end </pre> <p>Here I’m pretty aggressive – I simply run all of the filter specs in spec/filters when any file in app/filters is modified. You can get pretty specific though – make sure to check out the default autotest configuration inside of the rspec-rails plugin to get an idea for what’s possible.</p> <p>If you’re unsure about which specs are not getting run, try running autotest as:</p> <pre> % autotest -v </pre> <p>Autotest will say “Dunno!” for each file for which it doesn’t have a mapping.</p> collin tag: 2008-07-22T22:49:00Z 2008-09-03T20:04:29Z Did my team win today? <p><a href="">Did my team win today?</a> is a little rails app that I wrote that will show you if your <span class="caps">MLB</span> team won today or not. Well, actually, it’ll just show you the last known score for your team.</p> <p><a href=""><img src="" alt="" /></a></p> <p>Hope you like it.</p> collin tag: 2008-07-20T22:39:00Z 2008-09-03T20:04:22Z Terrible Lizards <p>Incredible to think that these once roamed the earth.</p> <div class="thickbox"> <a href="" class="thickbox" title=""><img src="" alt="" /></a> <a href="" class="thickbox" title=""><img src="" alt="" /></a> <a href="" class="thickbox" title=""><img src="" alt="" /></a> <div></div> </div> collin tag: 2008-07-13T15:12:00Z 2008-09-03T20:04:15Z Restart Passenger Phusion using a TextMate bundle <p>So I’ve recently started running my development instances using Passenger. It’s been a really nice transition, even with the extra steps of setting up a hostfile and adding an entry into an Apache config file. I know about the <span class="caps">OS X</span> preference pane, but I prefer to do the extra steps.</p> <p>One extra step I don’t like doing is having to touch the [project_home]/tmp/restart.txt file in order to restart the application. Since I do most of my work in TextMate, I decided to write a little bundle so that I wouldn’t have to load up Terminal every time I wanted to restart my application.</p> <p><img src="" alt="" /></p> <p>You can simply hit the hotkey to restart the app. It’s project relative, so it should work for whatever rails project you happen to have loaded in TextMate.</p> collin tag: 2008-07-09T11:48:00Z 2008-09-03T20:03:48Z GrowlGlue : tying together Autotest and Growl <p>A while ago I blogged about modifying one’s ~/.autotest file and adding all sort of regular expression pattern matching to parse autotest output and then display notifications with images through Growl. Because it’s unreasonable to assume that anyone would actually <strong>want</strong> to do all of that, I made my first gem: <a href="">growl-glue</a>.</p> <pre> % sudo gem install growl-glue </pre> <p>And then inside of your ~/.autotest file, something simple like:</p> <pre> require 'rubygems' require 'growl_glue' GrowlGlue::Autotest.initialize do |config| config.notification :use_network_notifications => true config.title :success => "Everything is Great" config.title :failure => "Hate" config.say :failure => "ON NO!!!" end </pre> <p>And that’s it! It even comes embedded with sample success and failure images that you can override with your own if you wish (but don’t have to). Make sure to <a href="">look over the <span class="caps">README</span></a> to get started.</p> collin tag: 2008-05-26T12:40:00Z 2008-10-01T16:45:12Z Plugin Migrator: migrations for your Rails plugins <h2>Overview</h2> <p>My current work involves writing a handful of Rails plugins. These plugins provide additional functionality that includes ActiveRecord models that need to be persisted to the database. I originally created a migration class for one of the plugins that re-used much of the ActiveRecord logic (in fact, just overrides schema management). This worked fine, but as we started creating new plugins that needed the same functionality, we decided to pull the migration logic into a separate Rails plugin.</p> <p>And hence, the PluginMigrator was born!</p> <p>In order to use the PluginMigrator, your plugin must simply extend the PluginMigrator::Migrator class:</p> <pre class="ruby"> module MyPlugin class Migrator < PluginMigrator::Migrator set_schema_table_override "my_plugin_schema_info" set_migration_directory(File.dirname(__FILE__) + "/../../db/migrate") end end </pre> <p>The <strong>set_schema_table_override</strong> method tells the plugin where the version info for your plugin should be stored. For rails apps, this schema information lives in a table named “schema_info”. You’ll need to specify a different table name for your plugin, so that your plugin migrations can be managed separately from the Rails app. Don’t worry if it doesn’t exist yet – the migration system will automatically create it.</p> <p>The <strong>set_migration_directory</strong> method tells the plugin where to find the migrations. The migrations for your plugin should probably be stored in the same way as the main rails app. In your plugin root, it’s easy to just have a db/migrate structure:</p> <p><img src="" alt="" /></p> <p>To actually migrate, simply create a Rake task in your tasks directory inside of your plugin or in the main Rakefile for your plugin, depending on from where you want to run the migrate task:</p> <pre class="ruby"> namespace :myplugin do desc "Run the migrations for my plugin" task :migrate => :environment do MyPlugin::Migrator.migrate(ENV['VERSION'],false) end end </pre> <p>And then:</p> <pre> % rake myplugin:migrate </pre> <p>Typical <span class="caps">VERSION</span> behavior is also supported:</p> <pre> % rake myplugin:migrate VERSION=1 </pre> <h2>Installation</h2> <p>The PluginMigrator project <a href="">is hosted at GitHub</a>.</p> <p>From the Terminal:</p> <pre> ~/testapp $ cd vendor/plugins ~/testapp/vendor/plugins $ git clone git://github.com/oculardisaster/plugin_migrator.git </pre> <p>If you don’t have Git on your system, you can simply <a href="">go to the main project page</a> and click the download button.</p> <h2>Known Issues and Planned Features</h2> <ul> <li>Would like to be able to optionally exclude having the main rails app include plugin tables when writing out the schema.rb file during a Rails app migration.</li> <li>Would like to have the plugin migrator automatically create rake tasks to migrate the plugin</li> </ul> collin tag: 2008-05-20T20:04:00Z 2008-09-03T20:03:34Z A six hundred+ series <p>After much research into getting rid of lane oil and finally restoring my ball coverstock back to its near original condition I ruled the lanes today. My first 600+ series. This should help my street cred at league night tomorrow.</p> <p>:D</p> <div class="thickbox"> <a href="" class="thickbox" title=""><img src="" alt="" /></a> <div></div> </div> collin tag: 2008-05-12T02:04:00Z 2008-07-14T11:23:13Z Configuring Autotest and Growl in OS X 10.5.x <h2><i><span class="caps">UPDATE</span> – Use <a href="">GrowlGlue</a> Instead</i></h2> <p>Autotest Just got a <strong>lot</strong> simpler.. For an easier time of configuring Autotest and Growl please read <a href="">Configuring Autotest and Growl in <span class="caps">OS X 10</span>.5.x</a> instead.</p> <hr /> <br /> <p>First off, if you are not running <a href="">autotest</a> then you need to start. It’s awesome and a pretty integral part of my <span class="caps">TDD</span> workflow. A popular combination these days is to run a combination of autotest along <a href="">Growl</a>. There are already quite a few guides out there on how to set up a development environment with autotest and Growl—why am I writing this one? It is because many of the guides out there do not work exactly right under <span class="caps">OS X 10</span>.5.2, making it frustrating to set up these tools. After trying a number of them, and taking what worked right and what didn’t, here is what works for me.</p> <h2>Setting up Autotest</h2> <p>Autotest is part of the ZenTest suite, which should be installed as a gem:</p> <pre> sudo gem install ZenTest </pre> <p>After you install the ZenTest gem, you should then have autotest at /usr/bin/autotest.</p> <h2>Setting up Growl</h2> <p>You can download Growl from the <a href="">Growl website</a> of course. You will want to install the Growl application normally, but then after that is complete, <strong>you will also want to install the growlnotify extra</strong> that comes with Growl.</p> <p><img src="" alt="" /></p> <p>Once you’ve installed Growl and while the <span class="caps">DMG</span> is still open, open up a Terminal.app window and execute the following:</p> <pre> cd /Volumes/Growl\ 1.1.2/Extras/growlnotify/ ./install.sh </pre> <p>Now you should be able to test this out by typing the following into the Terminal.ap window:</p> <pre> echo "Hello World" | growlnotify </pre> <p>If you receive a “growlnotify: command not found”, then you need to add /usr/local/bin into your <span class="caps">PATH</span> environment variable.</p> <p>If this fails silently, that is because of an incompatibility between Growl and <span class="caps">OS X 10</span>.5.x that will cause dropped messages about 50% of the time. So even if you got the Growl notification, you should install the following fix for Growl.</p> <h2>Fixing Growl</h2> <p>Simply put, on <span class="caps">OS X 10</span>.5.x, growlnotify works about 50% of the time for me. To address this, first open up your Growl preferences (under System Preferences), click the network tab, and then make sure that the “Listen for incoming notifications” checkbox is checked. Like this:</p> <p><img src="" alt="" /></p> <p>After you set that, click back to the General tab, and then Stop Growl, and Start Growl again.</p> <p:</p> <pre> #! </pre> <p>And of course you will want to chmod 755 that file. To test that you have it configured, run thusly:</p> <pre> safegrowlnotify 'Hello World!' </pre> <p>You should have growl notifications coming up now:</p> <p><img src="" alt="" /></p> <h2>Configuring Autotest for Growl</h2> <p.</p> <p>Insert the the following into ~/.autotest (create if it does not already exist):</p> <h4>.autotest</h4> <pre class="ruby"> module Autotest::GrowlGROWLNOTIFY</span>:</p> <p><img src="" alt="" /> <img src="" alt="" /></p> <p>At this point, you should be all set up and ready to go. Simply running autotest should run the tests and then display the Growl messages along with an icon to boot that signifies success or failure:</p> <p><img src="" alt="" /></p> <p>Happy Autotesting!</p>
http://feeds.feedburner.com/gluedtomyseat
crawl-002
refinedweb
2,936
53.61
unsafeInterleaveIO duplicates computation when evaluated by multiple threads When the following code is compiled with -O1 or -O2, the interleaved computation (putStrLn "eval") is performed 1000 times, rather than once: import Control.Concurrent import Control.Exception (evaluate) import Control.Monad import System.IO.Unsafe main :: IO () main = do x <- unsafeInterleaveIO $ putStrLn "eval" replicateM_ 1000 $ forkIO $ evaluate x >> return () threadDelay 1000000 Taking a look at the source to unsafeInterleaveIO: {-#. It seems the comment about INLINE is not true. If I define the following function: interleave :: IO a -> IO a interleave = unsafeInterleaveIO {-# NOINLINE interleave #-} and replace unsafeInterleaveIO with interleave, "eval" is printed only once. If I change NOINLINE to INLINE, or if I remove the pragma altogether, "eval" is printed 1000 times. I believe unsafeInterleaveIO should guarantee that computations are not repeated. Otherwise, we end up with strangeness like this: import Control.Applicative import Control.Concurrent import Control.Monad main :: IO () main = do chan <- newChan :: IO (Chan Int) mapM_ (writeChan chan) [0..999] items <- take 10 <$> getChanContents chan replicateM_ 5 $ forkIO $ putStrLn $ "items = " ++ show items threadDelay 1000000 which prints: items = [0,1,2,3,4,5,6,7,8,9] items = [10,11,12,13,14,15,16,17,18,19] items = [20,21,22,23,24,25,26,27,28,29] items = [30,31,32,33,34,35,36,37,38,39] items = [40,41,42,43,44,45,46,47,48,49] For the time being, programs can work around this by using a NOINLINE wrapper: getChanContents' :: Chan a -> IO [a] getChanContents' = getChanContents {-# NOINLINE getChanContents' #-} I tested this on Linux 64-bit with GHC 7.2.2 and ghc-7.4.0.20120111, and on Windows 32-bit with GHC 7.0.3 and 7.2.2. All of these platforms and versions exhibit the same behavior. The bug goes away when the program is compiled with -O0, or when functions returning interleaved computations are marked NOINLINE (e.g. getChanContents').
https://gitlab.haskell.org/ghc/ghc/-/issues/5859
CC-MAIN-2021-25
refinedweb
320
57.98
> I was wondering if adding additional enum definitions to an integer > object would cause problems with SNMP Managers that would have to > support both the old and new objects. > > For example: > [ ... snipped .., ] This modification is explicitly allowed. See RFC 2578 Section 10. > Would a SNMP Manager be able to manager two different devices, one > that had objects using the old FooValue TEXTUAL-CONVENTION and one > that used the new value new FooValue? Sure ... assuming that agent and manager are implemented properly. That means: (a) the agent properly handles the situation where a manager, implemented to support the extended TC, sends it a value that it doesn't support (which it has to be able to do anyway); (b) the manager is prepared, when reading an object, to get back values that it does not know about but which the agent (implemented with a newer version of the TC) does; and (c) the manager is prepared, when setting an object, to have the agent (implemented with an older version of the TC) reject apparently valid values. > Is it even possible to compile two MIBs with different definitions > like this? The question is confused. Presumably, the TC (FooValue) will reside in some MIB module (FOO-TC-MIB) and the different versions of FooValue will reside in different versions of FOO-TC-MIB. Naturally you would not compile more than one version of FOO-TC-MIB at a time. Now, the objects defined with FooValue could live in other MIB modules that import FooValue from FOO-TC-MIB. Since you are only allowed to add (not to remove) enums, then everything will compile just fine as long as the version of FOO-TC-MIB is at least as new as the newest MIB module that imports from it. In other words, you are safe if you always use the latest version of FOO-TC-MIB. (*) One possible side effect from adding enums is that it might silently change the meaning of compliance or capabilities statements; but that can be fixed by adding OBJECT or VARIATION clauses that explicitly spell out which enums are requires or supported (respectively). nobody (*) Actually, there could be compilation problems if you change enum labels, since they can appear in DEFVAL clauses; so you shouldn't do that, despite the fact that RFC 2578 allows it. The IETF MIB review guidelines draft now forbids that.
http://fixunix.com/snmp/64361-support-additional-enums.html
CC-MAIN-2014-35
refinedweb
396
55.78
jGuru Forums Posted By: vikas_pandya Posted On: Monday, June 3, 2002 07:36 AM I am trying to use XML Security Suite and SOAP Envelop API for digital certificates using SOAP. I have put xss4j.jar and xml4j.jar in my classpath. I am getting errors related to all the classed under com.ibm.trl package. Like 1)Class com.ibm.trl.soap.SOAPDocument not found in import. import com.ibm.trl.soap.SOAPDocument; 2)Class com.ibm.trl.soap.SOAPException not found in import. import com.ibm.trl.soap.SOAPException; 3)Class com.ibm.trl.soapimpl.SOAPDocumentImpl not found in import. etc. I wonder from where could I find packages from Tokyo Research Lab.? Not sure which jar file have to I put in classpath and from where could i download it?? Thanks in advace,
http://www.jguru.com/forums/view.jsp?EID=901085
CC-MAIN-2014-52
refinedweb
136
63.66
Falsely Accused of Child Abuse Child Abuse Have You Been. Falsely Accused? Don’t Sink into Denial If you get caught in this nightmare, even though you are completely innocent, the first thing you must do is acknowledge the seriousness of the charges. If you feel you do not need to worry because they could not possibly have a case against you, you are placing yourself in danger. It is amazing how quickly these situations can get out of control. The consequences for a conviction of this crime can be horrific, so protect yourself and your children immediately. You should obtain a lawyer experienced with these types of charges. Don't speak to any officials except your attorney about the case. Even if you have not been officially charged, you need to be prepared in case you are eventually arrested. Do Not Confront your Accuser At first, you may not even know who has made this terrifying accusation. The accuser does not have to be revealed unless there is a court order to do so. If you suspect or find out who it is, however, you should keep your distance. Do not go to see them, do not call them, do not have any contact with them whatsoever $6. Be You Own Advocate Learn everything you can about being falsely accused. Read books, internet articles or anything you can find on the subject. Discuss your findings with your attorney. Get involved with other people who have been falsely accused of similar crimes and learn from their experience. You will be amazed by how many people have been in your position. Build a support group of trusted family and friends around you. Ask them if they will be character witnesses for you if you need them. Falsely Accused of Child Abuse Don’t Console Yourself with Alcohol or Drugs Though this may well be the most stressful and depressing time of your life, do not give in to the temptation to blur the pain with alcohol or drugs. It could have the reverse effect and actually enhance the depression. It is also very important that you stay strictly within the confines of the law at this time. You could be asked to submit to a drug test or the court could call witnesses to testify that they had seen you impaired. It simply isn't worth the risk. This is a very scary time in your life, but do not panic. You need to keep your mind focused on contributing to your defense and finding the best way to protect yourself and your family from more damage. Most importantly, do not go through this allow. Retain a good lawyer and let your attorney help you. Take his advice and be prepared to wage the fight of your life. Your future is at stake. Yeap, Kids are out of control....my girlfriends daughter said I choked her....I have never ever touched her..... what a joke the system is, Something needs to be done about these type of kids.. I was falsly accused of child abuse. with out a shread of evidence ; without proper investagation with no proff i was a danger to my son i was not given a drug test but ordered to complete a 6 month program my problem was i was homeless and living on my sons income from ssa waiting to be approved by social security disability i allowed my son to stay with a so called friend for 300.00 a month the next month this bitch wanted custody of my son and his whole check in the amount of 1.100.00 she called dcfs and made all these false allegations. dcfs never helped me with my real problem and that was homelness i was in a drug program 4 months and testing clean 2x a week and the social worker tells me that's great ypur in a program but your never going to get your kid back you don't have an income or a home i was broken hearted they never once tryed to help me with my real problems my ex daughter in law got guardianship of my son my case closed in july2008 my parental rights were not terminated i have a home now and a income now im trying to find out how i go about going back to court to terminate guardianship and regain custody of my son he is 14 years old now any advice will help thank you for letting me share my story Last month I was falsely accused of child abuse, maltreatment, and neglect....I am soooo outraged at the fact that social services came to my home at around 9:30 in the evening when my fiancée and I were winding down from a long day at work and my 4 year old son was just about to fall asleep. They asked my son to remove his shirt lift his pants.....for what!!!!! Do they honestly think my son is oblivious to the fact that his mother and father had no idea who these two people were? My poor son must be traumatized by this! I felt violated! Who would create such a lie? I've been in court for about a 1.5 years paying an attorney to keep my apartment. Could the people in my building stoop to this level? What upsets me the most is all the children who are really being abused. Social services waste their time coming to homes that have no abuse and never make it to the homes where children are in need of help. Does anyone have a good attorney who works pro bono? I can barely pay my bills with one attorney on the payroll I definitely cannot afford another. - This was a really helpful article. Currently, my boyfriend and I are going through false accusations made by my ex-husband and my mother, which were conveniently made amidst a court battle for me to relocate one state over. They stated that my boyfriend was the perpetrator, and was physically abusing my son. He is currently seeking legal counsel, at least for advice on how to handle his situation. Children and Youth became involved, and this has cause such disruption and drama in our lives, and the caller (I already have a strong feeling as to who made one of the calls) has dragged my son into a situation that I have been trying to protect him from. What angers me, is there is actual abuse going on in my family, and while people are focusing on something that is not going on, they are failing to help out the family member who is actually being abused. It sickens me that people do this to be spiteful, and it almost makes them as bad as people who actually see abuse happening and fail to report. Does anyone know of any free resources that we can tap into to further prove his innocence? I know this will all be brought up during the relocation hearing. Childrens services is coming to my home tomorrow to investigate false charges that I abuse my children. What should I expect of these people? The person who called DCS was uspset because I wont let my daughter hang out around her daughter because I don't like the values they instill in their family. I am a Christian and I do have high standards. Will they want to strip search my kids, I have 12 yr. old twins, will they want to go thru draws and things? Thank You very much, I will let you know how it goes. On Saturday we had the un-welcomed visit from DYFS, Nj's DCS. We found out that the night before at 11:30 pm someone put a call that my wife and I were neglecting our 2 lil boys, by not feeding all the time, not bathing, not changing diapers in a timely matter and that the kids had east access to alcohol. After interviewing my wife, then having her strip them down to nothing and inspecting them, then interviewing me, then going on a tour of our home to see it is baby proofed from head to toe, they asked if we had any enemies, because faulse accusations usually are made. They acted like there was nothing wrong with it. I asked what rights we had as parents who were falsely accused and basically told we have none. However, though they will be "throwing" this case out, my wife and I would now be on file for being accused. We have an idea as to who may have done it, we have not spoken to this person in 1.5 months, but because they under investigation for robbing us, we feel they are going after us. We contacted our investigator to let them know of what has happened and who we feel may be behind it. As of now, it is just frustrating to feel like there is absolutely nothing we can do to prevent someone from falsely accusing us in the future. - I wish they would stop with these false accusations and save real children. I was abused for years and no one ever helped. Social services wasn't even called. For all of you that are being falsely accused, I am so sorry you have to deal with that. My Son was falsely accused because he was babysit for his Godborther he would babysitting about three day out our week that last day that my son was babysitting the baby stopping breathing and my son had to give the baby C.P.R he didn't know how to give the baby C.P.R HE DID THE BEST HE COULD TO SAVE THE BABY LIFE.but the police Department didn't ask anyone else who was wish the baby.grantmother. mother. father,uncle.aunt,girlfriend,the roommate all these people was wish this baby at some point of time. but secent my son was the last preson with the baby that who that are accused for all the injuries to the baby. the new release was nothing but lie that why i don,t beliver in the in D.A.are these lie as law they are not out to help you they just want to get payed that all.i hate this damn country. wear is the right in this world at the bottom of hold. i hate D.C.S My husband was falsely accused of sodomy on a child under 14. He has gone threw his trial and won. The child told them that her grandma made her lie about it. Can my husband sue them because all these things were false? You know, some people are weird. Back in the day when I used to drive a school bus, I was accused of being a pedophile because I wouldn't put the music channel on that the kids wanted to listen to. The mom told other people but thankfully, the administrating people knew me and of my character and squashed that mom's accusations. You have to be very very careful these days. People are sue happy and some are so weird. I stayed on the route and they weren't going to intimidate me with their false accusations. I knew one school bus driver who told a kid to sit down or he won't be riding the bus. The parents forced the school district to have the driver removed from driving. He was one of the greatest drivers out there. In this world, your dammed if you do and dammed if you don't. But I strongly believe that people will pay their price on judgment day. My fiancé and I have been fasley acccussed of abuse by my fourteen year old daughter and I have lost my other two childern, been thrown in jail and put through hell and yet has anyone even bothered to yet take a statement from us.Whatever happened to innocent until proven guilty.Wow I am amazed at how DCS of virginia has treated us where is the justice for parents.The real treat is my oldest daughter and her foster parent breaks into my house a week later steals pretty much whatever they wanted and I am not even allowed to file a report with the police department. I do know this system definitely needs to change and any advice anyone could share I would greatly appreciate. My partner and I live in Australia. In July 2008 we were falsly accused of abusing/neglecting our four boys by the school principal. Not only were we falsely accused but we have now lost our children until they each attain the age of 18. We are permitted to see them once a month under supervision and the children are constantly asking when they can come home. Their foster parents are spoiling them by getting them whatever they want. If they want an xbox, they get it, a playstation, they get it. We can't afford (and never could) to buy them what they wanted when they wanted it but we kept them well fed, clothed and kept a roof over their head. In 2006 we were in a house fire, the corroner ruled it an electrical fault then in Nov 2007 a plumber changing the hot water system set fire to the roof. My kids have been through enough hell and now DoCS (as they are known in NSW) have taken away the only thing that ever meant anything to me. I was abused as a child and DoCS only stepped in after they had removed my sister. They left me there for 3 years with the rapist and did nothing in that time. In court they brought up the time I ran away from home at 14 and blamed it all on my mother, the rape, the running away, the fact she couldn't keep her kids together. Now I am being accused of hereditary neglect, basically meaning, because my grandmother neglected my mother, my mother neglected me, then I must have neglected my boys. Not only all that, the officers lied in court trying to introduce false evidence but when it came time for our proof we didn't neglect our children, even the judge didn't want to know. People who report other people because they are seeking revenge need to realise, they are pulling the officers away from the children who need the help, the ones who are being bashed and dying in their parents care. All I want now is my babies back and life to go back to normal but I know this will never happen. I have to live with knowing I am labelled a bad mother for the rest of my life and my kids will grow up also knowing my partner and I did nothing wrong but the dribble that DoCS are putting into their heads on a weekly basis. DoCs have a huge problem also with mothers who breastfeed their children for longer than 12 months. My youngest boy was breastfed for almost 5 years. I tried everything to ween him but was told by NMAA that he will ween when he is ready. Apparently that's wrong. I am supposed to stop feeding my child at 12 months and waste money on formula when breastmilk is supposed to be best. I am sorry to hear all these stories and am saddened even still that I have now become one. Nothing will ever fix what has happened and nothing will ever be the same for any of us in this position. All we can do is our best and hope that gets us our kids back in the end. Good luck to you all. It's sad that society generally condemns the wrongly-accused party. This adds to the hurt of the wrongly-accused. Last friday the Denver cops showed up at my door and handed me a piece of paper stating that my fiancé was being investigated for child abuse. They questioned my 7 year old and 5 year old at school. From what I am gathering from my kids the cops were the first ones to talk to them. and then the social worker showed up. We met with an investigator on Monday and he gave my fiancé a ticket for harming a minor x's 2. The reason they got involved was because my oldest does have a scratch on his nose from ruff housing with my fiancé and my youngest had a bruise on his cheek.. The bruise on the cheek happened at school and my son has told 4 people the same story. We are going through this on only one income and we have to get an attorney so that we don't lose custody of the boys or my fiancé goes to jail or worst prison. Is there anyone out there that has some information for us... Recently my boyfriend whom lives with me was acused by his sons mother of abusing his sons.. now i have a daughter by him and another daughter by another man but my boyfriend is all shes ever know and that she calls daddy.. his 2 boys also live with us.. now the mother is in and out of jail, on drugs, cant keep a job.. n called cps on us well it clear the case was dropped.. but now she filed a interjunction and they took the boys until our court date...he cant even go near the school his son goes to.. if he was abusing his kids in my home i wouldn't be with him and wouldn't he beat the others??? wouldn't i report it..?! shes just mad cuz she cant handle them like we can and that we have a family... she has taken them..well stole them from us number of times and she always gives them back cuz she cant do it... she wants the food stamps and the childsupport that's all.. what to do?? what do we do for court and what do we say?? HELP! My husband has been accused of hitting our son in Colorado. It is so scare I don't want anything to happen to my family! I was accused of child abuse a couple of days ago, I have been in a 5 year legal custody battle with my ex-husband. He is the one who takes me to court, has called child protection, the police dept. and has even had a private investigator follow me around. In the five years he has never found anything to use against me. A couple of days ago I was served to appear in court for alleged child abuse. The document claims that ALL the scars on my 7 year old son, I made. My son is an avid soccer player and my ex-husband fails to note that. He also failed to inform CPS of our 5 year custody battle, etc. I was awarded primary residental custody since our divorce, and we are in trial now...my ex-husband tried to have our oldest son claim abuse against me, but my son never said what daddy wanted him to say..anywho, several doctor visits later and therapists later...our youngest son now comes out of the shadows and says that mommy hits him. My youngest son has also said that he says that because daddy makes him say these things and if he doesn't he will hit him and will get very mad at him. Anywho, I wish I could say that I have faith in the system BUT that light seems to dim more and more each day. My ex-husband currently was awarded for his access to be extended until further investigation. It's been two dreadful, surreal, sad, weeks since I last had my boys. How can someone just say the word abuse and everyone jump??? I miss my boys with all my heart and I will continue to fight (with my attorney)for my boys because they have been put in the hands of the man who has mentallty & emotionally abused them and hope that the system sees the truth. I WAS FALSELY ACCUSED AND NOW I NEED ADVICE ON SUEING TANEY COUNTY MISSOURI, PROSECUTOR RODNEY DANIELS,D.F.S. OF MISSOURI, MY EX-WIFE DEBRA LOFLAND AND HER FRIEND ANGIE BRADLEY,THE SHERIFF AND THE INVESTIGATING DETECTIVE. I SPENT 3 AND A HALF YEARS IN TANEY COUNTY JAIL PROVING MY INNOCENCE. I DESERVED TO BE COMPENSATED FOR MY TIME. MY LIFE WAS IN DANGER EVERY DAY BECAUSE OF THE CHARGES. I AM AND I WILL PURSUE DAMAGES. IT IS WRONG FOR AN EX-WIFE TO MENTALLY ABUSE MY DAUGHTER TO LIE FOR HER. IS THERE AN ORGANIZATION I CAN TURN TO OR AN ATTORNEY OR FIRM WILLING TO STAND UP FOR THOSE WHO ARE FALSELY ACCUSED. PLEASE E-MAIL ME AT alan.baker1999@yahoo.com I was falsely accused of child abuse on my children. My daughter's father accused me thinking that my kids were automatically going to be taken away to be given to him, since i have full custody of them, due to his past usage of alcoholic problems and Marijuana. The investigation went on by interviewing my children, myself, and by visiting my home, etc.. The Case was closed after that. Then he called cps a second time now falsely accusing me of drug abuse i offered myself to be drug tested and cooperated with them to proof my innocense, case was also closed. This was a very hard time for me, he is now fighting for custody and going to use this against me as well as some police reports he filed against me without me knowing. I also recently had an argument with my brother's girlfriend.(They have a child together)that sadly ended in a fist fight,i defended myself from her that day, something she doesn't expect from anyone. Well as revenge: since she knows about my recent problems with the father of my kids she has now accused me of child abuse not only to my children but to my two year old niece also. Somehow she took pictures of her baby with a bruise on her forehead two days after the argument. Took them to police. No where in this world am i known as a bad or abusive person; Im not one to do any of this! I'm now being charged for this,a felony 3 and being investigated for the third time by CPS. This is by far the worst thing to happen to me in my life and all because of lies! Im currently trying to fix this in court with my attorney and having a hard time proving my innocense. The worst part of all is that when you're accused your automatically seen as guilty. Any advise anyone? Do you know if i will go to jail for this false accusation?...This has taken away so many nights of sleep, and the depression is kicking in hard. :-( Recently I was falsely accused and charged with abuse of a child, namely my step daughter. I have 3 children of my own, and a step son and step daughter who live with their father. (my SS moved 3 years ago, and my SD moved 18 months ago - after we grounded her from Army Cadets one evening for her continual rude, disrespectful behaviour towards us her parents) Now I am to move from the family home, only have surpervised access to my children, not be at pools, schools, etc. This comes after a year of much stress over the twice changed mind of my wife to move, and take up the offer of her father to put her up in a new house. My wife wanted to share custody of our 3, when it suited her work schedule. After my wife decided to remain in the relationship, my SD increasingly became irrational and emotional. Recently the CAS was called on her father, as a result of an anonymous complaint regarding her fathers' alcoholism, neglect etc. As it turns our there has been embellishment, and lies by both the SS and SD regarding their father. My SD wanted to move away from him, and be with her mother, but was not interested in returning to our rural, somewhat isolated home, as she was hoping to move with her mother into a new home, close to her school, and in town, so she wouldn't have to rely on getting driven around (she is very social) I also would confess our home isn't the nicest, as it is still be finished, a project we took on when we purchased the home, and has been delayed, by the number of children we have. I can see why she doesn't want to move here as well because she thought she would get her own room built right away, without due consideration to the other higher priority jobs that required completion. Also I don't approve of her continual weekend long sleepovers with her boyfriend either. Her boyfriend lives almost 2 hours from our location. Her mother considered moving close to her work which is halfway. I am appalled at how this can happen. My wife just doesn't know what to believe. She is mainly believing her daughter, but she also can't believe I would do anything like this. Just on the say so of a melodramatic, embellishing, extrovert of a child, A family is ruined. My son is absolutely devastated. He is very angry. All my children ages, 3, 6, 10, are acting out. It is so disheartening to witness. On top of everything, I have home-schooled my children, my son the longest at five years. He is very involved in sports, swimming, karate, soccer, gymnastics, etc. Not shy at all to get up in front of a large group to demonstrate katas, in karate, loves soccer, and is an avid computer enthusiast who has recently taken to programming adjustments to his favourite pc games. My daughter the artist, asked who was going to be her new daddy, because my wife and in-laws have told her I am going to jail. My little 3 year old son with most charming smile is just becoming aggressive and intolerant. AhhhhhhhhhhhhH!!!!!!!! I have been their primary care giver, and now, .... Than I hear from my wife, my SD doesn't want me to be apart from my kids, nor does she want me to go to jail. This from the 16 SD who has made such absolutely horrid allegations. What did she think, Mom would just finally choose to leave me with no question as to her ability to get full custody (increased government financial assistance, an issue she often raised over the past year when considering separating.) How can anyone be so socio-pathic to make incredibly bogus allegations? Ahhhhhhh!! Stupid punk kid. Stupid misguided child. And to think on top of all of this BS, she has been recently taking birth control pills, that have their warnings of all manner of emotional instability. Do ya think, DUH!! Even the cop who arrested me couldn't look me straight in the eye. So much BS. What happens when I am cleared? What a pretty letter of apology for what she has done? Worse, what if I am not cleared? Her word against mine. She is a great actress too. I am so frustrated. The only thing holding me together, is the commitment to my wonderful children who need me. I love them, and am furious over the harm, this one selfish, unstable child is causing. How dare she. Even despite after interviews, with my 3 children, and 2 stepchildren, there was no corroboration by any other child, apparently according to my wife the CAS worker stated that I have our 3 kids so brainwashed, that they wouldn't speak out against me even if I had assaulted them. So not only do I have a false allegation, I have some CAS worker, denying the honesty of my children, and trying to convince the world, I assaulted them as well. No proof, this after 20 minute or less interviews. What is wrong with people, do they not see the damage they are doing? I hope that anyone out there considering to lie like my SD has, please, please reconsider. heather kirkwood does pro bono...she is a harvard grad google her! she is in wash state or oregon, but if you google her she will come up...she is wonderful she is in wash state or oregon, but if you google her she will come up...she is wonderful i was falsely accused two weeks ago. i had an incident with an ex friend and she then called dcfs. i am still waiting for the case to be closed. the social worker did tell us that after a report is unfounded that anyone who tries to report you again for 7 years will have to leave their name. they cant make an anonymous report. that means that you can press charges on the person for making a false report. My husband is being falsely accused of sexually abusing his children,(two different mothers)It all started because the weekend b4 we took her son she was gonna leave her oldest son home alone, my hubby said don't do that, just bring him up here. So she did and said she would be back on the next day to get the oldest son. She never did until the day after that until she came and got both boys. She stated the two kids called and asked her to come get them, the very next weekend she was calling us to take her son for the weekend. We said we had plans. After 3 calls that day, his son hung up on him cause we weren't gonna take him. Monday comes along and we were waiting for his daughter to come home and she didn't. Come to find out Dss went to the school and took her. The mother with the son took him to a councelor and he said his dad did bad things to him and his step sister. Long story short, He is sitting in jail for something he didn't do, has a court appointed attorny who isn't doing much for him. Our lives have deffinately changed for the worse! I would like to discuss this further with a pro bono lawyer, in Massachusetts. If anyone knows of one could you please let me know?? I'm desperate to help him prove his innocents! They even moved his trial back 9 months. So he will be sitting there for 2 years b4 it even goes to trial..Hope someone out there is interested in hearing my husbands story and is willing to help him! Thanks! i live in fla and someone made a call on me. On 1/16/10 there was an officer and SS investigator waiting on me at my daughters school. The report said i had hit her in the jaw and chest and they did a drug test on me. I don't even drink. Now they want my daughter, which will be 10 in a few days, to go have a psychological evaluation.they already have ben by my house and seen that we live nicely and that she has everything that a child needs plus.only thing that i can think of is that someone must be upset with me and this is there revenge.SICK!it seems that dcf wants to keep digging to hopefully mske a case.SICK!what they don't relize is they are making nothing into somethink ands its the child and only the mother who suffers.dose anyone have any advice on how to get this chip of our bach?flaca1949@live.com/772-643-3207.enough is enough.yes i understand sometimes that they don't do a well enough job,but sometimes they do go way to far.this case needs to be closed cause there is no case here i have a sick week old daughter my third child i have a 3 year old son and a 4 year old son i took my daugter to the hospital becaue she cryed when i moved her arm on friday january 22 2010 and i was never seen they took to long and i had her another appoinment so i went ahead and took her to the dr appoinment there the doctor twist and turnered her arm aleast 3 times up and down and then sent her for xrays after the xray the arm swoll up and then they diagnosed her with a spiral fracture to her humerus they investigated all my other children me and my husband and they removed her from the home. they left the other children. the doctor has stated that she do not know how this happened and she says that she can see that it has been broken for the most 14 days and with that sayed they will not allow my family any custody because they don't know if any of them has had custody in the last 14 days. i don't know how her arm was broken. this is really unfair my daughter is in the care of some people i don't even know and i cant even get visit what did i do so wrong. they are treating me like i brought in a battered infant. by the way my other children have never been in the hospital with any suspect sistuation. mom in pain i know your pain, my daughter had the exact same problem, she had a broken arm, and we were accused of abuse its been almost two years now, and we finnally prooved she was sick, our pain is almost over...please call lawyer heather kirkwood, google her she will help On thanks giving weekend I was arrested by my childrens father, he told them i had been threatening him, and i was trying to take my children away, then last week I had child protection workers come to my home, because we worked out our differences started counselling for the both of us and our children, they said Iam and abusive spouse, and that they did not want us together, im 125lb 56" he is 230lb 5 11" i don't think i could hurt him, but ss thinks i can. they said they were going to close our file, but then they went to our childrens school and interogated them, she coerced my son to say that i stabbed there dad in the stomach and he had to get stitches in his belly. the truth was there dad donated a kidney to his brother and of course he came home with stitches on his stomach small enough to look like a stab wound. the children knew there dad donated a kidney, but they a had told us that this woman came into the room had pop and candy waiting for them and as she was interogating them she was "really nice to us" my son said and that is why they told her what she wanted to hear, so now Im afraid they are going to take my children away from me, they have been trying for years but they never had a reason to take them away they managed to take all of my family members that live in the same city away from them, and when that started they were constantly at my door with new accusations and Im afraid now that my children had told them this lie that they will succeed in there witch hunt My ex was falsely accused of sexual abuse 5 months ago. He was released on bond and one of the conditions is that he cannot have any contact with anyone under 18. My children were interviewed prior to his arrest and they adamently deny any innapropriate actions by their father (the older two are now adults). I do understand the stipulations of his bond yet I do not understand why the D.A. will not approve SUPERVISED visitation for our minor children. I've pleaded on behalf of my children yet my pleas fall on deaf ears. Does anyone know what I can do??? My children have never gone more than 3 days without seeing their father and they are truly suffering. My child's school sent DYFUS saying I abused her. Ridiculous and downright insane. The social workers saw that there was just no evidence of any kind of neglect towards any of my four children. They plan to close the file. However, I am mortified that anyone can just call and make such unfounded accusations. I was told the case will be closed but is there more that I need to worry about here? What rights do I have? I am not allowed to confront them because technically they're anonymous but can a lawyer investigate this matter for me, or a PI or someone who can look into this and prove the school incompetent and reckless? I have a friend that is being falsely accused of child abuse and was wondering if her name gets put on the Registry List what does that mean, how bad will it hurt her and her future. She doesn't have the money to fight with a lawyer, so wondering what to tell her on how this will effect her life, and her two children she has custody of. A couple months ago my six year old step-daughter acussed my five year old of sexuall abuse. Long story kinda short She told the ER doctors, the police and ss that my five year old held her down and shoved something up her butt but when the Drs examined her there was no evidince. When the ss and police asked her to draw the object he useed she drew a cat. SS told me that they belived my son after talking to him. When they talked to him they came into my house before my son came home from school so they knew that i had no chance of talking to him. When my husband took his daughter home the mother had half an hour to talk to her daughter. The mother of my step-daughter has made false acusations before and has made my life a living hell for the five and a half years. When she was acussing me i let go of it and dealt with it but when she started on my five year old there has to be something to do. We don't have much money to do anything we have five children together. If there is anyone that had some advise please let me know it would be greatly apreciated and used. I have been accussed of abusing a child at my job not once but twice within a span of two and a half weeks. I only have been working there for a month and a half. I am very passionate when it comes to working with kids and what they fail to realize is this is not only going to affect my employment but my entire career that I have taken the time to build for years. Now I have loans in a field that doe not protect me and may or may not be able to obtain a position in it. Regardless of working in this field I must still pay my loans. Why????????? would a person do this, is it jealousy? I am praying everyday that I can get through this crisis. I pray that employers find away to properly protect their employees from such accusations because this is no game or joke, people take this very seriously. I will be praying for everyone who may be going throughthe same thing. God Bless!!! I have 4 children my youngest is 5 weeks my sis 23 was watching the kids, well she fell asleep with the baby on her chest she said she woke up and he was on the floor crying(his arm is broke) we rushed him to the hospital and cps was called I understand this people have a job to do but they are say she did the to him. My sis ironically is in school for social work I am going to school for nursing. this whole thing has been a nightmare!!! I know with everything in me she would never hurt my kids...They have her taking a lie detector test soon. I don't know what to do. We never even considered this would happen to us in a million years. All I can do is pray right now, does anyone have anymore advise for me? I am freaking out!!!! So I stumbled across this page while searching for advice on where in my custody/dissolution trial I can bring up the 6 false abuse allegations that my husband has placed on me (which were all dismissed for finding no abuse present). He was charged with terroristic threats and two assault charges when he threatened to kill everyone in the house (our two boys 3 & 4 were present), beat another person badly, and dislocated my jaw. He was only convicted of domestic and an assault and spent 8 days in jail. Now I am trying to prepare myself for this trail and its me against his lawyer... if anyone has any advice, please share it. Also, pray for me and my boys who have already been through so much. I have been falsely accused of child abuse against my son that I have raised for the past 3 years. My ex husband is accusing me of child abuse to hurt me and has made false allegations about me to the asst state attorney. They have no evidence and my ex husband has no proof of his allegations. I went four months with no contact with my son. Now I have had only 4 visits with my son for one hour at a time with a doctor present in the room and my ex husband has managed to have to courts enact a stay-away order against me. I cannot call my son, see him, go to visit him at school, or send any gifts. I can only write to him but he is not able to read yet and that means I must rely on my ex husband to read him letters. I raised my son for the first year on my own while my ex husband was overseas, and spent the past two years being separated from my ex husband, raising my son while he partied. I finally filed for divorce and walked away from the marriage thinking it would be quick and easy as I asked for nothing. When I started dating, problems began. Now, I'm being accused of child abuse with no evidence or history, and I have had my son taken away from me. I have not been able to have my son home since July 2009. I am in such pain and don't know what to do. My attorney has asked for another continuance (3 now), meanwhile my ex husband is brain washing my son and I am losing time with my baby boy. I don't know what to do anymore. I have taken and passed a polygraph, two pyschological evaluations, and have had great positive visits and reports by the doctor with my son. My ex husband and his father know a few people in power and my life has been taken away fom me. I have been outcasted in town and feel like a prisoner in my own home. Please help me. I'm desperate, sad, and frustrated. i found out through social work records that my x partners sister has been maken annonymouse phone calls and accusations,my x partner phones them and asks updates after accusen me hitten my youngest son,which his dad admitted to social work was his siter and called it tit for tat,all accusations are kept on record as maliciouse calls so why are they not prosecuted and charged for it,seems be the main parent with mental illness is held responsible for everything wrong in a childs life,we are failed to be heard or have rights comes to seeing social work records kept on us unless done through courts I wound up in Jail during trial, for 8 months, with shit and piss being thrown at me at all hours of the day or night. I am a big guy and so no one wanted to confront me physically. But I knew if convicted I would be living in hell in prison. I became my own advocate. I requested copies of all documents accusing me and transcripts of every court proceeding. I made my notes on them so I could help with my defense. It was the only thing that kept me alive, especially knowing that in this type of crime no evidence is needed, only the accusers testimony. Like I said before I am a big guy, and during that time I was dealing drugs and it was one of my clients who did it to me because I would not give him free drugs. I am also fairly good looking and have had numerous women lovers. This knowledge was the only thing that kept some incarcerated friends from kicking my ass or worse. The Dickerson brothers were bigger than me and notorious for going to jail once a month for a bar brawl. The older brother even warned me that if I got convicted that I should hang myself in the courtroom rather than come back into the jail. The following is a little explicit: The kicker in the whole accusation (the accuser was a boy of 6 coached by his father) was that the boy was asked how did he know I had penetrated him and he replied because he looked back and saw it. This was in every document. I couldn't believe that the accusation went so far. I had even asked the prosecutor, when in her office, if she had ever had anal sex and if that is the way she knew she was penetrated. I offered to pull down my pants and get an erection to see if she could handle my 8 inch and thick penis. That I had no problem showing it to her or anyone she appointed. Because if she had my penis in her ass she would know it before full penetration just as he would have screamed bloody murder if I had done it to him. But the only thing that got me off was I did my due diligence. I had a public defender who, as we all know, don't do much but make deals. I don't think he would have figured anything out without my help. So if you are innocent, do your own due diligence. There are too many innocent people in prison (25% +-). And that is injustice. Our court system doesn't care whether you are right or wrong, its all about who has the better argument. Justice is blind to many things, but the truth is number one. My kids dad and I are going through a recent nightmare. Two weeks ago thursday a lady came over and said she was from DCFS. She told me an annonymous person called in and said my kids dad sexually abused our daughter and what she said was an exaggerated lie. I do not know what to do!! My daughter is in daycare 5 times a week monday through friday 9am-5:30pm and when she is not at daycare she is at home with me. I cannot believe people can get away with calling DCFS and make up lies. I NEED HELP WHAT R WE TO DO?? THEY WANT TO DO A LIE DETECTOR TEST ON MY KIDS DAD PLEASE GIVE ME ADVICE OR IF YOU CAN HELP PLEASE LET ME KNOW MY E-MAIL ADDRESS IS BUTTERFLYGRL54303US@YAHOO.COM ALL UNDERCASE PLEASE SEND ME AN E-MAIL IF YOU HAVE ADVICE OR YOU CAN HELP WE CANT EVEN AFFORD AN ATTORNEY My boyfriend was falsely accused of child abuse...he and his daughter were playing and "rough housing" as he has always done with his daughter and my 3 year old daughter and all his nephews, his 6 year old daughter claimed he hurt her intentionally. She told his mother this because she kept pressuring her the child first told the grandmother they was really playing and he didn't try to hurt her but because she had gotten a bruise on her arm and a scratch on her face the grandmother kept asking repeatadly and as any young child will do she said what she knew would get her attention the most... Any ways his mother went to the police and the cps got involved, well by the time the child, who has previously had a problem with being a habitual liar and had been previously diagnosed with odd(obsessive defiant disorder), told the truth that they really was just playing to law enforcement it was to late. we talked to many lawyers around and no one would take the case for less that 10,000 and we didn't have that kind of money laying around so he was stuck with a public defender who said this was his first case like this (not really something we wanted to hear) he was offered a plea of 20 years with serving 15 in federal prison we didn't take it then he was offered 15 serving 10 we declined this offer also, he then voluntarily with the help of the decision of his public defender took a lie detector test which was admisitered 3 times he passed every time... so he passed the lie detector and the child admitted she lied but neither mattered. The test couldn't be used as evidence because the district attorney didn't want it used. His lawyer even wanted to use character witnesses for my boyfriend and that was denied. So 3 days befor court he was offered a plea of 10 years 3 suspended 5 probation and serve 2 in prison... he was advised by his public defender it would be smart to take it because we couldn't prove his innocence and even if they was playing the way the statue reads on child abuse in mississippi temporary dismemberment(a bruise) qualifies as child abuse even if you are playing with your child and he or she gets a bruise its child abuse...if you spank your child and a red mark shows its child abuse.. how are you supposed to discipline your child.. the laws are so messed up to "protect the child" that nothing can protect a parent... No wonder so many children are into drugs and running around your pretty much not allowed to discipline your child.. Pretty much your houseing government property. My boyfriend was told if he didn't take the plea and he went to court there was a great chance it wouldn't turn out well and he would be looking at 20 to life.. although it deemed him guilty he and family decided it would probally be the best because of the fact that if he went to court and lost that his 8 month old son could possibly be 25 when he was free or the 3 year old 28 and the 6 year old 31... So he was told by his grandfather that sometimes a wise man knows when to back down, so he did now he is sitting in jail for 2 years and will be on probation for 5 and will be a convicted felon for the rest of his life... i don't know if that's the worst thing or the fact that the 6 year old child is off scotch free and has the power to do this again and she will i believe because now she knows what to do to get her way and get attention... How are we supposed to be comfortable around our children with the laws so messed up. what's worse is there are children out there abused every day and the abusers are free.... My boyfriends family and i are going to try to make lie detector test admissable in court for future cases where the innocent are guilty.. if you have a case like this or know some one who has please email me the story at nicole_w22@yahoo.com Thanks Nicole in Mississippi Dear Counsel, My name is Mrs.JULIE BURANY . I am contacting your firm in regards to a divorce settlement with my ex husband ( Mr Scott Burany) who resides in your jurisdiction. We had an out of court Agreement (Collaborative Law Agreement) for him to pay $796,500.00 plus legal fees. He has only paid me $82,000 since. I have been on sick bed over a protracted espionage long cancer. I am presently in London hospital recuperating. I am hereby seeking your firm to assist in collecting the balance from him as he has agreed already to pay me the balance by next week as long as the payment is going into my legal counsel's trust account who will also act as witness to this transaction. I want Your Firm to help me collect this payment from him or litigate this matter if he fails to pay as promised as i am urgently in need of the money for my treatment and my children general well being. Kindly Reply to my Private email address: julie_burany20@yahoo.com Sincerely, Julie. I need advice. I have a 17 month old little girl and 3 month old son. well around 2:30 am just after easter my son woke up crying for a bottle and a diaper change. I awoke but by the time i got awake enough to be able to know what i was doing my boyfriend got up and took care of him. So i laid back down thinking thank you omg sleep. so i turned my back to them closed my eyes and tried to go back to bed. Well my son was screaming which he normally does when he has to be burped or needs a diaper my boy friend tended to all of this. well he couldn't calm him down so he asked for my help. my boyfriend had my son on his back and had it to where my son was grasping his fingers. he noticed that my sons left arm was non responsive. We didn't know what it could be and really didn't think of what could have happened for it to be non responsive we woke his dad and my daughter up. we all got ready and rushed to the hospital. upon arrival we couldn't explain what was wrong all we knew was that something was severly wrong and every time you touched or even moved my sons arm he would scream bloody murder. they took us back and we waited as they poked around on him. well they did an x-ray and found that his arm had a spiral fracture. i didn't know what a spiral fracture was just that a fracture was a broke arm almost. well we were freaking out trying to come up with scenerios on how this could have happened to my baby. the hospital called dcf and reported it. they came out and talked to us seperatly this dick head cop interigated us seperatly and because we couldn't tell them an exact story of what had happened it looks really bad. well the dcf worker said we know ur concerened and worried but we are not going to take your baby. we were releived she said they would put us through parenting classes and counseling and we were more than willing to comply with there demands. well 3 hours later she comes in with a car seat and says shes taking my baby. we freaked out we were running on lack of sleep we are still worried and we were histerical. i was in dcf all of my life and abused also so i know the pain. now they are trying to use the fact that i was abused against me trying to make it seem like i am crazy and is thinking abuse is ok well i am 110% against any form of abuse. They have ripped up our family my daughter is so confused the person watching my children while the caregiver is working is not sticking to my sons diet plan to help him gain weight because he was 3 weeks premature and breech when he was born and had a sensitive stomache so he was on soy formula. she is not feeding him the way he needs to be fed to help continue his weight gain and i cant stand this girl. They wont let my boyfriend see the kids they are making him look like some kind of monster. if my boyfriend handled im wrong when he went to care for him and it happened then then we both know it was an honest to god accident. my boyfriend has gotten to the point where he wont co-operate with them unless he has an attorney present i passed a u.a and they are coming out monday to inspect the home. i just visited with my beautiful little angels today and it went well still hard on any mother to be able to see her children for a time limit and have them taken again from you. We have already found so many things that dcf has done wrong they didn't u.a either of us when they took the kids they took my son back to the hospital for his hand swelling from the fracture and didn't notify me AT ALL!!! and im still pissed about that i want to know what happens to my kids whether its a paper cut or a bug bite i want to know. they never finger printed the caregiver within 24 hours of placing them in there care. and the caregivers family has been running there mouth about everything and were being slandered all over myspace. these people are making him out to seem like a monster me seem like im some piece of shit mother whos sum luv sick puppy and im tired of it. i want my children home where they belng so we never have to look back. so when we think of it its just a bad memory. please help To all you who have gone through this, and I have been wrongfully accused as well. If you go to this site if can save you a host of un-needed drama. Especially if you have just been falsely accused. It is a horrific situation when people that you once loved could act in such evil and destructive ways. May God have mercy on their soul. State:WV Reason: Falsely accused of Child Molestation I have been falsely accused of molestation. this has been going on for around 2-3 years. Lately, I've been Removed from South Charleston Taco bell (accuser's ex husband's workplace) because of this matter. He had told me not to talk to or even look at his son. I moved to another table quietly like nothing was said. Another employee had addressed us and gave us a take out bag told us (my girlfriends Step-Mother and myself) that I had to leave but she could stay. This happened recently at the beginning of April. We did leave the store quietly, just very aggravated. being publicly humiliated for no reason. I had broke down and cried over all of this, being accused over something I didn't do.Angie(girlfriend's Step-Mother)drove to my friends house to calm down I was so depressed about all of this. i just couldn't handle it. Am I eligible of emotional Damages? Me and my feonce are being falsely accused of child abuse ATM. Almost 3 weeks ago we woke up from a nap to find our 4 month old had his leg stuck in the crib so i paniced and pulled him out. well he seemed like he was ok so we didn't worry about it till the next day. The day after it had happened he started acting like he couldn't move it so then we started to get a little worried. So we layed him on his tummy and he was using it a little better than on his back so we felt a little better about it. Then comes day 3 we had takin him out to my feonce's mothers house to get time to our selves for a night and she calls us at 11pm at night saying that its starting to swell and he is crying more. He had an appointment with a doctor the next day so we had them look at it then to make sure it wasn't broken and they sent us down to the ER for them to X-ray it and it came back as ok. Then they wanted to do a full body X-ray that consists of 27 diff. X-rays. Then they come back telling us that there were 9 fracture's on him 4 being spiral. We flipped out and i was in shock wondering what was going on. We had left to go to the house and get clothes because they said they were ganna keep him overnight because before they got all those results back they had just thought that there was a bacteria in the bone causeing it to swell. So we had gotten a call while at home then not even 20min. later a cop, detective, and social worker shows up at our door to take our kids, because i have a 2 year old too. They took my 2 year old into the hospital to examine him and do a full body scan X-ray on him he came out clean. Now there trying to charge us with felony child abuse which is 15-20 years locked up. My baby was born 4 months early, stillbirth took then 20min. to rececitate him but he made it and was in a mercy hospital for almost 3 months before we even got to bring him home. I don't know what to do because they are trying there hardest to pin this on us. We think that it could have possible happened while he was in the hospital for the 3 months. Needless to say we are going through some major hell right now and they have him in protective custody and were anly aloud to see him once a week supervised visits. We also have to take a phsyciatric evaluation to see if we are capable of doing something like this. I cant eat i cant sleep, all i want is my baby back but they are going to drag this out for another 2 moths possably. So i know how people are feeling being falsely accused of something that they haven't done. I'm just hoping that they actually open there eyes and see that we didn't do this and love our kids with all our hearts. And all i know is when this is all over, and have my baby back im going to be leary with who has him and the way they are handling him. I also want to say that i can understand what the lady said 4 days ago about her baby and the spiral fracture well they are pointing fingers at me like they are at your boyfriend and im the mother for crying out loud. they were trying to judge my man on his past with a false assult charge on him and i told them you don't even be lookin at him for this he is a perfect father in every way shape and form. so now they are pointing at me. So i understand chick trust me. And good luck on yours. Just make sure you have a lawyer presant during any questioning and do not under and surcomstances answer any with out him presant because they can come back and say he said she said. And you don't want that so your boyfriend is doing the right thing when it comes to that. Just do not get snappy with them or irritated at anytime. you don't want them to have that on you. Are you kidding me... Being accuse of something even little can ruin someone's life... If I am found guilty of this stupid and not true accuisation... I can lose my privelages of being a health care worker!!! LIes hurt peoples lively hood and not sure why someone would make something up .. it's cruel!!! And Not only Not only It isn't fair but I wasn't nice not rude but just... I don't know confused and caught off guard, and was defensive to the worker, who just showed up out of no place!!! So I look guilty right? or can I just still be in shock... To say this last year was easy woulod be the biggest lie i ever told .my husband was accused of abuseing our children . My father and new wife wants my children for their money . My kids have said that they told them what to say, and how and when to say it . dfacs came into my home , and checked our house . They had the police search my home 2 times . when they found nothing they still screamed he did this. I've asked for proof they say i have to trust them, but the fact is they have none. They said i have to trust them , but how can i trust them when they got on the stand all they did was lie. About everything . They said my children wouldn't have known anything about sex. My kids are 13 and 16 . They teach them about sex in school, and if they are telling the truth and my father and his chick did tell them what to say ... well wouldn't adults know what sex is ? no one listens . Everyone here in our town knows . we have no privacy ,and worst of oall they are letting my father and her get away with it . They never even asked them about it . And worse they are tring to put my kids in their home. My father is a drunken abusive butthead . He had a child removed from his home for almost 2 years . But none of that matters. It's a bad nightmare and doesn't seem to be ending soon. I've neve had anything against me.But they tell me they r worried about me. And about the safety of my kids.Yet they want to put them in the hands of a drunk , mean abuseive man .I don't get it .Can Anybody give me some help? thank you . Crissy2010 I understand what your saying, my son and his girlfriend has two children, both premature. It wasn't his arm it was his leg, and all of us are going through the same thing. I have went and hired them an attorney, but the CFS, and the rest are wanting to know what they are preparing for the hearing. I informed the kids not to talk to them about the case, without their attorney present. Also, He got his leg caught in the babybed as well. They only took one child into protective custody, and informed them that they might have to pay child support to this foster parent whom was late getting the child to a visit. Did they say something to her, NO. It just cut the time down for the visit. My wife (along with our 17 month daughter) abandoned our home and went to a womens shelter. She accuses me of emotional abuse. This is false, as she just wants out and wants me to support her habit. Should I change the locks at my home because I am afraid that if she returns, she may up the ante and accuse me of something that will get me arrested. The police don't seem concerned about my concerns. I'm a mother of two awesome children. Unfortunately, my fiancé was falsely accused of child abuse towards my daughter who is 11. Let me begin by saying that first of all I would not be with a man who I thought was abusive. If I had any doubts in my mind that he was we would NOT be together. I've known this man for over 9 years now. Longer than my first marriage with my ex-husband (which lasted 5 years). My fiancé and I are planning to be married next near. My daughter decided to go to the school's principle in the afternoon to report that my fiancé hit her across the face.....Not true and here is why. 1st of all I put my children on the bus every morning and there was no red mark on her face if there was my fiancé would have left that same morning! 2ndly, my son didn't say a thing or notice, and neither did my daughters teacher for that matter, or any of my daughters friends. 3rdly, my daughter waited till the afternoon to report a story because she didn't want to listen that morning. When she reported it I was unaware of the report! I'm the emergency contact for her school "don't you think they would have called me?" Rather they didn't, and called the father instead (which I found out later). My ex-husband in return (a school teacher in our town, not the same school as my daughters) hands me a piece of paper ordering EMERGENCY TEMPORARY CUSTODY OF MY KIDS! And hands it to me as he was picking up the kids for the weekend! This is how I found out. My ex then after handing me the paper proceeds to tell me that my daughter had a mark on her face, and the principle stated the same thing. I find this amusing because firstly, there was no mark, it was filed as a non-emergency with DSS apparently, and in the report 51b it was filed as non-emergency. Why didn't my daughter go to the nurse? If there was a mark there would have been a report filed by the nurse "would there not?" however, there wasn't. Is it me or does this to you begin to sound like a conspiracy going on inside the school working with my ex-husband because he has some sort of influence as a teacher? Think about that one. If I had a student with a mark, bruise whatever, I would have sent that kid right away to the nurse and they would have not been coming home that day back to the abusers house....but guess what, the school sent both my children home that same day it was reported....still unaware anything was falsely said or filed....until that weekend my ex was having our children over. As frustating as this is, and how disappointed I am of my daughter for making such a lie. I can't blame her because well lets face it when kids don't get their way, they will say or do anything for either negative attention, or because they don't like the rules and regulations in a home. Have we all not done this people as kids....hello! To make matters worse I'm put in a report for neglect.....um excuse me on what grounds....you have no evidence to back up this, and you're basing it off hearsay. Not to mention you are dealing with a divorced families, and like most divorced families that are not easy, kids are unfortunately put in the middle, or can play sides. I have always been fair with my ex not going through DOR working with him for the sake of the kids but this time he's gone too far and I'm not putting up with it. Thanks to him, I've lost my job and college education for now, because of dealing with false alligations. It's not a pretty picture. Now DSS, the social worker I got has blown off three appointments with my fiancé and I, is completely biased of us both and has zero intrest in listening to anything other than what the kids are saying. She not to mention completely screwed me in court by saying that it needs to be further investigated! Um....as to what....do these people not have common sense? My fiancé and I have a house, 5 bedrooms, 2 full baths, and over a half an acre of land. The kids have their own rooms, he has provided more for my kids than their biological father, who is mind you divorced twice, has 4 kids, and is on his third marriage.....um....how about a red flag there! And to top it all off he is a teacher in my kids same school system and lives an hour away, and my kids behavior did a 360 since he started working there! The list goes on and this is only a small percentage of the crap I've had to encounter with him. My daughter like most girls, is a daddies girl (I have zero problem with that!) I'm glad he is a part of my kids lives....but it's to the point it's an obsession and it needs to stop. I've never taken this man to court for a damn thing and stayed out of his personal life giving him the benefit of the doubt because he needs to live too. I get that. But when you cross the line to take my kids away from me with false alligations and get the school to back you up or Social workers "without proof" biased, and take my kids away even when he has them every other weekend and two days during the week....which is more than what most fathers have, you've crossed the line by not only putting the kids in a bad situation by getting them to lie just to live with you, or make things up that are untrue, you've crossed the line in my opinion. Even the mandatory councelor that Social Services Implimented agrees with me 110% and doesn't understand why this is being dragged out or why when I requested for a new worker are they still using her to go to my ex-husbands house, and sending a different one here! IT'S FILED AS NON-EMERGENCY AND THEY ARE MAKING IT OUT TO BE EMERGENCY! Not to mention neither myself or my fiancé have a criminal record! In a nutshell, I'm tired of this, disappointed, and can't believe this is happening to my family. It's time that the governement looks as to how Social Services is abusing their SERVICES, and put PARENTAL RIGHTS BACK INTO EFFECT! I'm sorry but it's cases like these that make parents fear to even say anything to their children! And what then, pay taxes out of pocket for higher crime rates, and early pregnency in kids.....there is zero respect for parents today and not enough credit being given to those who do a wonderful job! I'm sick of Social Services thinking they control and have the final say. I'll be damned if someone tells me I'm a neglectful mother! Especially when I nor my fiancé did a damn thing! I was falsely accused of fracturing my four year old's (now five) clavicle last year. The irony of the situation is that this was an accident, witnessed by at least two teachers at his preschool, while i was not even present! My accuser? A jealous mom. She hates me because of the way I look. Watch out people! These false accusations are easy to make but have devastating effects on families. The false accusers will receive no punishment whatsoever but they hold the power in their hands. It is completely unfair and ridiculous that they can get away with this. The laws must be changed to punish false accusers and set an example for others. I would never condone child abuse of any kind but as parents we are too vulnerable to the mentally ill individuals who know how to work the system. In my case, this jealous mom is a social worker. After she realized that her claims about my son were unfounded, she attempted to coerce my daughter into talking with her about " what was wrong". I still have to see this deranged woman on a regular basis and live in fear that the next time one of my kids gets hurt, she will be watching and waiting for her opportunity. in 1995 and for neary 5 yearsi was acussed of mistreating my son ifirst heard about this of a small note in my mailbox fom there it snow ball into more trouble for my family my son then through this in more trouble with his mates and police eventunly welefare found out it wasn't me involed and the folled me for 4 years stalking me where ever i went my son bashsd his sister and handicaped brother plus his dad years later welfare knew about but did nothing about it i lost my marriage through all this and hy xhusband never blieved me at the time welfare said sorry i wouldn't accept it at all my son with all the counsling he got over the years made him worse he is now going to court this month for stabing another person his a voilent man and i should have being giving awwritten appolgy a long time ago for what happen my xhusband had cancer last few years abd i been sick from all this tell me what you think about this hathor i am currently being accused of putting my 20 month old stepsons foot into hot water causing him to obtain 2nd degree burns. i was running a bath for him and my son and i left him alone near the bathroom. i never in a million years thought that he would get into the bath himself. i was in the living room when i heard the scream and i ran in there and saw he had his foot under the running water. i rushed him to the er. CPS now believes i submerged his foot into hot water. my husbands family has been saying horrible lies about me. my son and daughter have been taken away from me and are with my mother in law (which is not an ideal situation but better then foster care). this is a horrible experience and its just beginning. i want it to be over i want my children back. my husband's father's girlfriend, a breast cancer survivor, was reported because she was (supposedly) seen smoking pot on her front porch. they sent over HR to do a surprise investigation sunday morning. her daughter was dressed for church playing xbox while she was cooking breakfast. the HR investigator asked some questions and was intelligent enough to let it go. on another separate incident, my husband and i were called in to HR once because my x-husband had spanked our then 8yr child old on a weekend visit. they didn't even call in the right people! when they told us about what happened. we were confused why they had called us in. we knew of the exact incident because his father called us to let us know he was riding his bike out in the street where it was dangerous. and he had taken a twig or something from the yard and spanked him with it. he didn't get many spankings very often so we remember most of them and what they were for. i never spanked with switches (my mom used a spoon) but his father grew up that way. and that's how he spanked him. he didn't spank him hard enough to leave any marks and we had our son back at our house the following week. our son told his counselor about the spanking the following year. like others here i couldn't believe that they were waisting there time on a spanking that happened over a year ago! it also was dropped. like the people are saying it appears anyone can cry wolf and they are all over it. the most painful thing i see for the parents above is that they will miss so many special moments with their children that they can never get back. a first word, a first step, first game. just the overall bond you get to form over the years with your child. its awful that this happens to people, people that cant afford the protection they need. and also once you are accused it is ALWAYS with you. even if you are proved innocent. i know cause im to blame for looking at people this way in the past, celebrities, etc and thinking maybe they are guilty even though they were proved innocent. its devastating to hear all of these stories. its sad for the parents accused and for their children, because the kids are dependent on CPS to be sure they are not breaking apart loving families by mistake. i am hopeful that there is a place for people to share. i pray that all of the innocent people here are reunited with their loved ones. and that the CPS will take this seriously enough to change how they do things. i have falsely accoused 2 weeks ago from my ex wife that i was sexually touching my step daughter when my ex wife was at work 4 years ago, this allegation made after when i applied for divorce. Now i have to go to police station in next 2 week to know if the charged me or not. i am confused and angry but hopping for good. These stories are horrible. There is something wrong with the system. My husband and I were reported to CPS, get this. FOR A BLISTER ON OUR CHILDS FOOT. The worker closed the case immediately, but it is troubling when a teacher can report a petty issue, when I am sure there are many children that are being beat, raped, tortured you name it. When they wasted there time and resources on us they could have been helping a child in need. We are considering a lawsuit, as the teacher questioned our daughter after the conversation with CPS, she did not follow proper procedures..the conversation was private. Any comments And Gob Bless the innocent families Reading this brings tears to my eyes ,,my feiance has been in jailwaiting trail for almost 6 months ,we have a 2 year old and now a 4 month old , when i frist started dating him his x girlfriend was very jelouse, she had a little girl(3) who thought of my man as a dad and even know they broke up we would have her (babysit ) alot her mom was on drugs and the little girl always wanted to come to are house ... well right after i had my son these false lies started coming out bout my man rapping her .. FROM THE 1ST time it came to are attention we told his x to take her to the doctor . well she never did and we never heard from her or the lil one for over a year ,well all the sudden a hole year latter he is being chargeed , and pretty much just cause that little girl said it means he did it ... i mean all they doctors reports say she has never been raped but some one has convinced the lil one in to thinking this shit happened to her .. so i am praying that god lets the truth come out cause i cant loose my babys dad over a lie my youngest has never even got to touch her daddy , I am so upset and the worst part is thatlil girl is for the rest of her life gonna think he did this to her!!1 man i am scared but shit he didn't do anything to desever all thus Last night CPS came to my house. Since my husband and I had just finalized a step-parent adoption to my son, I assumed she was there to do a follow-up. I was wrong. She was there to investigate a report of abuse. My son had at some point, in some manner, told his teacher or nurse that his dad (speaking of my husband)had punch him in the head and knocked him out... When she questioned him, my son went on to tell her that I abuse him. I yell and spank and push him down, and throw him across the room, and he gets sent to his room for weeks. All for the tiniest of infractions. When it was my turn to be questioned I was all sorts of confused, and distraught. I explained that my 9 year old is extremely sensitive. He often feels that the world is out to get him. He has had a lot of trouble with bullying at school and no one seems to want to listen. His side of the story is always "they punched me, they kicked me for no reason. and when i tell the teacher, they run up and tell her it was me. so i get in trouble and they get away with it." (his teacher apparently told him she was tired of the tattling and if there was no blood or guts she didn't want to hear about it. I also told her of an incident a few days earlier when my son came home with all his notebooks and had cleaned out his desk. I was looking through his work, seeing what they do, and came across a journal entry dated months before. "My dad punched me. I don't know why. It really hurt. For no reason." When I questioned my son, he said he was "improvising". That he was writing a story and was making it interesting for his readers. O.O I continued on with how I try my best to raise him. I was abused as a child and try very hard to not let any of that take place in my own home. Then my husband's turn came. I didn't hear most of their conversation, as I wasn't supposed to. But he did inform the woman that (and he has a much better memory than I do) he remembers an incident a few weeks back where my son came to him crying that I had hit his head off a chair. And when asked to further explain, it came out that I had given his a swat on the back of his head and he turned so quickly to get away from it that he knocked his head on the dining room chair. I am so lost right now. I don't understand why my son is so upset. I love him. I hug him everyday. He is well taken care of. I don't know how to explain the difference of abuse vs discipline to him. I tried. I told him a story of once, when I was about 15, my dad was so mad at me that he beat me with a wooden spatula for 20 minutes. Leaving black, and I mean black, bruises on my arms and back the size of grapefruits. I explained that there are families that don't all sit down to dinner together. Families that don't have food. I didn't want to scare him, or get his pity. I need so desperately for him to understand the difference. And the consequences of what could happen from the story he told. When I explained to him that he could be taken away, he didn't seem all that bothered. But tears streamed down his face when I informed him that my husband and I could also go to jail. Why does he think his life is so terrible? He has everything he needs. I would say "spoiled" but that always has bad connotations with it. Before now, I just thought he was privileged... Maybe his is spoiled. Any help or tips on how to get him to understand? And ideas on what to expect with CPS? It still hasn't sunk in. How likely is it that I could lose my child? I ALLOWED MY 13 YR SON TO FIGHT OTHER 13 YR WHO WAS THREATINH/HARRASSING HIM. WHEN MY SON WAS THROWN DOWN , HE WAS INJURED WITH A BROKEN COLLAR BONE, NO INJURIES TO OTHER BOY. WHEN WE GOT BACK FROM HOSPITOL POLICE SHOWED UP.AFTER WE EXPLAINED WHAT HAPPENED OFFICER ASKED ME [MOM] TO STEP OUTSIDE, THEN ASKED ME "IF I WAS THERE?" I SAID YES, THEN HE HANDED ME HIS CARD, WITH A CASE # AND SAID IF ANYTHING I CAN BE CGARGED WITH CHILD NEGKECT/ABUSE. HAS ANY ONE HAD THIS HAPPEN TO THEM???PLEASE SOMEONE GIVE ME SOME ADVISE????? Child abuse a very serious crime I got very I'll and sacrificed my marriage trying to defend a false allegation of the same when my son started your school. Let's hope I don't have to do it again with his younger brother. So by the 3rd social worker and just about everybody refusing to make a phone call to my sons scout leader who was the only person I had any support from a mental health worker who wanted to take him into care on the strength of a pastoral log (teachers notes) before she even met him I lost the plot with them all put together a number of recordings I had made that proved my innocience and their incopentance, took it to the head of the prior school who it would seem sorted things out. School head who's staff led my autistic son into making the allegation wrote to me unsure what he would be apologising for. My advice to anybody ever slightly worried about being in the firing line is to put up some cameras record every meeting and put everything you need anybody to do in writing. Then put it together on a cd send it to the in this case the head of the school and advise him/her you might put it on the web then they will treat you with some respect. They don't talk over my head now. Beleive me I was a lucky one who saw it coming in time to do something about it a lesson any abuse victim will tell you they might wish they had done as a child. Abused becomes abuser not always true some of us learn from our experiences and do our best to protect our own children from the same. Just google berrow wood school. (now closed by the authorities) DOES ANYONE HAVE A THOUGHT ABOUT ABOVE STORY BY "CHRISTINE" IF THEY THINK I WOULD OR WOULD NOT BE CHARGED WITH CILD NEGLECT OR CHILD ABUSE??? THANKS my partners ex is accusing me of smacking and pinching her son! she has alo said that when we used to have him overnight and my partner went to work she said i burnt him with cigarettes.. i cant believe the lies that people would make up about their own chidren being harmed, i am a care worker and i have 2 beautiful daughters, i just need to know what is going to happen next, she says she is going to see her solicitor so he cant come to our house anymore because she says he is at risk of harm from me. am i going to lose my girls? im so scared iv been crying myself to sleep at the thought of losing them. please can someone give me some advice because i really don't know what to do I have two kids one is 6 and the other is 9 the littlest one pees her pants alot and she has premature altisum. I was called on to youth and county services last year in 2009 by my school saying my kid smelt like urine. I told the case worker that she has a problem holding her pee that we get her good nights and she washes 2 times a day there is food in the house and they wash daily and clean clothes. They sent me a letter saying the case was closed and now in 2010 i moved to a new area in my county but the same county services they came out to my door on 6-10-2010 saying i was reported of child neglect they told me my child smelt of pee and not clean. I told them the same thing she washes 2 times a day she wears good nights to bed there is food in the house to eat she is not beaten or neglected she has a bedtime and she is loved and cared for they told me i will be receiving a letter of exucution of cancelation letter and he told me that the case is closed. The first time he just showed up to my door un exspected i left them in to see the house and the kids and this time they called me i was surprised he told me the same report was made. but he talked to the kids and i was close by and asked them questions like do you go to school and eat and have a bed time they told them yes and that is when he told me that no more investagtion is going to be made should i be worried about this or no. My 6 year old she had accidents at night time and she pees i told them that she has a inconsadence problem and that she pees at night time. He told me that was understandable. what should i do after the letter shows up to my house. please let me know what i need to do to get my self in the right path? TO UNKNOWM--GIVE YOUR DAUGHTER VERY LITTLE TO DRINK LAST 2 HOURS BEFORE BEDTIME.AT BEDTIME ALWAYS HAVE HER TRY TO PEE. ALSO I WOULD--GIVE HER SHOWER/BATH EVERY AM BEFORE SCHOOL [IF SHE DOES PEE] I was chraged with two sodomies of a child under twelve and rape of two children. I finally proed my innocence when the state attorney generals office dropped the charges. I was unable to get discovery in the case until the tenth month of incarceration. The therapist in all of this drove my kids mother to child protective services in order to get me. I also had two sister in laws who are drug addicts who want me and my childrens mother to break up. They spoke ill of me. I do not want them to have contact with me or my kids because of their lifestyle. I am still fighting child protective services. They labeled me indicated even though the state attorney generals office refused to prosecute the case. i HAD ASKED MY SISTER,ANGELA HERMAN OF AZ, IF SHE COULD LOOK AFTER MY SON ANTHONY FOR A MONTH SO I COULD GET BACK ON MY FEET, SHE SAID SURE, THAT'S WHAT FAMILY'S FOR, WELL MY SON WAS NOT WITH HER FOR MORE THEN 3 DAYS, I CALLED TO TALK TO HIM AND MY SISTER WHO I ASKED TO WATCH HIM, AND MY MOTHER, WERE ON THERE WAY TO TEXAS TO GIVE MY SON TO HER DAUGHTER, THEN CPS CAME TO MY DOOR SAYING I ABANDONED HIM AT HER DOOR, SHE CAME TO FLAGSTAFF AZ, TO PICK UP MY SON, THEN SHE HAD SAID, I BEAT HIM SO BAD THAT HE COULD NOT TALK, ALSO SHE PUT IN THAT MY SON IS RETARDED, CHRISSY JOHNSTON, ANGELA'S DAUGHTER THAT ANGELA GAVE MY SON TO, ALSO SAID I BEAT HIM SO BAD THAT HE CAN NOT TALK, I FINALLY HAD THE MONEY TO RENT A CAR TO GO TO CALIFORNIA TO PICK UP MY SON, SHE DIDN'T TELL ME SHE WAS GOING TO MOVE TO CALI, BUT SHE DID, I WENT ALLL THE WAY TO CALIFORNIA AND SHE ACKTED LIKE I WAS TAKING HER SON AWAY, MY SISTER FOUND OUT I WAS PICKING HIM UP, SO SHE CALLED CPS, SAYING I WAS HIGH ON METH, CHRISTIN JOHNSTON ALSO CALLED CPS SAYING MY SON WAS IN DANGER, CPS TOOK IT AS IF I WERE THE MOST SCRUD UP MOTHER ON METH, SO BY THE TIME I EVEN WAS IN THE STATE OF AZ, MY SON WAS A MISSING 5 YEAR OLD WHO WAS IN DANGER,SO CPS WAS LOOKING FOR MEAND MY SON, TRYING TO SEARCH MY FRIENDS HOUSE CAUSE MY SISTER CALLED THE COPS SAYING I WAS THERE BEATING MY BABY, CHRISSY CAME BACK TO AZ TO GET MY SON CAUSE CPS WAS GOING TO PUT HIM IN A FOSTER HOME IF CHRISTIN DIDN'T HAVE HIM IN HER CUSTODAY, TILL THIS DAY I DON'T KNOW WHAT THE REPORTS ARE CAUSE CHE CPS WONT TELL ME, MY FAMILY GOT CUSTODY, EMERGANCY COUSTODY FROM THE COURTS, MY SON IS SO MAD AT ME, AND I AM SO HEART BROOKIN THINKING HE DON'T KNOW WHY MOM KEEPS GIVING HIM AWAY, MY SON IM NOT GIVING YOU AWAY, THERE STELLING YOU FROM YOUR MOMMY, AND I DON'T KNOW WHY,I WILL FIX IT I HOPE WHEN I GET MONEY TO GET A LAWYER, HOPEFULLY THEY DON'T TAKE HIM AND PUT HIM IN A FOSTER HOME AND DESTROY HIS LITTLE MIND, THIS HURTS SO BAD, I CANT WORK, CANT SLEEP, I HAVE NO LIFE NOW, BUT YOU ALL WILL PAY, I PROMIS YOU,,, TERI L, ADAMS My brother has been serving time for child molestation, when no proper investigation of any kind was performed and the supposed victims father had even said his daughter had been lying to get attention. There was no physical evidence of any sort at the hospital and I know for a fact her own father had laid naked in bed with her, I witnessed this myself. I'm so angry that my brothers life is ruined and the truth doesn't seem to matter one bit. The police of Gwinnett County doesn't care that he's innocent, no one seems to besides his family. This is ridiculous, that so many people can lose their children and their lives because people assume if a child says something happened , it's automatically true. I would think by now in the USA people would understand things aren't always as they seem and enough people would want the right thing as opposed to a knee-jerk reaction thing. The frustration with the law and with ignorant people I feel far surpasses anything I ever thought possible. I would love to know and understand why the same laws that apply to murderers, real rapists and serious drug dealers don't to supposed child molesters. In this Country they are suppose to,period. This BS about a 1,000 feet is just that, BS. Where in God's name are these people on the list suppose to live? They should be able to live like any one else in this great Country of ours! I don't think we are so great any longer, we have thrown out what made us great for hysteria. We should all feel real good about that! If I sound bitter, angry, cynical.........whatever, I am! Wades lawyer was pathetic, all he cared about was getting through it, since as he pointed out, he could make a lot more money on someone that had money. He didn't even try as soon as the prosecution made an offer he advised Wade to take it, what the hell? In my opinion since they came out with the offer immediately,I would have told them to F off, my client wasn't taking it, since they knew they had nothing otherwise why make the offer right off the bat? No physical evidence, her own father saying she had been lying for attention, no proper investigation and yet my brother rots, wow..............what a great place we live! I was wrongly accused of child abuse and this is being on my record ever scence this happened and is affecting me greatly and I would like to sue the people who did this to me and after i get the money i would gladly pay any lawyer who would help me settle this immidietly. ok I was leaving with my wife and her kids 3 adults and 1 kid this adult one have hated me for years i have being with them for 9 years and then it happened one of the adult doughter of my wife who also wanted me out of the house for reason I know not ( because i never gave them any reason to hate me )and i was never alone with any of her kids never. so I think they saw no other way to get me that by telling my wife's grand doughter to lie to the teacher in school and say to the teacher that I was having sex with her jesus a 3 year old whom i grue to see as my own anyways the girl was taken to the doctors and she was given a full check up with regular doc and feranciscs they found nothing at all neither of them and i mean nothing anyways i was arrested and while all this investigation was going on i was in a cell waiting for the results until morning the next day when the police officers let me go for lack of evidence i did not even go in front of the judge, yet I have this on my records iwas devestadated, humiliated , shamed . now my wife the mother of this individual who did this to me is still with me because my wife believed me and know that i would have never done or do anything like this i tried to talk to the da and he would not and he would not want me to go to court the da let the case open for as long as he could to get pay from it i think i even had lawyers talk to him and after that the same lawyers didn' want to help me I need help please anyone who can help me get this of my back so i can go on with my life please help me I want to sue this people and clear my name from all this and i know that a law suite is in order i will pay gladly after i get this money but i need a lawyer 559 w 191 St Apt 21 nyc,ny 10040 /1917-529-6110 please help me some one please. I am a physical therapist I was accused to have touched a child inappropriately during one of my session. We operate in a very open area and there is hardly any close and confined space that this event could have happened. All the time I was with other people while seeing the child. I don't know what the child has said to his parent but they have contacted the administrator and filed a case against me. I don't know what to expect and i don't know what to do. I only saw the child 4 times. One is together with his parent. need help.. Im from Ohio. My wifes family has been against us being together ever since we got together. Her mom wants her living with her and hates that she moved in with me an hour south. When we got married, childrens services were called about an hour after we said I do. So they came and told my wife she had to place the kids somewhere, which was with her mom. She went down to be with them till after the investigation. Well, they found it unsustainable but within the first couple weeks of being at her moms, my wife got with her x husband while she was pregnant with my child. I filed for divorce. When she broke up with him, she wanted me to drop the divorce, this is mainly due to the fact she wasn't going to be able to get full custody. I didn't take her back. But 7 months later, my son was born, my heart melted and I took her and all the kids back. I dropped the divorce 5 months later and the same month on our anniversary, children services were knocking on our door again. She signed to let the kids go to her moms again, went to be with the kids again, and now a couple weeks after being there, she is dating another guy.... again.... Well needless to say I don't trust her or her family or the situation at all. I obtained a lawyer. The investigator said that all she needs to do is talk to me, get my side of the story and she could close the case. I wanted to talk to her cause I have nothing to hide but my lawyer doesn't want me to talk to her until he has a better understanding of what was said. They were checked out to be physically fine but whatever the kids grandmother put in their heads has dragged this investigation out for 45 days now. My lawyer sent letters to all who are involved but he hasn't gotten anything back yet. I have to file for divorce agagin. I feel like she has the most to gain. Its like she got back with me just to have me drop the divorce, used the alligation as an escape route and a way to sway the custody in her favor. She called me wanting me to talk to them and get it over. She said the investigatior told her all they are doing is waiting to talk to me to get this over. My lawyer wants to file something in court to have them take jurisdiction and attempt to shut the safety plan down because I haven't seen my son in 45 days and it is killing me. But I don't want this to go to court. The kid that Im being accused of whatever with is 4. I'd like to just talk to the investigator and get it over with. If you don't have anything to hide why not talk to them. I just had a CNS worker show up at my house two days ago with accusations that I smoke pot and drink with my 15 year old son, who i might add is currently on probation and testing clean for the last 2 years. SMH if my son had tested clean for 2 years straight now how is it possible that he is doing drugs with his mother. I am currently going to school studying criminal justice and plan to enter the next police academy class so why would I be doing any type of drugs. I had informed the worker that currently I am going through a bad break up and that my ex left and left me with a mountain of bills and back rent already owed and now I am stuck on unemployment trying to pay these off. Fortunately I had lots of food in my fridge as I had just gone food shopping, my house was clean and I grabbed the cup from her right then and there and submitted a sample for a drug test. The question I have is with all the proof of no possible drug abuse in the home how long can they keep this case open. My son was convicted of child abuse in 2009,a class 5 felony. He is currently serving a 1 1/2 yr sentence do to a 5 yr prior drug felony. He and his wife were forced by CPS to divorce. The mother was accused by CPS " failure to protect her children". She was not home at the time the baby was injured. Her mother(grandma) made sure to lie about the relationship of the two. CPS is on the side of the grandma! Grandma has her two children. During the court hearings (which took 2 yrs of hell and $$$) the couple had another baby. The grandma does not know of this child( She suspects there is something going on). Mom is a good mother to her children with no doubt , the grandma has guardianship of the two children. Mom gets visits every weekend.! I have no idea if my son is aloud to see his new baby in prison. The mom was told by her attorney she heard a rumor of her having a baby. She is not on good terms with the attorney. She owes $$ and is bankrupt from this whole situation. My worries now is Can CPS come in and take this baby? The baby is not in harms way. Can anyone give me their feed back? its been almost 2yrs since my children have been gone. i have an 8yr old daughter and a 3 yr old son and a 16 month old all 3 are in foster care. my daughters school notifyed dss about her being sexually abused the day that this was reported i had just taken my daughter to a doctors appointment the school was complaining she had redness between her legs come to find out she had an infection due to getting a bubble bath she was examined down there there was nothing pointing to abuse.my x husbands also in the picture he pays child support and we have joint custody of her. he doesn't care about our daughter hes always yelling and screaming at her. the day it was reported is the day i lost my children i was also 5 months pregant carrying my boyfriend child.i took my daughter to cac to get interviewed and iwaited there it seemed like hours finally i got answers they said your daughter accused your boyfriend and her father and some other people of abusing her they told me since i couldn't protect her shes being placed in foster care then they said there taking my son to who was 15 months old at the time. after my children were taken they came to the house and did a forencic investagation collected everything even took the computer well almost immedantly we hired a lawyer to get our kids back he cost a fortune. a week later my boyfriend took a poly test and passed then her father took one and failed her father admitted having sexual dreams about his child but he was never arrested for it. to this day they cant find any evidence pointing that she was abused by us. and the most screwed up thing of all is the state is giving her father full custody and trying to terminate my rights as a parent so they can adopt my 2 boys. i have spent over thousands of dollars and delt with heartach especially just to see your children for 1 hr a week. these people have ruined my childrens lives just for there own greed. ill never stop fighting for my children i will prove my innocence and that this system is corrupted. here's the thing. My boyfriend is a drug addict currently recovering in a rehab facility. He has been there for 3 weeks, and dyfus is now focused on me for some weird reason. The person who called (spencers mother) Dyfus, told them that i am an amazing mother, and that they just wanted spencer to get help and that i never put my child in danger. I always have food in the house, diapers, and my child is happy and healthy and progressing normally. So do i have any rights? I mean, i purposly skipped an in home appointment today because im so tired of this. Why do they want to come by once a month? Not only is it infuriating to me that they come here and scrutinize everything saying the baby runs on his toes (which he dosnt) and should be drinking from a cup right now (my decision) but i don't like the neighbors seeing a dyfus van pull up, its embarassing. Spencer was the problem, and he went to rehab on his own, no one made him, and hes is not here and wont be here for 45 days, so why am i in question now? I seriously don't want anything more to do with dyfus, and i called today and left a message that someone call me with a reason a legal reason why this needs to be kept up, because i said im not interested in participating in these visits any longer, and i stated that i was going to search for my legal rights online...does anyone know where i can find them because im looking, and i cant find anything. by the way, i left dyfus a message tuesday night, and its thursday night...i havnt had a call since. I don't know weather to be relieved or worried. i keep imagining police knocking my door down in the midle of the night and yanking adon from my home. One time I watched my little cousin for my uncle and when he came back. My three year old cousin out of know where started crying. She wouldn't stop crying so he accused me of abusing his daughter. I'm still hurt over it because I would never do anything like that to a person. Well, it looks like Im an a big truble. After reading these story it look like hell is waiting for me. My step douther acuse me of molesting her, and the whole familie is on her side. But Im inocent, and the go a fight on their hand. i am really scared me and my mom fight just like any other teen and mom sunday she threw a salt shaker at me and it hit me in the nose social services went to my skool to talk to me this is the second time in 5 yrs that my mammaw has accused my mom of child abuse im fourteen and fear that i may be taken away from my mom and put into a foster home what should i do Hi my son is 7 years old and he is being accused of assult against my boyfriends 3 year old daughter she is saying that he touched her bits down below my son has two sister's aged 6 and 4 my son would never do anything like this how do i go about it? iam do worried my kids maybe taken away :( This was a nighmare, to make a very long story short. I had 3 kids by the time I was 19 my ex husband was in the navy. My 1 month old was hurt bad. I had just put the kids to bed for a nap well thought it would be okay to take one of my pain pills for the c section I had that just would not close. I feel asleep, woke up to my 1 month old crying and went to see what was wrong she had bruises all over her face. I picked her up and rushed her to my neighbors to get a ride. Bottom line is my 2 year old did it. When asked he stated he was playing with her. Well they did not believe that. And stated that I did it and stop trying to blame my son. They wanted me to take a polygraph my lawyer said not to because of my cp. So I ended up jail for 3 months my kids get taken from me I was never in trouble before not even a traffic ticket and could not even get a OR from the courts. I wanted to take it to trial being 19 and scared my defense lawyer told me it was a supid move and that I could await up to a year before going to trial. So I asked him what I should do? he said take the plea bargin and you will be out today. So I see my son 16 years latter and he said he tried to tell them the truth and they still would not believe him. My daughter that was hurt turned out great she is smart and pretty and I guess I have to be happy with that, then I am. To the people out there accussed of an injustice do not cop out like I did because I did not know the system. Fight and try to get yourself a paid lawyer money will and always talks. hello i just had my fourth kid she has down syndrome and now my boyfriend is in jail because of my sister. she said he was molesting and bearting my kids so i got my kids takin away and lost them to the one who called! it is costing his family 30,000. and mine 15,000. She even called the police and dhs and told them she lied and they don't care! please pray for my family As I scroll down the page reading story after story about how DCF has broken up homes and invents child abuse cases to justify their existence, I realise parents need to ban together and fight this destruction. An Anonymous phone call was made to DCF (coincidentally on the same day I filed contempt of court charges against my ex). This retched person was making police reports while I was at work, planting evidence in my bedroom, and poisoning my child's mind against me. The caseworker assigned seemed to take pleasure in saying things to me like "your daughter wants nothing to do with you", and you have an alcohol and drug problem, you'll never see your child again unless you take a drug test, which of course she never ordered, but I always submitted to. You are not innocent until proven guilty when you are falsely accused, it is a broken sick system where anyone can make any kind of accusations against anyone, no investigation into the truth is needed. This dispicable caseworker lied to me about almost everything and failed to cooperate with me in anyway. There was not a shread of evidence to anything I was accused of. I haven't seen my daughter in over a month and don't expect to for a long time since the court granted the "real child abuser" custody, just because he claims I hit him and my daughter, of course there being no prior accusations for the almost 16 years he was out of her life, and to this day I have to fight with everybody for telling the truth, no-one believes you. I don't know if this will help, but I filed a complaint with the Inspection Generals office for Florida, against the caseworker for unprofessionalism, lying, and for downright incompetence. I hope this gets me somewhere and I would encourage all of you to do the same in your state. This is a nightmare no good parent that loves their child should ever go thru. The real crime that is being committed here is the system that endangers children is the very one that is suppose to protect them. I am going through this battle.I split with my ex-husband back in may and he has been after me since then.Well my current boyfriend had to leave home because my ex husband told cops that my boyfriend sexually abused my daughter. but the thing is he has not been around for weeks or even spoken to the kids.Now we are in different counties and the kids are grieving and depressed.My daughter even told us he did not do anything to her. all the tests come back negative. But the state is taking their time and destroying us even more. I hope the father goes to jail for the suffering we have been through. I think its bull crap that we have to go through this we all most had everything we ever wanted but now my boyfriend lost his job and really depressed because he can't be around us.I don't think no one should have to go through this. My daughter and our family is currently going through a nightmare in the RI Family court system due to my grandchildrens' doctor and her staff to set appropriate appointments and to humanly understand that right before a holiday that people close "shop" early and felt the need to call DCYF on my daughter because my daughter didn't do as instructed (because of an enlarged abdomen with my granddaughter...which after a battery of test have no conclusion as to why this occurred). The doc sent my daughter to an x-ray lab that closed early the day before Thanksgiving. My daughter called the office to make them aware of this and the docs office said Friday would be fine...I guess the doc had 2nd thoughts, called DCYF and sent a rescue to my daughters' house where they transported her to the hospital. I took my grandson that night while all this was going on. While my daughter was being "prosecuted" by the hospital staff, they ran a battery of test on my granddaughter. They found that she had 3 previously broken ribs, and a previously fractured leg. We suspect that the ribs was caused by a television set falling on her 5 months previously that my daughter took her to the hospital and they NEVER did an x-ray (mind you she was a year and a half old and the TV set was a 19" older television (about 43 lbs-my daughter weighed it)She had it on a nightstand in their playroom and my grandson knocked it over. Also my granddaughter fell down a flight of stairs a month previously due to a faulty door latch on her apartment door. Her landlady who lived down stairs heard her fall and went to her. My daughter and her checked her out and she seemed ok laughing and playing but favored her knee the next day and was ok after that...no bruising, running around playing and eating like all children do. My grandchildren are now in foster care. My daughter and her ex boyfriend settled the civil suit with DCYF and is undergoing the re-unification process. But the AG's office is still pushing to send them to jail and for them to NEVER see there kids again! They were NEVER arrested for any abuse! They pleaded nolo to simple neglect because she had missed 4 previous doctors appointments in the civil case. This is a travesty of mega porportions! I have clearance to get my grandkids into my custody but at the time my daughter was on welfare, lost her welfare, so she lost her apartment because of over-due rent and has been living with me and trying to work a full time job, night school, drug test (court ordered), and visitation once every other week. To me, and I know my daugter and her ex boyfriend, if the state knew me, they would know that If I EVER witnessed my daughter or her ex EVER harmed these kids, that the wrath of me would be far worse than any court could provide. This is such a waste of taxpayers money on accidental coincidences that I have ever seen! We go to trial in November she's supposed to get the kids back in December...I don't forsee that happening... What to do...this is very common to be guilty of this and have to be proving yourself innocent. Nuts. My sister-in-law Laura, falsely accused her father George Martin of raping her when she was a child. She had 'recovered memories and stopped speaking to the family for seven years. Now she says she lied and wants a relationship with him again. But she is currently accusing her brother and his wife of sexually abusing their children. Why are narcissistic drama queens allowed to commit crimes like this and not be prosecuted? hi, I just wanted to say that I myself have been a victim of child abuse, and reading all your stories about being falsly accused is horifying and it is sick to make a false statement the authorities are doing the best to protect all children, I myself am persuing a man through court who groomed me and assulted me but i have very little evidence, this man is a serial actacker and no body has stopped him yet so I just wanted to say that although you and your families have been hurt by these isck people making the claims please just keep in mind that the police are there to protect the kids at the end of the day Thanks On September 24th of this year my stepson, in front of witnesses, strangled my dog and almost killed it if not for my daughter interveening. I proceeded to spank him on the butt for his actions. This is a kid that constantly gets into fights with other kids and is constanly bruised from it. On Sept,28th an officer and cps worker came to my house because a woman at his school saw a bruise on his arm and stripped searched him in class and found bruises on his back. Now I have been accused of abuse and my stepson and husband ( his legal father) are not allowed to live with me. My husband was told that if he brings his son around me then he will be taken away from him. My life is in total disarray and I have been arrested from this accusation, almost lost my job, my family had to bail me out and I am completely humiliated in front of my community. Where is the justice for the parents wrongly accused. This kid has school documentation of severe behavioral problems and prior to living with me had no structure or discipline. So now what happens if I am found not guilty, are the cops gonna say," oops,my bad" The damage has already been done and my family is split apart. Does anyone have any suggestions. I live in New York State. on may 26 2010 my daughters father who had just recently came back in to my life was visiting his daughter who at the time was 9 months old i have 2 older children sons 13 and now 11 the us marshalls BROKE IN TO MY HOUSE WITHOUT A WARRANT OR TELLING ME WHO THEY WERE THEY HELD GUNS AT ME AND MY DAUGHTER TRYED TO MAKE ME LIE DOWN ON THE FLOOR LIKE A DOG MY DAUGHTERS FATHER HAD WARRANTS FROM ANOTHER STATE THAT WERE NOT FILED UNTIL 2010 BUT THEY SAY IT HAPPEN IN 2003 THE US MARSHALLS WENT UPSTAIRS HELD A GUN AT MY 65 YR OLD MOTHER AND ORDERED HER DOWNSTAIRS THEY THEN WENT TO MY SONS ROOM KICKED IN THEIR DOOR AND WOKE THEM UP WITH HOLDING GUNS AT THEIR FACES AND YELLING AT THEM TO GET DOWN STAIRS my younger son is austic and has a hard time understanding people esp when you wake him from a dead sleep my daughters father was arrested and taken away 4 hours later they came back and arrested me i left my children with my mom and brother and my daughter went to stay with her other grandma they were being cared for they had food clothes and a place to sleep they were clean 2 hours before i was to be released from that hell hole dcs came to see me they told me the kids had been placed with my brother all the kids they said my mother nor i could go home why ? because i had been taken away from my mom for a short time back in 1983 i was not allowed to see my children i had been in there 8 days and the only thing i could think of was seeing my children holding my baby girl close to me the next day we went to dcs that was the first time i had seen my children in 9 days i didn't hardly get to talk to them i was watched like i was some kind of monster and i entered in to a perm plan they took my children from my brother placed them with another family member then they were placed in a family in another town about 2 hours away from me as to date i have completed the perm plan and i am not allowed to see my children my daughter is now 14 months old i have been told that my children were sexuraly abused and i knew about it my mother knew about it and my brother the problem being is that part of the perm plan was that i went to all my childrens doctors appts i asked the doctors to check and make sure nothing had happen just because of my daughters fathers charges i just wanted to be sure and i didn't trust dcs so i wanted proof the reports all say that no signs of sexural abuse happen when i said this to dcs guess what i was told oh there wouldn't be any evidence really ? there wouldn't be i am sure i am not giving up the fight but i am told that they may charge me on the failure to protect law bring it on you already put me in jail took my children what else can you liars do to me This is why Children should research about Child abuse and child rights before secretly acusing their parents i was accused of aggravated criminal sexual abuse in the state of Illinois, my step-daughter made accusations that i had gone into her bedroom and put her hand on my penis. I was arrested at work, my wife left me and my own 2 yr old and 3 yr old sons were away with their mother for almost two months. My wife came back to me on Christmas of last year once she received certain evidence. She says she didn't beleive it at all but had to support her daughter. Well i was charged, arrested, i had to hire an attorney for about $8000.00, the DA has made a couple of offers to us over the last year and myself and my attorney said hell no, this is going to trial. I was ordered out of the home i pay for and to have no contact of any kind with my kids. I am a very loving father that gives everything i have for my family. And come to find out my 13 year old step-daughter was sleeping with a 20 year old man at the time of this accusation and clearly wanted me out of the picture. Long story short i went to trial with a 7 man 5 woman jury to find me not guilty it only took the jury 15 mins to deliberate. I still have a ways to go though, as DCFS has found me indicated of this no matter what the State Court finds....how can this be??? How can they without even talking to me or questioning me or being at the trial pass this kind of judgement?? I was tried and found NOT GUILTY!!! I have lost 30 lbs in the last year just due to stress....This whole DCFS system is the most terrible system i have ever dealt with. I would never touch any kid in any appropiate way...this still baffles me that i can be found not guilty in a court of law by a jury and yet indicated by DCFS. My wife and I and my two little boys do live happily together nowm, but i need to know how i can go about getting DCFS indication un-indicated. What a bunch of hose shit... My step daugher was mad because I didn't want her boyfriend over that weekend. Just because I thought she needed to spend some time with her friends. She told her mother horrible lies. Her mother told her to report it to the school. I blame the mother for she knows us very well and should have spoken to us first. CS came and found nothing and apparently step daughters story changed several times and she said it was a year ago her father hit her. How long does it take to get a letter from them letting you know it was unfounded? The caseworker said it was unfounded. It it over yet or will we keep having to deal with this? Hello, i was in a custody battle in 2008 for my son, his grandparents had an emergency order of protection put against me using false accusations , they were able to take temporary custody of my son and i could not see or contact him. it took me one month to obtain a lawyer to have it dismissed and some form of visitation established, i then filed to get my custody back Feb 18, a deposition was set for the following April 24 and our actual court date for may 8th but at the desposition there whole case fell apart and they wanted to settle everything and not have the court date so i agreed that they could have visitation every weekend and a few weeks in the summer, I was awarded with sole custody care control and education of my child. i fear they will try and do this again, are they able to do such things and what can i do to stop them. In April I was falsely accused of 8 felony counts 6 related to sexual things with a minor and 2 related to furnishing alcohol. I was asked to come talk to a sheriff for an investigation which was a joke because he only talked to me for about 4 minutes. 2 weeks after that I was arrested. Spent a day in jail before my family got me a lawyer and bailed out. After we got the arrest warrant it states a friend of ours son who was there the night this supposedly happened as the kids witness. This person was never questioned even though I told them he was and they could have easily asked him and had it all cleared up. So far the case has not gone anywhere but it looks like this month it will be taken to trial. The D.A. tried to offer a horrible deal where I would accept the 2 lowest felonys. The lawyer and I agreed it was ridiculous and I certainly would not accept guilt for something I didn't do. What makes us all mad is that besides talking to me all of 4 minutes there was no investigation. There is no medical or physical evidence and I have witnesses saying it didn't happen. My lawyer says sadly this happens a lot in this state which is Kansas. If it weren't for my friends and family and church family I don't know how I would be getting through this. After I go to trial and this kids lies are proven we plan on suing. They can never give me back my dignity and I have anxiety attacks and depression because of this. I want them to know lying is not acceptable. I think my step son's preschool teacher might try and accuse me of abuse. I have 2 boys one is 2 and half and the other (which is my step son) is 4yrs. They play rough as all boys do. While they were playing in the morning, my oldest fell on this big toy truck that they have. He told me he had jumped off his bed and landed on it, he even gave a full on demo of what happened. It did leave a reddish bruise on his lower neck. When I picked him from school the teacher was questioning me about it and I told her what he had told me, (obviously I wasn't standing in the room when he got hurt). After we got in the car he told me that they are going to take a picture of it when he goes to school tomorrow. Now I'm worried that they are going to try and accuse me of child abuse. I don't know what will happen, will social services show up, are they going to try and take my kids??? I don't know what all happens with a first time report so to speak?? I live in colorado, does anyone have an idea at what I might be dealing with?? Please Help WorriedMamma I can't imagine them taking your kids for a mark on the neck. Just be honest with them, don't stress. They have to deal with real issues like starving kids and abused kids. Don't even worry about the teacher or whatever she is. Make sure you tell her that photographing your child without your permission is against the law!!!! Dyfs has been in my families lives for the past 2 years due to an anonymous phone call saying i was on drugs and my wife was going to kill our kids. Two quick drug tests for me and a psych evaluation for her and everything should have been over because we proved the call to be false. So they began to pick anything they could to stay involved. The house is messy, the kids aren't respectful, they need us to give them counseling. whatever they wanted to say just to not close the case. Well finally i screwed up and kicked my son in the butt when he refused to get ready for school for the second day in a row. I immediately regretted it and knew i shouldn't have done it. In the two years we had been dealing with them there hadn't been any abuse accusations. But this one mistake has ruined my life and i would say ruined my families too but i have not been allowed to see or talk to them in the past 15 days. Dyfs put my kids and wife in a safe house. They called the county prosecutor and had him have his office arrest me and charge me with child abuse. when they took them they told my father-in-law that it would be less then a week until we would bee in family court. Well up to 15 days and they still haven't even filed with the court yet and at on point they tried to tell me that there was going to be no court because dyfs would decide. I fought that and supposedly now they will take this to court but when is the big question. I tried to start therapy at the place dyfs told me to go but since i told them i didn't want them to pay, they refused to tell me or my therapist what direction they want us to take the therapy. almost like they want me to fail. I finally agreed to let them pay because i wont be able to afford it as often as i need it and they wont let me see the therapist that i'm comfortable with even though he works for the office they are sending me too. i have to see the one that they want me to see. Sounds like they really want to help me get better, doesn't it? haha. And now the latest thing that i have heard from someone that did talk to my wife is that they have already tried to talk her into divorcing me, and when she flat out said no to that, they are now telling her that she has to file in court for full custody and that if she refuses to do that they are going to remove the kids from her too. Maybe im dumb, but that doesn't seem right to me. and not just from a moral standpoint but from a legal one to. i don't see how that could standup in court if it came out. maybe someone who reads this will be offer some advice or explain that to me. when they first took my family i called them to find out what they want me to do to get my family back and they listed three different types of counseling. I started the one on my own (the one who is now no good) and the other two i have made calls to try to get into. Im willing to do what it takes, but now im wondering if its all useless? Are they going to push through whatever they want without caring how hard anyone is trying, and with out caring that every individual person in my family is saying that we want to be together? Dyfs has become way to powerful and seems to do have no problem doing what they want no matter who it hurts. I understand that in theory dyfs is a very good idea. Having an organization who looks out for our young who cant defend themselves. in practice though they seem to have gotten away from helping families and at least in my situation seems to be more of a witch-hunt for me instead of helping my kids or helping our family. charged with a crime i did not commit falsely charged and convicted now i have to register as a tier 2 sex offender for something i absolutely did not do. i got divorced and became very succesful. my ex wife got very jealous,she had my daughter and stepdaughter make up a story saying i rubbed my penis up against my stepdaughter. i cant even wrap my mind around such a heinous and disgusting act,it makes me wanna puke. i got a visit from detectives,blew me away,agreed to talk to them(mistake) they distorted my story to a point of lieing. NEW HAMPSHIRE POLICE HAVE NO INTEGRITY! they wanted me to take a lie detector,if i passed i'd be cleared, i readily agreed knowing i'm innocent. in the meantime i contacted an attorney, he said absolutely do not take the lie detector,they are in no way accurate and are subject to the administrators interpretation. in other words if the police are allowed to give you a lie detector test it is gaurnteed to come back deceptive. POLICE LIE always have a third party administer the test. anyways i had a third party give me the test twice and passed both times. hired a lawyer,private detective. cost me 30,000 bucks for a crime i never comitted, this drug out for over 2 years all the time im wondering how my daughter whom i use to love so much could do this to me and if i was gonna go to jail for a heinous crime i never did. trial date was coming up--- at the court date right before trial the prosecuter offered me a plea bargain. drop the charge of felonious sexual assault and plead guilty to indecent exposure and lewdness,have to register as a sex offender for 10 years and 3 years probation--no jail time. i literally had 20 minutes to make the decision to take the deal. my spendy lawyer said it was a "VERY TRYABLE CASE" but he also said i was in control of my future right now---take the deal and know for a fact i wont go to prison --or put my life and future in the hands of 12 strangers in the jury trial. i had no clue of the ramifications that go along with being a falsely charged sex offender. i wanna puke. i took the deal because i know our justice system is corrupt. now 8 years later they change classifications on sex offenders and instead of registering for 10 years,like my sentence said, they say i have to register for the rest of my life. so they changed my sentence on me randomly. I WILL FIGHT THIS WHEN MY 10 YEARS TO REGISTER IS UP, my daughter has since turned 18 and has yet to come clean and tell the truth,i don't think she would get in trouble because she was a minor when she was forced to lie by her mother. i have lost my daughter,jobs,friends,family over this false charge. THE PEOPLE WHO KNOW ME KNOW IM NOT THE GUY THE SEX OFFENDER REGISTRY MAKES ME OUT TO BE How can someone live with telling such a lie,how can they look in the mirror and like themselves?? I HAVE NOT LET THIS BEAT ME AND I NEVER WILL CUZ I'M NOT THAT GUY. i am still very successful and my family is very well off. It's a shame my daughter doesn't get the chance to live this lifestyle people dream about. KARMA IS REAL OH IT IS the people responsible for this false charge will get theirs---oh they will someday I had my two children before marriage and theres no father on their birth certificates and two weeks ago my husband soon to be ex, after being away in a different country for a year shows up at my front door with cutody papers from a local judge and took my children. I haven't been able to see them in two weeks and went to court and showed the judge the petitions were written with wrong ( the last names and middle names were wrong for the children) and gave him the birth certificates as proof he made a mistake. my husband still has the kids and they want to arrest me for contempt of court for fighting for my children to stay with me.I'm heartbroken,angry and need help. I have no power. I have police reports of abuse and live at the dv office. I want my children back, help! I was arrested for donestic abuse of 2 kids:my 12 and 15 year old grand daughters. I had been hit,kicked,had heavy objects threw at me my them.Been cussed by them.I have told them many times to stop hurting me and to leave my home. They would not mind.I was taking Paxil,and have been for a very long time,I fought back against them and as I said was arrested.I am out of jail on bail and am having a hard time getting a lawyer.Please I am a 68 year old man who needs help.Can anyone help me? NJ DYFS is the slowest way to protect your children , they do not look in to facts i know this I reported the mother of my children for abuse { one was her splitting the head of my 7 yr old child open with a brush } they did nothing , not until I myself filed charges on the mother , why did dyfs do not a thing , the mother had filed for and got a FRO on me and in DYFS eyes no judge would grant a FRO to a good man ,, BULL CRAP the system takes in womens lies and lets good fathers and the children suffer , now that things are getting in to the courts the truth will be told and many witness,s will prove it . in the end why did the judge grant a FRO ? he simply asked the woman { are you scared of him } poof the beinging of the childrens and my nightmares , the mother then kept the children for 6 months even though there was a court order for every weekend parent time , and the court just warned her , now her lies are catching up to her. one thing i can say is NEVER give up on your children and always keep records of everything you do . people cant hide from lies they do catch up to you .what did the mother get sofar from her lies , her son dont talk to her , her older daughter dont talk to her , and the 7 yr old is almost out of the house to her fathers where she will be safe . and the mother will only be left with her new drug addict criminal husband who owes over 100k in back child support . All you people wrongly accused - - get a good attorney. They cost about 3,000.00 up but are worth your family not being split apart. Do not go with a court appointed attorney! They really don't care because they don't get paid much and they are forced by the judge to take the case they are assigned. I could give a link for this if you wish, but I commented on an anonymous forum about a girl who claims she hates her autistic brother, I commented to someone who wrote a hateful comment that they do not understand her (I also have an autistic sibling) and it is very frustrating having an autistic brother (I did not state anything about child abuse, I would never hurt my autistic brother) but another person who calls themselves "concerned citizen" claims that they've reported me to the department of homeland security and that they will subpoena my isp, I don't live in the USA. But I stress the fact that I did not say anything about harming my brother, only that he makes me frustrated sometimes. Anyway please reply to me and inform me of what could happen, I'm 18 I live at home with my mother, father and autistic brother, we are very poor. Please help me. My father has been accused of child molestation by my daughters, I am in the middle of this because part of me has to believe it but the other part doesn't believe it. They show NO signs of it, they are NOT afraid to be left alone with him, they ask him to take them places alone, they spend time with him alone, and no matter what site I go on those are all signs, I feel they are lying, they act as if it is all a joke, one talks about boys all day, she's on the phone/internet being a tenager, the other is dancng, singing & playing as if nothing happend and it "happend" 4 days ago to her and the other said nothing happend to her but when asked by the detectives, she said it did, but since she lies about everything I don't believe her, but when she got out of the interview one of my daughters asked her what she said and she said she told them he did do something to her but she was laughing about it..... so as you can all see, it's hard for me to believe them. I have benn around him my whole life and he has NEVER touched my wrong in any way.... What should I do? i am also going through hell. i lost visitation to my 6 yr old daughter, because my ex husbands new wife cant hace any more kids and wants mine, plus his mom brain washed my child. they can not charge me with anything, there are no criminal charges pending, and my child has told everyone she lie and that her grandmother she calles (mimi) made her do it. but its funny every counceling session, doctors appointment, and etc. her step mother and mimi took her they were the ones talking to all the therapist and doctors, not her dad, or my family and never did they call me and interview me for anything. But according to everyone there is nothing i can do but go with the flow and wait until she gets older. I just lost my baby boy he is 4mo. old, My partner and I we accused of abuse. I'm doing all I can to reach out for help, I read all I can I've called all supports but DHHS and the Detectives are out for blood.I'am just as upset to how these injuries happend.My child has special needs and my partner has had to perform baby CPR on him but I know I didnt do this,and I know this was completly unintentional,I know his heart.If there is ANYONE out their who can help me please do.I will do whatever I have to to make sure my child is safe and this NEVER takes place again. I'm also in recovery I'm 20mo. sober and this is the hardest thing I will ever do.If anyone is out there I need your help! I have a little girl and my fiance and we had just moved in together. My mother who has always been a very jealous person had my daughter for the weekend and when it came time for me to pick her up i found that they were at DHS awaiting me to make a statement about my fiance sexually and physically abusing my child!?! I was ordered to move in with my mother and to keep my daughter from any contact with him for the next 30 days while this is investigated. They have talked to my child without me there, they have taken her to the doctor without me having any idea as to what was going on. They have shamed my fiance's name. I know in my heart he didnt do this. My daughter is in love with this man and he planned on adopting her. My world is falling apart. The DHS caseworker made a comment to my mother today that if the allegations came back true, which they probably would, The protection order would be indefinite. I love my daughter and would stand up for her til the very end. They are now making me look to be this horrible mother that is only worried about losing her boyfriend. This is not true at all! I know these allegations are false! I just do! All the websites I have looked at say that he needs a good lawyer...we do not have that kind of money!?! I dont know what else to do??? PLEASE HELP!!! Any advise will be greatly appreciated. almost 3 yrs ago my boyfriend was accused of molesting his son. he since has had charges dropped and passed a lie dection test. we have had many people,including cops, attorneys, and judges say that this was just a way to take custody of his son, which he had full. but he still cant see his son what should we do?? My brother recently got custody of his two daughters, 4 and 6 years old, with the help of a couple who were his "friends." He offerred guardianship if anything were to happen to him they would take the girls. They proceeded to then invite him to live in their home with his kids while he got his situation sorted out. Only a week later their 13 year old accuses him of inappropriate touching. He was arrested the same day, fri 7 january, and his daughters remained in the couples custody. His bail hearing was that sunday, and bail set at $25000. The couple refused to let our mom see the girls, and lied about taking them back to their mother. They also claim they can't find the guardianship papers. No one in our family has any assets, or means to hire a lawyer. My brother worked so hard to get his kids, and things were finally looking up for him. He would never do the things he's been accused of. He is a good person, and not in the sense that he pretends to be good, but a genuinely good hearted person. He has never had any charges, or convictions even remotely related yet he seems to be classified as guilty without any evidence, or witnesses. I have stooped to even begging lawyers, and all I get is replies stating fees in excess of $12,500. I would sell everything I own if I thought it would even come close to that amount. Now his daughters are living with strange people who they'd only visited a few times, and having their minds poisoned by these lies about their dad. We need a miracle, and at the very least those girls should be with family, people who they know and who love them. With very little hope I'm leaving my email tynanlanc@gmail.com. Well I was hoping to hear some good news but guess that's hard to come by in these situations. Amazing what adults will stoop to in order to hurt an ex. My daughter has three children, the youngest of which has a different father. My daughter and this man are estranged, and went to court and parenting allocation time was decided. However, the father continually accusses other children of abusing this little girl. It's a ploy to get complete custody, I live with my daughter and grandsons, I'm here all the time, and this little girl is well treated. But, her half brothers are contantly accussed of abusing her by the father. This is so painful because we know that it hurting this little girl, she's only 5 and this has been going on for years. Social services are called in and of course the accusations...everthing from sexual molestation to the entire family living in a barn, antoher time living in one room with all the beds shoved together, another child visiting molesting the little girl...all these things are documented as unfounded (because they are) but they never stop. We can only hope that ALL of the children are not messed up for the rest of their lives because of the paranoid delusions of this man. No one will help. Like many here, it appears that the only recourse is to hire a lawyer for a lot of money, and we don't have that. CHILDREN SHOULD NOT HAVE TO GO TO THE HIGHEST BIDDER! BUT THEY DO! I have been accused of sexual abuse of my six year old child. The other day he told his carer at vacation care that I'd made him touch my private parts. It is not true and never would be. He is not allowed to touch me on my breasts, private parts and he can only give me a quick kiss on the cheek or lips. They reported me to the authorities. Then he admitted he had made the whole thing up. But the report is still there, and my lawyer tells me I could be arrested. It is totally unfair. Where are the checks and balances. Whatever happened to being innocent until proven guilty. It has totally ruined my life and my relationship with my child. When asked why he said it he said "for fun". It certainly is not fun for me. All these stories are so sad! I was doing some research on whether or not there was a case against an ex who was trying to gain full custody of our son, but lost, then turn around and say I was hurting my son. I would like to share my story for others as well, and although it is a long one, I will make it as short as possible. I was 3 months pregnant when I left my ex because he would tell me and his 'buddys' that he didn't want us. I would wake up every morning (during the winter) frozen to my blankets. We also didn't have food in the house and he would take off to the bars every night...sometimes I would be his DD (for him and his buddies)... anyway... long story short, I turned to my best friend. We lived together, both went to school, I had the baby. When my son was 3 months old, I got an email from an attourney at law looking for a DNA test from my son, myself and my ex. I have been in and out of the court since... first DNA test, then full-custody, then for the fact that he didn't want to pay child support.... so, you want full custody of your son, but you do not want to pay child support?! I forgot to mention my ex owns his own business. He has been able to take us to court as much as he pleases, however, I am just a stay-at-home mom and a full-time student, while my best friend (now my fiance) just finished school and started working at a local plant. So.... my ex got the DNA test, did not gain full-custody (we have shared custody- he gets 3 weekends a month)and did not get out of paying child support... he turns around and has DHS take my son out of my home because there was a bruise on his arm. I noticed the bruise on his arm earlier that week.. however, he is 17 months old and climbs, falls, plays in my kitchen cupboards... so on and so on. Hence his nickname monkey. hehe ;) CPS took him out until the investigation was over... which lasted 2 days... sickest, saddest 2 days of my life!!! When the investigation was over, there was no sign of neglect. However, a few weeks later, I got a knock on my door.. it was CPS again. I figured they were just going a "check up", but they were there because my ex had called again about a "cigarette burn". The CPS took a look and said it looked nothing like a burn, but eczema (which my son has had since he was born). oiye... I really don't need to put up with this every time there's a spot or a scratch on him. The worse of it all is that I am constantly on edge.. if my son is running/playing outside and falls, my heart just drops! I think: omg! if he gets an "owie" I'll lose him forever!!! We should not have to live like this. I have an adventurous one year old who is going to fall, and although his bumps and bruises will more-than-likely be ruled out as neglect, CPS still has to take the child out of the house until the full investigation is over! Shouldn't they see that my ex is calling wolf each time? oh, and also, when they take my son out of my home, they ask me if it is okay that he stays at his fathers until the investigation is over... I say YES, because my son is more comfortable there than he would be in a home! I feel I am the only one who is fighting for my son's best interest. Good luck to all of you. and sorry for those who weren't so lucky. I understand what you are all feeling. God bless!!!!!! my boyfriend was falsley accussed of touching his ex girlfriends daughter when he was in jail. he got put in prison on no evidence. but the one who should of went to prison for it was the mother of the child. she was on meth and was making it in the home with the children there. she had different men in and out of the home. but when she was arrested for this drugs in the home they never arrested her for child abuse or neglect. in fact it was her who had done this. but they lied on my boyfriend and said it happened twice the week he was in jail for driving on suspended liscences.an the week i moved back in with him. the mother forced the girl to lie about it. when in fact the mothers boyfreind is the one who done it. but he seems to be able to get out of trouble because his father is in with the judges as their best freind. whata person to do when you are sentence to prison for what someone else did yesterday something horrible happened to me , i and my 4 yr old daughter laid down at 230 -245 , we were going to take a nap like we do almost everyday , i woke up at 315 i called out to her , she said iam laying on the floor mommy , i said get up here and lay down . at 330 she started screaming bloody murrder i flew up out of the bed , i said what is wrong with u mya , she i want the baloons the lady outside has , starting this week she has started calling out the windows to people who walk by and throwing fits to play with stangers dosent matter if the windows are opened or not , well anyways at about 345 she was asleep , so i fell asleep alo at 10 till 5 fireman broke into my home , and had taken my daughter out of my home , they had me go outside and please keep in mind i just woke up so i def in shock i had know idea as what was going on , the asked me if i was on drugs i said no , they said are u alright i said yes but of course i wasnt , they said my daughter was telling people thru the window all day she was alone and cant breathe , and she wanted to play with a little boy that was outside ,she was standing with a woman i had no clue who she was , so i found the manger of the apt called this in i also noticed that manger left work early before the fireman and the police showed up . and what made things even worse , is when i told mya to come to me , she said she was scared of me , i couldnt belive what was going on , so i walked over and picked her up and told her you are not allowed to play with your toys for 1 day , i also told her this is why you dont lie mya .. after the fireman walked away , 10 min later 4 cops showed up , they asked me to come out side , i thought oh my god there going to arrest . my daughter started screaming dont take mommy to jail , i told her mya please go inside and wait for me , so a officer went into my apt . he said oh this is such a nice place , i was thinking what in the world did they expect to find crack hanging from the ceilings ? so they also asked me if i was on drugs , i said no , they asked me if i was ever in trouble with the law , which no i havent been , i told them its as simple as this we laid down to take a nap she woke up before me , and that she has started to scream out the windows to people she dosent even know , and lying alot which she has been , than they asked me if i was here all day with her alone i said yes iam monday thru friday .. than my husbamd ishome on the weekends . so they took my name , and hers , but they told my husband that they dont see a problem here , but iam thinking CPS will be called now , i have done wrong so now i terrifed of what will happen . this was a horrifying i have never had anything that happened like this .... This might give some people hope that their situation is not totally lost. A couple of years ago, my ex began to make accusations of abuse against me on our two young daughters. It was her attempt to limit my time with them. She began coercing the girls to tell mandated reporters that I was hitting them and locking them in a dark room. DCFS became involved in 8 different occasions and every time the determination was that the allegations were "unfounded", but that did not deter her from taking advantage of a bruise on my youngest's rear end that occurred at her mother's house. This time I was interviewed by the police SVU and by DCFS and a charge was initiated against me because the girls said that I had hit them. In Dependency Court, the judge ordered an evaluation, since the bruise was not consistent with me striking my daughter, but I already knew that, since I had never laid a hand on either of them. After a month of investigations and interviews with numerous people, the evaluator contacted the judge and recommended that the girls be removed from their MOTHER immediately, since she posed an imminent threat to the safety of the two girls, since she was actively abusing them emotionally and psychologically and they could not risk the safety of the girls once the real truth came out. Needless to say, it was great to hear the judge say that all charges against me are being dropped and their mother was being charged with Emotional and Psychological abuse for forcing the girls to falsely accuse me. The charges were substantiated against her and I was awarded SOLE Legal and SOLE Physical custody. They still get to see their mom, but they now understand the consequences of not telling the truth. Thanks for your hub. Luckily I'm not involved with anything like this but I'm in Law School because I'd like to fight many injustices such as these cases. Their are so many very sick, conscienceless people out there who have no problem destroying someone's life and doing things out of spite. We need to increase laws and punitive action against people with the audacity to lie about something like this as soon as the lie is exposed. The courts also need to start listening to the children a little more and stop ignoring them when they refute the charges on their own accord. This lady that i have pressed charges aagianst for assault is very upset with me because she could go to jail. she knows that me and my daughters father is not on good terms so she emailed him and told him that i abuse my daughter he took the email and got a protective order for me to stay away from my daughter the police came to my house at 2am and took my daughter and gave her to him giving him temporary full custody til our court date. the social worker called and she said she saw my daughter and she didnt see no signs of abuse and she seems happy and like a regular 3 yr old. our court date is wed i also have a son by some1 else but they didnt take him. if im being accused of abuse y they take 1 and nit the other. the social worker said that they dont need to rush to see my son they will see him after the court date but y? will i get my daughter back wed? i never been through this Someone advise me! I am a youth minister and since January, rumors have been whispered by someone that on our January ski trip, I slept in the same bed between 2 of my 8th grade guys. (I am male) The students and their parents both VERY openly state that it is complete nonsense! My senior pastor knows me and believes me, but then 2 weeks ago someone sent an email to my pastors governing authority in the church with the same anonymous claims. The email account was anonymous as well. My pastor explained to him that it had been investigated and nothing was found which satisfied him. but NOW someone sent the same accusations to DHR and I have been put on paid leave until it is resolved. DHR is investigating and interviewing the students allegedly involved, their parents, my pastors, and although it has been almost a week and I have yet to receive ANY contact or official statement that I am being investigated, I can only imagine they will interview me as well. With both alleged "victims" and their parents completely denying anything adamantly it seems like it should be a case closed.... I have been falsely accused of child abuse!!! my 13 year old bully of a daughter saeid I hit Hey in the head with a closed fist. They came to my house AND arrested me, took my 8 year old son and gave him to his father who has actually been charged with battery. .. I don't get it how can they Do THIS they haven't even interviewed my son...He is now doth my mom who IV lived with for 5 Yeats AND She knows I don't hit my kids!! I have a lot of people on my side AND I'm not getting anywhere..on being visited 1 a week by social service, EVEN the guardian at litem said this is all wrong..I'm in criminal Cort that has a no contact order AND I'm in juvenile court that says I should have supervised visits.. I can't afford a lawyer I'm disabled help my son wants to come home so bad I'm not an abuser... NY daughters father is a bad man if u knew how insane he really was u would be scared. I know some things about him AND he doing g THIS to discri I was acused by my step daughters mom of hitting her... she said the time she was with me I hit her and didn't feed her. She also had some scratches I wasn't aware of. My step daughter says she scratched herself which I don't believe but mom is acussing me. She's stating my step daughter is saying this...I'm not sure if its jelousy because she has been calling me mommy. I have two younger daughters as well. I love all 3 girls. When my step daughter is with me she is ok and then she goes to her moms and is brained washed. I don't know what to do. Nobody has contacted me yet. My husband asked my step daughter if I hit her and she said no, but supposebly she said she's scared of me because hit her. The mom stated first doctor was one that called dcfs then that it was the school. hi I am so glad this site is here to air my frustration over false allegations and could do with some advise. My son was one of 4 lads in the frame for the father of the little girl, so he had a DNA test for speed and he was the dad, he left the army to be a good father. In the mean time the mother was binge drinking and smoking pot and eventually was evicted from her home. He had no home he lived with us, he applied for housing so he could take the little girl, whom the mother had begged him to, as the grandmother would not allow her to see the little girl and would not even speak the mother. In the mean time he got a house we all chipped in and got it nice, the little girl was handed over but reluctantly so that she made a false residency for the little girl claiming abandonment until services realised she was not the mother but the grandmother, the mother had designs of setting up home with my son and he put her right explaining they still could be good parents splitting 50/50 responsibility and went to court and done so. She was fine but still had an obsession about the 2 of them, so she moved back in with her mam, then it all started, non return, back to court, warned by the judge, even admitted she took drugs, the judge was not impressed and nearly awarded full residency to my son, until she turned round and said I get my drugs of him, so judge back his own arse by telling my son he had to leave it at 50/50 but gave her a stern warning, she snatched her in broad daylight with her mother in a car, back to court and days stipulated and last warning, he had his days and she had hers, he informed her he was getting services to do a drugs test on him so she had better beware he will prove her allegations, and hey ho she did not return the little girl, she refused his phone call he called police who went round and then phoned us to say they would be leaving her there due to the allegations of sexual touching, for crying out loud how sick is that, stooping so low so as not to return the little girl that has been a parcel passed around over the last year. so she made this allegation, even social services had done a check on son and closed case that they were happy with their findings of how settled and happy the little girl was the home is immaculate and she had no concerns. I feel her and the nana have threw violence, then drugs and now the last step to keep the little girl and the dad away which was the nana's intention from get go, oh god even the solicitor and social services were shocked, my son is upset but says he has done nothing and has nothing to hide from these sick allegations, but what happens now do they just beleive the mother even with the history they have, this is so unfair, mothers dont get this over little boys so why is is always aimed at fathers, i hated my ex but would not even had a thought in my head to say such filth. Can anyone help? Advise or tell me what happens now my son is saying he wants to go to the papers cos its disgusting when mothers can falsely accuse just to stop a fathers rights, the solicitor who should have taken it back to an emergency hearing said she is shocked and she is digging herself a hole, the police the social worker said the same but solicitor does not know what to do, how bad and where does that leave my son when a mother who was unfit, abandoned her, the nana falsely tried to claim residency and stop a DNA saying you dont need a man we can raise her alone. my son could have just walked away and left like many other fathers but he stepped up and said I cannot sit back and wait for her to come to me and people know I never had anything to do with her, I have a conscience, and now he is being branded to stop his rights, oh god this is so unfair where do we go from here, fathers are so unfairly treated when a woman is scorned and then used the child for a pawn in the game of war against a fathe My son was accused of looking at Porn almost four years ago. He was never arrested or charged with a crime until he received court papers now. He has to go to court in May. My husband and I are 100% convinced that his ex-wife put child porn on his computer and on discs. Their entire family moved into our home until his ex-wife was kicked out two months later for being abusive to me. My husband, son and myself were at work all day while his ex-wife was staying all day in our home. Every time we ever saw her she was on the computers. We were wondering what she was doing while we were at work. She did absolutely nothing to help with the family chores while she was here. There were several times while in our home we heard quite a few lies. One was when she told her daughter that I told her to take her dog, which we couldn't have in our home with the addition of the four of them. Her mother told our granddaughter that I told her to take in out and let it run loose. I acturally told her she needed to take her dog to the pound. She said she couldn't afford it, I don't like lying however, I told her to go and call the pound and tell them she found it. That if she let it loose it would die. I found outlater from her son that she had let their other dogs out to run away. Very little that comes out of her mouth is the truth. We are actually more than 100% sure she framed him. SHe told the police that she found a disc in her son's drawer looked at it saw porn (this was in 2001) put it away and then she lost it. My son and grandchildren live with us and we have never seen anything what she says at all. If we did he would have been kicked our of our home and the police called. Our children are doing extremely well. My son is in school again learning to become a welder. She has continued to lie and abandoned her children. She has made numerous lies about my son. She said that we were harrassing her, which is odd, since we have never known her phone number or address. The children don't even know them. She said her common law husband wasn't in trouble wih the law, when in fact he has been wanted in four states. He has four alias and the bounty hunter came to our home looking for him because he skipped bail. She took her current husband across several states to hide him and he was finally apprehended and was fighting extradiction, He was finally retuned with no bond. While in the other state he was on a quarter of a million dollar bond. This is a person who is an outstanding citizen without a felon. Her daughter who lives with us. Showed me a facebook that her mother founder on and told me that her mother continues to lie and that she is a poor example of a mother. The school made false accusations against me. I have a seven year old who needs help. He has the mentality of a 3 year old. Problem is I'm poor and can't get help for him. Well, he is constantly ruining and staining his clothes. The school is saying I send him to school in dirty clothes, that I don't feed him Abd said that I didn't come pick him uo from school when he was sick when my husband picked him up from school because I was sick. Can I file charges against the school? I live in Alabama. The whole thing is absolutely ridiculous and has made me lose all faith in the school systems. No one cares about the children who are actually abused and neglected. What do I need to do. My kids ages are 9,7,4. Two boys one girl. They all have to share a room because my sister lives with me and my husband. Will I get in trouble for that?? My partner has just been accused of molesting his step daughter when she was younger, (she is 19), even her mother (my partner's ex-wife) did not totally agree with it all and now he has to be interviewed by the detectives, it is completely untrue and all these resources are being wasted on us instead of saving and protecting real victims. She does not want to work, does not want to take responsibility for her life and wants to completely destroy his life, like she is so jealous of the other kids (3 more, 1 with special needs) and yet, he has treated her like daughter with no preference between her and the others. Even when we first met he told me he had 4 kids and was so enthusiastic about them all, I had no idea until about 6 months or so after we met that she is actually his stepdaughter. And that is ok,I loved the fact he considered her his daughter. He never "groomed" her, never gave her anything special, worked really long hours and actually was not at home alone very often or at all with the kids when they were married because his ex-wife never worked a day in her life, we are scared of the consequences of this, the ramifications on our life and also his relationship with his other children, (his youngest daughter is 7 and we have never had a problem taking her for the day etc - even he has had her on his own since the divorce) so why now after all these years? and why did his ex-wide (mother of girl) not know about it? She has trusted him and us to take all kids whenever. What is she after and what is it we need to do to protect ourselves? False allegations are a epidemic that destroys a person entire life and dreams. Once accused of sexual allegations against a child, ones life is forever changed. Ruthless individuals do this and usually the accused will become wrongly convicted for the rest of their lives. THE ONLY WAY TO STOP THIS is to get the word out to the people of our country. Telling lawmakers will NEVER accomplish anything. The chld abuse industry is too big of a money maker for lawmakers to ever want to go backwards, so we as the people must do it. Every single person who knows what its like to be falsely accused of any crime against a child should be telling everyone they can about the abuses our government is handing down. Our government has found a way to be a tyrant and get the majority of the population to agree with it. Slowly but surely the abuses by our government is being found out. Peace out. I brought my son to the ER because of a bruise on his ear and a scratch on the back of his ear. my father, who is the kindest man ive ever met had babysat for me that afternoon and when i returned my son was taking a nap, my father went home and when my 2 1/2 y/o woke up from his nap, i seen the bruise! i asked my father and he couldnt explain what would of caused it. My son has vision problems and has no depth perception (cant see distance) and does fall and bruise himself constantly. i just wanted to make sure the injury didnt cause a cuncusion or something, i panic alot. I walked into the ER and was told that his injury was consistent with child abuse! My son was taken away from me while in the ER, they said he wasnt safe with me and untill i got home i didnt even realize that her accusation was that i physically abused him, he means the world to me and his grandfather and this is outrageous! now i have to defend myself against something that i know was an accident and in no way am being treated as innocent till proven guilty! something really does need to be done about this system! My son is 10 years old and handicapped. I have put my entire life on hold taking care of him. Gavyn is a wonderful little boy and I take him to extra therapies, pay for anything and everything that I am told can help him overcome some of his problems... here is the issue Gavyn goes to a school here in Florida that teaches handicapped children, Gavyn loves his school. Someone keeps reporting me to DCF from the school! Gavyn goes to the hospital 2x a week for blood draws and testing, he bruises easy at the site of the needle marks plus the hospital restrains him sometimes because he is such a hard stick... He had a bruse at the elbow, next day Gavyn keeps pointing to go "out" which means school so I take him... DCF shows up the same day at my house scaring the crap out of all 4 of our children.. They make Gavyn undergo all this testing then decide. Yep you guys did nothing wrong it was the hospital blood draw that caused the bruse... DUH people so I took Gavyn back to school.. Everything fine until DCF shows up again because Gavyn had a slight odor of "diaper" on his hands... He has the mentality of a 2 year old and he is autistic so yes he does reach in his diaper alot to check himself... DCF comes and Gavyn is just getting out of the car and the worker says that he sees nothing wrong, etc etc again so he says the case will be closed nothing to worry about... (Just to inject here Gavyn loves the water so dang much I put him in the big tub 3x a day to let him play and laugh.. Water bill is freakin $165 a month, I pay it with a smile because it makes his day brighter).. Okay another of Gavyns loves is animals so I take him outside to let him play with the dog, kittens and the 2 older cats that are outside. We keep the animals all outside this way the house stays clean of any debris, etc. So Gavyn pets the animals and gives them all hugs then gets into the car and we go to the school... DCF shows up again because someone called and said they saw a ONE FLEA in gavyns hair!!!! ARE you freakin kidding me I am sooooooooo angry right now I am still shaking! Wtf am I suppose to do? Do I give my son a happy fun laugh filled day or put him in a isolation room with nothing????? Gavyns disorders could end his life anytime with really no warning so I am trying to give him all of the best memories and love I can but right now I jsut feel really violated because it is getting to the point that I am a nervous wreck. So of course DCF said they would close the case again but it is so STUPID and a TOTAL WASTE Of time and money to send out a DCF worker at 6pm at night to check on a child becuase they were outside and got ONE flea in their hair! Really seriously people I want to go into that dang school and just scream at them to let Gavyn be a happy little boy and stop all this crap but I know that would not end anything.. What should I do? Lost and feeling angry here in Florida I was arrested the day after babysiting for my wife's ex bestfriend's son (7yrs old) he stayed upstairs and we stayed downstairs with our 3month old son . we would often babysit for him as his mum wanted to go out and get drunk and use drugs and we thaught it was unfair for him to be pushed around to total strangers. we had no problems all night and none in the morning. he asked me to take him to school so i did. i then walked home and enjoied the day with my family as i don't work as i am very deppresed. at about 8pm there was a knock at the door i got up and opened it it was 1 Detective and 2 police in uniform the detective said do you know why we are here? i said yes as i thaught they were at my door to take a statment as there were 4 cars broken into the week before and i had seen the person do it.i let them in as anyone would the detective then said do you know (the childs name) i said yes we babysat for him last night they said we know you did. they then said i am arresting you for rape of a child under the age of 14. i was in pure shock i didn't know what to do they put me in the back of a police van and took me to a local station. were they took my picture and DNA and swobs from inside and outside my penius iand also they took my clothes as i had not changed since the day before . i was questioned for hours and i didn't want a solicitor. after a few hours in a cell i had a call from my wife saying she had got me a solicitor and not to say another word until i had spoken to them. so i did the next day my solicitor arrived and i was told to say no comment to all questions because i gave all my statment in the first interview.i was told that the child was collected from school by his mother and he said to her that i had gone into the bed with him and pulled down his pj's then put my willy into his bum. his mum told him to stop lieing as he often lied about things a 7yrs old shouldn't even know about. but he didn't stop he said he was saying the trooth. so she phoned the police and they took 4hrs to arrest me. i never touched him in any way. i was releced on bail and returned as my bail stated on a certan date and i was charged with sexual touching of a boy under 14. i was releced on bail to attened court and was told that the CPS had found semen on the inside front of the boys boxers (underwere) and a very small cut on his backside (0.0001 of a milermeter) the semen on the front inside of his boxers was not a strong mach to my DNA. i have now been to court 3 times and they have always put it back to a later date i have been away from my wife and son for well over a year. and i have started to have pannic attacks. i am in court very soon and it is going to be a 4day trial i do not know what is going to happen. i am innosent and would not ever touch a child i am happily married and i am the proudest dad in the world my son can now walk and talk and i have missed it all. the boy who made these false allagations of abuse is probobly at home now having fun with his family and has probobly forgotten about making it all up and ruining me life and my familys life no one seems to think of the affect on my family they all seem to be worried about evryone else . my wife and son have had social services all over there lives saying things like it is my wifes fult that the boy got raped because she was there. the boy was never raped or even touched. they are also saying that i can not come home and that they will be in there lives forever. HELP PLEASE !!!!!!!!!!! me and my wife are still talking evry day and have never fallen out of love . i love my wife and son more than anything in the world we need HELP and please could someone let us know that to do ??????????????? PLEASE COMMENT !!!!!!!!!!!!! I was accused of abusing my son when he started secondary school at age 11. I knew what he was like if led in the right direction, His mother knew but would not defend me so I turned to his scout leader and the church but the school and the social worker would not even phone them. Child and mental healthcare without even meeting him were talking about taking him into care. I started recording meetings here and there it was obvious the staff had made up their minds so I took my son to a children’s ambassador (Kiddy shrink) who told me my son was playing up because he was lonely. He was lonely because he was in a new school and had not even been introduced to other students, just thrown in the deep end. I put my recordings together and took them to the head of his prior school. I told them I have the church, my own kiddy shrinks, his scout leader and others ready to come into school. I told them they were incompetent refusing to make a simple phone call and I would take the matter higher make up a website etc. with my recordings on it and tell the whole world. I used the freedom of information act to get a copy of teacher’s notes and school file as well as access to his social care file. I wrote to the head of the school telling him he owes me and my son an apology he wrote back stating “At no time did the school make an abuse allegation” But I had recordings that show this is not true. But what’s the point that will cause more harm than good now. I just record meetings in school now and they leave me alone. The mental healthcare people tell me he is autistic but that is not what my own kiddy shrink and the church think. Unfortunately I proved my wife to be a poor mother and she did a runner. my wife got a d.u.i. with my daughter in the car, my daughter has been sick with throwing up all her life. the state blames it on her home life and also they said she has an eating disorder and she does not . which they found out after they took her from my home and made her go to a clinic of their choosing and they said she does not have an eating disorder, they still have my child and now they are trying to say that she has mental problems and she does not. the latest diagnosis was she had and adjustment disorder, never told us why they took her and still has not in the state of nebraska lincoln, involved is kvc whom is training to get nationally accredited and in the state of nebraska, i am a 100% disable veteran and just really at my end of understanding how you can take someone child for no good reason at all even after finding out what they wanted to know. i need any help as to how to fight lancaster county court, lincoln,ne please any advice... the doctor that initially diagnosed her even they proved she malpractice my child, and now they have file charges against me stating that if i can't admit she has an eating disorder then i am neglectful of her health which is crap i have been taking my daughter to the doctor since she was born. any help would be nice. thanks monty044@hotmail.com again thanks any advice please My husband and I were also falsely accused of shaking our son. During the ALJ trial it came out that the state did not know if he was even abused, how, whom or when. This was three years ago and we are still paying off the lawyer bill. It is now to the point where we would like to fight back. Is it to late? Do we have a chance? How do we even go about starting? I have been divorced for nearly a year now and have recently met a wonderful woman who is fantastic with my daughter. My ex being jealous as she is has tried her upmost to cause problems and now has said that my behaviour with HER daughter during the marriage was wrong - i never touched her daughter i didn't even discipline her daughter she did - all i did was go to work and support her 3 children from her previous relationship as their father didn't pay anything for the maintenance of his kids. 10 years i supported them for when the eldest was in trouble with the police it was me who went to the police station and dealt with it all. i feel sick with the thought that her lies could cost me my daughter - amazingly she has only said this to my mother and not the police - i'm sorry but if my daughter was abused in ANY way at all i'd immediately call in the police without any hesitation! In Britain the punishment is too lenient for false accusations - most never get any sentence whilst destroying someone elses life - justice???? i think not :( My boyfriend and I have been falsely accused of child abuse by the mother of his daughter. It's very upsetting to have these bogus accusations against us and we are being investigated by CPS. Even their daughter has been coached and brainwashed into believing and saying that I have pushed her and called her ugly names. I love her and would never do such a thing nor would her father. The real tragedy here is that her mother is the one that is psychologically and emotionally harming her child by putting her through this and making her believe that her father doesn't love her. Naturally my boyfriend has less rights as the non-custodial parent and we're having to deal with all the obstacles this woman puts in our way. We need to protect ourselves from these false accusations because we along with their daughter are the real victims here! What can we do to protect ourselves from this??? Our nightmare began when one morning our precious 2 month old woke up and would not eat. Then I noticed her head felt soft and swollen. Immediately we took her to the doctors. They did some testing on her and concluded everything was okay that day. They wanted to recheck her the next day and reccommended x-rays. They saw a possible fracture and she was sent for a catscan. She had a small linear skull fracture and from a bone scan 1 healing rib and 2 chips on the corner of her longbones. We were in total shock. How could this have happened to her? They removed both of our children from our home for the investigation. We truly believe she has a bone disorder like brittle bones disease. Last week she had labwork done to test for deficiencies and it came back normal. It required a lot of blood. We tried to take her for the bone testing, and 2 labs said it is just too much blood for an infant and could be harmful. So we are not pursuing to do the test at this time. She also had previously had her 2 month vaccinations, which i've researched a lot about that causing bone fragility due to the mixing of toxins causing a decrease of vitamin c and tylenol can decrease it also. I am very scared to vaccinate her again because of all the horror stories i've been reading about these poor infants even dying after vaccines. They call it a "well-visit" but here we are injecting them with multiple toxins claimed to protect them could actually be harmful to them. The worst part is we have no idea how this could've happened. If she has the disease it can be from normal everyday handling. We are great, hard-working, loving parents torn apart by something we cannot explain. I feel sorry for everyone innocent in our situation. We have since hired 2 attorneys to work for us, but it is such a financial burden. Unfortunitely it's all about the money, the more children they remove from homes the more money they are funded by the government. This society is all wrong and innocent families are being torn apart. We know we did no wrong, and will fight this to the end no matter what the cost, our children are worth it all. You know we took her to the doctors and now are being punished for it. Our children have been to every checkup and appointment needed. We will definitely be looking into ways of sueing after this is all done. It is not right the emotional distress they put the whole family through. Our advice to everyone: get a great lawyer or two( if you can't afford one rack up a credit card or take out a home equity line of credit) and fight until the end! my brother has been falsey accused of child abuse of a minor the police put my family through hell they were abusive and rascist! my brother has been charged on 3 accounts of rape and is sitting in prison awaiting his trial, now the girl has admited to making the whole thing up please give me some advice x I had my 4 yr old son taken from his father about almost 4 months ago in Texas. He accused me and boy friend at time of abbusing my son. He called CPS and they investigated us and we cleared. But then he found out that he would have to give me my son back he left with him to California. He told me I will never see my son. I had US Marshals on his ass with out him knowing after 4 months gone they caught my ex with my son. But because my son had been brain wash by his father when they turned him into DCPS in California they said that Im being charged with neglect. So now I cant see my son I had to drived from Texas to California and go to court cause my son had been brain washed. In the mean while my son is with a foster parent. Any body know what can I do. We have a situation that is very confusing. My husbands grandaughter which I will refer to as OUR grandaughter, was taken away from her mother, this is our son's daughter, on alleged child abuse charges. We were not informed of this until over 1 month after the fact by my husbands ex wife. We were never allowed to go to any of the custody hearings because we were never informed that they were going on. My step son is in prison and he was never married to this young woman, but we have always had liberal visitation with our GD. My husbands ex wife called last weekend to inform us of what had happened and that she will have our GD for an undertermined period of time. I called the courts CPS etc... and they had advised me to go talk to the mother of our GD. She was in jail because of a failure to appear warrent.I went to see her and asked her what was going on. She said someone called CPS and said she was abusing her girls, so they came and took them away. But what confuses me is if she is the alleged abuser then how can she have visitation even supervised twice a week before this goes to trial? She insists that she did not do this, and that she feels like she is being set up by my husbands ex. I don't know but I found it rediculous that my husband and I were not informed and were going crazy not being able to get in touch with her! This is the state of Michigan and we live in Wisconsin but on the border so we are only a few miles away from where she lived with our GD. I thought each biological grandparent had to be informed and given the chance to have the child in their temporary custody? I am not sure that these charges are founded, there was no physical evedence that she had ever abused either one of her kids. So I am very confused. There is a jury trial set fo Aug 23 and I suppose we will find out more then but if anyone has any insight on this please comment. have proof of lies and lots of corruption within DCF. Randy Why should illegals get better treatment than we legals do at the hands of CPS? Why would being in the US illegally make them exempt from any unpleasantness but able to partake of the benefits? I feel for them, but being illegal doesn't give them more rights, as Randy is suggesting it should. I've fought off accusations of child abuse, and my advice is that you should be willing to give up everything you have to do so. The "authorities" do corrupt interviews that traumatized the kids, and they don't expose the brainwashing. An excellent (not the cheapest) lawyer can get the head of CPS to do a real interview that exposes the brainwashing. If you have any resources, be willing to spend them on your defense. If you don't have any money or retirement set aside you can tap, then you are at the mercy at the public defender. Start pulling together a network of people who are willing to make statements in your defense. You want quantity and quality. I had a doctor, specialist who was very confident that my son's condition could not be caused by abuse, nor did he show any emotional or physical signs. He'd had regular appointments with full trunk exams. His receptionist told me that abusers don't seek medical treatment but avoid it, and I was very actively seeking, looking for answers. Know that even though your ex may try to alienate you from the kids by cutting off all contact that this is illegal. Just because your ex says you can't discuss the case with the kids does not mean that is the case, either. Record all phone calls between you and the kids and you and the accuser. Keep a log. Check the laws about recording calls for your state(s) online. I paid $300/HR for my lead council 8 yrs ago, and that firm, who normally dealt with professional athletes, gave us emergency status and dropped everything as soon as I called. They pulled files and got to work even before calling me back, before money was promised, much less collected. They already had advice and action planned. My ex paid $13k for a 2 person firm (1 was on probation for ethics violations), who practically gave the case to my lawyers. Even poor representation is expensive. If the person falsely accusing you has or may get an attorney, you need to get out there and meet with every decent lawyer in your area. Once they've talked to you, they can't represent the side opposing you - conflict of interest. That was one thing they had us do, and we had to pay for a couple of consults, but most are free. If you don't have money to defend yourself, you really don't want to be up against a great attorney. The system for alleged child abuse really is guilty until proven innocent, and those who make the false accusations will get their reward come the final judgement day. My heart goes out to all of you. I've been there! Unfortunately its nice to see others with the same problem, I now know Im not alone on this. So, Im being accused by my own child of sexual abuse. I didnt realize the seriousness of the situation at first, my child is just young, then it all took a spin. CPS and the local authorities investigated the situation and some how deemed me unsafe, all of a sudden I felt like I was in a bad dream. I was light headed and it was almost like tunnel vision or a cloud. The last thing a parent wants to think is their own child has been hurt in any way but, to be the parent who has supposedly brought harm to your own child makes you want to die inside. This has caused a terrible break up of our great committed marriage and tore our family apart. It is by far one of the hardest things to prove on both sides therefore the solution has to be CPS's judgement. There are no criminal charges against anyone after their investigation but so much more lost because of it, now it is one parent deciding to not allow the other parent any involvment in their lives, they have now moved on and become a new family. Even after all the time that has gone by it still hurts me inside and makes me depressed when I think of what I have lost and for what reason? I have not moved on like they have, its not that easy for a parent to just forget about and stop loving their child. I, to this day still, continue to have faith they will learn the truth and come back to me but I am so scared its too late. I have slowly given up on the fight and considered living out the rest of my life as a sucker, the worst part is I dont know who Im supposed to be mad at. There are some of the most amazing parents among us who deserve nothing less than to spend the rest of their life with the ones they love but, sometimes its those amazing parents who dont get to live that experience. Its sad all the innocent people out here can feel guilty about the same thing, I respect the parents who NEVER give up on their child. If 60 percent of reported abuse cases are false, what do we need to do as parents to prevent this from happening to our children when they have kids of their own? I wish you all good luck on your problem and only God can judge. I HAVE HAD 5 unanouisted visits concerning first my 17 year old daugter 2 times false crazy stories. She was out on the street homeless and selling drugs. that social worker saw our house and new it was false, closed it out. She is a troubled teen who got in trouble 2 summers ago. she went for a intake where they felt she needed counsling which is paid by the state. We do have insurance but i felt it wasn't a big deal. Since that they wanted to clos her case out, however she didn't go there enough. So i started taking her. I have fibromyalgis and dics degented disease, for 9 years i have been seeeing a rhumatoligist who prescribes meds. I can't take most pain meds because i through up from them. The alligations is i abuse my meds . He has never seen me under the influence and said so. However they asked for my medication and counted them to see if i was abusing them it was taking as prescibed he had nothing . Something recently happened when my daughter was in her session with her drug counsler who by the way knows me from 10 years ago. She called dyfs and said a bold out lie about how i souned slurry on the phone, and that my daughter had some kind of memeory of me not walking right 8 years ago. They have never seen me incapacitated on every visit. I refused to come in for a drug eval because i how the system works they will say u need to go through all there bullshit. they want to speek to my doctor and get my records from the pharmacy i refused, because they will try to make a case against me for child abuse. 10 years ago i had a car accident with my daughter in the car. they told me i couldn't drive with them. I had a court date however nobody could stay with the children there twins, called my lawyer he said he would take care of it,the judge ordered them to be removed. At that time i was engaged to my now husband who they said could stay in the house if he goes for a intake, he did then they were to be transfered to my sister who is a therapist, they lied it took weeks ,the girls were traumitized. my husband was told just come for some evaluations. Which he passed with flying colors that turned into 9 months . They made me jump through hoops ,everytime they would put upon something else i had to do i became pregnant developed many illness because of the stress. finally after my son was born had a new judge and granted me the children back home, but the scumbag lawyer had the balls to want to take my newborn thank god this judged got pissed at her and said no! It's all about the mighty dollar from the sate no one polices them. Now i'm walking on egg shells because who knows they said ther starting to make a case against me! Ihave a lawer i told the case worker from here on in speak to my attorney! the system is broken and needes to be changed. i got locked up for child endangerment for no reason, my gf said i wasa a great father to my son, so i sat i jail for 3 days, the judge dropped my charges for no evidence, now my gf wants to move back with me in my house, and her mom is just threatning to call cps for her moving home, can i get my son taking away from us over that? the cps lady even told my girl there really is no case against me, but will we be ok and be able to keep our son. id really appreciate feed back , and also there was no violent crimes, To Darryl: Tell the "mother-in-law" that you intend to press charges against her if she wrongly accuses you again and causes any more legal trouble for you without evidence or cause. If she calls your bluff, do it. I have been investigated 12x by DCF in Florida. One accusation was made by an ex fiance' because I ended our engagement. The rest have all been made "anonymously" by my own mother and ex husband. Each case I have been found not guilty. What do I do? I use to be a teachers assistant and because of all of these false accusations, I will not be allowed to work with children anymore I have been told. Can I sue the state of Florida? I know my mother and ex husband are behind all of the accusations, but I have no proof. My ex husband has NEVER paid me a penny in child support and is doing this to try to get custody of our son. Child support enforcement is of no help. Apparently because my ex husband lives out of state when they send a letter to the address I have for him (that I know is correct) he and his gf send it back to child support enforcement saying that he doesn't live there-and they believe it! I am in need of real help. I am tired of these charges and get no help from child support enforcement. If my ex was locked up, he wouldn't be able to make these accusations!HELP! I am now going through the agonising process to wait to see if I am going to be charged with the sexual abuse of my sons. I'm on bail for it and so is my lodger !! My ex has accused me of this before (though I did not find out until 2 years after), just to keep my son out of the country. She then, within 48 hours of telling the court she suspected abuse - gave me unsupervised contact with him !! And THEN, had another child with me. Now she says my son is showing overly sexualised behaviour by rubbing himself on her furniture - he's 4 now. Added to this she says she had seen him do this on three occasions. However, I think this is a lie, as she went to see her solicitor after this supposedly happened 3 times to give me more time with my sons ! Makes no sense. Also the claim came 34 minutes after her friend verbally accused me at the garage, and she later sent a threat of injunction by e-mail for something else(still have it) prior to Police putting one in ! According to the Police, my son claims he does not like my lodger and runs around the house and to get away from me and the lodger, he hides himself in a lockable cupboard. Police searched house - took away my pc and memory sticks (wont find anything that a single man wouldn't look at) - then the Police confirmed there is no lockable cupboard in my house. They asked had I watched porn with my kids ! The evidence against me is that my son also thrusts his hips into the air. Police asked me why, and I said dont know. Was only when I got home I realised I did ask him to do this - when I changed nappy I say 'bum up' to get the nappy underneath. Have tried to get back into see the Police, but they have sent file to CPS (crown prosecution service). I tried to talk to them for 7 weeks after the accusation first came to light. The whole thing is a joke- not seen kids now for 6 months. I have evidence of this lady lying, committing perjury, fabricating evidence and falsifying evidence, committing fraud by not declaring her previous names - I even divorced her ! I have evidence of her claiming I was trying to pass a sexual disease by not wearing a condom, she is on benefit - but spends £2,000 a year on flights whilst claiming council tax from local government office. In a way I hope it does go to court to show what an true liar and devious person she really is. my sister is a drug addict. Shes using in front of her 2 year old son and taking him for drug rides at 3:30am. She has been stealing from everyone to get money for drugs so now alot of people are after her. She has a few felony charges pending as well. I called DCF hoping maybe they will forse her to go to a rehab treatment center. DCF went to her house and found that it was all true....so now they will start random drug test. Now......she made a false report on me! I'm a teacher so this wont look good when a school runs a cori/sori check. DCF did come to my house but didnt believe a word she said. He knew immeditly is was bogus. Does anyone know if i can sue her for this? This is going to follow me around with every teaching job i apply for. I live in MA about 10 mths ago my kids were taken from me by dfys becasuethe kids aid my ex was hittin them and i drank to much at the time we were in a shelter now i have gotten things together and a new bf and because of his past n his familys past with dyfs they say he couldnt be around my kids alone so i got a day job then his crazy ex calls dyfs on me still with a dyfs case open n only one child in my custody still fightin for the other two.well my middle child the one i have likes to lie n he tells his school my bf hit em and now they took my child back in custody again i dont know what to do sumone help me please This week my 7 year old was have a temper tantrum and didn't want to go to school and wouldn't get dressed. I grabbed her arm and said she had to get dressed because she would be late for school. after school I picked her up and she said mom I was upset and told my teacher her hurt my arm when u grabbed me. I talk to the principal who reads me the report(mind you no one called me from the school) they said the had to call children and youth and when they came to school they took pictures of my daughters arm but the report said she had nothing on her arm. I'm in hysterics literally. i have been charged with nothing so far we received letters from c&y stating they wanted to speak with my husband and kids not me. I'm a wreak! Do not let CPS workers enter your home without a warrant. Don't listen to their threats and lies. CPS cannot kidnap your child without a court order or evidence the child is in immediate danger. Do not meet with social service workers in your home or at their office. As soon as you know allegations have been made, immediately take your children to your pediatrician for a physical. This is to document your children's actual physical condition. Meet social workers at your lawyers' office. If they insist they must tour your home, require that they make an appointment. When they arrive, have someone follow each worker with a video camera. Restrict their access to places and things that do not relate to your children. (They have no business wandering through your bedroom, your home office, your closet or anywhere that is private and does not relate to the children's well-being.) The reason why CPS acts out so badly is because naive, decent parents let them get away with things that are totally illegal. Come on! You know full well that these people are not legally entitled to wander through your home and interrogate your children on a whim. Just say no, and mean it! If you won't stand up for your children and insist that their rights be respected, then you are not a fit parent. Never forget that children have Constitutional rights too. Your duty as a parent to to defend their rights. CPS workers consistantly trample children's rights, creating horrible trauma and broken lives. Read the 4th Amendment and think about how CPS treats children's bodies, belongings and homes. You know what CPS does to children is wrong. You are your kids only protection from these scum - so be strong! allow CPS workers to BS their way into your home, you permit them to violate the 4th amendment rights of every single person who lives there, plus anyone who may have stored their belongings with you. If you want to discard your own 4th amendment rights, go right ahead. Just don't discard anyone elses rights. Your spouse's 4th amendment rights are not yours to discard, nor are your children's. It is also wrong of you to discard the 4th amendment rights of elderly parents or friends who may be visiting or sharing your home. Say no! It's the right thing to do. If more people said no, CPS would stop pretending they were entitled to abuse people with impunity. Thank you for replying.I Told my husband we should talk to an attorney but he said we shouldn't have to, since I didn't harm our daughter. Yes I agree but when you receive letters stating your the "perpetrator" then I beg the differ! My husband thinks that if we get lawyers involved it's like like admitting you have something to hide. My daughter had nothing whatsoever on her arm nor did the report from what the principal read to me state there was anything on her arm. They went on an upset child who woke up on the wrong side of them bed, who didn't want to go to school that day. The principal said the c&y worker was there for a matter of 5 minutes. If they thought the child was in immediate danger wouldn't they remove her from the home that day? This happened 5 days ago . one again thank u for all ur help I despise CPS and feel that it should be abolished and started from scratch. I have been falsely accused several times by my husband's ex wife, and people in the neighborhood who did not like me. My kids told the CPS worker that I am a great mom, but they still had to have their pics taken, interviews done, etc. I think there should be some serious stipulations put in place for someone to become a social worker in the first place. 1. Have their own children. 2. Take a common sense test. 3. Know how to hook an older kid up to a lie detector! lol 4. Be married (maybe even with a crazy ex to deal with, too!) Most of htese people are overworked, underpaid, and under appreciated, but that creates an attitude of "I could care less what is right, just get it done". Other CPS workers feel superior to the parents they deal with. I think these people should ALL be required to have real world experience wtih their own kids and husbands. Period. I no longer fear being falsely accused, but for those going through it - I send my prayers to God and please be emboldened by the fact that He only allows you to go through what He knows you can handle! I pray for those kids who are lying and being threatened into lying, that they would understand the hurt and pain and that those threatening them would stop trying to control people in this way because they are literally ripping families apart! I hope things change really soon! My girl friend mother of are kids had dcf called on her.on are youngest girl age 5. She burned her hand on a heat lamp. So dcf went to school and talked with both kids. Then came to are house went threw it top To bottom. and we told them she had a doctor appt. they said yes looks good everything is fine. Now they called saying the burn looks like it was held there r u f in kidding me. So they want a copy of doctors appt and want us to sigh a release form. Should we just say no and pull her from pre school. She doesn.'t have to go and they won't leave her alone in school stripping them to look at them when we r not around and It's a man that did it. Where r my rights My daughter made a disclosure that I touched her privates while I was touching mine. She is now 8yrs old and has been in my care since birth till CPS took her away march 2011... I haven't seen my daughter since then and courts want to place her in her mother's care. I cannot afford a lawyer and have been battling with this with 3 different public defenders so far... I need help. Email: chicha49@yahoo.com Burden Of Proof I fell out with a neighbour because she used me and my kids to get out of her house because she wasnt happy about it and lied and made accusations that i was loud and drilled at stupid o clock in the morning? I heard from my neighnours she was twisted and would do any thing but never knew she would go to the child services when i confronted her she screamed and yelled at me infront of her 2 yr old daughter and promised me should would get me back for calling her a bad mum... She made accusations saying i smaked my son round the face and swore and manhandled them.This angered me because i know im a great mum and to hear this totally puts u down.The child services have got on to was has happened but still doesnt make me feel better i want justice for being wrongly accused aand sickens me that they waste their tym with inocent people while kids are being abused.... I"m a father of a 4yr old girl. I just got full custody of her. She was living with her grandma, (the mother's mom) for the last year. I've been with my daughter every single weekend for the last year and about a month after the custody battle, I took her in during the week and set her up in a preschool. Within two weeks of taking her full time, the grandma says my daughter is telling them that daddy hits her. I now have a temporary protection order on me and can't see my kid, and after reading all this, I fear going to jail. My child has not been injured by me and I hope this gets resolved. But I'm sure by now my daughter is being taught how to lie and I don't know if I can take it.'m a 35yo female and was accused of touching a 4yo girl by the mother!, the girls mum was my mate....Her BF (was also a mate) tried to kick my door in injuring my husband , then said he was going to kill me and burn my house down! I didnt know what to do so i went and got a polygraph...I passed with flying colors...The mother (ex mate) is still going on with it and I now want to sue! Apparently there is no help or justice for me!!!! No Sorry, No Closure! to sue and maybe go to the news is all i have now but dont know how to go about it! :( It sucks! Currently, my ex-husband and I share custody of our 4 year old daughter. She spends 2 weeks with him each month, and the rest of the time with me. My ex husband and I signed a custody agreement, saying that our daughter would live with me and my new husband when she starts school, because he wanted to move to Atlanta, and he knew her living with us would be better for her. Well, his plan to move to ATL fell through, so he bought a house where we live instead. After that, he called and said that "WE WILL be renegotiating the custody agreement because the schools in my area are better than the schools in your area." I told him that was pure conjecture on his part, and there was nothing to renegotiate. A few days later, I got a call from him saying that our daughter "flinched" every time her grandmother moved around her, and that my daughter said that "mommy hits her in the forehead". He said he is contacting CPS to get an investigation going. This is absolutely not true, and if anything, he has had the past two weeks with her to coach her. After reading these stories, I am seriously about to have a nervous breakdown. Haven't heard from CPS yet, as it has only been one day since he said he was going to file a complaint. I am seriously afraid that I will end up serving jail time based on her coached interview. It is apparent to me that because my ex can't afford to fight for custody in a court room, he is trying to paint me as an unfit mother so he can win custody without having to pay a dime. I had my son over the summer. Everything was great, so I thought. Currently, he's being evaluated for autism and has already been diagnosed as having ADD. He gets very out of control at times and can be a handful. Over the summer, he would tell me about things that allegedly happened at home, things that his mom was doing. Well today, 5 months after he went back home, I was being interviewed at home for allegations made against me by my son. He told his therapist that I lock him in a closet, I threatened to cut his head off, and I put Icy-Hot on his face as punishment. Only truth is the Icy-Hot, but he asked what it was and if you ever use it on your face. I said no, he said why, I explained and he insisted on asking why. Sort of when you intentionally give your child something extremely sour, just to see their reaction. Never knew he would say I did it to punish him. The problem is, I can't say he's a liar given his mental medical history. I'm worried for various reasons. I told the CPS rep today that I'll do whatever it takes to see that he gets help. I've never been to one of his therapy sessions, but if I need to go, I will. There's no proof or evidence against me, even the CPS rep told me that(which is kind of reassuring), however I've heard stories about this and conviction is involved. I have a 2 year old with my fiance', and we're happy. My son is also a big part of this family. My entire life can be ruined due to these accusations. Not only could I lose my son, but I could also be considered a danger to my daughter as well. I know he has mental problems, but his mother isn't helping matters by letting him listen to Insane Clown Posse and taking him to their concerts(he's only 8.) He's now branding knives at her and talks about cutting heads off! It's apparent that he tells us what he thinks we want to hear. Daddy doesn't love mommy so I'll say bad things about her to him, and vice versa. I was going to use what he told me to pursue full custody, however with these allegations, how can I ever know if what he's told me is true? What can I expect? Supervised visits(in which I agreed to if it was required,) restraining order, or even jail time?. Great Advice and yes false allegations of child abuse are horrific for the parent who loves there child. However investigators are highly trained to get to the bottom of all cases. You offered sound advice great Job Voted up!!! I am so grateful for your blog article.Really thank you! Fantastic. fkkfbecdcgda ive been going thru a dss case for almost three years. we were falsely accused but they took them anyway. for a year we fought to get my children back. took parenting classes, mental evaluations, counseling, homeservices. what did i do i forgot a doctors appointment thats all they could dig up. no drugs no alcohol no anything. ive always kept a job had food made sure my kids had everything they needed. out of all these people that actually abuse their kids i get called on by someone who got jealous because my kids father wouldnt go out with them. after we finally got them back they made every excuse to keep the case open to monitor us. the moment they found out im pregnant come in and take my kids again saying i was hiding a pregnancy from them like the moment i found out i should have called them and told them all about it. now im fighting with them again the judges so far have told them they dont have a case but since they never provided me with a service they wanted me to complete they get to keep them til i finish it. they havent been providing the service still i had to petition them in court to make them do it so i can get my kids back . i think the courts should step in and say if they dont provide the service in a certain time and youve done everything u were suppose to then the case should be closed. so now that i have made them do the services all of a sudden new allegations come up now the childrens father apparantly sexually abused my daughter. how i dont know since he hasnt had unsupervised visits with his children in over two years. oh yeah that right they made it up because they have never wanted my children to come home because their to busy trying to make money off of kids. this is taking place in cherokee county gaffney sc i wont say her full name but the intials r dw the whole case she has done nothing but change her story or flat out lie about everything.. How would you feel if it were the police that made the alegations up on you. Your child wondered off like 3 year olds will do if you turn your head for a minute and you call 911 for help and they arrest you for child neglect. A month ago I layed down to take a nap with my 2 year old daughter we took a nap the same time everyday I had been sick also so I had my brother come over to help me out he decided to nap also I locked all doors even chain locks before I layed down . I woke up to my brother yelling the cops are at the door at that time I noticed my back door was open chain was broke off also. when I opened my front door cops were there and many more people in my yard the chef in my town is also my sisters brother in law who was there also who was treating me like a criminal they said my daughter was outside in front yard by road with are dog the chef notices my brother who has a past history of drug use and makes a allegation to CP's who they said they has to call that there were possible meth use in my house which was false they asked me and my husband to do a drug test I felt like a criminal I told them I wanted my attorney we took drug test both of us past a week later I was arrested and charged with endangered to child felony 2 which is false clasification after a month cps dropped my case they said they seen no need for them to be called the chef police made a false allegation I have been dealing with Social Services since november of 2015 because my daughter decided to lie to her teachers about my boyfriend scratching her instead of telling them the truth about them being cat scratches instead of my boyfriend scratching her. She has now been telling them we are beating her and making up excuses and even more lies which has now made it where DCYF is not trying to open a endangered child case on us because my child is trying to seek attention. My daughter bruises easly, so she herself can put all of the bruises she gets on herself and she will constantly go "Mommy and daddy hurt me" I have looked through my states laws and found out they ahve done a lot of illegal stuff and violated my parental rights especially going to my daughter's school without my knowledge and then taking pictures of her bruises without any type of medical examiner there. I don't know what to do right now, I don't sleep, I can't find a pro bono lawyer in my area who could possibly take my case and I was already told if she cried wolf one more time she would be taking away. I need help, a lot of help. Hello Plz. Forgive me for saying this But the person that said dss won't strip search you child is a lie or don't know what he or she is talking about. They will and have done it more then once My husband is accused by a girl and her sister that not true cause i havea letter from the dhs that says is unfounded and its going to be expunged the case what can i do alrespect??? 174
https://hubpages.com/education/accused-of-child-abuse
CC-MAIN-2017-13
refinedweb
41,227
75.95
Programname arg1 arg2 inputfile outputfilepekerjaan ...semi-colon are ignored as comments. Command line looks like dedupe -rules: [login to view URL] [login to view URL] output should be the input file name with "-dedupe" added example: ([login to view URL]) Format of rules file is like this ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; duplicate rules text file ; ; primary field in CVS to dedupe the price your looking for ...create and POST a url like [login to view URL] The parameters invokerCode, arg1, arg2, arg3, arg4 and arg5 need to be looked up from the Assets and Opportunities modules. [login to view URL] will return {"code":"OK"} ...Sequence Environment Object If ($1st_Prod) { [string]$MICS_LOC = '[login to view URL]' [string]$MICS_Arg = 'CF=Arg1' [string]$MICS_Sort_Name = '1st [login to view URL]' } ElseIf ($2nd_Prod) { [string]$MICS_LOC = '[login to view URL]' [string]$MICS_Arg = 'CF=Arg2' [string]$MICS_Sort_Name = '2nd [login to view URL]&... ...will not play at all to either party once recording has been initiated first. Here is the two parts of the macro I have so far ;record a call exten => s,1,Set(CALLFILENAME=${ARG1}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}) exten => s,n,MixMonitor(/var/spool/asterisk/monitor/Contract/${CALLFILENAME}.wav,W(3)) ;play an announcement. exten => s,1,Playback(custom/lc2) ...sodales ullamcorper, ultricies vel nulla. {[login to view URL] 3 12} etc etc etc ------------------------------------------- In the first shortcode above [login to view URL] becomes $arg1, #1 is $arg2 and #2 is $arg3 With some help through stackoverflow I have it display the galleries but regular text is out of order and some there are some other problems. The task I have some work, in an Excel spreadsheet. we will be working together over meeting ID ...open("[login to view URL]", "r") as inputFile: # open json file data = [login to view URL]([login to view URL]()) # load json content data['PTransactionDate'] = [] data ['PValueDate'] = [] data ['PNarration'] = [] with open("[login to view URL]", "w") as outputFile: # open csv file output = [l... Create a python script to use it in command line to extract and filter data. the data file cont...lenght and save date in 2 files ( tab delemited) "good-output-file" with all good data, and "bad-outputfile" contain all data filtred. ... the scritpt must work like this in command line : /[login to view URL] data-name-file good-output-file bad-outputfile Create a python script to use it in command line to split and filter data. the data fi...filter by lenght and save date in 2 files "good-output-file"with all good data, and "bad-outputfile" all data filtred. ... the scritpt must work like this in command line : /[login to view URL] threshold-length data-name-file good-output-file bad-outputfile ...you to develop some software for me. I would like this software to be developed for Windows . Create an assembly( computer science) program that 1. asks the user for the inputfile name (f, c, d) 2. asks the user for the output filename (f, c, d) 3. ask the user for the passphrase (f, c, d) 4. ask the user if they want to encrypt (add shift value) or ...contained in that file is to be read into memory (i.e., extracted). Your program will be compiled and run on Eustis using the following commands: gcc -o etl hw1etl.c ./etl inputFile It is entirely possible that the input file either does not exist or is not where it is supposed to be. In such an event, your program should print an error message ...record for each ID and post the transactional information from each transaction to the 1 output record. The program should use logic like below [login to view URL] (perl programname) -i (Inputfilename) -o (outputfilename) 1 20 (ID field beginningbyte endingbyte) 21 90 (transactional rollup beginningbyte endingbyte) Additional information - the perl ...$D; } FUNCTION TRUNC(){ $NUM_ARGS = func_num_args(); $args = func_get_args(); IF ($NUM_ARGS = 2) { $ARG1 = $args[0]; $ARG2 = $args[1]; RETURN TRUNCC($ARG1,$ARG2); } ELSEIF ($NUM_ARGS = 1) { $ARG1 = $args[0]; RETURN TRUNCC($ARG1,0); } } FUNCTION Fix($dec){ return (int)($dec); } FUNCTION MOD($NUMBER I need a scripe with the following requirements: - start sc.. ...dangerous? at least 3 arguments are needed Examples are Topic: Arguments suggesting that Australia's attitude toward Anzac Day is dangerous Arg1 :Anzac Day cannot be publicly challenged without penalty Arg2: Anzac Day is exploited for political purposes Arg3: Anzac Day commemorations encourage a readiness to go to war Arg4: Popular attitudes toward ... ...Set(theext=${ARG1}) exten => s,n,GotoIf(${DB_EXISTS(CFU/${theext})}?cf:dial) exten => s,n(cf),Macro(stdexten-callforward,${theext},SIP/${theext}) [macro-stdexten-callforward] exten = s,1,Answer exten = s,n,Set(number=${DB(CFU/${ARG1})}) exten = s,n,Set(CDR(userfield)=Call_Forward_Uncond) exten = s,n,Set(CDR(accountcode)=${ARG1}) exten - Check if the user passes the currect number of parameters to the scripts - Check if the directory /efs/dev/$arg1/$arg2/$username_$release exists - If it exist, use cut '_' to get the realease number - If it not exists create the folder with mkdir - You can get the username with whoami, assign it to a variable and append _$release to it - Copy ...SIGNATURE IMAGE. The software must work through a proxy server. I would expect that the software would be called as such: createpod --OutputDirectory c:outputJanuary --InputFile [login to view URL] --ErrorFile [login to view URL] If a POD cannot be created (bad tracking number or other error), it should output the tracking number to the ErrorFile so we ...linked list sorted in numeric order. If the command is DEL you should delete that number from that list. When the EOF is encountered, write the list to the file whose name is arg1, one integer per line. Ignore any duplicate adds. Ignore any deletes of items not in the list. For example, if the file input contains: ADD 10 ADD 8 ADD 11 ADD 11 DEL ...numeric count overlayed over the slice. IMPORTANT NOTE: The data must stay in order as it is in the list Input: ChartTitle (string), Data (list of dictionaries, see below), Outputfile(string, filepath), Legend=True,Overlay=True, Size=(height,width)#inches Data structure: data = [{'Name':'Critical', 'Count':10, 'Color':'Red'},#t... Write a script which will take as a command line argument the name of a senator and outputs that senator’s twitter handle by extracting it from this URL. If arg1 is not a senator or does not have a twitter account output: no twitter handle found for $1 For example: afsconnect1 >: gettwit "Mike Rounds" @SenatorRounds afsconnect1 >: gettwit ...Long Dim arg1 As Byte Dim arg2 As Byte Dim arg3 As Byte Dim arg4 As Byte arg1 = CByte("&H" & ChByt0) arg2 = CByte("&H" & ChByt1) arg3 = CByte("&H" & ChByt2) arg4 = CByte("&H" & ChByt3) (((F3+06+50) ^ F3)+41) * 16 num2 = (((a... .. of a "Test I need to have a script which will do quote for step 1, 2, 3, 6,7 ...number of columns be present columnwise as seen in the inputfile for each ... ...columns and increase in number appear as seen in the inputfile as columns and... Right now i m useing this extensions but the prob is when start ivr its take 5 Sec...Dial(${DIALSTR},,M(answer^${CALLID})) exten => _X.,n(noroute),NoOP("No Dial String") exten => h,1,AGI([login to view URL],${CDR(uniqueid)}) [macro-answer] exten => s,1,AGI([login to view URL],${ARG1}) ==================================================================== I need a shopify scrappi...the tool finds the links the tool needs to save these links in a regular text file (the output file) tool needs to continuously look for the new links and save them to the outputfile also the tool needs to allow me to open multiple instances Interface must be user friendly video of what i have currently can be provided ...MIME::Base64; my $msgfrom = '[login to view URL]'; $msg = MIME::Lite->new( From => $msgfrom, To => $sendto, Cc => '', Subject => 'Your Daily Reports - ' . $inputfile, Sender => '[login to view URL]', Type => 'multipart/mixed', ); $msg->attach(Type => 'text/html', Da... ...[login to view URL](id); [login to view URL](getClass().getName()).log([login to view URL], "called" + [login to view URL]); String inputFile = [login to view URL]("%20"," "); final String movieFile = "/uploads" + inputFile; final String resultFile = "/uploads/files/" + id + "-" + start... Hi Can you write a script to b...Can you write a script to be used in an Asterisk Dialplan that extracts the Queue numbers for an Extension number: IE: extension number 413 is on Queue 50 and 53 so ARG1 = 50 and ARG2 = 53. I have about ten Queues Show Queue: Local/413@from-queue (Local/413@from-queue/n Local/411@from-queue (Local/411@from-queue/n ...column. Yes, I know…I am not that good at explaining ;-) So here is an example… Input in terminal: [login to view URL] [login to view URL] [login to view URL] 1 Explaination: script, inputfile, outputfile, column to write in Should produce a file like [login to view URL] File delimiter is and should always be ";" and encoding... .. ... People will enter their information on this page requesti...page requesting a quote for solar panels at no cost and submit request for for a call back. See example page: [login to view URL] People will enter their information on this page requesti...page requesting a quote for solar panels at no cost and submit request for for a call back. See example page: [login to view URL] ...parameters, arg1 for source file name and arg2 for export file name. The source will be a video in mp4 format (arg1), recorded from the camera of a mobile phone and be between 5 and 10 seconds long. (You do not need to record this!) The script will process every frame of the video to detect the pupil and log the output to a file (arg2) in CSV format ...are then returned after sending completion signal ctrl+c. Basic command: ./pastebin_crawler -k <keyword1>,"example substring",<keyword2>..... -o <outputfile> Both the keyword and outputfile arguments are optional and default to -k ssh,pass,key,token -o [login to view URL] Optional command: -a, Append to file instead of overwriting fil... hello i have asterisk and before i receive calls from SIP and send to IAX2 peers but now i want to receive calls from SI...Dial(${DIALSTR},,M(answer^${CALLID})) exten => _X.,n(noroute),NoOP("No Dial String") exten => h,1,AGI([login to view URL],${CDR(uniqueid)}) [macro-answer] exten => s,1,AGI([login to view URL],${ARG1}) If You can fixed Then please Bid ...administration tool are available to make changes to their code on request. EXAMPLE:{{fixed_url}}&username={{user_email}}&password={{user_password}}&method={{method}}&arg1=A&arg2=B&arg3=C Security: HTTPS, username and password should be part of every POST. Technique: POST to the web service with one of more arguments. JSON string would be the ...are able to handle this project before making a bid) I have developed a desktop application in OCaml under Ubuntu. It can be run in a command line: "name -parameters arg0 arg1 ..." and returns some XML result. Now, I would like to deploy it to a DigitalOcean Ubuntu server (512 MB Memory / 20 GB Disk) that I own. I will use JavaScript programs on the ...in 48 hours I'm happy to pay bonus 20% of the project budget !!! Excel with VBA macro stored in the ControlFile 1. InputFile - contains list of files to go through evalutation 2. Creates new excel file - OutputFile 3. OutputFile will have the following sheets with the following lists: a. FileList b. TableList c. RangeList d. ChartList e. PivotTableList Hi, I need a new script, to e...directory. The script could be wrote on perl or bash, but without use externals components. The script requiered, by command-line arguments, the [login to view URL], the inputfile, and indicate if will send by sftp or sent to local directory, and by command-line arguments write the sftp address server or local path. ..... ...for the number that was successfully sent to for example if the number is 123-345-2343 and it bounces for at&t tmobile but it works for verizon then in an outputfile we should have that number saved there and there wont be any need for it to send to sprint. Another way for this to work was Let all 10,000+ numbers first be sent with
https://www.my.freelancer.com/job-search/programname-arg1-arg2-inputfile-outputfile/
CC-MAIN-2018-43
refinedweb
2,053
61.46
Mex! 21 Comments: I just hope that too many of the "cantinas" aren't gone before I go down to Mexico to the dentist. Nothing better than a Corona after a root canal! Isnt most of the cost difference atrributed to differences in liabilty law? The real question is what can we learn from this to make our system better? Liability may be a part, but lets not let preconcieved dogma prevent accurate analysis. Quality control might be an issue, too. A competitive global market for health care would be good for everyone. It would lower costs by putting pressure on the U.S. health care market and would force tort reform. What's needed is reliable, independent review and analysis of the quality of doctors and hospitals in every country. A competitive global market for health care would be good for everyone Tell that to the "Buy American!" crowd. Next thing you know there will be tariffs on Mexican health care. My wife had excellent dental work done in Medellin, Colombia for about 20% of the cost, I think, of our local dentist. He was a better dentist, too, trained in the US. Speaking here as a dentist. At a practical level, you get what you pay for. Many of these dental tourists believe that fillings, crowns, extractions and dentures are simple widgets stamped out of a factory in China and think that receiving dental care is like going to the auto mechanic to swap out an alternator. Assuming for the moment that these Mexican dentists are the equal of their American colleagues; even the most technically competent dentist needs to be relatively accessible to the patient when things need attention, adjustment or intervention, as they so often do. For example: What if that root canal you had done last Friday flares up and now you're swollen and 100 miles away? The Mexican dentist cannot call your pharmacy for antibiotic coverage, and you can't exactly go back to the office first thing in the morning. Or what if that filling is high and your bite is "off" and needs a routine adjustment? I could go on. Buyer beware. We've had dental work done in Mexico and are fairly happy with the results. The price is about 1/3rd the cost in the USA. Cleanings and fillings are done well. However, I had a root canal and the results weren't good. The dentist felt terrible that she couldn't extract all of the root due to a twist in the root (and she didn't have the tools to get past the twist). Once back in the US, I went about two months and the tooth began acting up. A local endodontist had the specialized tools required to get to the root; $1400 later and the tooth is doing much better (pain free). We'll still get most of our work done in Mexico at 1/3rd the price, but we'll always have plan B waiting if the work done needs supplemental USA work. BTW, my wife's sister had a face lift in Mexico with incredible results (uh, no, not at the dentist's office...). Again, about 1/3rd the cost. She truly looks like a movie star now; just an amazing transformation. From HotAir.com:: VIDEO Think long and hard about letting the government take control of your health care. Hey ExtremeHobo, thanks for the link to the Daily Finance and that article in particular... Real nice find... One thing the author did not mention is the insane amount of drug war viloence happening on the Mexican border. It is happening in broad daylight, in very public places, and innocent bystanders are killed as well. I would not want to be hit by a stray bullet during my dental vacation. I have gone to Mexican Dental Vacation in the past, for my dental work. I saved more than 70% on the price I was quoted here in Canada. I also got a beachfront vacation, as they are located in the resort city of Mazatlan. It was a good break from the Canadian cold! It has been 5 years now, and all of my dental work is doing great, including the 2 implants I had done. I would highly recommend them. Im glad you enjoyed it 1. There is so much info out there for us economics junkies! In my San Diego area, visits to Tijuana, Mexico for dental work are become more common every year. Savings run from 70% to 85% over U.S. dentists. TJ is an awful place, with kidnappings, crooked cops and occasional drug war shootouts. But the savings are so great that many people weigh risk vs. return (savings), and still chose to go. The chance of actually getting kidnapped or shot are rather small. But it’s sad that our tort plagued medical system has become so expensive that people are choosing to take their chances in TJ for the substantial savings. I think a somewhat more interesting approach would be to combine a vacation into one of the safer resorts in Mexico (or elsewhere), and combine that visit with dental work. Or plastic surgery. Or both! After we institute national health care, this foreign medical vacation option will probably grow by leaps and bounds. Oh joy! We have been going to Mexico for dental AND non-emergency surgery since 1960's. Now we live here in Veracruz and enjoy excellent medical care for a fraction of US costs. Why? 2 reasons; there are too many doctors here competing(and no strong AMA) AND there is no tradition of lawsuits for every little problem. Better yet, let's give those dentists H1-B visas and bring them into the U.S. The same thing has happened in Europe. If you're looking for inexpensive dental treatment abroad at British private clinic standards, you can check out for an accredited dental clinic where Brits can save 70% on regular dentist costs, and not have to be on a waiting list. How is this any different than why it's cheaper to make cars in Mexico? - much less overhead and lower operating costs; they're perfectly happy with much lower salaries/wages which apparently go much further in the Mexican economy. This comment has been removed by the author. I find it interesting that I could not find anywhere on a web search about complaints people have filed from substandard work done in Mexico. Of course, all of the dental tourism sites with their 'consumer reviews' have nothing but raving fans. Sounds a little too good to be true. Also, I would imagine that the cost of dentistry also has something to do with the fact that it takes 8+ years of post secondary education and mounds of borrowed money just to become a dentist so figure that into the cost as well. I would much rather have someone who is readily available should a problem occur and support my local community, not another countries economy. I did a serious bunch of dental work in Mexico... and I had a situation where I experienced The Good, The Bad, and The Ugly. --[ Well, wasn't that ugly, but since the "Mexican Dental Vacation" folks in Mazatlan had promised to pay me back partial for poor work, and did NOT, that was kind of ugly.] I had a poorly trained dentist start the work there, and when I got nervous about a couple of things, I went to another Mazatlan dentist for a specialist perspective. He informed me that the prep work being done for my procedures was indeed incorrect. He referred me to yet another dentist for a second opinion- and then I (re-)began the work on three bridges, a root canal and a surgical extraction. All done by three independent Mexican dentists, one who had trained in the US and I was VERY happy with the final outcome. So while I had a bad dentist south of the border.... I also had three good ones. Kind of like here in the United States - but at least I could afford to get all the work done! I think it's very sad that dental work is so expensive in the US and you can go just across the border or abroad and get it for so much less. That should tell us something about the true costs. I admire anyone who does denistry work, but I do think it's too expensive and that is the reason most people don't get the dental work they need. It's true in my case. Going abroad has it's drawbacks, but I think the good far out-weighs the bad. I had horrible work done in Algodones, TLC dental to be exact. It is costing me triple the amount to get fixed. After being bruised, infected and in pain for several months with no remedy. I am now forced to seek help in the US, where we can have REAL ANTIBIOTICS AND PAIN MEDICINE prescribed by real dentists. DONT DO IT, NOT WORTH IT Links to this post: Create a Link
http://mjperry.blogspot.com/2009/03/mexico-new-dental-destination-70.html
CC-MAIN-2014-42
refinedweb
1,530
71.75
Created on 2015-04-07 16:23 by serhiy.storchaka, last changed 2016-06-06 02:30 by python-dev. Here is a (perhaps incomplete) list of documented names absent in __all__ lists of respective modules. Perhaps some of them (but not all) are worth to be added to __all__ lists. calendar.Calendar calendar.HTMLCalendar calendar.TextCalendar cgi.test configparser.Error csv.unix_dialect doctest.DocFileCase doctest.DocTestCase enum.EnumMeta fileinput.fileno ftplib.Error ftplib.error_perm ftplib.error_reply gettext.bind_textdomain_codeset gettext.lgettext gettext.lngettext http.client.HTTPMessage http.cookies.Morsel http.server.test logging.shutdown mailbox.Error mailbox.ExternalClashError mailbox.NoSuchMailboxError mailbox.NotEmptyError mimetypes.MimeTypes optparse.check_choice pickletools.OpcodeInfo plistlib.InvalidFileException pydoc.doc smtpd.SMTPChannel subprocess.SubprocessError subprocess.TimeoutExpired tarfile.CompressionError tarfile.HeaderError tarfile.ReadError tarfile.open threading.BrokenBarrierError tkinter.ttk.Widget tokenize.open traceback.FrameSummary traceback.StackSummary traceback.TracebackException traceback.walk_stack traceback.walk_tb wave.Wave_read wave.Wave_write xml.etree.ElementTree.XMLPullParser http.client.HTTPMessage: See Issue 23439. There was resistance to adding this (and the status code constants), though IMO they should be added, since they are documented public APIs. http.server.test(): In Issue 23418, I consciously left this function out. It is only mentioned as a place to look for sample code, as far as I can tell. New changeset ebf3e6332a44 by Berker Peksag in branch 'default': Issue #23883: Add missing entries to traceback.__all__. May be makes sense to add a helper in test.support that implements a test similar to the one in issue23411, and add tests for __all__ in multiple modules. I working on these three. calendar.Calendar calendar.HTMLCalendar calendar.TextCalendar Changes would be the same as for every module? Serhiy: Yes I was also thinking it might be time for a common helper function. Milap: I think changes like you mentioned (originally by me) would be fine. Another variation was done for Issue 10838: revision 10b0a8076be8, which expects each object that is not a module object (e.g. not from “import sys”), rather than expecting each object that is a function or class defined in the module. It might depend on the particular circumstance which technique is superior. New changeset 86fbe140e395 by Andrew Kuchling in branch '2.7': #23883: add names missing from __all__ (l*gettext, bind_textdomain_codeset) New changeset 717d87c13f0d by Andrew Kuchling in branch '3.4': #23883: add names missing from __all__ (l*gettext, bind_textdomain_codeset) I took care of the tarfile module. Added the following according to the first message: tarfile.CompressionError tarfile.HeaderError tarfile.ReadError tarfile.open The following were included in __all__ that were not explicitly mentioned in the first message but were denoted as an exported function, exported class, or an exported error. tarfile.main tarfile.TarIter tarfile.StreamError tarfile.ExtractError tarfile.SubsequentHeaderError tarfile.InvalidHeaderError tarfile.EmptyHeaderError tarfile.EOFHeaderError tarfile.TruncatedHeaderError This is my first patch so feedback is highly appreciated. Regarding tarfile: Two of the extra errors are documented, so I agree they should be added: * tarfile.StreamError * tarfile.ExtractError However I’m not so sure about main(), TarIter, and the HeaderError subclasses. They aren’t mentioned in the documentation. At least main() and TarIter are just implementation details I think. There are other documented items that should be added in my opinion. These would not be picked up by the proposed test, although they would be picked up by making the test like in revision 10b0a8076be8. * ENCODING * USTAR/GNU/PAX/DEFAULT_FORMAT Thanks for the feedback. I was unsure how to proceed with the undocumented items that seemed to be categorized as exported. Thanks for catching ENCODING & *_FORMAT. Oh I see, TarIter is listed underneath a comment saying “Exported Classes”, and main() is listed underneath “exported functions”. If they are indeed meant to be exported, they should probably also be documented. Otherwise, maybe we can just add another comment clarifying that they are internal. In the latest patch, I think HeaderError should be added back to __all__; it is just its subclasses that are not documented. Also XHDTYPE is listed twice in the test case. If it were up to me, I would add the TarInfo.type constants (REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE). But I’m not sure if others would agree. Put HeaderError back in and removed the extra XHDTYPE. We can get more input on the type constants as well as the undocumented but exported items. Could just be cleared up with some edits to documentation. I? Woops just noticed above in the issue someone else picked up the Calendar __all__. I am genuinely sorry I didn't intend to duplicate the effort. Hi guys! Here is a patch for the fileinput module, with some names beyond fileinput.fileno: fileinput.hook_compressed, fileinput.hook_encoded as mentioned in the docs This is my first patch as well, so feedback's appreciated! Hi! This is my first attempt at contributing so as always, feedback will be well appreciated. :) I meant to start small so I took a shot with csv module. In test, initial expected set contains QUOTE_* because they don't provide __module__ attribute, and __doc/version__ because they are already in csv.__all__ (should they?). I've made a few PEP8-related fixes just around code I've touched (so they aren't completely unrelated). Is that ok? Reviews. Thank. > ftplib and threading have more functions I've meant function and exceptions, of course. Sorry for the noise. I've added previously missing test and docs for test.support.check__all__ in Issue23883_support_check__all__.v2.patch . Awaiting review. :) To.. === Serhiy: ftplib.Error does not actually appear to be documented. Perhaps it should not be added to __all__ after all? (excuse the pun) > Nice work with the check__all__() function. Thank you! :) >. Could you please elaborate on "making the test stricter"? I'd go with the first check + optional name_of_module. With second one alone, all freshly added test__all__ tests would need additional names in blacklists - not huge ones, but they would otherwise be unnecessary. I've amended the patches and I'm waiting for review. I've also thought of not only making name_of_module param optional, but to make it extra_names_of_module (so such param would be added to module.__name__ used in "getattr(module_object, '__module__', None) in name of module" check. It would account for less typing in general (module.__name__ occurs in almost all cases), but also less explicity. What do you think? > Serhiy: ftplib.Error does not actually appear to be documented. Perhaps it should not be added to __all__ after all? (excuse the pun) Agree. The list is only cursorily filtered result of some one-liners and can contain false names. Adding new names to __all__ can have undesired effect and break user code (by hiding builtins as for tarfile.open). Perhaps not all documented names should be imported with "import *". In any case it is too late for 3.5. I think names should be in __all__ even if they shadow builtins, at least in a new feature release. There is plenty of precedent, e.g. asyncio.TimeoutError; reprlib.repr(); threading.enumerate(). Modules with open() in __all__ include aifc, bz2, codecs, dbm, dbm.dumb, gzip, lzma, os, shelve, wave and webbrowser. Plus, pydoc ignores things excluded from __all__. J. The. > In any case it is too late for 3.5. Ok, next round of patches is based on default branch. > Jacek: If we used the ModuleType check, and somebody adds a module-level constant (like logging.CRITICAL = 50), the test will automatically detect if they forget to update __all__. That is what I meant by the test being stricter. Right and I think such case should be covered as well. I think it may be worth the hassle of adding new condition in detecting names expected to be documented, so the whole if clause would look like: if (getattr(module_object, '__module__', None) in name_of_module or (not isinstance(module_object, types.ModuleType) and not hasattr(module_object, '__module__'))): expected.add(name) Obviously tradeoff lies in required blacklisting: * with previous __module__ check - all undocumented, non "_*" names defined in checked module, but constants need to be in *extra* and new ones won't be detected * with ModuleType check only - all undocumented, non "_*" names defined in checked module + all functions and classes imported from other modules needs blacklisting * with extended __module__ check (proposed above) - all undocumented, non "_*" names defined in checked module + all constants imported from other modules; this choice also requires less 'extra' params (in fact, in these patches only csv.__doc/version__ case left) In this round of patches I went the new, third way. One odd thing: in test.test_logging, are these: 3783: self.addCleanup(setattr, logging, 'raiseExecptions', old_raise) 3790: self.addCleanup(setattr, logging, 'raiseExecptions', old_raise) ("Ex*ec*ptions") really typos or is it intentional? test.test_logging has raiseExceptions name as well. Also, pickletools.OpcodeInfo and threading.ThreadError are not really documented, are they? That raiseExecptions thing looks like a typo to me. The code should probably be monkey patching the module variable, and restoring it after the test. Then you wouldn’t need to add your extra typoed version to the blacklist. In the logging module, I reckon raiseExceptions (non-typoed) should actually be added to __all__. It is documented under Handler.handleError(). pickletools.OpcodeInfo: It is briefly mentioned as the type of the first item of genops(). I don’t have a strong opinion, but I tended to agree with your previous patch which added it to __all__. threading.ThreadError: It is not documented, but it was already in __all__. I think it should be restored, in case someone’s code is relying on it. I'm getting patches ready with amendments you've proposed. Two things, though (and two on Rietveld): > That raiseExecptions thing looks like a typo to me. The code should probably be monkey patching the module variable, and restoring it after the test. Then you wouldn’t need to add your extra typoed version to the blacklist. Wouldn't it be better to just blacklist the typoed version in this patch, with proper comment, and then fix the typo along with test? Working it around like you proposed looks like unnecessary overkill. I'm also not yet sure where is the "don't change too much in one patch" border. > pickletools.OpcodeInfo: It is briefly mentioned as the type of the first item of genops(). I don’t have a strong opinion, but I tended to agree with your previous patch which added it to __all__. That addition was a little absentminded of me, sorry for that. Is such brief mention considered a documentation for a part of API in this case? raiseExecptions typo: Might be best to get the typo fixed first (maybe open a separate issue, since it should probably be fixed starting from the 3.4 branch). Regarding OpcodeInfo, it is probably up to your judgement. > raiseExecptions typo: Might be best to get the typo fixed first (maybe open a separate issue, since it should probably be fixed starting from the 3.4 branch). Done in #24678 and commited in 83b45ea19d00 . > Regarding OpcodeInfo, it is probably up to your judgement. Then I'll leave it as it was - without OpcodeInfo in pickletools.__all__ . The test for it remains in the patch, though. Thank you all for your work and apologies for my lack of response. I'm +1 on adding a check__all__ helper to test.support. But passing "self" to it feels a bit weird. Perhaps the assertCountEqual part could be moved outside of the helper. If Serhiy(and/or other people) are happy with the current API, I am happy too :) Here is a brainstorm of alternatives that don’t require passing “self” into a helper function. But IMO the current proposal that does pass “self” is better. * Passive expected_module_api() function, and manually check the return value. Precedent: support.detect_api_mismatch(). def test_all(self): # In class test.test_tarfile.MiscTest blacklist = {"bltn_open", ...} possible_exports = support.expected_module_api(tarfile, ignore=blacklist) self.assertCountEqual(ftplib.__all__, possible_exports) * ModuleApiTestBase class. Subclass it to use it: class ExportsTest(support.ModuleApiTestBase): # In module test.test_tarfile module = tarfile ignore = {"bltn_open", ...} * Raise AssertionError directly in case of failure. No automatic error message showing the different names though. Precedents: support.run_doctest(), .check_warnings(), script_helper.assert_python_ok(), _failure(). * Make a temporary internal TestCase instance: def check__all__(module, etc): expected = ... ... TestCase().assertCountEqual(module.__all__, expected) Does anyone have strong preference towards one of the propositions above? TestCase subclass looks reasonable IMHO, but I'd not add that to the scope of this issue (I'd be happy to implement it later, though). Any suggestions? many things are not present in os.__all__ that should be, including os.getcwd Michael: According to Issue 18554, os.__all__ was fixed in 3.5. Can you confirm? It is working for me: Python 3.5.0 (default, Sep 20 2015, 11:28:25) [GCC 5.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> "getcwd" in os.__all__ True @Martin, my mistake. You're correct. I forgot I was using Python v3.4. Berker (or anyone else), do you have a preference on how we move forward? I am inclined to use Jacek’s function as it is. I think it is certainly an improvement over the current state. People can propose an alternative version of the function later if they want, though in my opinion the underlying problem is in the architecture of unittest’s assertion methods; see Issue 19645. I have added comments on Rietveld. Besides few stylistic nitpicks Issue23883_support_check__all__.v5.patch LGTM. > But passing "self" to it feels a bit weird. This is not new. There are other testing helpers in test.support that needs passing "self". If the helper is used many times in one test class, I prefer to make a method: class SomeTest(TestCase): check_something = test.support.check_something def test_foo(): self.check_something('foo') def test_bar(): self.check_something('bar') But in this case I'm happy with the current API. Serhiy, thank you for the review. I've made proposed changes (along with rebasing Issue23883_all patch; Issue23883_test_gettext.v3.patch still applies cleanly). I like Martin's support.expected_module_api() suggestion in msg247167. I still find passing self to a function just to use assertCountEqual a bit weird, but I can live with that. The reason why I prefer the current API over my support.expected_module_api() idea is it requires the extra assertCountEqual() boilerplate at each call site. Jacek’s three patches look ready to me. I propose: 1. Commit Issue23883_support_check__all__.v6.patch to 3.6, which everything else depends on. 2. Commit Issue23883_test_gettext.v3.patch to 3.6. (Andrew Kuchling’s original gettext.__all__ fix was made in 3.4 and 2.7 as well, but we would have to backport the support function, or rewrite the test, to apply this to earlier branches.) 3. Commit Issue23883_all.v6.patch to 3.6 only to limit the chance of breaking existing code. 4. Rewrite Mauro SM Rodrigues’s issue23883_fileinput.patch to use support.check__all__(). 5. Update Joel Taddei’s Issue23883_tarfile_all.patch and Issue23883_calendar_all.patch for support.check__all__() and addressing review comments. 6. Work on the remaining modules, probably in a separate issue to keep things under control. According to my calculations these modules are: cgi, configparser, doctest, http.cookies, mailbox, mimetypes, plistlib, pydoc, smtpd, tkinter.ttk, tokenize, xml.etree.ElementTree. Another question that comes to mind: Should we add anything into What’s New, maybe warning of new symbols from “import *”? > The reason why I prefer the current API over my support.expected_module_api() idea is it requires the extra assertCountEqual() boilerplate at each call site. I personally find explicit assert* calls in a test case more readable(e.g. I don't need to check what the helper does every N month), but I guess that's another version of tabs vs. space debate :) > Jacek’s three patches look ready to me. I propose: Your plan sounds good to me. Thanks! > Should we add anything into What’s New, maybe warning of new symbols from “import *”? I guess it wouldn't hurt to add a sentence :) New changeset f8fa7bc837a3 by Martin Panter in branch 'default': Issue #23883: Add test.support.check__all__() and test gettext.__all__ New changeset 78d67bdc1142 by Martin Panter in branch 'default': Issue #23883: Add missing APIs to __all__; patch by Jacek Kołodziej New changeset 25a7ceed79d1 by Martin Panter in branch 'default': Issue #23883: Add news listing modules with new exported APIs Thankyou. Martin, yay! :) And thank you for the documentation correction. Milap, Joel, Mauro, are you still interested in working on patches for calendar/tarfile/fileinput patches? I intend to finish them up if that's not the case. Yes, I'm, I have a commitment now but I'll submit a new version later today New version. issue23883_fileinput.v2.patch looks good to me. Week and no response, I'm posting updated patches for calendar and tarfile. I committed the last three patches to 3.6: 571632315c36: fileinput a2ffa9eedb1b: calendar 48090e08e367: tarfile a5d3ebb6ad2a: Update news Please let me know if there are some outstanding patches here that I missed. Otherwise, I think we are up to step 6 in <>. New changeset 571632315c36 by Martin Panter in branch 'default': Issue #23883: Missing fileinput.__all__ APIs; patch by Mauro SM Rodrigues New changeset a2ffa9eedb1b by Martin Panter in branch 'default': Issue #23883: Add missing APIs to calendar.__all__ New changeset 48090e08e367 by Martin Panter in branch 'default': Issue #23883: Add missing APIs to tarfile.__all__ New changeset a5d3ebb6ad2a by Martin Panter in branch 'default': Issue #23883: Update news New changeset 62e925be0aff by Serhiy Storchaka in branch 'default': Issue #23883: Removed redundant names from blacklists. Thanks for caring for this Martin. > Should we add anything into What's New, maybe warning of new symbols from "import *"? I think yes. New changeset bd6127a6354f by Martin Panter in branch 'default': Issue #23883: grp and pwd are None on Windows Serhiy: I already added a bullet point at <>. Per Martin's request, I've created a few new issues for next batch of module's __all__ list updates: * cgi: #27105 * configparser: #27106 * mailbox: #27107 * mimetypes: #27108 * plistlib: #27109 * smtpd: #27110 * tokenize: #27112 I've also looked at pydoc module, but I'm not sure what to do with it: `doc` function has only a brief docstring, it's not mentioned in docs at all. Should it really be in pydoc.__all__? I think pydoc could be left alone. The RST documentation doesn’t say anything about importing any functions from the module that I can see. I was surprised that it even defines __all__ = ["help"]. Perhaps pydoc.doc() was another false indication in Serhiy’s list. In this case I'm proposing a small patch just for testing pydoc module's __all__ list and left the decision to you, whether to apply it or not. :) Test doesn't use test.support.check__all__ (see msg266312) - blacklist would be huge and expected list, as you already pointed out, has only one value. New changeset a36c7f87eba9 by Martin Panter in branch 'default': Issue #23883: News updates for __all__ attributes
https://bugs.python.org/issue23883
CC-MAIN-2017-13
refinedweb
3,171
59.19
OK guys I'm back! :p This was actually a problem I asked you guys about before, but now I am trying to add a looped error checking. I want the program to say if the hour is wrong, if the seconds are wrong, or both. Then let the user retry it. I got the hour to work, but the other two are acting wierd. This is what I have so far: Any advice?Any advice?Code: #include <stdio.h> main () { int tfhour; /* Intialize tfhour, tfseconds, & twhour */ int tfseconds; int twhour; /* Prompt user for input of military time */ printf("Enter a 24-hour time (ex. 22:23): "); /* Check to see if "seconds" input is valid */ /* and contines to check the hour */ while ( scanf("%d:%d", &tfhour, &tfseconds) == tfhour <=0 || tfhour > 24 ) { printf("Not a valid hour time! Please enter a new one! "); /* If not, output */ } while (tfseconds > 60 || tfseconds < 0) { printf("Not a valid seconds time! Please enter a new one! \n"); } /* If between 1 & 12, make that input twhour */ if (tfhour <= 12 && tfhour > 0) twhour = tfhour; /* If between 13 & 24, subtract 12. Then place in */ /* twhour's postion */ if (tfhour >= 13 && tfhour <= 24) twhour = (tfhour - 12); /* Print twhour & seconds value with output */ printf("Equivalent 12-hour time: %d:%.2d ", twhour, tfseconds); /* Checking for AM or PM. If the inputed value gives */ /* a 1 off when divided then it equals PM */ if (tfhour / 12 == 1) printf("PM\n"); else printf("AM\n"); return; } Thanks!
http://cboard.cprogramming.com/c-programming/46145-error-checking-loop-printable-thread.html
CC-MAIN-2015-27
refinedweb
244
82.54
Hello, i recently started making fps and when i tried to make .cs backup in case i fricked up those 3 errors showed up, even tho i deleted .cs backup 1. A meta data file (.meta) exists but its asset 'Assets/FPS/Scenes/Scripts/menuStart.cs' can't be found. When moving or deleting files outside of Unity, please ensure that the corresponding .meta file is moved or deleted along with it. (When i check this place, .cs file is still there) 2. Assets\FPS\Scenes\Scripts\menuStart.cs(1,7): error CS0246: The type or namespace name 'Unityengine' could not be found (are you missing a using directive or an assembly reference?) 3. Assets\FPS\Scenes\Scripts\menuStart.cs(4,27): error CS0246: The type or namespace name 'MonoBehaviour' could not be found (are you missing a using directive or an assembly reference?) Im a total newbie and i don't know much coding, i just copy scripts from internet. Frick, i just wanted to make scene change button Here's my code: using Unityengine; using System.Collections; public class menuScript : MonoBehaviour { public void ChangeScene(string sceneName) { Application.LoadLevel(scenc 780 People are following this question. Custom 'wipe' Transition between scenes 1 Answer Player Sprite Changing Scenes And getting a new camera to follow it and default spawn position 1 Answer Multiple Cars not working 1 Answer Distribute terrain in zones 3 Answers Changing individual color of particles by C# script NOT Working? 1 Answer
https://answers.unity.com/questions/1757207/scene-problem-missing-unityengine-and-monobehaviou.html
CC-MAIN-2020-34
refinedweb
246
58.38
Solution for Programmming Exercise 11.4 This page contains a sample solution to one of the exercises from Introduction to Programming Using Java.). One possible user interface would be to present the user with a menu of actions that the program can perform. For variety, however, I decided on an interface based entirely on the command line. The first command line argument must be the name or IP address of the computer where a copy of the FileServer program from Exercise 11.3 is running. If that is the only command-line argument, then the client will contact the server and send an "index" command to the server. The server responds with a list of file names. The client reads these names and displays them on the screen. The program then ends. (If you want to give another command, you have to run the client program again with a new command line.) If there are two command-line arguments, then the second argument must be the name of a file on the server. The client contacts the server and sends a "get" command. The server responds with a one-line message, either "error" or "ok". The client reads this message. If the message is "error", indicating that the requested file can't be sent, then the client just displays an error message to the user. If the message is "ok", then the server also sends the contents of the file. The client tries to create a local file of the same name. It reads the data from the server and saves it to that file. However, for safety, the client will not create a new file if a local file of the same name already exists. This is considered to be an error. (An alternative would be to ask the user whether to replace the existing file.) Finally, I wanted to make it possible to save a downloaded file in a local file with a different name. For this, three command line arguments are used. The first is the server, the second is the name of the file on the server, and the third is the name of the local file where the downloaded file is to be saved. In this case, the program is willing to overwrite an existing file of the same name, so the command must be used with some care. If the server program is running on the same computer as the client (for demonstration purposes), the following command lines can be used to run the client: java FileClient localhost java FileClient localhost datafile.txt java FileClient localhost datafile.txt mycopy.dat java FileClient localhost datafile.txt datafile.txt The first command shows a list of files that are available on the server. The other three all try to get a file named "datafile.txt" from the server. The second command would refuse the save the file, if a file named datafile.txt already exists. The last command would replace an existing datafile.txt with the file retrieved from the server. The actual programming of the client is fairly straightforward. The example program DateClient.java, from Subsection 11.4.4 provides a model for opening a connection to the server and for sending and receiving data over the connection. You should be able to follow the solution, given below. Note that the client program must know the protocol that is used to communicate with the server. The user of the program, however, does't need to know anything about the protocol. The user only has to know how to use the program, and the user interface does not reflect or depend on the details of the protocol. By the way, once you understand how the FileClient and FileServer examples work, it's not a big conceptual leap to understanding how the World Wide Web works. A Web server program is just a greatly souped-up version of the FileServer program. It has access to a collection of files. It receives and responds to requests for those files from client programs. To get a file, the client program -- a Web browser -- needs to know the computer on which the server is running and the name of the file. This information is encoded in the url address of a Web page -- just like it's given on the command line of the FileClient program. A Web page, of course, can contain links to other Web pages. The link includes a url with the necessary information for finding the page. To get the page, the Web browser just goes through the same process of contacting the specified server and requesting the specified file. (One big complication is that not all the files on a Web server are text files, so the client needs some way of knowing what type of data is stored in the file, and it needs to know how to handle data of that type.) import java.net.*; import java.io.*; /** * This program is a client for the FileServer client program works with command-line arguments. * The first argument must be the name or IP address of the * computer where the server is running. If that is the * only argument on the command line, then the client * gets the list of files from the server and displays * it on standard output. If there are two parameters, * the second parameter is interpreted as the name of a * file to be downloaded. A copy of the file is saved * as a local file of the same name, unless a file of * the same name already exists. If there are three * arguments, the second is the name of the file to be * downloaded and the third is the name under which the * local copy of the file is to be saved. This will * work even if a file of the same name already exists. */ public class FileClient { static final int LISTENING_PORT = 3210; public static void main(String[] args) { String computer; // Name or IP address of server. Socket connection; // Socket for communicating with that computer. PrintWriter outgoing; // Stream for sending a command to the server. BufferedReader incoming; // Stream for reading data from the connection. String command; // Command to send to the server. /* Check that the number of command-line arguments is legal. If not, print a usage message and end. */ if (args.length == 0 || args.length > 3) { System.out.println("Usage: java FileClient <server>"); System.out.println(" or java FileClient <server> <file>"); System.out.println( " or java FileClient <server> <file> <local-file>"); return; } /* Get the server name and the message to send to the server. */ computer = args[0]; if (args.length == 1) command = "index"; else command = "get " + args[1]; /* Make the connection and open streams for communication. Send the command to the server. If something fails during this process, print an error message and end. */ try { connection = new Socket( computer, LISTENING_PORT ); incoming = new BufferedReader( new InputStreamReader(connection.getInputStream()) ); outgoing = new PrintWriter( connection.getOutputStream() ); outgoing.println(command); outgoing.flush(); } catch (Exception e) { System.out.println( "Can't make connection to server at \"" + args[0] + "\"."); System.out.println("Error: " + e); return; } /* Read and process the server's response to the command. */ try { if (args.length == 1) { // The command was "index". Read and display lines // from the server until the end-of-stream is reached. System.out.println("File list from server:"); while (true) { String line = incoming.readLine(); if (line == null) break; System.out.println(" " + line); } } else { // The command was "get <file-name>". Read the server's // response message. If the message is "ok", get the file. String message = incoming.readLine(); if (! message.equals("ok")) { System.out.println("File not found on server."); return; } PrintWriter fileOut; // For writing the received data to a file. if (args.length == 3) { // Use the third parameter as a file name. fileOut = new PrintWriter( new FileWriter(args[2]) ); } else { // Use the second parameter as a file name, // but don't replace an existing file. File file = new File(args[1]); if (file.exists()) { System.out.println("A file with that name already exists."); System.out.println("To replace it, use the three-argument"); System.out.println("version of the command."); return; } fileOut = new PrintWriter( new FileWriter(args[1]) ); } while (true) { // Copy lines from incoming to the file until // the end of the incoming stream is encountered. String line = incoming.readLine(); if (line == null) break; fileOut.println(line); } if (fileOut.checkError()) { System.out.println("Some error occurred while writing the file."); System.out.println("Output file might be empty or incomplete."); } } } catch (Exception e) { System.out.println( "Sorry, an error occurred while reading data from the server."); System.out.println("Error: " + e); } finally { try { connection.close(); } catch (IOException e) { } } } // end main() } //end class FileClient
http://math.hws.edu/eck/cs124/javanotes5/c11/ex4-ans.html
CC-MAIN-2018-47
refinedweb
1,445
67.45
ipq_read (3) - Linux Man Pages ipq_read: read queue messages from ip_queue and read into supplied buffer NAME ipq_read --- read queue messages from ip_queue and read into supplied buffer SYNOPSIS#include <linux/netfilter.h> #include <libipq.h> ssize_t ipq_read(const struct ipq_handle *h, unsigned char *buf, size_t len, int timeout); DESCRIPTIONThe ipq_read function reads a queue message from the kernel and copies it to the memory pointed to by buf to a maximum length of len.. RETURN VALUEOn error, a descriptive error message will be available via the ipq_errstr function. DIAGNOSTICSWhile the ipq_read function may return successfully, the queue message copied to the buffer may itself be an error message from a higher level kernel component. Use ipq_message_type to determine if it is an error message, and ipq_get_msgerr to access the value of the message. BUGSNone known. AUTHORJames Morris <jmorris [at] intercode.com.au> Distributed under the GNU General Public License.
https://www.systutorials.com/docs/linux/man/docs/linux/man/3-ipq_read/
CC-MAIN-2022-21
refinedweb
150
53.31
Doyle LardellPro Student 888 Points doesnt work need help some one help here import random start = 5 while start is True: num = random.randint(1, 99) def even_odd(num): if num % 2 == 0: print ("{} is even".format(num)) start -= 1 else: print ("{} is even".format(num)) start -= 1 # If % 2 is 0, the number is even. # Since 0 is falsey, we have to invert it with not. return not num % 2 1 Answer Chris FreemanTreehouse Moderator 59,806 Points You have the right concepts but you have wrapped your code around the function even_odd instead of calling the function from your code. You don't need to alter the provided function to solve the challenge. Instead, place your while code after the provided function. Post back if you need more help. Good luck!!!
https://teamtreehouse.com/community/doesnt-work-need-help
CC-MAIN-2020-45
refinedweb
133
82.85
To me, naming our interfaces org.uima would imply that they were not a product of apache, but decided by some entity called "uima.org". Like in the example Thilo suggested, with org.w3c namespaces for things that originated from the W3C rather than from any Apache project. Built-in types are currently have a "uima.cas" prefix and could stay that way if we like. I'm not sure why introducing "org" would be helpful. It just seems strange to have anything named "org.uima" if there is not a separate entity whose domain name is uima.org. -Adam On 11/3/06, Marshall Schor <msa@schor.com> wrote: > Main issue with waiting: these changes are disruptive to our users. > Moving to Apache gives us one renaming opportunity (to change from > com.<previous-company>. etc.). > > I agree with impls being org.apache. Besides the interfaces, we have > things like the built-in types - I'd like to see these with org.uima > prefixes. > > -Marshall >
http://mail-archives.us.apache.org/mod_mbox/uima-dev/200611.mbox/%3C2787e08a0611030817t5b13d6f7xee3fbf2203968d39@mail.gmail.com%3E
CC-MAIN-2018-30
refinedweb
165
77.74
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode. Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript). On 25/12/2015 at 07:38, xxxxxxxx wrote: Hey there, here is my problem: I have made an object and in the .res file I made a button that should, when pushed, open a seperate plugin, and I don't really know how to do that. Do I have to write the code into the ObjectData's Execute method or where do I have to write my code? hopefully everything is clear ^^ (sorry fo my bad english) wish you guys a nice Chtistmas day! greetings, neon. On 25/12/2015 at 12:52, xxxxxxxx wrote: No, in the "Message" method. Straight from the python doc: def Message(self, node, type, data) : if type==c4d.MSG_DESCRIPTION_COMMAND: if data['id'][0].id==THE_BUTTON_ID: print "Pushed button with command ID", THE_BUTTON_ID return True The method "Message" is inherited from NodeData. On 04/01/2016 at 01:50, xxxxxxxx wrote: Hello, as Cairyn shows, the button is catched in NodeData.Message(). Best wishes, Sebastian On 15/01/2016 at 09:20, xxxxxxxx wrote: Hello Neon, was your question answered? On 20/01/2016 at 08:36, xxxxxxxx wrote: Hello S_Bach, sorry for the late answer, I had to much work to do for school, that I could't even take a look in the forum and wrire a reply, really sry for that! But yes, my question was answered, thank you two ^^ Best wishes, neon
https://plugincafe.maxon.net/topic/9275/12336_object-data-plugin-help-solved
CC-MAIN-2021-49
refinedweb
275
80.21
Compatible with Windows7 & Mac OS X Snow Leopard Jonathan Asbell wrote: > When I input an xml document and associate it with an xsl document the > output I get is just the xsl by it self... <snip /> Hi Jonathan It sounds like your stylesheet might contain the wrong xsl namespace declaration, which causes the <xsl:stylesheet> element to be interpreted as a result element. If you're using 0_18_2, then use : <xsl:stylesheet xmlns: However, if you're using 0_18_5, or any other tool which claims that it conforms to the XSLT 1.0 spec, then use : <xsl:stylesheet xmlns: If this isn't the problem, then post your stylesheet to the list, and I'm sure someone will able to tell you what's wrong. -- Warren Hedley XSL-List info and archive:
http://www.oxygenxml.com/archives/xsl-list/199912/msg00558.html
CC-MAIN-2013-20
refinedweb
132
72.09
MQTT version 3.1.1 client class Project description. It supports Python 2.7.9+ or 3.4+, with limited support for Python 2.7 before 2.7.9.. Contents - Installation - - Reporting bugs - More information Once you have the code, it can be installed from your repository as well: cd311, transport="tcp") - transport - set to “websockets” to send MQTT over WebSockets. Leave at the default of “tcp” to use raw TCP. Constructor. Reinitialise. max_queued_messages_set() max_queued_messages_set(self, queue_size) Set the maximum number of outgoing messages with QoS>0 that can be pending in the outgoing message queue. Defaults to 0. 0 means unlimited. When the queue is full, any further outgoing messages would be dropped. message_retry_set() message_retry_set(retry) Set the time in seconds before a message with QoS>0 is retried, if the broker does not respond. This is set to 5 seconds by default and should not normally need changing. ws_set_options() ws_set_options(self, path="/mqtt", headers=None) Set websocket connection options. These options will only be used if transport="websockets" was passed into the Client() constructor. - path - The mqtt path to use on the broker. - headers - Either a dictionary specifying a list of extra headers which should be appended to the standard websocket headers, or a callable that takes the normal websocket headers and returns a new dictionary with a set of headers to connect to the broker. Must be called before connect*(). An example of how this can be used with the AWS IoT platform is in the examples folder. tls_set() tls_set(ca_certs=None, certfile=None, keyfile=None, cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLS,. By default, on Python 2.7.9+ or 3.4+, the default certification authority of the system is used. On older Python version this parameter is mandatory. - (if the python version supports it) the highest TLS version is detected. If unavailable,_set_context() tls_set_context(context=None) Configure network encryption and authentication context. Enables SSL/TLS support. - context - an ssl.SSLContext object. By default, this is given by ssl.create_default_context(), if available (added in Python 3.4). If you’re unsure about using this method, then either use the default context, or use the tls_set method. See the ssl module documentation section about security considerations*() and after tls_set() or tls_set_context(). enable_logger() enable_logger(logger=None) Enable logging using the standard python logging package (See PEP 282). This may be used at the same time as the on_log callback method. If logger is specified, then that logging.Logger object will be used, otherwise one will be created automatically. Paho logging levels are converted to standard ones according to the following mapping: disable_logger() disable_logger() Disable logging using standard python logging package. This has no effect on the on_log callback.. reconnect_delay_set reconnect_delay_set(min_delay=1, max_delay=120) The client will automatically retry connection. Between each attempt it will wait a number of seconds between min_delay and max_delay. When the connection is lost, initially the reconnection attempt is delayed of min_delay seconds. It’s doubled between subsequent attempt up to max_delay. The delay is reset to min_delay when the connection complete (e.g. the CONNACK is received, not just the TCP connection is established).() or tls_set_context(),. Connect Example mqttc.connect("iot.eclipse.org") connect_async() connect_async(host, port=1883, keepalive=60, bind_address="") Use in conjunction with loop_start() to connect in a non-blocking manner. The connection will not complete until loop_start() is called. Callback (connect) (connect_srv) When the client receives a CONNACK message from the broker in response to the connect it generates an on_connect() callback. SRV Connect Example mqttc.connect_srv("eclipse.org") reconnect() reconnect() Reconnect to a broker using the previously provided details. You must have called connect*() before calling this function. Callback (reconnect) When the client receives a CONNACK message from the broker in response to the connect it generates an on_connect() callback. disconnect() disconnect() Disconnect from the broker cleanly. Using disconnect() will not result in a will message being sent by the broker. Disconnect will not wait for all queued message to be sent, to ensure all messages are delivered, wait_for_publish() from MQTTMessageInfo should be used. See publish() for details. Callback (disconnect). Loop. Loop Start/Stop Example mqttc.connect("iot.eclipse.org") mqttc.loop_start() while True: temperature = sensor.blocking_read() mqttc.publish("paho/temperature", temperature) loop_forever() loop_forever(timeout=1.0, max_packets=1, retry_first_connection=False) This is a blocking form of the network loop and will not return until the client calls disconnect(). It automatically handles reconnecting. Except for the first connection attempt when using connect_async, use retry_first_connection=True to make it retry the first connection. Warning: This might lead to situations where the client keeps connecting to an non existing host without failing. MQTTMessageInfo which expose the following attributes and methods: - rc, the result of the publishing. It could be MQTT_ERR_SUCCESS to indicate success, MQTT_ERR_NO_CONN if the client is not currently connected, or MQTT_ERR_QUEUE_SIZE when max_queued_messages_set is used to indicate that message is neither queued nor sent. - mid is the message ID for the publish request. The mid value can be used to track the publish request by checking against the mid argument in the on_publish() callback if it is defined. wait_for_publish may be easier depending on your use-case. - wait_for_publish() will block until the message is published. It will raise ValueError if the message is not queued (rc == MQTT_ERR_QUEUE_SIZE). - is_published returns True if the message has been published. It will raise ValueError if the message is not queued (rc == MQTT_ERR_QUEUE_SIZE). A ValueError will be raised if topic is None, has zero length or is invalid (contains a wildcard), if qos is not one of 0, 1 or 2, or if the length of the payload is greater than 268435455 bytes. Callback (publish) (subscribe) (unsubscribe) When the broker has acknowledged the unsubscribe, an on_unsubscribe() callback will be generated. Callbacks on_connect() on_connect(client, userdata, flags, rc) Called when the broker responds to our connection request. - client - the client instance for this callback - userdata - the private user data as set in Client() or user_data_set() - flags - response flags sent by the broker - rc - the connection result - flags is a dict that contains response flags from the broker: - flags[‘session present’] - this flag is useful for clients that are - using clean session set to 0 only. If a client with clean session=0, that reconnects to a broker that it has previously connected to, this flag indicates whether the broker still has the session information for the client. If 1, the session still exists. The value of rc indicates success or not: 0: Connection successful 1: Connection refused - incorrect protocol version 2: Connection refused - invalid client identifier 3: Connection refused - server unavailable 4: Connection refused - bad username or password 5: Connection refused - not authorised 6-255: Currently unused. On Connect Example def on_connect(client, userdata, flags,_data_set() - rc - the disconnection result The rc parameter indicates the disconnection state. If MQTT_ERR_SUCCESS (0), the callback was called in response to a disconnect() call. If any other value the disconnection was unexpected, such as might be caused by a network error. On Disconnect Example def on_disconnect(client, userdata, rc): if rc != 0: print("Unexpected disconnection.") mqttc.on_disconnect = on_disconnect ... on_message() on_message(client, userdata, message) Called when a message has been received on a topic that the client subscribes to and the message does not match an existing topic filter callback. Use message_callback_add() to define a callback that will be called for specific topic filters. on_message will serve as fallback when none matched. - client - the client instance for this callback - userdata - the private user data as set in Client() or user_data_set() - an instance of MQTTMessage. This is a class with members topic, payload, qos, retain. On Message. If multiple sub match a topic, each callback will be called (e.g. sub sensors/# and sub +/humidity both match a message with a topic sensors/humidity, so both callbacks will handle this message).. This may be used at the same time as the standard Python logging, which can be enabled via the enable_logger method.311, transport="tcp") Publish Single). -. - transport - set to “websockets” to send MQTT over WebSockets. Leave at the default of “tcp” to use raw TCP. Publish Single311, transport="tcp") Publish, transport. Publish Multiple Example import paho.mqtt.publish as publish msgs = [{'topic':"paho/test/multiple", 'payload':"multiple 1"}, ("paho/test/multiple", "multiple 2", 0, False)] publish.multiple(msgs, hostname="iot.eclipse.org") Subscribe This module provides some helper functions to allow straightforward subscribing and processing of messages. The two functions provided are simple() and callback(). Simple Subscribe to a set of topics and return the messages received. This is a blocking function. simple(topics, qos=0, msg_count=1, retained=False, hostname="localhost", port=1883, client_id="", keepalive=60, will=None, auth=None, tls=None, protocol=mqtt.MQTTv311) Simple Subscribe Function arguments - topics - the only required argument is the topic string to which the client will subscribe. This can either be a string or a list of strings if multiple topics should be subscribed to. - qos - the qos to use when subscribing, defaults to 0. - msg_count - the number of messages to retrieve from the broker. Defaults to 1. If 1, a single MQTTMessage object will be returned. If >1, a list of MQTTMessages will be returned. - retained - set to True to consider retained messages, set to False to ignore messages with the retained flag set. -. Simple Example import paho.mqtt.subscribe as subscribe msg = subscribe.simple("paho/test/simple", hostname="iot.eclipse.org") print("%s %s" % (msg.topic, msg.payload)) Using Callback Subscribe to a set of topics and process the messages received using a user provided callback. callback(callback, topics, qos=0, userdata=None, hostname="localhost", port=1883, client_id="", keepalive=60, will=None, auth=None, tls=None, protocol=mqtt.MQTTv311) Callback Subscribe Function arguments - callback an “on_message” callback that will be used for each message received, and of the form def on_message(client, userdata, message) - topics - the topic string to which the client will subscribe. This can either be a string or a list of strings if multiple topics should be subscribed to. - qos - the qos to use when subscribing, defaults to 0. - userdata - a user provided object that will be passed to the on_message callback when a message is received. See simple() for the description of hostname, port, client_id, keepalive, will, auth, tls, protocol. Callback Example import paho.mqtt.subscribe as subscribe def on_message_print(client, userdata, message): print("%s %s" % (message.topic, message.payload)) subscribe.callback(on_message_print, "paho/test/callback", hostname="iot.eclipse.org") Reporting bugs Please report bugs in the issues tracker at. More information Discussion of the Paho clients takes place on the Eclipse paho-dev mailing list. General questions about the MQTT protocol are discussed in the MQTT Google Group. There is much more information available via the MQTT community site. Project details Release history Release notifications 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/paho-mqtt/1.3.1/
CC-MAIN-2018-22
refinedweb
1,811
50.12
Leonardo da Vinci’s Mona Lisa is one of the most famous paintings of all time. And there has always been a discussion around her enigmatic smile. He used a trademark Renaissance technique called sfumato, which involves many thin layers of glaze mixed with subtle pigments. The striking result is that when you look directly at Mona Lisa’s smile, it seems to disappear. But when you look at the background your peripherals see a smiling face. One could spend decades studying the works of these masters from various perspectives, but if we want to hone in on the disappearing nature of that smile, mathematics can provide valuable insights. Indeed, though he may not have known the relationship between his work and da Vinci’s, hundreds of years later Salvador Dali did the artist’s equivalent of mathematically isolating the problem with his painting, “Gala Contemplating the Mediterranean Sea.” Here you see a woman in the foreground, but step back quite far from the picture and there is a (more or less) clear image of Abraham Lincoln. Here the question of gaze is the blaring focus of the work. Now of course Dali and da Vinci weren’t scribbling down equations and computing integrals; their artistic expression was much less well-defined. But we the artistically challenged have tools of our own: mathematics, science, and programming. In 2006 Aude Oliva, Antonio Torralba, and Philippe. G. Schyns used those tools to merge the distance of Dali and the faded smiles of da Vinci into one cohesive idea. In their 2006 paper they presented the notion of a “hybrid image,” presented below. If you look closely, you’ll see three women, each of which looks the teensiest bit strange, like they might be trying to suppress a smile, but none of them are smiling. Blur your eyes or step back a few meters, and they clearly look happy. The effect is quite dramatic. At the risk of being overly dramatic, these three women are literally modern day versions of Mona Lisa, the “Mona Lisas of Science,” if you will. Another, perhaps more famous version of their technique, since it was more widely publicized, is their “Marilyn Einstein,” which up close is Albert Einstein and from far away is Marilyn Monroe. This one gets to the heart of the question of what the eye sees at close range versus long range. And it turns out that you can address this question (and create brilliant works of art like the ones above) with some basic Fourier analysis. Intuitive Fourier analysis (and references) The basic idea of Fourier analysis is the idea that smooth functions are hard to understand, and realization of how great it would be if we could decompose them into simpler pieces. Decomposing complex things into simpler parts is one of the main tools in all of mathematics, and Fourier analysis is one of the clearest examples of its application. In particular, the things we care about are functions with specific properties I won’t detail here like “smoothness” and “finiteness.” And the building blocks are the complex exponential functions where can be any integer. If you have done some linear algebra (and ignore this if you haven’t), then I can summarize the idea succinctly by saying the complex exponentials form an orthonormal basis for the vector space of square-integrable functions. Back in colloquial language, what the Fourier theorem says is that any function of the kind we care about can be broken down into (perhaps infinitely many) pieces of this form called Fourier coefficients (I’m abusing the word “coefficient” here). The way it’s breaking down is also pleasingly simple: it’s a linear combination. Informally that means you’re just adding up all the complex exponentials with specific weights for each one. Mathematically, the conversion from the function to its Fourier coefficients is called the Fourier transform, and the set of all Fourier coefficients together is called the Fourier spectrum. So if you want to learn about your function , or more importantly modify it in some way, you can inspect and modify its spectrum instead. The reason this is useful is that Fourier coefficients have very natural interpretations in sound and images, as we’ll see for the latter. We wrote and the complex exponential as a function of one real variable, but you can do the same thing for two variables (or a hundred!). And, if you’re willing to do some abusing and ignore the complexness of complex numbers, then you can visualize “complex exponentials in two variables” as images of stripes whose orientation and thickness correspond to two parameters (i.e., the in the offset equation becomes two coefficients). The video below shows how such complex exponentials can be used to build up an image of striking detail. The left frame shows which complex exponential is currently being added, and the right frame shows the layers all put together. I think the result is quite beautiful. This just goes to show how powerful da Vinci’s idea of fine layering is: it’s as powerful as possible because it can create any image! Now for digital images like the one above, everything is finite. So rather than have an infinitely precise function and a corresponding infinite set of Fourier coefficients, you get a finite list of sampled values (pixels) and a corresponding grid of Fourier coefficients. But the important and beautiful theorem is, and I want to emphasize how groundbreakingly important this is: If you give me an image (or any function!) I can compute the decomposition very efficiently. And the same theorem lets you go the other way: if you give me the decomposition, I can compute the original function’s samples quite easily. The algorithm to do this is called the Fast Fourier transform, and if any piece of mathematics or computer science has a legitimate claim to changing the world, it’s the Fast Fourier transform. It’s hard to pinpoint specific applications, because the transform is so ubiquitous across science and engineering, but we definitely would not have cell phones, satellites, internet, or electronics anywhere near as small as we do without the Fourier transform and the ability to compute it quickly. Constructing hybrid images is one particularly nice example of manipulating the Fourier spectrum of two images, and then combining them back into a single image. That’s what we’ll do now. As a side note, by the nature of brevity, the discussion above is a big disservice to the mathematics involved. I summarized and abused in ways that mathematicians would object to. If you want to see a much better treatment of the material, this blog has a long series of posts developing Fourier transforms and their discrete analogues from scratch. See our four primers, which lead into the main content posts where we implement the Fast Fourier transform in Python and use it to apply digital watermarks to an image. Note that in those posts, as in this one, all of the materials and code used are posted on this blog’s Github page. High and low frequencies For images, interpreting ranges of Fourier coefficients is easy to do. You can imagine the coefficients lying on a grid in the plane like so: Each dot in this grid corresponds to how “intense” the Fourier coefficient is. That is, it’s the magnitude of the (complex) coefficient of the corresponding complex exponential. Now the points that are closer to the origin correspond informally to the broad, smooth changes in the image. These are called “low frequency” coefficients. And points that are further away correspond to sharp changes and edges, and are likewise called “high frequency” components. So the if you wanted to “hybridize” two images, you’d pick ones with complementary intensities in these regions. That’s why Einstein (with all his wiry hair and wrinkles) and Monroe (with smooth features) are such good candidates. That’s also why, when we layered the Fourier components one by one in the video from earlier, we see the fuzzy shapes emerge before the fine details. Moreover, we can “extract” the high frequency Fourier components by simply removing the low frequency ones. It’s a bit more complicated than that, since you want the transition from “something” to “nothing” to be smooth in sone sense. A proper discussion of this would go into sampling and the Nyquist frequency, but that’s beyond the scope of this post. Rather, we’ll just define a family of “filtering functions” without motivation and observe that they work well. Definition: The Gaussian filter function with variance and center is the function It looks like this In particular, at zero the function is 1 and it gradually drops to zero as you get farther away. The parameter controls the rate at which it vanishes, and in the picture above the center is set to . Now what we’ll do is take our image, compute its spectrum, and multiply coordinatewise with a certain Gaussian function. If we’re trying to get rid of high-frequency components (called a “low-pass filter” because it lets the low frequencies through), we can just multiply the Fourier coefficients directly by the filter values , and if we’re doing a “high-pass filter” we multiply by . Before we get to the code, here’s an example of a low-pass filter. First, take this image of Marilyn Monroe Now compute its Fourier transform Apply the low-pass filter And reverse the Fourier transform to get an image In fact, this is a common operation in programs like photoshop for blurring an image (it’s called a Gaussian blur for obvious reasons). Here’s the python code to do this. You can download it along with all of the other resources used in making this post on this blog’s Github page. import numpy from numpy.fft import fft2, ifft2, fftshift, ifftshift from scipy import misc from scipy import ndimage import math def makeGaussianFilter(numRows, numCols, sigma, highPass=True): centerI = int(numRows/2) + 1 if numRows % 2 == 1 else int(numRows/2) centerJ = int(numCols/2) + 1 if numCols % 2 == 1 else int(numCols/2) def gaussian(i,j): coefficient = math.exp(-1.0 * ((i - centerI)**2 + (j - centerJ)**2) / (2 * sigma**2)) return 1 - coefficient if highPass else coefficient return numpy.array([[gaussian(i,j) for j in range(numCols)] for i in range(numRows)]) def filterDFT(imageMatrix, filterMatrix): shiftedDFT = fftshift(fft2(imageMatrix)) filteredDFT = shiftedDFT * filterMatrix return ifft2(ifftshift(filteredDFT)) def lowPass(imageMatrix, sigma): n,m = imageMatrix.shape return filterDFT(imageMatrix, makeGaussianFilter(n, m, sigma, highPass=False)) def highPass(imageMatrix, sigma): n,m = imageMatrix.shape return filterDFT(imageMatrix, makeGaussianFilter(n, m, sigma, highPass=True)) if __name__ == "__main__": marilyn = ndimage.imread("marilyn.png", flatten=True) lowPassedMarilyn = lowPass(marilyn, 20) misc.imsave("low-passed-marilyn.png", numpy.real(lowPassedMarilyn)) The first function samples the values from a Gaussian function with the specified parameters, discretizing the function and storing the values in a matrix. Then the filterDFT function applies the filter by doing coordinatewise multiplication (note these are all numpy arrays). We can do the same thing with a high-pass filter, producing the edgy image below And if we compute the average of these two images, we basically get back to the original. So the only difference between this and a hybrid image is that you take the low-passed part of one image and the high-passed part of another. Then the art is in balancing the parameters so as to make the averaged image look right. Indeed, with the following picture of Einstein and the above shot of Monroe, we can get a pretty good recreation of the Oliva-Torralba-Schyns piece. I think with more tinkering it could be even better (I did barely any centering/aligning/resizing to the original images). And here’s the code for it def hybridImage(highFreqImg, lowFreqImg, sigmaHigh, sigmaLow): highPassed = highPass(highFreqImg, sigmaHigh) lowPassed = lowPass(lowFreqImg, sigmaLow) return highPassed + lowPassed Interestingly enough, doing it in reverse doesn’t give quite as pleasing results, but it still technically works. So there’s something particularly important that the high-passed image does have a lot of high-frequency components, and vice versa for the low pass. You can see some of the other hybrid images Oliva et al constructed over at their web gallery. Next Steps How can we take this idea further? There are a few avenues I can think of. The most obvious one would be to see how this extends to video. Could one come up with generic parameters so that when two videos are hybridized (frame by frame, using this technique) it is only easy to see one at close distance? Or else, could we apply a three-dimensional transform to a video and modify that in some principled way? I think one would not likely find anything astounding, but who knows? Second would be to look at the many other transforms we have at our disposal. How does manipulating the spectra of these transforms affect the original image, and can you make images that are hybridized in senses other than this one? And finally, can we bring this idea down in dimension to work with one-dimensional signals? In particular, can we hybridize music? It could usher in a new generation of mashup songs that sound different depending on whether you wear earmuffs :) Until next time!
http://jeremykun.com/tag/python/
CC-MAIN-2015-06
refinedweb
2,246
58.72
Introducing 'SWITRS to SQLite' The State of California maintains a database called the Statewide Integrated Traffic Records System (SWITRS). It contains a record of every traffic accident that has been reported in the state—the time of the accident, the location, the vehicles involved, and the reason for the crash. And even better, it is publicly available! Unfortunately, the data is delivered as a set of large CSV files. Normally you could just load them into Pandas, but there is one, big problem: the data is spread across three files! This means you must join the rows between them to select the incidents you are looking for. Pandas can do these joins, but not without overflowing the memory on my laptop. If only the data were in a proper database! SWITRS-to-SQLite To solve this problem, I wrote SWITRS-to-SQLite. SWITRS-to-SQLite is a Python script that takes the three CSV files returned by SWITRS and converts them into a SQLite3 database. This allows you to perform standard SQL queries on the data before pulling it into an analysis system like Pandas. Additionally, the script does some data cleanup like converting the various null value indicators to a true NULL, and converting the date and time information to a form recognized by SQLite. Installation and Running Installation is easy with pip: pip install switrs-to-sqlite Running the script on the downloaded data is simple: switrs_to_sqlite \ CollisionRecords.txt \ PartyRecords.txt \ VictimRecords.txt This will run for a while (about an hour on my ancient desktop) and produce a SQLite3 file named switrs.sqlite3. Accident Mapping Example Now that we have the SQLite file, let us make a map of all recorded accidents. We load the file and select all accidents with GPS coordinates as follows: import pandas as pd import sqlite3 # Read sqlite query results into a pandas DataFrame with sqlite3.connect("./switrs.sqlite3") as con: query = ( "SELECT Latitude, Longitude " "FROM Collision AS C " "WHERE Latitude IS NOT NULL AND Longitude IS NOT NULL" ) # Construct a Dataframe from the results df = pd.read_sql_query(query, con) Then making a map is simple: from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt fig = plt.figure(figsize=(20,20)) map = Basemap( projection='gall', llcrnrlon = -126, # lower-left corner longitude llcrnrlat = 32, # lower-left corner latitude urcrnrlon = -113, # upper-right corner longitude urcrnrlat = 43, # upper-right corner latitude ) x,y = map(df['Longitude'].values, df['Latitude'].values) map.plot(x, y, 'k.', markersize=1.5) This gives us a map of the locations of all the accidents in the state of California from 2001 to 2016: There are some weird artifacts and grid patterns that show up which are not due to our mapping but are inherent in the data. Some further clean up will be necessary before doing any analysis! A Jupyter notebook used to make the map can be found here (rendered on Github).
https://alexgude.com/blog/switrs-to-sqlite/
CC-MAIN-2019-35
refinedweb
486
61.77
A tutorial for anyone who might want to setup a Ubuntu 18.04.1 LTS desktop specifically for machine (deep) learning applications and scientific computing. Just the basics. This tutorial assumes you have: - Fresh Ubuntu 18.04.1 LTS install. If not, I’d refer to this useful article. - A GeForce 10 graphics card Installing and updating packages from Canonical In the Terminal, first update your package database then upgrade the installed packages on your system. sudo apt-get update sudo apt-get upgrade Next, install some general packages used for coding, ML, and scientific applications (some extend beyond the uses detailed below). sudo apt-get install vim csh flex gfortran libgfortran3 g++ \ cmake xorg-dev patch zlib1g-dev libbz2-dev \ libboost-all-dev openssh-server libcairo2 \ libcairo2-dev libeigen3-dev lsb-core \ lsb-base net-tools network-manager \ git-core git-gui git-doc xclip Validate G++-7 Compiler and BoostLib are properly functioning We can run a quick check to see that both the GNU C++ compiler and BoostLib are working as intended. Create a file called ‘test_boost.cpp’ and add the following code: #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm> int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in; std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); } Compile and execute the program. g++-7 test_boost.cpp -o test_boost echo 3 6 9 | ./test_boost The output should be 9 18 17 Installing Anaconda 5 (Python 3.6 version) From Terminal grab the most recent Anaconda3 install script, and use wget to put it in your Downloads folder, and install it to the default directory. wget -O ~/Downloads/Anaconda3-5.2.0-Linux-x86_64.sh sh ~/Downloads/Anaconda3-5.2.0-Linux-x86_64.sh Follow the installation instructions: - Enter to read through license terms. - ‘yes’ to agree to license terms. - Enter to accept default installation location (/home/{User}/anaconda3), or specify another directory - ‘yes’ to prepend the Anaconda3 install location to your ~/.bashrc file - (Optional) ‘yes’ or ‘no’ to the VS code license. Source the changes in the terminal, update conda, and check your Python version: source ~/.bashrc conda update --all python Generating a public key and setting up GitHub Here SSH will be used in one small way for connecting to version control hosts like GitHub and BitBucket. First, generate a public RSA key using a passphrase you’ll remember. ssh-keygen -t rsa -b 4096 This will generate a public key and an identifier in the ~/.ssh/ directory. Now, copy your public key to the clipboard. xclip -sel c < ~/.ssh/id_rsa.pub Login to your GitHub account, and under Settings click SSH and GPG keys and add a new SSH key Give the key a title, i.e. dl-computer, and in the Key field you will paste your public RSA key. Add the key. Now you can clone/push/pull/etc via SSH. git clone git@github.com:username/projectname.git Installing NVIDIA Drivers More comprehensive instructions here. Check NVIDIA’s website for the newest driver version, remember that number. Run the following, substituting ‘nvidia-[version]’ below. You’ll first purge any old nvidia remnants, then add the personal packages archive for compiled graphics-drivers, and update the database. Note: 396.54 is the version that should work for this install for GeForce cards, but owing to a bug it has to be installed through the Software & Updates GUI. sudo apt-get purge nvidia-* sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update # sudo apt-get install nvidia-396 # doesn't currently work Install NVIDIA 396.54 (GeForce/Titan) through Software & Updates GUI instead of through terminal. Open Software & Updates > Additional Drivers and select “… nvidia-driver-396 (open source)” and apply the changes. Now restart your computer. Check that you can communicate with your graphics card by typing nvidia-smi in to the terminal, it should give you something that looks like this: Install CUDA 9.2 Install dependencies needed for CUDA, then download the CUDA install files. sudo apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-devcuda_9.2.148_396.37_linux wget -O ~/Downloads/ wget -O ~/Downloads/cuda_9.2.148.1_linux Install the primary CUDA toolkit. sudo sh ~/Downloads/cuda_9.2.148_396.37_linux You’ll be prompted with the following: - Read license, and when done hit Escape and type ‘accept’. - ‘y’ to unsupported configuration. - ’n’ to installing the driver (already done above). - ‘y’ to installing the toolkit. - Enter for installing to the default path. - ‘y’ to symbolic links in /usr/local/cuda - ‘y’ to installing samples. - Path to samples: /usr/local/cuda-9.2 If the NVIDIA driver version is not supported it will display a warning to that extent and stating that it was not installed correctly. If this happens, make sure your NVIDIA driver was installed properly as detailed above. Next, install the primary CUDA toolkit patch. This is a quick process. sudo sh ~/Downloads/cuda_9.2.148.1_linux Test out that CUDA was installed properly by compiling the sample programs mkdir ~/cuda-testing cp -r /usr/local/cuda/samples ~/cuda_test cd ~/cuda-testing/samples make -j4 Check that the number of programs created is >140, and that the compiled programs run successfully. ls -l bin/x86_64/linux/release/ | wc -l ./bin/x86_64/linux/release/eigenvalues Install cuDNN 7.1.4 for CUDA 9.2 cuDNN is a library for deep learning, incorporating many GPU-enabled primitives that are used with TensorFlow/Pytorch/etc. To get access to the library, you’ll need to register an account with NVIDIA when prompted if you don’t have one already. After registering, download cuDNN v7.2.1 Library for Linux Now, install a dependency, extract the zipped tar ball and copy library contents to the CUDA path as follows. sudo apt-get install libcupti-dev cd ~/Downloads tar -zxvf cudnn-9.2-linux-x64-v7.2.1.38.tgz sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-9.2/lib64/ sudo cp cuda/include/cudnn.h /usr/local/cuda-9.2/include/ sudo chmod a+r /usr/local/cuda-9.2/include/cudnn.h /usr/local/cuda/lib64/libcudnn* Installing TensorFlow and Pytorch environments Testing GPU-enabled TensorFlow and Pytorch using Anaconda environments. Create two separate conda environments for TensorFlow-GPU and Pytorch with a few other packages. First, TensorFlow (and Keras)… conda create -y --name tfgpu python=3.6 source activate tfgpu conda install -y -q -c tensorflow-gpu keras After the environments have been created and installed, we can test the GPU-enabled versions of TensorFlow and Pytorch. source activate tfgpu python -c " import tensorflow as tf; print(tf.Session(config=tf.ConfigProto(log_device_placement=True)))" Here, you should see terminal output indicating that gpu:0 devices were used. Next, for Pytorch. conda create -y --name pytorch python=3.6 source activate pytorch conda install -y -q -c pytorch torchvision cuda92 pytorch Test that Pytorch is using the GPU with the following. source activate pytorch python -c "import torch; print(torch.cuda.get_device_name(0))" Which should return the name of the device it will be using, in my case it returned: Installing Docker CE For dockerizing your builds. Can’t beat the straightforward official documentation. Source: Deep Learning on Medium
http://mc.ai/setting-up-a-ubuntu-18-04-1-lts-system-for-deep-learning-and-scientific-computing/
CC-MAIN-2019-09
refinedweb
1,208
50.84
Microsoft recently released the Windows 8.1 Preview, providing developers everywhere with a first glimpse at what they need to do to prepare for the next release of the operating system. 8.1 may sound like an incremental release, but the next version of Windows is packed with features enabling developers to create better, faster, richer Windows Store apps. Microsoft has provided a great document summarizing the new features, but I wanted to offer my own take on it by making available a new version of Contoso Cookbook – one that’s faithful to the original, but that was rewritten from the ground up to demonstrate what’s great about Windows 8.1, and what developers should expect to encounter when they port Windows 8 apps to the new platform. If you’re not familiar with it, Contoso Cookbook is a Windows Store sample app that I wrote last year for Microsoft. It was published on MSDN, complete with 300 pages of labs that developers could use to get up to speed quickly on Windows 8 by developing an end-to-end app in either XAML and C# or HTML5 and JavaScript. Once I got my hands on the Windows 8.1 Preview bits, I updated the XAML and C# version to help developers get up to speed just as quickly on Windows 8.1. (I haven’t updated the labs themselves; I may do that later, but for now all I have to offer is the completed sample code. I haven’t updated the JavaScript version, either, but hope to do that later this summer if time permits.) The new version is pictured below. You can download a Visual Studio 2013 solution containing the Windows 8.1 Preview version of Contoso Cookbook from SkyDrive and take it for a test drive. It looks a lot like the Windows 8 version on the outside, but there are a few differences. For example, you can now click the Settings charm, select Preferences from the settings menu, and use the Preferences page shown below to specify whether the app should use local (in-package) data or remote data. The latter is hosted in the cloud in Windows Azure. Local data is the default, and is useful if you’re demoing the cookbook and don’t have an Internet connection available. Of course, the Preferences page itself uses Windows 8.1’s new SettingsFlyout control – something that was missing from the XAML run-time in Windows 8 – as does the About page accessed through the settings menu. SettingsFlyout is one of many features of Windows 8.1 that dramatically reduced the amount of code and XAML required to create the cookbook. The following sections provide an overview of the changes I made to leverage the new infrastructure in Windows 8.1. I made other changes as well – for example, I completely reshaped the JSON data that feeds the app to improve its structure and make it more in keeping with the JSON sample data that Visual Studio provides – but that’s not what’s important. What IS important is what Contoso Cookbook tells us about Windows 8.1 – and along those lines, there’s plenty to talk about. Tiles Windows 8 supported two tile sizes: square (150 x 150 pixels) and wide (310 x 150 pixels). Windows 8.1 supports four tile sizes: small (70 x 70), medium (150 x 150), wide (310 x 150), and large (310 x 310). Only the medium tile is required, but apps have the option of supporting the other sizes as well. To that end, I added a large tile to Contoso Cookbook. You can see the 310 x 310 image file (LargeLogo.png) in the project’s Assets folder, and if you look in the app manifest (on the Application UI tab), you’ll see where I designated it as the large tile image. Now, if you pin Contoso Cookbook to the start screen, you can right-click it and use the Resize button in the application bar at the bottom of the screen to select any of the four tile sizes. Note that you can switch to a small tile even though I didn’t provide a small tile image. The Windows 8.1 Preview generates the small tile image for you if you don’t provide one, but for pixel-perfect small tiles, you always have the option of providing your own 70 x 70 image. I also made a minor change to the code in ItemDetailPage.xaml.cs that creates a secondary tile to pin a recipe to the Windows start screen. The SecondaryTile class has a new constructor in 8.1, as well a new VisualElements property that lets you control the tile’s foreground and background colors, specify whether text should be shown on the tile, and more. The documentation warns that some of the old constructors “may be altered or unavailable for releases after Windows 8.1 Preview,” so the time is now to fix your code. Snapping, View State, and Window Size In Windows 8, any Windows Store app could be snapped – reduced to occupy a 320-pixel-wide slice of the screen. That slice was exactly 320 pixels wide, and if you didn’t like it, well…you just had to get used to it. Windows 8.1 lets apps be resized continuously down to 500 pixels. And by checking a box in the manifest editor, you can allow your app to be resized down to a width of 320 pixels. In other words, snapping as we knew it has gone away. Most apps don’t have to do anything special to accommodate narrower window widths because Microsoft believes that 500 pixels is wide enough to accommodate most UIs – even those that use GridView controls to scroll horizontally. However, you have the option of responding to changes in window size and adjusting the layout of your UI if necessary to provide a compelling user experience. If your app is one that displays real-time information – for example, a mail app or one that shows stock prices – you might elect to enable the 320-pixel option so a user can keep it on the screen without taking valuable real estate away from other apps. In that case, you’ll almost certainly end up writing logic to adjust the layout when you’re occupying a very narrow slice of the screen. But how that logic is implemented has changed in Windows 8.1. Most Windows 8 apps written in XAML and C# used logic built into LayoutAwarePage (which was generated by Visual Studio) to drive changes to the layout through Visual State Manager based on changes in view state. The current view state was obtained from ApplicationView.Value and was always set to one of four values: Snapped, Filled, FullScreenPortrait, or FullScreenLandscape. Forget about predefined view states: they don’t exist any more. Neither, for that matter, does LayoutAwarePage. In Windows 8.1, you register your own Window.SizeChanged event handler in each page whose layout you want to change when the window size changes, and you either effect those changes in code, or you call VisualStateManager.GoToState to let Visual State Manager do it for you. Since SizeChanged events don’t fire when a user clicks the Back button to go back to a page, you’ll want to include similar logic in the page’s OnNavigatedTo override as well. In the original version of Contoso Cookbook, I went to great pains to make sure all three pages looked good in snapped mode. Since the cookbook is probably not an app most users would want to keep on the screen, I did away with the snapped layouts in the new version and accepted the default minimum width of 500 pixels. I did, however, include logic to change the layout of the group-detail and item-detail pages in portrait mode. “Portrait mode” doesn’t necessarily mean the screen orientation is portrait; it means Contoso Cookbook is running in a window that’s taller than it is wide. In the screen shot below, the item-detail page is showing in portrait mode because it’s occupying about half the screen, and the width is currently less than the height. But drag the bar a little further to the right, and the page will snap back into landscape mode and lay out the content the same way it does when it’s running full-screen. Look inside ItemDetailPage.xaml and you’ll see the Visual State Manager XAML I wrote to define visual states named “Portrait” and “Landscape:” <VisualStateManager.VisualStateGroups> <VisualStateGroup x: > Then open ItemDetailPage.xaml.cs and you’ll find the C# code that I wrote to switch between these states: public ItemDetailPage() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested; Window.Current.SizeChanged += (s, e) => UpdateVisualState(); } protected override void OnNavigatedTo(NavigationEventArgs e) { navigationHelper.OnNavigatedTo(e); UpdateVisualState(); } private void UpdateVisualState() { VisualStateManager.GoToState(this, ApplicationView.GetForCurrentView().Orientation.ToString(), false); } Notice how I used the ApplicationView.Orientation property, which is new in Windows 8.1, to generate the string – either “Portrait” or “Landscape” – that identifies the visual state. ApplicationView also now has properties named IsFullScreen, AdjacentToLeftDisplayEdge, and AdjacentToRightDisplayEdge, which you can use to make adjustments to the layout based on the app’s size and position. Of course, you can also use the width of the window to drive layout changes. In a Window.SizeChanged handler, you can get the width from WindowSizeChangedEventArgs.Size.Width, and outside of SizeChanged (for example, in OnNavigatedTo), you can get it from Window.Current.Bounds.Width. Search In Windows 8, developers were encouraged to implement search contracts to support in-app search. The idea was that at any time, a user could pull out the charms bar, tap the Search charm, and initiate a search. It sounded good at the time, but it didn’t work out so well in practice. For one thing, most users never realized that the Search charm existed. To incorporate Microsoft’s new vision of how search should work, I began by removing the OnSearchActivated override from App.xaml.cs. (It will probably need to be added back in for RTM, but in the preview, it seems that apps can’t be externally search-activated since the search pane no longer shows a list of search-supportive apps). Then I added Windows 8.1’s new SearchBox control to Contoso Cookbook’s start page (you can see it in the upper-right corner of the first screen shot in this article) and wired up handlers for the SuggestionsRequested and QuerySubmitted events that the control fires. These handlers are essentially the same ones that used to be wired up to the search pane; when Microsoft designed the SearchBox control, they intentionally based its API on that of the SearchPane class to make porting easy. Consequently, if you wish to perform an in-app search of recipe data in the new Contoso Cookbook, you don’t go to the Search charm; instead, you type a search term into the search box on the start page and press Enter or tap the magnifying-glass icon. Microsoft has additional plans to enhance search that haven’t been fully revealed. Look for more news around this important feature when Windows 8.1 RTMs. AppBars and CommandBars Another change forthcoming in Windows 8.1 is how you implement application bars, often referred to simply as “appbars.” In Windows 8, you declared an AppBar control, declared a two-column Grid containing StackPanels inside it to separate left commands from right commands, and filled the StackPanels with Button controls stylized to look like appbar buttons. StandardStyles.xaml contained more than 200 button styles to help with the styling. AppBar controls are still supported for backwards compatibility, and there may be times when you still need them – for example, if you want to include TextBox controls or other non-button controls in an appbar. But Windows 8.1 introduces the CommandBar control, which makes it easier than ever to work appbar magic in your apps. CommandBars host AppBarButton, AppBarToggleButton, and AppBarSeparator controls, which don’t require external styling. And they automatically compact themselves to use space more efficiently in windows that occupy just a portion of the screen. If you look in ItemDetailPage.xaml, you’ll see how I declared a CommandBar in that page: <Page.BottomAppBar> <CommandBar> <AppBarButton Icon="Camera" Label="Share"> <AppBarButton.Flyout> <MenuFlyout> <MenuFlyoutItem Text="Photo" Click="OnShootPhoto" /> <MenuFlyoutItem Text="Video" Click="OnShootVideo" /> </MenuFlyout> </AppBarButton.Flyout> </AppBarButton> <AppBarButton Icon="Pin" Label="Pin" Click="OnPinRecipe" /> </CommandBar> </Page.BottomAppBar> Compare that to the XAML gymnastics required to create the same appbar in the original cookbook and you’ll appreciate the simplicity this brings. Oh, and notice the MenuFlyout control attached to the first AppBarButton. That’s another one of 8.1’s new XAML goodies. To create a menu that pops up when an appbar button is clicked in Windows 8, you had to new up a PopupMenu object and call some obscure XAML methods to position it over the button. In 8.1, you simply declare a MenuFlyout, attach if to a button via the Flyout property, and let the run-time do the work. Although not shown in my sample, you can put appbar buttons in a <Command.SecondaryCommands> element to position them in the other half of the CommandBar. Settings Flyouts One of the elements most glaringly absent from Windows 8’s XAML run-time was a SettingsFlyout control. To display a settings flyout – something almost every Windows Store app does – you either had to craft one from scratch, or get it from a third-party library such as Callisto. Good news: Windows 8.1 includes a SettingsFlyout control. Showing settings flyouts has never been easier, and the control includes a number of helpful properties such as HeaderBackground and HeaderForeground that allow you to style it to match the branding of your app. To add a settings flyout to your project, you invoke Visual Studio’s Add New Item command and select “Settings Flyout.” Visual Studio then derives a class from SettingsFlyout and drops it into your project, a lot like a user control. Your open the XAML file and insert the content that you want to appear in the flyout, and then displaying the flyout is a simple matter of instantiating it and calling its Show (or ShowIndependent) method: new AboutSettingsFlyout().Show(); Contoso Cookbook contains two settings flyouts: an About flyout and a Preferences flyout. You can see them by clicking the Settings charm and selecting About or Preferences from the ensuing settings menu. You’ll notice that I set HeaderBackground on both flyouts to the same orangish color used in Contoso Cookbook’s splash screen. Unfortunately, there is still no way to interrogate the system for the color it uses in its own flyouts’ headers, so you just have to pick a color that’s consistent with the styling of your app. HTTP Networking In Windows 8, WinRT had great support for sockets networking, WebSocket networking, Bluetooth networking, and even NFC networking. But inexplicably, it had no general-purpose HTTP networking support. Consequently, Windows 8 apps that wanted to communicate with REST services relied on .NET for Windows Store Apps’ HttpClient class. The .NET version of HttpClient is still there, but in 8.1, WinRT introduces an HttpClient class of its own. Located in the new Windows.Web.Http namespace, WinRT’s HttpClient class offers a few features .NET’s does not, including support for chainable HTTP request filters that allow you to add layered support for authentication, retries, and other HTTP goodies. I rewrote the parts of Contoso Cookbook that rely on HTTP networking to use the WinRT version of HttpClient. Here’s the code in RecipeDataSource that retrieves JSON recipe data from Azure: _baseUri = ""; var cts = new CancellationTokenSource(); cts.CancelAfter(5000); // Wait up to 5 seconds try { var client = new HttpClient(); var response = await client.GetAsync(new Uri(_baseUri + "BlueRecipes")).AsTask(cts.Token); if (!response.IsSuccessStatusCode) { await new MessageDialog("Unable to load remote data (request failed)").ShowAsync(); return; } jsonText = await response.Content.ReadAsStringAsync(); } catch (OperationCanceledException) { new MessageDialog("Unable to load remote data (operation timed out)").ShowAsync(); } Notice how I included logic to time-out the call to HttpClient.GetAsync if the request doesn’t complete within 5 seconds: I called the AsTask extension method to convert the IAsyncOperationWithProgress returned by GetAsync into a Task, and I passed in a CancellationToken set to time out after 5000 milliseconds. This is something Windows Store developers frequently miss. You have no guarantees when an async network call will complete (or whether it will complete at all), so it’s always a good idea to include a time out so your app doesn’t hang and leave the user wondering what’s happening. Summary Contoso Cookbook doesn’t leverage all the new features in the Windows 8.1 Preview, but it certainly hits the highlights. I haven’t compared code counts in the old and new versions, but I can attest that the 8.1 version of Contoso Cookbook required substantially less code and markup to write, thanks in no small part to new controls such as SettingsFlyout. I’ll update Contoso Cookbook again Windows 8.1 RTMs. Until then, feel free to share the source code with colleagues and try to get them excited about 8.1! Update: I just created a video based on this blog post and published it for free on WintellectNOW. Check it out and let me know what you think!
https://www.wintellect.com/whats-new-for-developers-in-windows-8-1/
CC-MAIN-2021-04
refinedweb
2,936
62.38
import products from manufacturer website to my shopify store Budget €8-30 EUR can you import products from manufacturer website to my shopify store? you have to do the pricing and put nice images in it from the manufacturer. the images has to be editet with contrast and color, so it looks better. 46 freelancers are bidding on average €22 for this job Hi, I can import products from manufacturer website to your shopify store. Please send the website link. Let's discuss and start. Thanks Hi ! My Name Is Murad, I’d like to be considered for your project. All The Skills You Need I Can Provide Them Your Answer Is On My Feedback's Please Feel Free To check Thank You Yes, I can import product to shopify. ----------------------------------------------------------- Budget fixed $50 for mix 200 products Hello, we will help you import products from your manufactor website to your shopify store contact us for further details Hello, how are you? I have read the details provided, but please contact me so that we can discuss more on the project. I believe I have the required skills in this case.
https://www.freelancer.com/projects/website-design/import-products-from-manufacturer/
CC-MAIN-2018-47
refinedweb
190
71.24
Forum:Update on "The Article Whisperer" competition From Uncyclopedia, the content-free encyclopedia Hello (again), Some of you might remember my suggesting a new writing competition awhile ago. I've been working on it off and on for the past few months and I think its finally ready to start in a week or two. The main thing that's holding things up is the lack of judges for the competition. There are currently 5 judges signed up (Group 1: User:Mordillo, User:Under user and User:Optimuschris; Group 2: User:PuppyOnTheRadio, User:CheddarBBQ and ?) but at least 4 judges short. Ideally, there would be five groups of three judges for each category. The contest could be run with only two or three groups if they were willing to judge more then one category but I'd like to try and avoid this since its makes for a heavy workload. Again, I'd appreciate any and all help for anyone who can spare some time for the competition. Thanks for your time everyone. MadMax 22:24, September 23, 2010 (UTC) P.S. I've started a list of judges here. - I think it's pretty clear I'm a terrible judge (fuck you to Ape) so I'd rather compete if it's all the same to you. ~ Avast Matey!!! Happytimes are here!* (talk) (stalk) Π ~ ~ 24 Sep 2010 ~ 03:57 (UTC) - I'd be happy to fill one of the judging spots. Go ahead and put me down for whatever's needed. -RAHB 04:05, September 24, 2010 (UTC) - This is the first that I've heard about this competition. Looks like a great idea. I'd like to help out but I also want to enter. So if it is possible for me to judge a category and enter another category (or two) I'd like to do that. Or if there is any other way I can help just let me know. -- Brigadier General Sir Zombiebaron 04:19, September 24, 2010 (UTC) - I've already gone and signed myself up if that's fine with you. -- TKFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUCK 17:16, September 24, 2010 (UTC) Another update After a bit of reorganizing, the competition now needs only 3 1 judge for Miscellaneous-related Articles. This category is for entries which fall outside "General Knowledge" and "Popular Culture" topics as well as Alternate-namespace articles (HowTo, UnBooks, Why?, etc.). The competition is scheduled to start on September 27, although the actual judging period will be from October 4 to October 10. Thanks to the above editors who have already signed up as judges. MadMax 19:41, September 26, 2010 (UTC) Is there any chance... ...the time to write an article could be extended? I mean, PLS gives you two weeks, why can't this? I say this because I'd really love to enter this, but I don't know if I'll have the time to do much of anything but school work this week. (Also, if the time can't be extended that's totally fine--I'm just curious more than anything.) —Unführer Guildy Ritter von Guildensternenstein 22:48, September 27, 2010 (UTC)
http://uncyclopedia.wikia.com/wiki/Forum:Update_on_%22The_Article_Whisperer%22_competition
CC-MAIN-2014-52
refinedweb
526
64.1