Client doesn't have a name/class at startup - awesome-wm

I'm trying to start an application (Spotify) on a particular tag. Rules aren't applied and now I'm inspecting the client class by printing the class in a notification in the "manage" signal. This results in an empty notification.
client.connect_signal("manage", function (c, startup)
naughty.notify({title=c.class})
end)
When I restart awesome, it does print the client class, so why isn't it working when the client is initially started?
Using xprop, it also prints the class:
WM_CLASS(STRING) = "spotify", "Spotify"

Sounds like a bug in Spotify (and I think I heard about this one before). I would guess that Spotify does not follow ICCCM and only sets its WM_CLASS property after it made its window visible and not before.
I fear that you cannot do much about this except for complaining to Spotify devs to fix their stuff.
You could work around this by starting a timer in the manage signal that checks if a window turns out to be spotify a short time later. Alternatively, you could do something like client.connect_signal("property::class", function(c) if c.class == "Spotify" then print("This is now a spotify window") end end) to react to change to a window's class (of course you'd want to do something more useful to Spotify's windows than printing them).
(Per the ICCCM, a window is not allowed to change its class while it is visible, but who cares about standards...)

I had a similar issue with the claws-mail client. Inspecting it via xprop, it shows
WM_CLASS(STRING) = "claws-mail", "Claws-mail"
but awesome just did’t apply the rules for it. The trick was giving awesome-wm both of these class names in the rules section by providing a set of characters to chose from:
rule = {class = "[Cc]laws%-mail"}
I hope this works for your spotify application, too.
For further reading about patterns in lua I suggest this:
https://www.lua.org/pil/20.2.html

Related

Got the "My test app isn't responding right now. Try again soon." error message even a clean start from Google Assistant Simulator

I am still quite new to this topic, so sorry if I didn't provide enough information.
For the first time, I copoed everything from https://developers.google.com/actions/dialogflow/first-app to learn about it, which works great.
After, I tried to create my own one, then at the end, I got this message "My test app isn't responding right now. Try again soon." from https://console.actions.google.com/project/[[PROJECT-ID]]/simulator/.
Therefore, I tried to delete everything and make a complete new start, including all the projects on https://console.actions.google.com/ and https://console.dialogflow.com.
I then copied the exact same thing from https://developers.google.com/actions/dialogflow/first-app again, but this time, I still got "My test app isn't responding right now. Try again soon." from https://console.actions.google.com/project/[[PROJECT-ID]]/simulator/.
I tried to look at firebase log, no error indeed
I tried to use the web demo from the integration tab, everything works (which means the server side code or the connection have no problem) as expected, firebase also logged the request.
I tried to use a different browser (chrome -> firefox) still not working.
Here is the response code from the Google Assistant Simulator (its kinda nothing):
{
"audioResponse": "//NExAARqQ...",
"conversationToken": "GidzaW11bG...",
"response": "My test app isn't responding right now. Try again soon.",
"visualResponse": {
"visualElements": []
}
}
And here is the debug message (yes, its nothing in there, so I'm stuck):
{
"agentToAssistantDebug": {},
"assistantToAgentDebug": {}
}
Any help would be appreciated. Thanks!
In Actions Console..
Go to Develop -> Invocation
Set a display name (Eg: Hello World) and click Save
Go to Test and type "Talk to Hello World"
Fixed the issue for me.
Make sure your Actions on Google project has a name.
I spent almost 2 days scratching my head on this. Just go to Activity controls of the relevant google account (The account that you are using for the simulator) and turn on all those switches (You may leave out Youtube related stuff).
And.....Voila, it works!
Usually, these are turned off for non-personal accounts.
Faced the same issue when I tried to change the language of app to a locale.
Try the following,
Check if the welcome intent and fallback intents have responses and training phrases
All contexts are mapped
Disable and enable testing
At least in my case, I've added 'Suggestions' for an ending scene, like below:
You can see the error on the right side log of 'Test' page:
Fix is to remove 'Suggestions' in ending scene.
I had the exact same issue and after struggling for hours I found the stupid error on my side: In my Dialogflow Agent settings, I accidentally turned on the V2 API. So my firebase function kept complaining about null intent. Hope this help.

Can't figure how phone number reveal works

I am pretty new to web-scraping and recently I am trying to automatically scrap phone number for pages like this. I am not supposed to use Selenium/headless url browser libraries and I am trying to find the a way to actually request the phone number using let say a web service or any other possible solution that could give me the phone number hopefully directly without having to go through the actual button press by selenium.
I totally understand that it may not even be possible to automatically reveal the phone number in one shut as it is meant not be accessible by nosy newbie web-scraper like me; but I still like to raise the question for my information to get detailed answer from an expert point of view.
If I search the "Reveal" button DOM element, it shows some tags which I have never seen before. I have two main questions which I believe could be helpful for newbies like me.
1) Given a set of unknown tags/attribues (ie. data-q and data-reveal in the blow button), how is one able to find out which scripts in the page are actually using them?
2) I googled the button element's tag like: data-q and data-reveal the only relevant I could find was this which for some reason I don't have access two even-if I use proxy.
Any clue particularly on the first question is much appreciate it.
Regards,
Below is the href-button code
Reveal
Ok, according to your demand there are several steps before you finally get a solution.
1st step : open your own browser and enter your target page(https://www.gumtree.com/p/vans/2015-ford-transit-custom-2.2tdci-290-l1-h1/1190345514)
2nd step : (Assume you are using Chrome as your favorite browser) Press Ctrl+Shift+I to open the console, and then select 'Network' tag in the console.
3rd step : Press the 'Reveal' button on that page, watch the console carefully, catch the http request which is sent immediately when you press the 'Reveal' button. You can see the request contains a long string of number in Query String Parameters, actually it is a timestamp.
4th step : Also you can see there is a part named 'Request Headers' in that http request, and you should copy the values of referer , user-agent , x-gumtree-token.
5th step : Try to construct your request (I am a fan of Python, So I am going to show you my example code in Python)
import time
import requests
import json
headers = {
'referer': 'please enter the value you just copied from that specific request',
'user-agent': 'please enter the value you just copied from that specific request',
'x-gumtree-token': 'please enter the value you just copied from that specific request'
}
url = 'https://www.gumtree.com/ajax/account/seller/reveal/number/1190345514?_='
current_time = time.time()
current_time = str(current_time)
current_time = current_time.split('.')[0] + current_time.split('.')[1] + '0'
url += current_time
response = requests.get(url=url,headers=headers)
response_result = json.loads(response.content)
phone_number = response_result['data']

Send future clients to right monitor in awesome?

I'm trying to implement a very customized implementation of awesome.
I have two monitors. I'd like to have my first client always open on the left monitor (a Chrome window in kiosk mode), then all clients after open up on the right monitor.
Are there any custom layouts that accomodate this?
I'd be willing to program it myself, but I'm not sure how to bind a script to some kind of "new client" event.
The new client event is the manage event. It is emitted whenever, well, a new client gets managed by awesome.
To send the first client that ever appears to screen 1 and all following ones to screen 2, you could do something like this:
local first = true
client.connect_signal("manage", function(c)
if first then
c.screen = 1
else
c.screen = 2
end
first = false
end)

Qualtrics.SurveyEngine.addOnload runs twice in preview mode in Qualtrics survey software

Whenever I try to test a Qualtrics survey in preview mode, Qualtrics.SurveyEngine.addOnload will be called twice. This is not a problem for conditional events (as in most of the examples), but a large problem for unconditional code a timed page change (this will be triggered twice as well). See the following snippet:
Qualtrics.SurveyEngine.addOnload(function()
{
$('NextButton') && $('NextButton').hide();
var that = this;
var timeOutInterval=1000+Math.trunc(Math.random()*10000);
alert(timeOutInterval); //for Testing only
var myVar;
myVar = setTimeout(function(){ that.clickNextButton();}, timeOutInterval);
});
If I launch the survey, this will lead to a page change after 1-11 seconds. If I preview the survey, this change will happen as well, followed by a second change. The alert will be shown twice as well.
Does anyone have a solution, how this functionality could be tested in preview mode?
I've run into Survey Preview issues with JFE as well. There are ways to get around JFE mode and preview in non-JFE mode.
If only care about a specific set of questions in a block and don't care about the survey flow, the easiest solution is to use View Block. It does not use JFE. Go to the Block drop down and choose View Block.
If you need to preview the whole survey, there are tricks to 'break' JFE and force it to non-JFE mode. These tricks seem to be a moving target as Qualtrics makes changes. The best one (easiest) I've found that is working for me today on my Qualtrics account (notice all the qualifiers) is to add an end of survey object to the survey flow, click custom, and check the "Override Survey Options" box.
If that doesn't work, I've found that once a survey gets over a certain size, it doesn't use JFE mode anymore. I don't know what the limit is, but if you add a bunch of fake questions after your end of survey you can trick it that way as well.
Qualtrics links jQuery as of current writing (albeit the shorthand $ is reserved for the prototype.js library).
Following should skip execution of addOnload javascript in the mobile preview:
Qualtrics.SurveyEngine.addOnload(function()
{
if(jQuery(this.questionContainer).parents('.MobilePreviewFrame').length)
{
console.log('Mobile Preview - skipping rest of addOnload');
return true;
};
console.log("Running addOnload()");
// The rest of your code. Log statements can obviously be removed
});
Hope this is helpful
It seems Qualtrics now defaults to JFE mode for live surveys as well. We have been able to resolve this by adding the query string &Q_JFE=0 to the end of our survey URLs, like so:
https://uleidenss.eu.qualtrics.com/SE/?SID=SV_123432434343&Q_JFE=0
This had the additional benefit of solving our issue with JFE mode breaking several of our long time running Qualtrics JQuery experiments.

youtube channel new ID and iframe list user_uploads

It seems that youtube are now using ID's for their channels instead of names (part of the V3 api)
However it seems that the embedded iframe playlist player cannot handle these channel ID's
example channel https://www.youtube.com/channel/UCpAOGs57EWRvOPXQhnYHpow
then ID is UCpAOGs57EWRvOPXQhnYHpow
Now try to load this
http://www.youtube.com/embed/?listType=user_uploads&list=UCpAOGs57EWRvOPXQhnYHpow
Can anyone shine a light on this issue ? Or is there some hidden username ?
I also placed this question at the gdata-issues website http://code.google.com/p/gdata-issues/issues/detail?id=6463
The issue here is that a channel is not a playlist; channels can have multiple playlists, yet the listType parameter is designed to look for an actual playlist info object. The documented way around this is to use the data API and call the channel endpoint, looking at the contentDetails part:
GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UCuo5NTU3pmtPejmlzjCgwdw&key={YOUR_API_KEY}
The result will give you all of the feeds associated with that channel that you can choose from:
"contentDetails": {
"relatedPlaylists": {
"uploads": "UUuo5NTU3pmtPejmlzjCgwdw"
}
}
If available (sometimes with oAuth), there could also be "watch later" lists, "likes" lists, etc.
This may seem like a lot of overhead. In the short term, though, it can be noted that the different feeds are programmatically named; so, for example, if my user channel begins with UC and then a long string, that UC stands for 'user channel' -- and the uploads feed would begin with 'UU' (user uploads) and then have the rest of the same long string. (you'd also have 'LL' for the likes list, 'WL' for the watch later list, 'HL' for the history list, 'FL' for the favorites list, etc. This is NOT documented, and so there's no guarantee that such a naming convention will perpetuate. But at least for now, you could change your ID string from beginning with UC to beginning with UU, like this:
http://www.youtube.com/embed/?listType=user_uploads&list=UUpAOGs57EWRvOPXQhnYHpow
And it embeds nicely.
Just to inform on current state of things -- the change suggested by jlmcdonald doesn't work anymore, but you can still get a proper embed link via videoseries (with the same UC to UU change). I.o.w. link like
http://www.youtube.com/embed/videoseries?list=UUpAOGs57EWRvOPXQhnYHpow
works as of at the moment of writing this.

Resources