Showing posts with label Web. Show all posts
Showing posts with label Web. Show all posts

06/08/2025

[Bing] Disable AI search clutter

AI is seemingly unescapable these days and annoying generated content is being shoved everywhere without consent.

To disable AI content clutter (copilot answers, video results, similar content and related searches) on Bing searches you can add a small rule to uBlock Origin extension under "My Filters" section:

www.bing.com##.b_ans

This will obviously break as soon as Microsoft pushes any update that changes the page content setup, however the workaround will be the same and will simply require finding out which element(s) to block.

uBlock Origin also has a very handy element picker mode that allows selecting a page component to create a rule to block it. Naturally the same can be achieved also by inspecting the page with Developer Tools (F12 usually) and finding the element tag(s) to block.

06/11/2023

[Tampermonkey] Disable Bing Chat search integrations

When using Bing search there are multiple places that integrate the Chat functionality with the ChatGPT AI. Some of these integrations are annoying and can be easily disabled by installing the Tampermonkey browser extension then adding a couple scripts to modify the displayed webpage and its behavior.

 // ==UserScript==  
 // @name    Disable Bing Search Engine Scroll  
 // @namespace  your-namespace  
 // @description Disables scrolling on the Bing search engine page to prevent accidental scrolling into the Bing chat feature.  
 // @match   https://www.bing.com/*  
 // @version   1  
 // @grant    none  
 // ==/UserScript==  
   
 window.addEventListener("wheel", e=>{  
 if(e.target.className.includes("cib-serp-main")) e.stopPropagation();  
 });  

  • Disable sidebar Chat autosearch functionality when disaplying search results:
 // ==UserScript==  
 // @name    Disable Bing Chat autosearch  
 // @namespace  your-namespace  
 // @description Disables the Bing Chat autosearch functionality on the right side of results when doing a search.  
 // @match   https://www.bing.com/*  
 // @version   1  
 // @grant    none  
 // ==/UserScript==  
   
 const element = document.getElementById("sydwrap_wrapper");  
 element.remove();  
 const element1 = document.getElementById("b_sydTigerCont");
 element1.remove();

Remember that of course these scripts might stop working one day if Microsoft decides to change something on their side, when that happens they will simply need to be updated.

20/12/2016

Facebook and Airbnb login bug, now you are someone else

Well, everyone nowadays is running around trying to spot and fix bugs for money and I just stumble upon someone else's information for free.

This is an unexpected Christmas gift given it happened close to this huge fail from VISA, which makes it possible to guess full credit card details in a frighteningly fast amount of time. So read that article first, and then image what could someone do if they had all your personal info, including partial credit card data.

14/07/2015

[Oracle] wget or curl binaries from OTN website

Usually when you try to download Oracle's JDK or Oracle's DB driver jars you need to manually accept a license agreement before you are allowed to download them.

This obviously is not possible to do when trying to get those resources using wget or curl, but you can work around this by adding a cookie to your request saying that you do accept the licence:

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "RESOURCE URL"

Where RESOURCE URL for latest JDK7 for example is: http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz

If you do not do this, you'll just download a file saying that you need to accept the licence instead

22/05/2015

[Linux] Check remote port connection

It may happen that you're working on a server with a user that has very limited capabilities. Sometimes you have no access to telnet:

telnet host port

nmap:

nmap -A host -p port

curl - it will complain that it did not receive data, meaning that it connected successfully:

curl http://host:port

netcat:

nc host port

 or whatever other tool you like to use. So what to do? Well maybe, you have access to bash:

cat < /dev/tcp/host/port

but I find this method not very reliable. Instead you might have access to Python as well:

python
import socket
test_conn=socket.create_connection(('host',port))

29/11/2014

[TIBCO Spotfire] Run script at startup from a Web Player mashup

If you created a mashup page that includes a Spotfire analysis served via Web Player using JavaScript, you can easily trigger the embedded IronPython scripts to run as soon as the report is opened.

This also works if the report is accessed directly via an URL that uses Configuration Blocks.

  • Create a Document Property as a boolean and set it to false.
  • Tie your script to that Document Property; every time its value changes, the script is triggered
If using the JS mashup page, have a JS script run when the onOpened event is fired and set that property. Make sure that the mashup page runs under the same site as the Web Player on the IIS server, eg: "Add application" under the Spotfire Web Player site.

Mashup page:

 <html>  
   <head>  
     <title>MySamplePage</title>  
     <script type="text/javascript" src="PATH_TO/SpotfireWeb/GetJavaScriptApi.ashx?Version=3.1"></script>  
     <script type="text/javascript" src="PATH_TO/myScript.js"></script>  
   </head>  
   <body>  
           <!-- Whatever -->  
           <div id="webPlayerDiv"/>  
   </body>  
 </html>  


Script:

 var webPlayer;  
 var webPlayerRelativePath = "PATH_TO/SpotfireWeb/";  
 var analysisPath = "PATH_TO/myAnalysis";  
   
 <!-- when the page is accessed, include the Web Player analysis via JS -->  
 window.onload = function()  
 {                 
   openWebPlayer();       
 };  
   
 var openWebPlayer = function()  
 {  
   var webPlayerCustomization = new spotfire.webPlayer.Customization();  
      <!-- enable/disable toolbar buttons -->  
   webPlayerCustomization.showCustomizableHeader = true;  
   webPlayerCustomization.showTopHeader = true;  
   webPlayerCustomization.showClose = true;  
   webPlayerCustomization.showAnalysisInfo = true;  
   webPlayerCustomization.showToolBar = true;  
   webPlayerCustomization.showExportFile = true;  
   webPlayerCustomization.showExportVisualization = true;  
   webPlayerCustomization.showUndoRedo = true;  
   webPlayerCustomization.showDodPanel = true;  
   webPlayerCustomization.showFilterPanel = true;  
   webPlayerCustomization.showPageNavigation = true;  
   webPlayerCustomization.showStatusBar = true;  
   
      webPlayer = new spotfire.webPlayer.Application(webPlayerRelativePath, webPlayerCustomization);  
   
   var onError = function(errorCode, description)  
   {  
     log('<span style="color: red;">[' + errorCode + "]: " + description + "</span>");  
   };  
   
      <!-- when the report is loaded, set our Document Property to true to trigger the script -->  
   var onOpened = function(analysisDocument)  
   {       
           webPlayer.analysisDocument.setDocumentProperty(  
                     "myProperty",  
                     "true");  
   };  
        
   webPlayer.onError(onError);  
   webPlayer.onOpened(onOpened);  
   webPlayer.open(analysisPath, "webPlayerDiv", "");  
 };  

If using the configuration block in the URL instead, add:

 &configurationBlock=PROPERTY_NAME=VALUE;  


So you'll have something like:

 http://myServer:PORT/SpotfireWeb/ViewAnalysis.aspx?file=/PATH_TO/MyAnalysis&configurationBlock=MyDocumentProperty=VALUE;  


18/10/2014

[HTML] Image as input button

When creating an HTML form, replacing an input button with an image is as easy as:

 <input type="image" src="http://example.com/path/to/image.png" />  


[SSL] Create Java keystore from certificate and key

To create a Java keystore file from a certificate and key pair files, you can use the openssl and keytool commands.

First, convert the certificate to PKCS12 format:

openssl pkcs12 -export -in mycertificate.crt -inkey mykey.key -out mycertificate.p12

then create the keystore:

keytool -importkeystore -srckeystore mycertificate.p12 -srcstoretype PKCS12 -destkeystore mycertificate.jks -deststoretype JKS

24/05/2014

[Windows] Scan hosts for open ports without Telnet with PortQry

When testing a connection, you'll probably want to check if a particular port is reachable on the destination host. Telnet is fine enough for this task:

telnet host port

but unfortunately, Windows comes with the Telnet client disabled by default. Since enabling it requires you to have Administrator privileges, an alternative is to use Microsoft PortQry which is a command line tool with no installation required.

After downloading and extracting it, you can run it as:

portqry -n host -e port

[Debian] Run Wireshark as non-root user

Wireshark by default enables only the root user to capture network traffic; the idea is that as a root user you'll capture and store the traffic and as non-root user you'll perform any analysis you need. This unfortunately does not allow you to perform a "live capture" where you can work on the data while it is freshly captured from your network interface.

To enable non-root users to run a live capture too, simply dpkg-reconfigure it:

sudo apt-get install wireshark
sudo dpkg-reconfigure wireshark-common

When prompted to allow non-root user to perform restricted operations, say Yes.

Then logout and login again and you should be set. If not, add your user to the wireshark group:

sudo usermod -a -G wireshark $USER

28/10/2013

[Java 4] Download file from portlet v1.0

Same scenario as last time, but a cleaner solution: link a servlet directly from a JSP page and have the server serve the file as a response instead of a new JSP.

12/10/2013

[Java] Keep HTML form filled after failed Spring validation

I was working on a JSR-168 portlet written in Java 4 using Spring 2 and I had plain HTML forms validated via Spring validators. Everything works fine with this setting but upon failed validation, the page would reload showing the errors and an empty form.

Instead of replacing all the forms with Spring ones (form:form), I found an alternative solution which let me keep my current project structure and tone down the necessary modifications.

08/10/2013

[Java] Store session attributes in portlet controller and retrieve them from JSP

I was coding a portlet following the JSR-168 specification and Spring 2 and I noticed an inconsistent behaviour on some pages. Passing some Map objects, needed to initialize the JSP drop-down menus, by storing them in session in the controller and retrieving them in the JSP, would work always except when the page was reloaded after a failed form validation during the submission phase.

Note: this issue could not be solved by simply using the ModelAndView addObject("name", value) method in the controller and then retrieving the object in the JSP with ${name} outside of a Java block, since I needed to perform some actions on those values directly from the JSP, therefore inside a Java block, without using EL.

25/09/2013

[Java] Spring use DAO in JSP page

So you're happily coding your webapp with Spring, and have all your DAOs correctly defined as beans; you know they work because you are constantly injecting them around, but now you need to access one of them from a JSP.. how?

You may find this code fragment useful:

 <%@page import="com.groglogs.mydaos.MyDao"%>  
 <%@page import="org.springframework.web.context.WebApplicationContext"%>  
 <%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>  
   
 <%  
 MyDao myDao = null;  
   
 WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());  
 if (context != null) {  
   myDao = (MyDao) context.getBean("myDao");  
 }  
 %>  

You import your DAO, and request it directly from the JSP. Note that this example relies on the fact that somewhere you have correctly defined a bean named "myDao".

28/01/2013

Opera quick proxy toggle button

If you use Opera and need to easily and quickly toggle on or off your proxy setting, much like Firefox's QuickProxy add-on, you may try this. Point your browser to this URL:

 opera:/button/Enable%20proxy%20servers,,,%22Disable%20Proxy%22,Expand%20Enabled%20%3E%20Disable%20proxy%20servers,,,%22Enable%20Proxy%22,Expand%20Disabled%20+%20Show%20preferences,22,Proxy%20servers  

Then accept the installation and drag the button where you want. Clicking on it will toggle the proxy on and off and a long-click will bring you to the proxy configuration menu.

25/01/2013

Liferay cannot access login page

If you tinker with Liferay's page permissions, you may accidentally edit those associated with the "Welcome" page, effectively preventing ANYONE from ever logging in again.

To regain access you may try this (replace VERSION with your own):
  • stop Liferay (stop Tomcat), on Linux you need to run: /liferay/apache-tomcat-VERSION/bin/shutdown.sh - you may need to be a superuser to do this. On Windows it's the same path but you should use shutdown.bat instead
  • edit the portal-ext.properties file. You can find it under /liferay/apache-tomcat-VERSION/webapps/ROOT/WEB-INF/classes - and add this line:
 auto.login.hooks=com.liferay.portal.security.auth.CASAutoLogin,com.liferay.portal.security.auth.FacebookAutoLogin,com.liferay.portal.security.auth.NtlmAutoLogin,com.liferay.portal.security.auth.OpenIdAutoLogin,com.liferay.portal.security.auth.OpenSSOAutoLogin,com.liferay.portal.security.auth.RememberMeAutoLogin,com.liferay.portal.security.auth.SiteMinderAutoLogin,com.liferay.portal.security.auth.ParameterAutoLogin  


NOTE: With this, you are enabling the auto-login feature by ANY means on the portal, so remember to remove that line after you've successfully restored your situation.
  • restart Liferay. It's the same as stopping but you should use startup instead of shutdown
  • open any browser and point to:
http://LIFERAY_IP:LIFERAY_PORT?parameterAutoLoginLogin=ADMIN_USERNAME&parameterAutoLoginPassword=ADMIN_PASSWORD

Replacing LIFERAY_IP with your portal's IP (could be localhost), LIFERAY_PORT with your portal's port (could be 8080), ADMIN_USERNAME with the portal's admin username (could be test@liferay.com or simply test) and ADMIN_PASSWORD with the portal's admin password (could be test). EG:

http://localhost:8080?parameterAutoLoginLogin=test&parameterAutoLoginPassword=test

NOTE: You may input ANY user/password there, not necessarily the admin's ones, but that user must have the ability to edit the "Welcome" page's permissions, else he'll now be able to login albeit without the means to solve the issue.

12/11/2012

Enable Tomcat remote access

To reach an application published inside Apache Tomcat using the host's IP (localhost does not work for remote access), you need to modify the server.xml file which is located under Tomcat's conf/ directory.

Look for this piece:

 <Valve className="org.apache.catalina.valves.AccessLogValve"  
 directory="logs" prefix="localhost_access_log." suffix=".txt"  
 pattern="common" resolveHosts="false"/>  


and set resolveHosts parameter to true. You may also need to add a line to the client machines' hosts file so that the IP can be resolved.

28/02/2012

27/09/2011

How to contact Facebook or delete your account

Contacting Facebook can really be a pain, but definitely deleting your account is even harder. Since they rely on your data to survive, they will hang on to it as long as possible.

Luckily, Mary Smith gathered all possible ways to contact Facebook and receive support. Feature requests, suggestions, bug reports and account deletion can all be found there.

You can even request Facebook to send you a CD copy of all the data they have about you accordingly with your country's privacy laws.

By the way, good luck at getting Facebook to reply to you, especially with the data request. If they don't answer, insist since they MUST satisfy your request within a limited time.

UPDATE: An anonymous user pointed out that more information about that is available at  webmarketing-conseil.

06/07/2011

[PHP] PageRank implementation




There are two possible PageRank implementations: the power method and the iterative method. We will describe both.

To check the results obtained we provide a scri'pt to generate a .gexf file to be opened with Gephi.

Test datasets are available at the Toronto university website.


Technologies used:
  • PHP
  • Gephi
  • XML
1.Power method
 

This method takes longer than the other one, however the result is equally right. Using a sparse matrix instead of the full one may help speed up the process.

Method description:

  1. Pick the NxN input matrix and make it stochastic, call it A
  2. Create the P" matrix as alpha*A+(1-alpha)*M with alpha a factor which describes the probability of a random jump and M an NxN matrix filled with values 1/N
  3. Create starting vector v_0 with length N filled with values 1/N
  4. Compute v_m = v_m-1*P" where the first time v_m-1 is exactly v_0
  5. Compute the difference v_m - v_m-1 which should converge to 0
  6. When the difference doesn't vary over a certain threshold or i iterations have been made, stop. v_m should contain the PageRank for every page
To run the program you must have the nodes and adj_matrix files from the chosen dataset. The implementation source code is found here here.

NOTE: Due to Apache and PHP limitations, you may have to modify the php.ini file to grant more memory to the scripts (if you don't want to store the matrix on filesystem like we did) by setting the memory_limit parameter to at least 768MB and raising the maximum script execution time to 5 minutes(300 seconds) with max_execution_time.

2. Iterative method - found on phpir

To use this method you must have the
nodes and adj_list files from the chosen dataset.




Method description:


Each page is given a starting PR of 1/N where N is the number of nodes in the graph. Each page then gives to every page it links a PR of current_page_PR/number_of_outbound_links.
It's introduced a dampening factor alpha (0,15) which represents the probability of making a random jump while visiting the graph or when reaching a cul de sac.

PR_new = alpha/n + (1-alpha)*PR_old




Every PR is then normalized between 0 and 1.

The process keeps going until it has reached i iterations or the difference between old and new PR doesn't vary over a certain threshold.

Our implementation is available here.


3. Gephi parser:

To use the
parser you you must have the nodes and adj_list files from the chosen dataset. The parser outputs a .gexf file to be opened with Gephi. Here is a sample .gexf file obtained by parsing the first dataset available on the site (the one about abortion).