How to find the amount of people are following one specific user on Scratch, and how do I add it to my project? - mit-scratch

So, I am working on a project that includes having a live follow count on it, so how do I add it? I also do not know how I can acsess the api base from inside the project.
I have wondered and I have not came up with a viable solution.

That is not possible, but it might be upcoming in a later Scratch version. For now that is beyond the limits of scratch. You can make a view counter that updates a cloud variable by one every time a project is loaded, but users could autoclick and cheat the system so that it would provide incorrect values.

Related

Show the history of a State Machine/Workflow

I'm trying to find a way to represent graphically the history of an operation inside an state machine. So if the operation has gone through state_1>state_2>state_3>state_2>state_4>end I would like to see that path visually.
We are using a Web-UI and a Java Backend, so any HTML-JS or Java library (that creates image files or something like this) should be ok for us. We are using JBMN for parts of the state machine, my initial approach was to find something related with it, but I haven't found anything
Any ideas?
Do you want to do some crazy animations? or just highlight the states that were already executed?
If you want to do that, you can use the jbpm designer that already provide that functionality.
Cheers

How should one handle dependencies among Play sub-projects?

After creating a huge mess of a Play project, I decided that it would probably be a good idea to break it into sub-projects so that the dependencies are, I can compile part of the project, etc.
Unfortunately, I'm discovering that the sub-projects have slight dependencies on the whole project. The coupling is small enough that I'm not ashamed of it, but SBT won't let me declare circular dependencies. (And I think that's a good thing.)
Here's an example. I have a users sub-project that defines several models for dealing with users. There are also basic views that you would probably expect for dealing with users: login, logout, changePassword, updateSettings, etc. The problem is, these all depend on my main template so that they look like the rest of the site. So I need some way to let the users sub-project know what the main template is that it should embed its views in.
As another example, most sites have a "default" page that they send users to when they try to access information they're not authorized to access, or after they logout, etc. The sub-projects need to know what that page is so they can redirect to the default page as needed. But the default page is defined in the main project, which the sub-projects can't depend on.
I started trying to solve this problem by using my Global.onStart method in the main project to "inject" settings into the sub-projects. For example, I created a var to hold the default page, and then set controllers.users.App.defaultPage to the right value when the application started. But then I realized that every sub-project is going to need a few hooks to tell it how it fits into the main project, and trying to manually keep track of all this was just asking for trouble.
Has anyone come up with a good way of dealing with this issue? Should each sub-project have a default Configuration that the main project can modify? Is there a way for each sub-project to declare what configuration it needs, so that the main project failing to provide it would trigger an error? Should I be ashamed at how coupled my code is, and go back to the drawing board?
Thanks!
After more searching, I came across this blog entry. I'm going to give this a shot and see how it works:
http://eng.42go.com/play-framework-dependency-injection-guice/
After using this for a couple of weeks, it's been mostly a success. There are still chicken/egg problems to work out, but I think that's because I hadn't really thought through how much each of my sub-projects depended on others.
There's still no really easy way to access routes from parts of projects you don't depend on, but you probably shouldn't be linking to projects you don't depend on, anyway. I did figure out how to specify a main template and urls/calls for things like my "Not Found", "Permission Required", and "Login" pages so that all sub-projects could access them.

How to use Plone as Document Management?

I wish to create a document repository for my company. Reason is because my company have many documents and they did not have a version tracking in place. This means everyone is using different version all the time.
Plone is something new to me and i got to know from a good friend of mine. And too bad he is not around anymore to answer my question. I believed in him and i wish to materialize his idea, to use Plone as a document repository for my company.
I have install Plone and manage to view the default Plone page, add all company's username and change the logo to my company's logo. And now the biggest question is, how to setup the document repository? What i have in mind was to create a "page" for the user to add files, download files, search for files and read its description.
Any lead for me to go about?
Reusable,
Same problem here. We started to use Plone as our main DMS 4 weeks ago (inserting existing docs at present).
For working copies, we use iterate (insert plone.app.iterate under eggs in your buildout.cfg).
For versioning, Products.CMFEditions. I believe this worked out of the box.
For creating new workflow, look into plone.app.workflowmanager and read the docs.
In a previous question we asked, we were still looking at Dexterity which has alot going for it but eventually we decided on adapting an existing content type based on Archetypes.
As for inserting files, as long as the description is ok, they will be found through the in-built search functionality, but you might consider using Iterate mentioned above to make sure that nobody is using the same file twice.
As your new, as I am, the docs seem hard at first but are actually quite good.
And this book is still giving me the foundation we need to keep adding functionality.
Good luck
I think, you should get pretty far with vanilla Plone installation, without developing your own extensions or other customization add-on-products. Therefore, I'd recommend you to start with Plone 4 User Manual to find out everything you could do out-of-the box.
As #Speediro mentioned, versioning support comes built-in for the main content types (and you don't actually see CMFEditions mentioned anywhere), but it's not activated for file uploads. Although, as briefly mentioned in the manual: Content items can be configured to have versioning enabled/disabled through the Site Setup → Plone Configuration panel under "Types".
Working Copy Support (plone.app.iterate) should also be there already waiting for activation on Site Setup's add-ons-panel.
Yet, before the Plone Collective (=community) Developer Docs or Professional Plone 4 Development, I'd recommend Practical Plone 3. It has a bit outdated graphics (because it was made for Plone 3), but it's great next step after the user manual. E.g. how to define content rules to send e-mails notifications for content updates (still through the browser without coding). Or how to create custom forms using Products.PloneFormGen.
When you really need to write your own code, it'd be time for Professional Plone 4 and the Collective Docs.
If you can't have a developer to manage your stuff, I would recommand to stay on official Plone, no custom code and use only widly used addons.
I mean:
stay on the default theme (sunburst)
use the default plone content types
only customize the logo
activate plone.app.iterate in the addon controlpanel
do not play with workflow because they need to know what you are doing. by default a file has the visibility of it's folder. It mean if you can see the folder you will be able to see all files inside. You can just activate default worklfow for files under the ZMI.
Use collective.quickupload addon
Your database will going really fast to a huge size because Plone is doing indexing and indexing means lot's of spaces. So you will have to handle this as system adminstrator;

Should I put included code under SCM?

I'm developing a web app.
If I include a jQuery plugin (or the jQuery file itself), this has to be put under my static directory, which is under SCM, to be served correctly.
Should I gitignore it, or add it, even if I don't plan on modifying anything from it?
And what about binary files (graphic resources) that might come with it?
Thanks in advance for any advice!
My view is that everything you need for your application to run correctly needs to be managed. This includes third-party code.
If you don't put it under SCM, how is it going to get deployed correctly on your production systems? If you have other ways of ensuring that, that's fine, but otherwise you run the risk that successful deployment is a matter of people remembering to do all the right things, rather than some automated low-risk "push the button" procedure.
If you don't manage it under SCM or something similar, how do you ensure that the versions you develop against and test against are the same? And that they're the same as production? Debugging an issue caused by a version difference you don't notice can be horrible.
I generally add external resources to my project directly. Doing so facilitates deployment and ensures that if someone changes the version of this file in your project, you have a clear audit history of what happened in case it causes issues in the code that you've written. Developers should know not to modify these external resources.
You could use something like git submodules, I suppose, but I haven't felt that this is worth the hassle in the past.
Binary files from external sources can be checked in to the project as well, although if they're extremely large you may want to consider a different approach.
There aren't a lot of reasons not to put external resources like jQuery into your repo:
If you pull it down from jQuery every time you check out or deploy, you have less control over which version you're using. This holds true for most third-party libraries; you probably don't want to upgrade your libraries without testing with your code to see if it breaks something.
You'll always have a complete copy of your site when you check out your repository and you won't need to go seeking resources that may have become unavailable.
For small (in terms of filesize) things like jQuery and images, I'd just add them unless you're really, really concerned about space.
It depends.
These arguments relate to having a copy of the library on your system and not pulling it from it's original location.
Arguments in favour:
It will ensure that everything needed for your project can be found in one place when someone else joins your development team. I've lost count of the number of times I've had to scramble around looking for the right versions of libraries in order to be able to get something working.
If you make any modifications to the library you can make these changes to the source controlled version so when a new version comes out you use the source control's merging tools to ensure your edits don't go missing.
Arguments against:
It could mean everyone has a copy of the library locally - unless you map the 3rd party tools to a central server.
Deploying could be problematical - again unless you map the 3rd party tools to a central server and don't include them in the deploy script.

How do you organize your temporary workfiles?

I do alot of bugfixing and implementing new features for several different customers. These customers all report their bugs, change requests and new feature request into our Trac system.
Sometimes these requests result in me creating some SQL change scripts, sometimes there are Excel documents or Access databases with testdata, Word documents from the customer and so on. Alot of files that are used to fix one ticket and then can be deletede when the ticket is closed.
I usualy do this by creating folders in the filesystem like this: /customerXX/TicketNNNNN and then just dumping everything in there.
How do you organize your workfiles? Have you found some fantastic tool to do this?
I would say for scripts or files that are related to a particular ticket, the best thing to do would be to attach the file to that ticket in your issue tracking software - almost all issue trackers that I've worked with will allow you to do this. That way, you can look back and a) see exactly what you did in case something goes wrong, or b) do exactly the same thing if the issue comes up again later. That's almost certainly the best place to keep files with extra info from the customer, too (or at least the first place most people will look).
For frequently re-used scripts that aren't specific to a particular ticket, I would create a scripts/ or bin/ directory in the associated project, and keep them in there.
I also have a small handful of useful files that I keep in src/misc/ off my home directory, with things like SQL queries to get readable "explain" output out of Oracle and such, that aren't specific to any particular project. The number of these is small enough that subdirectories aren't necessary, though - I suspect if you ended up with a large number of these files, many of them could/should be moved to specific projects or your issue tracking system.
JIRA has been quite helpful for this at my site. It supports issue tracking, file attachments,and you can easily customize and categorize your projects and issues.
I use Fogbugz and I add all file to the case. I believe that no matter what application you use, The important is to keep this files for future references. If your bug-tracking tool does not let you attach file then add the files to the version control.
We use CaWeb4 and find it very easy to use for our bug tracking.