Symfony 1.4 Action not being hit. Why? [closed] - symfony-1.4

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I'm working on an old project that needs some extra functionality. It uses symfony 1.4. I'm new to symfony.
There are 4 actions now:
executeAdmin, executeDashboard, executeHome, executeView that work well. They are in a file called action.class.php.
The routing looks like this (in routing.yml):
editor:
url: /editor/:action/*
param: { module: bookeditor }
It was my assumption that creating a new executeTest in the same action.class.php would work out of the box.
private function executeUpload ( $request ) {
$this->response->setContent("<h1>Ok!</h1>");
return sfView::NONE;
}
When going to mysite/editor/upload I get the 404 page.
If I replace the code of executeAdmin for example:
private function executAdmin ( $request ) {
$this->response->setContent("<h1>Ok!</h1>");
return sfView::NONE;
}
When going to mysite/editor/admin I get the "Ok" on a blank page.
Why does this happen? How can I fix this?
(I cleared the symfony cache and restarted apache after each change.)

execute* function inside the controller must be public.
Also you have a typo here: executAdmin. It should be executeAdmin.

Related

How can I get the input value of a text field that has been created with airtable in wordpress?

I am trying to make some further adjustments to an address text field. But the problem is that its made with airtable. I want to get the input of that address and use it to get some data from zillow API for the user. How can I do this? I have viewed the source HTML and I only see the airtable script.
This probably went unanswered for being too vague. I'll try to leave some pointers if anyone stumbles upon this in the future.
Are you the host of the WP page? do you have access to the Airtable base in question? Is the "frontend" viewable? Airtable's API is pretty well-documented, simple as it may be. Whatever you need, if it's from a shared view, it can be fetched with a curl request.
Other than that,if the base is public, or shared publicly, and particularly if you need this data at a steady rate or in larger quantities, you'd be better off requesting access and collecting the information with a script from the Scripting app. Since ES6, this is as trivial as doing something like
let query = await base.getTable
(cursor.activeTableId)
.selectRecordsAsync()
let payload, selectAll = query.records.map(rec => rec.name),
selectAll ?
payload = { records: JSON.stringify(selectAll) }
: console.error('something went wrong')
remoteFetchAsync(('your scraping endpoint', payload)=>
//rock'n'roll past this point
})

LINQ Cache issue

I am pretty new to LINQ and having a issue with what seems to be irregular content caching. The website in question has 6 content areas of different subjects now on the odd occasion the content just blanks out to nothing or has the same content for all 6 areas. It will clear up this issue by itself over time or the only other way to fix it is to recycle the app pool :(
Have tried using
DBLocal.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, ret)
but this caused similar problems.
Has anyone else come across this problem as I cannot seem to find anything about it online
Thanks
Clinton
ADDED CODE:
Dim discussionDetails As Model.Discussion = Services.Discussion.getById(discussionId)
Public Function getById(ByVal discussionId As Integer) As Model.Discussion
Dim _discussion As Model.Discussion = DBLocal.Discussions.SingleOrDefault(Function(p) p.DiscussionId.Equals(discussionId))
Return _discussion
End Function
You haven't shown us the lifecycle of the DBLocal instance. It should be per-request at longest, and per-unitofwork ideally.
You haven't shown us the code that assigns the discussion to a content area, nor the code that calls this method (how frequently is it called and where does that code get Ids from?)
Consider these cases.
SingleOrDefault returns null, if there is no matching instance.
SingleOrDefault throws if there is more than one matching instance.

Rating system for users and posts (and comments) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 months ago.
Improve this question
I need to implement a message board with rating system. Something similar to stack overflow, but much simpler.
I need to rate both questions / answers and compute the rating for each user.
I'm looking modules in Drupal to implement it. Could you give me some tip ?
thanks
Fivestar, and User Points could be used for the purpose, but you only get something similar to Stack Overflow.
The first module (which requires Voting API) can be used to allow the users to vote, and the second module can be used to transform the votes in points for the users who voted (among other things — the module is not limited to this). To integrate the two modules, there is another module, but I am not sure it's part of "User Points", or User Points Contributed modules.
The problem with Fivestar is that users are allowed to give a vote from 1 to X (I think the maximum vote can be changed), which is different from the voting system used by Stack Overflow, where users can simply report "I like it", or "I don't like it". With Fivestar there would be only positive votes, and nobody would be able to down vote a comment, or a node; it would be possible to lower the average by giving the minimum vote.
Between the modules I listed, there isn't a module that allows to give points to the author of the node / comment; using "Voting API", and "User Points" it would possible to do that, but no module I looked allows to do it (this means that you could probably write a custom module).
If you look at the list of the modules included in the installation profile ArrayShift, you can get an idea of the modules you can use to reach the same purpose.
The list of modules includes
Node comments, which transforms comments in full nodes; with this module, in example, is possible to use a voting module that works only for nodes with comments too.
Voting API.
Vote UP/Down that allows users to up vote, or down vote.
User Points.
ArrayShift Support Modules; it is probable that this module contains code that allows node authors to get points every time a node they created is voted.
In particular, a module that is part of ArrayShift Support Modules (as_tweaks) contains the following code:
/**
* Below, a bunch of simple hook implementations that award userpoints based
* on various events that happen. In theory, Rules module and various other tools
* could be used to do these things, but most of those modules don't have easy
* to export/import configuration data.
*/
// VotingAPI hook. When a user casts a vote on a node, the author should
// get/lose points..
function as_tweaks_votingapi_insert($votes) {
foreach ($votes as $vote) {
if ($vote['content_type'] == 'node' && ($node = node_load($vote['content_id']))) {
// Award the points
userpoints_userpointsapi(array(
'uid' => $node->uid,
'points' => $vote['value'] * 10,
'operation' => 'vote up',
'entity_id' => $node->nid,
'entity_type' => 'node',
));
}
}
}
// VotingAPI hook. When a user casts a vote on a node, the author should
// get/lose points..
function as_tweaks_votingapi_delete($votes) {
foreach ($votes as $vote) {
if ($vote['content_type'] == 'node' && ($node = node_load($vote['content_id']))) {
// Award the points
userpoints_userpointsapi(array(
'uid' => $node->uid,
'points' => $vote['value'] * -10,
'operation' => 'vote up',
'entity_id' => $node->nid,
'entity_type' => 'node',
));
}
}
}
The Drupal Fivestar works great.

How can I implement a "Related questions" feature like the one on Stack Overflow?

I want to implement a feature similar to the "Related Questions" list shown when asking a question on Stack Overflow. I like how the related questions populated when the Title is filled in.
I am using ASP.NET and jQuery. How might I implement something like this? Can anyone point to examples?
I looked at the source of the ask question page and I don't see any onblur or focus calls.
As a matter of fact there is a call. This bit of code is responsible for the GET request which is sent to the server ob 'blur' of the #title input element (it's in the source of the page, close to the top):
$().ready(function() {
$("#title").blur(function() { QuestionSuggestions(); });
});
function QuestionSuggestions() {
var s = $("#title").val();
if (s.length > 2) {
document.title = s + " - Stack Overflow";
$("#question-suggestions").load("/search/titles?like="
+ escape(s));
}
}
I was thinking of implementing something similar, although this may not be an answer to your question, here is what I was planning to do:
When a question is saved parse it and create a topic word to uniqueid (of the post) mapping and save in database indexed by word.
When a new question is typed and the focus go out of the title, make an AJAX call with all the relevant words from the database and match all the similar ids that is common (so that at least two words have the same id)
Populate with div that is dynamically made visible.
I am interested to know if anyone has more insight on this...

How to implement Windows Live ID Actions with ASP.NET AJAX [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
OK, so I'm working on an ASP.NET webapp with AJAX and the Windows Live ID SDK. I've successfully gotten it to authenticate via Live, however...
The Windows Live ID spec indicates that I have to look for request headers "login", "logout", and "clearcookie". The recommended code samples include a Response.Redirect, which doesn't seem to work when your page has extensive use of UpdatePanels:
loginCookie = new HttpCookie(strLoginCookie);
loginCookie.Expires = DateTime.Now.AddYears(-10);
Response.Cookies.Add(loginCookie);
Response.Redirect("default.aspx");
Response.End();
Further, the clearcookie Action requires I write directly to the Response:
public WindowsLiveLogin wll = new WindowsLiveLogin(key1, key2);
loginCookie = new HttpCookie(strLoginCookie);
loginCookie.Expires = DateTime.Now.AddYears(-10);
Response.Cookies.Add(loginCookie);
string type;
byte[] content;
wll.GetClearCookieResponse(out type, out content);
Response.ContentType = type;
Response.OutputStream.Write(content, 0, content.Length);
As a result, the response doesn't recognize it and the Windows Live logout feature times out, whether doing it via my logout button (logout Action) or the Windows Live site's logout feature (clearcookie Action). How can this be accomplished with static UpdatePanels and other AJAX controls in the markup?
I used this in a former AJAX project. I settled for not having logout functionality, which of course can be bypassed by clearing one's cookies. Please tell me a more elegant way!

Resources