how do I replace and redirect wikipedia search result url to offline localhost zim server?

I made a localhost wikipedia server via Zimserver using below script:

#!/usr/bin/env python3 import os import subprocess import sys import threading  from zimply import ZIMServer ZIMServer("/home/user/zim/wikipedia_en_all_novid_2018-05.zim", index_file="/home/user/zim/wikipedia_en_all_novid_2018-05.idx", port=8791, encoding="utf-8") 

When I search something in google I get the search url something like 

its counterpart in localhost is


notice the .html suffix and /wiki/ to /A/ transition.

When I click the url in the google search result it must be opened in the redirected localhost server as I stated above.

Problema al poner el result de mi ajax como autocomplete de un input

sigo con el tema del buscador en tiempo real, esta vez abarco otras cuestiones que, aunque esten relacionadas, no tienen nada que ver.

Tengo el siguiente AJAX:

<script>         $  (document).ready(function() {             $  ('#key').on('keyup', function() {             var key = $  (this).val();                     console.log(key);             var dataString =key;         $  .ajax({                 type: "POST",                 url: "../clases/Search.php",                 data: {key: dataString},                 success: function(data) {                     if (data) {                          // //Escribimos las sugerencias que nos manda la consulta                          //    $  ('#suggestions').fadeIn(1000).html(data);                          //    //Al hacer click en alguna de las sugerencias                          //    $  ('.suggest-element').on('click', function(){                          //            //Obtenemos la id unica de la sugerencia pulsada                          //            var id = $  (this).attr('id');                          //            //Editamos el valor del input con data de la sugerencia pulsada                          //            $  ('#key').val($  ('#'+id).attr('data'));                          //            //Hacemos desaparecer el resto de sugerencias                          //            $  ('#suggestions').fadeOut(1000);                          //            alert('Has seleccionado el '+id+' '+$  ('#'+id).attr('data'));                          //            return false;                          //    });                              var source = "source:"+data;                             $  ( "#key" ).autocomplete({                                 lookup: Preguntas Recientes - Stack Overflow en español,                                 onSelect: function (suggestion) {                                     alert('You selected: ' + suggestion.value + ', ' +;                                 }                             });                      }                     else{                         //$  ("#key").val("");                     }                  }             });            });     });      </script> 

La variable data contiene un array del objeto usuario :

<?php     include_once 'UsuarioHandler.php';     $  key=$  _POST['key'];      $  uh = new UsuarioHandler();      $  html = '';     $  usuarios =  array();      $  usuarios =  $  uh->findLikeApellidos($  key);      if ($  usuarios!= null) {          //este array es para la primera form que si funciona          // foreach($  usuarios as $  usuario) {         //     $  html .= '<div>         //     <a class="suggest-element"          //     data="'.'"          //     id="'.$  usuario['id'].'"         //     >'.$  usuario['nombre']." ".$  usuario['apellidos'].'</a></div>';          //     //$  html .= "<p>".$  usuario['nombre']."</p>";         // }               echo $  usuarios;      }       else{        // $  html.="vacio!";         echo "vacio!";     }          //return de la primera forma que SI funciona     //echo $  html;    ?> 

Lo que tengo comentado si me lo hacia bien, pero l que pretendo ahoa es que el data (que es el array de usuarios) me lo añada al input a forma de sugerencia.

Por eso dentro del ajax he metido la funcion de Jquery autocomplete para que a medida que vaya cambiando el resultado vaya actualizando las sugerencias, pero cuando empieza a buscar me da el siguiente error:

jquery-ui.js:6015 Uncaught TypeError: this.source is not a function     at $  .<computed>.<computed>._search (jquery-ui.js:6015)     at $  .<computed>.<computed>._search (jquery-ui.js:144)     at $  .<computed>.<computed>.search (jquery-ui.js:6007)     at $  .<computed>.<computed>.search (jquery-ui.js:144)     at $  .<computed>.<computed>.<anonymous> (jquery-ui.js:5988)     at handlerProxy (jquery-ui.js:641) 

Retrofit fails to download binary file in an Android app – end result is a corrupted file that is larger than expected

I am trying to download PDF files using Retrofit 2 on an Android app written in Kotlin. The snippet below is basically my entire code. Based on my log output, it appears that the file downloads successfully and saves to the intended location.

However, the downloaded file is larger than expected, and is corrupt. I can open it in a PDF reader, but the PDF is blank. In the example below, I tried downloading If I download this file through a browser, the result is a PDF that is 13,264 bytes. Downloaded with this code however, it is 22,503 bytes, about 70% larger than expected. I am getting a similar result for other binary files like JPEGs. However, downloading a TXT actually works fine, even a large one. So it seems like the problem is isolated to binary files.

package com.ebelinski.RetrofitTestApp  import import android.content.Context import android.os.Build import import android.os.Bundle import android.util.Log import import import okhttp3.OkHttpClient import okhttp3.ResponseBody import org.jetbrains.anko.doAsync import retrofit2.Call import retrofit2.http.* import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import* import java.util.concurrent.Executors import java.util.concurrent.TimeUnit  interface FileService {      @Streaming     @GET     @Headers("Content-Type: application/pdf", "Accept: application/pdf")     fun fileFromUrl(@Url url: String,                     @Header("Authorization") tokenTypeWithAuthorization: String): Call<ResponseBody>  }  class MainActivity : AppCompatActivity() {      val TAG = "MainActivity"      val RETROFIT_CONNECT_TIMEOUT_SECONDS = 60     private val RETROFIT_READ_TIMEOUT_SECONDS = 60     private val RETROFIT_WRITE_TIMEOUT_SECONDS = 60      private val retrofit: Retrofit         get() {             val gson = GsonBuilder()                 .setDateFormat("yyyyMMdd")                 .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)                 .create()              val converterFactory = GsonConverterFactory.create(gson)              val okHttpClient = OkHttpClient.Builder()                 .connectTimeout(RETROFIT_CONNECT_TIMEOUT_SECONDS.toLong(), TimeUnit.SECONDS)                 .readTimeout(RETROFIT_READ_TIMEOUT_SECONDS.toLong(), TimeUnit.SECONDS)                 .writeTimeout(RETROFIT_WRITE_TIMEOUT_SECONDS.toLong(), TimeUnit.SECONDS)                 .addInterceptor { chain ->                     val userAgentValue = "doesn't matter"                     val originalRequest = chain.request().newBuilder().addHeader("User-Agent", userAgentValue).build()                      var response = chain.proceed(originalRequest)                     if (BuildConfig.DEBUG) {                         val bodyString = response.body()!!.string()                         Log.d(TAG, String.format("Sending request %s with headers %s ", originalRequest.url(), originalRequest.headers()))                         Log.d(TAG, String.format("Got response HTTP %s %s \n\n with body %s \n\n with headers %s ", response.code(), response.message(), bodyString, response.headers()))                         response = response.newBuilder().body(ResponseBody.create(response.body()!!.contentType(), bodyString)).build()                     }                      response                 }                 .build()              return Retrofit.Builder()                 .callbackExecutor(Executors.newCachedThreadPool())                 .baseUrl("")                 .addConverterFactory(converterFactory)                 .client(okHttpClient)                 .build()         }      private val fileService: FileService = retrofit.create(      override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContentView(R.layout.activity_main)          doAsync { downloadFile() }     }      fun downloadFile() {         val uri = ""         val auth = "doesn't matter"          val response = fileService.fileFromUrl(             uri,             auth         ).execute()          if (!response.isSuccessful) {             Log.e(TAG, "response was not successful: " +                     response.code() + " -- " + response.message())             throw Throwable(response.message())         }          Log.d(TAG, "Server has file for $  {uri}")         saveFileFromResponseBody(response.body()!!)     }        // Returns the name of what the file should be, whether or not it exists locally     private fun getFileName(): String? {         return "dummy.pdf"     }      fun saveFileFromResponseBody(body: ResponseBody): Boolean {         val fileName = getFileName()         val localFullFilePath = File(getFileFullDirectoryPath(), fileName)         var inputStream: InputStream? = null         var outputStream: OutputStream? = null         Log.d(TAG, "Attempting to download $  fileName")          try {             val fileReader = ByteArray(4096)             val fileSize = body.contentLength()             var fileSizeDownloaded: Long = 0              inputStream = body.byteStream()             outputStream = FileOutputStream(localFullFilePath)              while (true) {                 val read =                 if (read == -1) break                  outputStream.write(fileReader, 0, read)                 fileSizeDownloaded += read.toLong()                  Log.d(TAG, "$  fileName download progress: $  fileSizeDownloaded of $  fileSize")             }              outputStream.flush()             Log.d(TAG, "$  fileName downloaded successfully")             return true         } catch (e: IOException) {             Log.d(TAG, "$  fileName downloaded attempt failed")             return false         } finally {             inputStream?.close()             outputStream?.close()         }     }      fun getFileFullDirectoryPath(): String {         val directory = getDir("test_dir", Context.MODE_PRIVATE)         return directory.absolutePath     } } 

If it helps, here’s my build.gradle file:

apply plugin: ''  apply plugin: 'kotlin-android'  apply plugin: 'kotlin-android-extensions'  android {     compileSdkVersion 28     defaultConfig {         applicationId "com.ebelinski.RetrofitTestApp"         minSdkVersion 21         targetSdkVersion 28         versionCode 1         versionName "1.0"         testInstrumentationRunner ""     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ''         }     } }  dependencies {     implementation fileTree(dir: 'libs', include: ['*.jar'])     implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$  kotlin_version"     implementation ''     implementation ''     implementation 'com.squareup.retrofit2:converter-gson:2.5.0'     implementation 'com.squareup.retrofit2:retrofit:2.5.0'     implementation 'com.squareup.okhttp3:okhttp:3.12.0'     implementation "org.jetbrains.anko:anko-commons:0.10.1"     testImplementation 'junit:junit:4.12'     androidTestImplementation ''     androidTestImplementation '' } 

How to get my result from Procedure

How can i get my out parameters from my procedure. My stl_mbc_cdr table has over 100 records and i cant see my results.

declare     call_charge VARCHAR(10);    MSG_OUT     VARCHAR(50); BEGIN    FOR REC IN (SELECT *FROM dulguunbaatar.stl_mbc_cdr_1062) LOOP     pk_test_duba.recharge_idd(REC.Called_Number,                                rec.call_date||rec.call_time,                                                          rec.duration,                                                          CALL_CHARGE,                                                          MSG_OUT);           END LOOP; end; 

Result count mismatch on search api autocomplete

We are using search api module and search api solr as databse server. We created result page using views and it has expose form. And in the expose form, we enable autocomplete.

The problem is we search search with a word e.g. ‘performance‘, in autocomplete it is suggesting two result ‘performance,‘ with 25 count and ‘performance.‘ with 11 count and when I select one of this and do the search, it’s showing total 41 result. So here is confusing, if ignore the special chars like ‘,’ and ‘.’ here and make the merge, it will become 36 which is not same as total count.

Note: I am doing fulltext search and configured same field in views and autocomplete.

So am I missing anything there or is there any issue? Or is this way it work, it will be big help if anyone could explain here?

Let me know if you need more information.

Search result page with tabs and ajax pagination

I need to create a results search page with those characteristics:

  • The page will have different tabs (like the bootstrap ones so no page reload), each tab will only shows the relative content type. There needs to be a “all” tab with all the content as well

  • Each tab needs to have a “load more” button on the bottom for ajax pagination

I can alter the search-results template and having the tabs, but I don’t know how to integrate an ajax pagination on each singular tab by using drupal functions (or using Views Infinite Scroll if it will be a view)

Any hints?

Differences in the result of the security tab of folders

Why is it that when I check the security tab of one folder I could see “Everyone” (but not authenticated users) and in other folders I see “Authenticated Users”?

When is that set?

I am asking because today I found out that a folder I have that usually had writing permissions for authenticated users, now doesn’t have authenticated users and “everyone” is restricted to read-only. And I am wondering what happened?

Running pipeline starting from another pipeline result

I need to create a pipeline to do unit and integrations tests and it will executed after lint pipeline on GO CD.

I’ve created a pipeline having as a material the previous pipeline (lint) but and the code is not available to the test pipeline. The test pipeline is automatically started when lint pipeline is successfully finished.

I have a git repository as a material on lint pipeline and it must be delivered to the next pipeline.

Git Material Repository to Lint Pipeline

Test Pipeline Material from lint pipeline

So I need test pipeline have the git repository from previous pipeline without cloning git again.

merge result of two queries in SQL

I want to combine result of two queries in a way that it should display the result of each ID from both tables separately and . It should display first ID from both tables and then display the result of second ID. Is theer any way to do this?

Suppose I have two tables:
Table 1:
Id Name

Table 2:

ID quantity Rate

1 30 100

2 45 800

Output should be:


1 30 100


2 45 800