Hello! I have a grid view with the row model having a image view and text view in it. I set a custom adapter to populate the the grid view with images and texts successfully.
But now I want to use a search view to filter the grid view on the base of text in text views. For this I implemented Filterable interface .
When i enter the string in my search view nothing happens. I am pasting my code also. Please check it . All the code is in one class.

Please view the code in the inner classes ImageAdapter and CustomerFilter specially. I have searched on internet for this problem, but by problem not solved. Please guide me what mistake i am doing?

package com.example.hp430.tabsexample;

import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.SearchView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;

import java.util.ArrayList;
import java.util.zip.Inflater;

import static com.example.hp430.tabsexample.MainActivity.MYPREF;
import static com.example.hp430.tabsexample.MainActivity.gridname;

public class TabFragment1 extends android.support.v4.app.Fragment {
    private AdView adView;
    SharedPreferences sharedpreferences;

public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup `container, Bundle savedInstanceState) {`
View rootview = inflater.inflate(R.layout.tab_fragment_1,container,false);
SearchView sv = rootview.findViewById(R.id.searchview1);
GridView gridview = (GridView)rootview.findViewById(R.id.pfgrid);

  gridview.setAdapter(new ImageAdapter(getActivity()));

    sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        public boolean onQueryTextSubmit(String query) {
            return false;

        public boolean onQueryTextChange(String newText) {
           new ImageAdapter(getActivity()).getFilter().filter(newText);
            return false;

    adView = rootview.findViewById(R.id.ad_view 
    gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public ...

vbScript - A Multi-column Sort With Minimal Coding

Please see my post vbScript - The Basics for more details on vbScript.

A previous post dealt with sorting. The code easily handles sorting simple things like lists of words, lines of text - cases where you only had to compare two things. What about the case where you want the option to sort on an arbitrary column of data, or you want to sort on multiple columns such as by birthdate, then by last name. That becomes more difficult to code.

Databases handle that with ease by allowing you to specify complex sorts in a SQL string. But sometimes you don't want to have to define a database just for the convenience of sorting.

In vbScript you can use ADO (ActiveX Data Objects) to create recordsets that are not attached to a database. You can add records, then sort them on the fly. You define a recordset by

Set rec = CreateObject("ADODB.RecordSet")

Then you add fields to the recordset with the Append method. You have access to all of the standard field type like VarChar, Int, Float, etc. I'll give the full list at the end. Fields can be accesses by a user specified field name, or by a zero-relative index. In the sample code we'll be sorting


so we'll need two fields - a VarChar (we'll name the field Word) and an Int (we'll call it Num)

rec.Fields.Append "Word",200,255 ...

vbScript - Some Useful String Functions

Please see my post vbScript - The Basics for more details on vbScript.

vbScript provides a number of functions for manipulating strings. I find that a few more simple functions would have made things a lot simpler. For example, I find myself checking to see if a string starts with a given string. What I have to code is

If len(str1) < len(str2) Then
    StartsWith = False
Else If Left(str1,len(str2)) = str2 Then
    StartsWith = True
    StartsWIth = False
End If

It would be much clearer if I could do

If StartsWith(str1,str2) Then

Similarly, I will frequently drop characters from the beginning or end of a string. This can result in some convoluted calculations inside calls to Left, Right, and Mid. Whenever I need a string function I code it up once and add it to my StrFuncs.vbs include file. They are detailed here. See the comments in the code snippet for details.


vbScript - Identify File by Perceived Type

Please see my post vbScript - The Basics for more details on vbScript.

There are times when you want to operate on all files of a given type. For example, you may want to enumerate all files in a folder or a drive that are recognized by Windows as video or audio. But how would you do that? There are so many video file types that it would be difficult to test for even the more common file extensions. Better to ask Windows to do the identification. The Windows Registry contains an key for all of the file extensions that it recognizes. A number of these keys have an associated entry with the name PerceivedType. The value of that entry is of type REG_SZ (zero terminated string) and is the recognized generic file type. It will be a value like "audio", "video", "text", etc. vbScript provides a way of creating, deleting, reading, and writing registry values.

For example, to get the PerceivedType for the extension "avi" you can do

Set wso = CreateObject("Wscript.Shell")
PerceivedType = wso.RegRead("HKCR\.avi\PerceivedType")

If there is no PerceivedType entry then this will throw an error so the easiest way around that is either

PerceivedType = ""
on error resume next
PerceivedType = wso.RegRead("HKCR\.avi\PerceivedType")


on error resume next
PerceivedType = wso.RegRead("HKCR\.avi\PerceivedType")

if err.Number <> 0 then
    PerceivedType = ""
end if

I'm lazy so I prefer the first form.

Please note that this method does not verify that ...


vbScript - Get Drive Letter by Volume Label

Please see my post vbScript - The Basics for more details on vbScript.

I have all my computers partitioned with two partitions. The drive letters are C (OS and applications) and D (user data). I use Macrium Reflect to take monthly full and daily differential images of C. To backup D Ii use a script front end for robocopy. Using a script to do the backup has one major problem. The drive letter of my dedicated backup external drive may change. I find that even if I have used Drive Manager to allocate a drive letter, there is no guarantee that this letter will never change.

What I can do is assign a unique volume label. Unfortunately I cannot directly use the volume label in any type of copy command. What we need is some way to scan all mounted drives and find the drive letter for a given volume label. We can do that by accessing the Drives collection returned by the FileSystemObject. If you examine the properties exposed by a single instance of a drive, for example, my D drive, via the following script:

set fso = CreateObject("Scripting.FileSystemObject")

set drive = fso.GetDrive("D")

Wscript.Echo "AvailableSpace =", drive.AvailableSpace 
Wscript.Echo "DriveLetter    =", drive.DriveLetter    
Wscript.Echo "DriveType      =", drive.DriveType      
Wscript.Echo "FileSystem     =", drive.FileSystem     
Wscript.Echo "FreeSpace      =", drive.FreeSpace      
Wscript.Echo "IsReady        =", drive.IsReady        
Wscript.Echo "Path           =", drive.Path           
Wscript.Echo "RootFolder     =", drive.RootFolder     
Wscript.Echo "SerialNumber   =", drive.SerialNumber   
Wscript.Echo "ShareName      =", drive.ShareName      
Wscript.Echo "TotalSize      =", drive.TotalSize      
Wscript.Echo "VolumeName     =", drive.VolumeName ...

(Keeping this eternal thread going...)

One of the earliest 'hardest' programs I wrote was a VAX11 assembler in VAX11 assembler. I aced that class becase it did everything exactly as DEC's assembler did except for generating code (I ran out of time).

The hardest programs I've written are, in essence, code generators. Such as a perl CGI script that generates HTML and JavaScript which in turn generates JS code and data for itself and generates perl data to be sent back to the server and used as input to tc (Linux Traffic Control). Simultaneously writing bash, perl, HTML, and JS on two separate and different platforms with non-persistent data.


Hi folks,

i am making a simple program using vb.net 2017

i want to make a hot key like pressing keys.decimal + keys.enter at the same time to shutdown my pc.

i am using a bluetooth usb numpad so crtl key is not an option.

thanks for your help.


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)

struct time_details
    int strt_time[5] ;
    int end_time[5];

int main()
   struct time_details user1;
   struct time_details user2;
   int found=0;

   /*taking time inputs from user | we can make the array dynammic also
   here if number of iterationa re not known */
   for( int i=0;i<5; i++)
       printf("enter 1st user start and end time ");
       scanf("%d %d",&user1.strt_time[i],&user1.end_time[i]);


   for( int i=0;i<5; i++)
       printf("enter 2nt user start and end time ");
       scanf("%d %d",&user2.strt_time[i],&user2.end_time[i]);


  for (int k = 0;k<5 ;k++)
      for (int l=0; l<5; l++)
          if (
                (user1.strt_time[k]<=user2.strt_time[l] && user1.end_time[k]>=user2.strt_time[l])
                (user1.strt_time[k]>=user2.strt_time[l] && user1.end_time[k]>user2.strt_time[l])

              int start_lap_time=0;
              int end_lap_time=0;
              found ++;
              printf("\n found overlapping interval start from %d end at %d",start_lap_time,end_lap_time);

  if (found==0)
      printf("\n No overlapping periond found between two users");

    return 0;

vbScript - Browse for Folder or File

Please see my post vbScript - The Basics for more details on vbScript.

Some scripts need input (other than from the command line) from the user. This can be read from the console (StdIn) or from a pop-up textbox (InputBox). This is fine for simple input but you certainly wouldn't want to have to type a folder or file name, especially when it might include a lengthy path. There are several ways to avoid typing a long folder or file name.

If you create a shortcut to your script on the desktop you could drop a folder or file onto the shortcut and access the item via the command line arguments. Each file or folder can be accessed as

Set fso = CreateObject("Scripting.FileSystemObject")

For Each arg in Wscript.Arguments.Unnamed
    Select Case True 
        Case fso.FolderExists(arg): WScript.Echo "Folder:",arg
        Case fso.FileExists(arg)  : WScript.Echo "File:  ",arg
    End Select

But if you want to be able to browse for a file or folder during the execution of the script that is a little trickier. Of files and folders, browsing for folders is easier because the Shell.Application object provides a method for doing that directly. That method is `Shell.BrowseForFolder. The parameters are

  1. a handle (when called from vbScript use the value 0)
  2. text to display in the title bar of the dialog
  3. window options
  4. start folder

Window options can be one or more (add the values) of

Const BIF_RETURNONLYFSDIRS   = &H0001   'Only file system folders ...

One of the Windows OS complaints is that updates can reset settings and break installed apps. You've found that you can't connect to your server so that's what you work next. I don't admin your setup so you are the expert at this point with you going over your setup and settings.


Could it be a .access thing?

RewriteEngine On

#RewriteBase /api/

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

Is it because of dublicate entries?

i use 'MyApp' only on my app.compontent.ts file

import { Component, ViewChild } from '@angular/core';
import { Nav, Platform, App, MenuController } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';

import { TabsPage } from '../pages/tabs/tabs';

import { SplitPane } from '../providers/split-pane';

import { AuthService } from "../providers/auth-service";

import { Common } from "../providers/common";

import { SettingsPage } from '../pages/settings/settings';
import { AccountPage } from '../pages/account/account';

    templateUrl: 'app.html'
export class MyApp {
    @ViewChild(Nav) nav: Nav;

    rootPage = TabsPage;

    pages: Array<{ title: string, component: any }>;
    public userDetails: any;
    public resposeData: any;
    public dataSet: any;
    public groupSet: any;
    public pressSet: any;

    userPostData = {
        uid: "",
        token: "",
        username: "",
        bio: "",
        profile_pic: ""
        public platform: Platform,
        public splitPane: SplitPane,
        public authService: AuthService,
        public common: Common,
        public app: App,
        public menu: MenuController
        ) {


        const data = JSON.parse(localStorage.getItem("userData"));
        this.userDetails = data.userData;
        this.userPostData.uid = this.userDetails.uid;
        this.userPostData.token = this.userDetails.token;
        this.userPostData.username = this.userDetails.username;
        this.userPostData.profile_pic = this.userDetails.profile_pic;
        this.userPostData.bio = this.userDetails.bio;

        // used for an example of ngFor and navigation
        this.pages = [
            { title: 'Homepage', component: TabsPage },
            { title: 'Settings', component: SettingsPage },
            { title: 'Account', component: AccountPage }


    userDetail() {
        this.authService.postData(this.userPostData, "userDetails").then(

            result => {
                this.resposeData = result;
                if (this.resposeData.userDetails) {
                    this.dataSet = this.resposeData.userDetails;

                } else {
                    console.log("No access");
            err => {
                //Connection failed message

    SettingsPage() {
        // Reset the content nav to have just this page
        // we ...


I am an absolute beginner to Xamarin and just started to develop a small application wherein, I am not getting any idea about why the BindableProperty changes are not getting reflected inside the view model.
Presently, I have written my BindableProperty in a separate Class and the code is as follows:

public static readonly BindableProperty IsValidEntryProperty = BindableProperty.Create("IsValidEntry", typeof(bool), typeof(MaxLengthValidatorBehavior), false, BindingMode.TwoWay);

public bool IsValidEntry
   get { return (bool)GetValue(IsValidEntryProperty); }
   set { SetValue(IsValidEntryProperty, value); }

protected override void OnAttachedTo(Entry bindable)
        bindable.TextChanged += HandleTextChanged;

void HandleTextChanged(object sender, TextChangedEventArgs e)
        IsValidEntry = false;
        IsValidEntry = (Regex.IsMatch(e.NewTextValue, emailRegex, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250)));
        if (IsValidEntry)
            EmailErrorMessage = string.Empty;
            EmailErrorMessage = "The email specified is incorrect";
        ((Entry)sender).TextColor = IsValidEntry ? Color.Default : Color.Red;

And, the view's code is as follows:

<Entry Grid.Column="1" Placeholder="Email" Margin="3" Text="{Binding LoginEmail, Mode=TwoWay}"
               IsVisible="{Binding SelectedPhoneEmailIndex, Converter={StaticResource KMConvert}, ConverterParameter=EMAILVIS}">
      <kmBehaviors:EmailValidatorBehavior IsValidEntry="{Binding IsValidValueEntered, Mode=TwoWay}"
                                          EmailErrorMessage="{Binding ErrorMessageForEmail, Mode=TwoWay}" />

Here, the "IsValidValueEntered" property (which is, of course, present in the view model) is bound to another Label's Text property in the same view but somehow, whenever any changes are done to the "IsValidEntryProperty" BindableProperty, those changes do not hit the setter of "IsValidValueEntered" property in the view model.

Any help is appreciated.

Thanks very much indeed.


No, i dont use any files from the web. I use local files.
The problem is that i can't connect to my database. Its realy frustrating. It happened before and it was because i gave the wrong root to the config file. But i haven't made any changes i was working on another project. I updated my windows 10 and thats it. Always that annoying error 'data is null'


import { Injectable } from '@angular/core';
import { Http, Headers } from '@angular/http';
import 'rxjs/add/operator/map';

let apiUrl = "http://localhost/PHP-Slim-Restful1/api/";

export class AuthService {
  constructor(public http: Http) {
    console.log('Hello AuthService Provider');

  postData(credentials, type) {
      return new Promise((resolve, reject) => {

      let headers = new Headers();
      this.http.post(apiUrl+type, JSON.stringify(credentials), {headers: headers}).
      subscribe(res =>{
      }, (err) =>{





MyApp@http://localhost:8100/build/main.js:1563:9 createClass@http://localhost:8100/build/vendor.js:13135:20 createDirectiveInstance@http://localhost:8100/build/vendor.js:12970:37 createViewNodes@http://localhost:8100/build/vendor.js:14428:53 createRootView@http://localhost:8100/build/vendor.js:14317:5 callWithDebugContext@http://localhost:8100/build/vendor.js:15742:39 debugCreateRootView@http://localhost:8100/build/vendor.js:15025:12 ComponentFactory_.prototype.create@http://localhost:8100/build/vendor.js:11922:37 ComponentFactoryBoundToModule.prototype.create@http://localhost:8100/build/vendor.js:4709:16 ViewContainerRef_.prototype.createComponent@http://localhost:8100/build/vendor.js:12119:45 IonicApp.prototype.ngOnInit@http://localhost:8100/build/vendor.js:61552:28 checkAndUpdateDirectiveInline@http://localhost:8100/build/vendor.js:13055:9 checkAndUpdateNodeInline@http://localhost:8100/build/vendor.js:14579:20 checkAndUpdateNode@http://localhost:8100/build/vendor.js:14522:16 debugCheckAndUpdateNode@http://localhost:8100/build/vendor.js:15415:55 debugCheckDirectivesFn@http://localhost:8100/build/vendor.js:15356:13 View_IonicApp_Host_0/<@ng:///IonicModule/IonicApp_Host.ngfactory.js:10:5 debugUpdateDirectives@http://localhost:8100/build/vendor.js:15341:12 checkAndUpdateView@http://localhost:8100/build/vendor.js:14488:5 callWithDebugContext@http://localhost:8100/build/vendor.js:15742:39 debugCheckAndUpdateView@http://localhost:8100/build/vendor.js:15279:12 ViewRef_.prototype.detectChanges@http://localhost:8100/build/vendor.js:12263:13 ApplicationRef.prototype.tick/<@http://localhost:8100/build/vendor.js:6593:58 ApplicationRef.prototype.tick@http://localhost:8100/build/vendor.js:6593:13 ApplicationRef.prototype._loadComponent@http://localhost:8100/build/vendor.js:6659:9 ApplicationRef.prototype.bootstrap@http://localhost:8100/build/vendor.js:6547:9 PlatformRef.prototype._moduleDoBootstrap/<@http://localhost:8100/build/vendor.js:6267:74 PlatformRef.prototype._moduleDoBootstrap@http://localhost:8100/build/vendor.js:6267:13 PlatformRef.prototype.bootstrapModuleFactory/</</<@http://localhost:8100/build/vendor.js:6188:21 F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14974 onInvoke@http://localhost:8100/build/vendor.js:5435:24 F</l</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:14901 F</c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:10124 f/<@http://localhost:8100/build/polyfills.js:3:20240 F</l</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15649 onInvokeTask@http://localhost:8100/build/vendor.js:5426:24 F</l</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15562 F</c</r.prototype.runTask@http://localhost:8100/build/polyfills.js:3:10815 o@http://localhost:8100/build/polyfills.js:3:7887