piwik widgets & java api - widget

I'm currently using piwik's java api to get my stats but I have some dificulties.
To begin, my standard code :
try {
SimplePiwikTracker piwik = new SimplePiwikTracker(3, myServer, request);
piwik.setPageCustomVariable(ACCOUNT_NUMBER, clientAccountNumber);
piwik.sendRequest(piwik.getLinkTrackURL(request.getRequestURL().toString()));
} catch (PiwikException e1) {
logger.error("Piwik error", e1);
}
The first problem is that even if I can see visited pages in "user logs", the widget "pages" does not display it.
The second, I want to know the number of different users that are using my website. To do so I send a custom variable containing the client's account number. Do you know a way to know how many different account numbers I have in my stats ?
Thank you for your help and sorry if there's any english mistakes (I hope there is not). :)

I found an answer for my first question.
Instead of using :
piwik.sendRequest(piwik.getLinkTrackURL(request.getRequestURL().toString()));
The solution is to use :
piwik.sendRequest(piwik.getPageTrackURL(request.getRequestURL().toString()));

A possible answer to the second question :
When you create a custom variable that is sent to your piwik server go to the custom variable widget. The pagination displayed when you select a variable can be an indication.
But if someone have a better answer, I'd be glad :)

Related

Symfony3, taking user input and saving into mysql

I am new to symfony and open-source in general. Im trying to create a simple product submition page which would store product's information in mysql. So far I've only been able to hard-code all the information and successfully store it (this was my first task to achieve). This is the code for it:
public function createAction()
{
$product = new Product();
$product->setName('Keyboard');
$product->setPrice(15.50);
$product->setDescription('Logitech keyboard v2.00');
$em = $this->getDoctrine()->getManager();
$em->persist($product);
$em->flush();
return new Response("Saved new product with: " .$product->getId() ."Id");
}
Now I want to have a page with couple text boxes and to be able to take this information, validate it and then store it. What would be a clever way to do it? As I'm learning for my internship, I want to be able to do it in a best possible way. Are twig templates the best solution here? What about fetching user's input? I would be really thankful if someone could write step-by-step bullet points on how to achieve my goal in abstract sentences. Thank you and have a great remaining Friday!
1) One of the best and yet simple ways for you to start your mission would be by reading Symfony book chapter about Forms. It contains basic examples about form rendering, validation and submission using twig.
2) If you need to know more about how to save everything to database and would like to use Doctrine (most common way) then this chapter covers it in detail and is also not too deep to make it easy enough.
3) If you would like to deepen your understanding of Validation then you should definitely read about it too
http://symfony.com/doc/current/book/forms.html
http://symfony.com/doc/current/book/doctrine.html
http://symfony.com/doc/current/book/validation.html

Uninstalling UserPassChange script

I installed a script http://www.googleappsscript.org/home/force-google-apps-users-to-change-password-periodically. Idea was to force Google Apps - users in my organisation to change their passwords every 3 months. Script works well. However, there are certain accounts whose password must remain the same and therefore I would need to uninstall the script.
Would anyone be able to help me out?
Thanks in advance.
An alternative method would be to add 3 exceptions to this list using an IF/ELSE statement, and a method to ignore the 3 users. I'll provide you with an example in C#, since that's the language I'm most fluent in:
if (username == "VIP1")
{ ignore(string username)}
else if (username == "VIP2")
{ ignore(string username)}
else if (username == "VIP3")
{ ignore(string username)}
else
{ passchange()}
You'd also need to provide an overload for the user in the ignore() method. If you have a relatively small userbase (under, say, 200 users), this idea would be very effective. If you have a larger userbase, this may be a bit of an expensive process, since you have to run through the entire userlist for each iteration of the if/else statement.
Users that installed the script and authorized it have received an email with uninstall instruction. This message shows a link to uninstall the script, this link is easy to re-build if ever they lost it :
use the link of the script and replace the ending part with /manage/uninstall.
for example, this script url
https://script.google.com/d/1DsMPFCPo-870TuOFM4Sg9BY0c28gyj8NY_________n0upV1AOG2MAsxy/edit?usp=drive_web
would be changed to
https://script.google.com/d/1DsMPFCPo-870TuOFM4Sg9BY0c28gyj8NY_________n0upV1AOG2MAsxy/manage/uninstall
that will direct the user to a page looking like this :

Changing html on a view based on if get parameter is set on Codeigniter

Before I used Codeigniter I had a page show certain html as long as the url had no get parameters and then have some of the html be replaced by another as soon as something like this is set in the url:
localhost/signup.php?success
Now my question is, what is the best way to do this in Codeigniter? Would I have to use one of those parameters on the controller's function (which I still can't get my head around)? And if so, how? Or if I just had php logic in the view like I used to do in plain PHP, what would I check for if not a get parameter? Thanks.
Too many ways to achieve this certain thing.
routes.php
extending controller and using constructor so you apply rules for every extended controller
flashdata
Before you start please read up on frameworks watch some video tutorials on how to make simple blog system etc. I myself wouldn't just jump in to concept, study up.
I mentioned flashdata and that is how you do things done (success, alert, warning bars).
By default, GET parameters are not enabled or useful in codeigniter, but URI segments work the same way. So...
If you had a controller called, signup.php and a function inside it called success, you could link to that with:
localhost/signup/success
then if you loaded the URL helper, which I always do in config/autoload.php or just with:
$this->load->helper('url');
You could say:
if($this->uri->segment(2) == 'success') {
//Show success message or load a view for it...
}else {
//The second URI segment is NOT 'success' so do something else...
}
But... codeigniter is just a framework for PHP. If it's possible in PHP, it's possible in codeigniter. You can simply go into the config/config.php file and enable query strings, but I would strongly suggest using URI segments and reading up on them as well as the URL helper.

determining if a status update is a retweet using api 1.1

I want a simple, robust way to identify retweets in a hashtag search using twitter api 1.1.
For example, if I send the following request with the proper authentication:
https://api.twitter.com/1.1/search/tweets.json?q=%23stackoverflow
I'll get the last 15 tweets tagged with #stackoverflow.
It looks like only retweeted status updates have the 'retweet_status' property. Is checking to see if the tweet has a 'retweet_status' property a reliable way to determine if it is a retweet?
'retweet' and 'retweet_count' don't give me what I need.
sounds rather like you've answered your own question. retweeted_status is present when the retweeter has used Twitter's official Retweet function.
However people still to the old style RT: <quote> approach which won't give you any solid data bindings in the data returned from the API. The only way to handle these is to compare the text and see if the original text is contained. If they've modified the text then you're stuck, but then if they've modified the text then technically it's not a Retweet - it's just plagiarism ;)
Thought I'd share my solution...
if (eventMsg.retweeted_status == null) {
//run code
}

What is the difference between the BU and ZK OK codes in SAP macro

I am trying the post an invoice to SAP using the F-47 transaction and using SHDB to record the transaction and learn how it works. I see there that sometimes BU and ZK BDC OK codes are used. I would like to understand the difference between them, but could not find any official documentation. Please, explain the difference between the two?
I found the meaning of some of the status codes. I post it here, so I can remember:
/00. Enter
/AB Go to overview
=ZK Go to additional information
=ENTE Enter (don't know exactly what is difference between /00)
=PI select cursor location
=STER Go to taxes
=DELZ delete cursor
=GO continue
=BU post (save)
/EEND end processing
=Yes select "yes" from message box
=BP park (save)
=ENTR Enter (don't know exactly what is difference between =ENTE or /00)
=AE save when changing document
=BK change document header (parking or posting parked document)
=P+ next page
=BL delete parked document
A BDC_OKCODE indicates which action is (will) be executed on a screen (things like save, back, exit etc). The BU code is used for a SAVE function (like in MM01 transaction). Sorry but I cannot recall to which function ZK maps to. Obviously their difference lies in the fact that they map to different functions. You can still find out which function each button utilizes by using System->Status->GUI status.
By the way, BTCI transactions are not fully robust- minor changes in GUI flow let your program break. Error handling / analysis is tedious.... DId you have a look to posting methods more preferably? E.g. like BAPI_* function modules? With the help of LSMW you can browse for different input methods and use them later standalone. Or you can use transaction BAPI directly.