How do I switch windows programmaticly? I mean like Alt+Tab does but without any labels or something.
I tried to look through the documentation but it's too complicated for me ( you can say then not to do it, but I learned action script with help of a good docs although didn't know a thing at first). And I don't complitly understand where exactly to look, because there a lot of libraries and some thing called GObject-Introspection. And when I am trying to find something there, I get lost out there, because I don't realy know what am I looking for. It's kind of a circle)).
I also tried to look at the source codes of other extensions, but it's even more complicated than the documentation. It sounds like I am pretty dummy but I can catch it up.
So, does anybody know how to deal with switching windows, where I can find methods I need in documantation or anything else?
The library you seem to looking for is libwnck. The library is written in C. However, you can access them in different languages, like JavaScript for the extensions. This is done via GObject-Instrospection, which at this point you do not need to understand deeply (just that GObject-Introspection is the glue that allows you to use the libraries in different languages). The prefix usually changes depending of the language.
For your specific purpose, you might want to take a look at devilpie2 instead.
Related
I work for a small company that isn't flexible in making changes on using a heavy themed webpage on Wordpress for their own reasons. They are also using a load of plugins, and it takes more than 10 seconds to load. So, I thought I should give it a try and check the generated homepage source code, after I ran the analysis that tells me that js is just a disaster.
The theme they had chosen was Unero, because it works with woocommerce I suppose. The website is a small e-shop along with a blog, nothing too fancy really, we use yoast SEO too, but that might be irrelevant.
I realized that there is a load of js scripts running here and there.
I read that you can set everything run with async set true.
A also read that this can cause things to break between scripts, due to undefined variables and other problems I suppose. Please note that I am kinda new to js technologies and I might not know what I really should be asking, or searching for. I do my best to explain what I need to happen though.
Is there a way you can override ( or overload, what is the term
here?)some js on footer, after being defined on their positon
(in HEAD and in BODY),setting it to async mode, by using a snippet
on footer? Will this actually work?
I do not want to involve any plugin general solutions, because I am
afraid they will break stuff as mentioned above. Correct me if I am
wrong and please suggest me something. Except if the solution IS to make a custom plugin, where I will have full control I guess.
I am open on ANY suggestions, as long as it won't break the site.
I am asking here and not on Wordpress Developement or any other Stack Exchange forum, because I am looking for a solution done by hand, along with an explaination why it will work. I am a code by hand guy really, and I am not afraid to dive deeper on something, if things are gonna be done right.
Is there a way you can override ( or overload, what is the term
here?)some js on footer, after being defined on their positon (in HEAD
and in BODY),setting it to async mode, by using a snippet on footer?
Will this actually work?
Answer: Yes, its possible but that could also happen with sync code. If plugin A is doing something like $('title').text('Title from A') and then the next plugin does $('title').text('Title from B')then its gonna get overridden, doesn't matter if its sync or async.
I do not want to involve any plugin general solutions, because I am
afraid they will break stuff as mentioned above. Correct me if I am
wrong and please suggest me something.
Answer: I am not sure what you want to do. What is your goal with this site? Do you want to untangle the mess of the plugins? That can be difficult since you have little control over the plugins and their mechanismm.
I am open on ANY suggestions, as long as it won't break the site.
Answer: One way would be to disable them one by one to see cause and effect and try to clean out that way. Another solution would to switch to more simple solution like Shopify and the third to creaate a custom solution that you have more control over.
Its quite an open question, so its kinda of hard to give a concrete answer or solution to your problem.
In all the ways I've worked with Javascript, I find that nothing ever satisfies my desire for self-documenting code. I want to be able to see the APIs of modules, functions, "struct" fields, and event payloads within my own code.
I'm curious if any IDEs or transpiled languages help people easily keep their internal API visible? For example, with many languages, often an IDE will give an expandable tree view of packages/modules/classes/functions. Javascript makes this difficult as there are so many ways to code all of these entities.
I find when writing an application in Javascript that after it reaches a certain size, I have to keep jumping between source files to remember these things. Consistent naming, clear coding style, and such good habits only go so far. In a language that has no static typing, very loose rules around function arguments, and passing functions as callbacks, JS code can be hard to scan and immediately see the higher-level structure. It's hard to separate interface from implementation, as all JS code is implementation.
In large projects with many programmers, it makes sense to enforce rules about documenting functions in comments and maybe auto-generate docs. But doing independent development, this is like a lot of manual work just to remind oneself of the architecture and internal API, and likely to be out of date most of the time. I'm not going to look up a function to remember what params it takes, see that it has no docstring comments, add them and rebuild the docs so I can go read them.
TypeScript sounds promising but seems too tied to Microsoft tools. CoffeeScript saves typing and can make for cleaner code, but I don't think it solves the problem of exposing a high-level view of the structure of an application.
WebStorm actually exposes some of what I'm looking for, but I wonder what else exists.
I'm looking for any tips, tools, techniques others use to mitigate this issue.
I'm a security guy by day a coder by night and I usually write my tools in java. It was something I was taught in school so really its just the simple fact that I'm comfortable writing in that language.
I have been for a few years now been limited by the inability to take a response from a server and build it up by actually running the JavaScript. This has drastically hurt my ability to do so many things like spider and simply see an actual response as if it was built in a browser. In order to compensate for this Weakness I have tried to use a number of different headless browsers. I tried JX browser, CORBA,SWT, HTML unit, etc. You name it I have tried to use it. As many of you know none of these technologies can even accurately handle some of the most simple JavaScript applications. Therefore, I'm really looking for an alternative.
I've been looking into potentially using something like server-side JavaScript in order to render the HTML and manipulate the DOM. I was looking at things like Node.js,PhantomJS, etc. ideally I would like to be able to keep using my Java code and somehow use these technologies as a supplement for those headless browsers. However, it looks like being able to talk to these technologies will be difficult. It looks like I might be able to leverage the commandline with Java and write to files with those js technologies and read those files with my Java code. This does seem a little clunky so I thought maybe I should just flip over to fully using these to build my tools. I wanted to get others' ideas or opinions on this. Just to give you an idea of what I typically need to do I need to be able to I need to build the send HTTP requests and get responses back,crawl sites, things like that.
I'm really just looking to see if there are other options available or if I'm going about this the right way
I have an issue where input is being doubled, tripled, quadrupled, etc. on user input after changing a select dropdown multiple times. Here's a small video showing my dilemma and posing the question: http://screencast.com/t/7Gb01nGe787p
Essentially the question is how to debug properly given circumstances like this?
I think how you debug depends heavily on how your code is structured.
If you are using widgets(jquery UI stuff, plugins, external libraries etc) you can always search around and see if its a known bug/issue. Aside from that, checking configurations(I've been burned by config's not being correct several times) can be helpful. Also check for conflicting code, such as events you may have defined that could interfere with the widgets behavior. Manipulating objects in the webkit console is particularly useful for this, since you can more easily find out in what cases your code will work, and in what cases it will not, without necessarily having to rely on manipulating the UI.
If you are not using something other people wrote, then debugging is a little easier in my opinion. For me, it really comes down to narrowing the scope of where I am looking. If you have any events related to your issue(onKeyUp or something), log it. Console.log can go a long way, especially when dealing with the state of UI, and so can breakpoints. I'm not sure if this is necessarily the best way to do it, but I find it to be very useful in the right situation.
If you are really stuck, you can always get drastic and start removing pieces of your code. May not sound very nice, but if you are really stuck and cannot seem to find what section of code is being problematic it will at least give you an indicator of where to look. Again, not the prettiest solution, but it's saved me a lot of headaches on more than one occaision.
Hope this helps.
I have extensively used Prototype before and it helped us add considerable interactivity to our web applications. However we are looking at making the move to use jQuery in order to standardize on something better supported in Visual Studio.
I understand that we can use the jQuery.noConflict to run it alongside Prototype, but we would like to avoid having users need to download both libraries to use our website.
So, is there a good resource that can help us move old scripts from Prototype to jQuery?
I can't really help you too much with your question, other than to say that I haven't heard of any such tool, and that I'd be really surprised if one actually existed.
While I think jQuery is a great library, and that you're right to be wanting to only use one library, just remember that the cost of you changing over all your scripts is going to be many many hours of work. The cost of your users downloading an extra 30kb of scripts is going to be roughly 0.3 seconds. Perhaps try to slowly phase out Prototype and only refactor your existing pages when a) you have to, or b) if you've got nothing better to do.
Falkayn,
There is no automated process available for conversion of JavaScipt code written against one JS library to another one. Moreover there cannot be one. Different libraries implement different proramming models as well as they arrange their APIs in different manner.
So, before you have found a solution to your problem now ask yourself a question: Am I going to convert my jQuery code once another even "cooler" "X-type" JavaScript library became available?
If your answer is no, take your time and convert the code manually no mater how long will it take. In case you answer "yes" don't convert the code at all.
So it goes.
Thanks guys for your input. I was looking for more of a syntax comparison than anything automated, but nickf makes a good point in that the real cost need not be too great. We only used Prototype on a few pages that really needed a high level of interactivity, so as long as mind out Ps and Qs it should not hurt to use jQuery everywhere else.