Search PureBasic Forum

Share your advanced PureBasic knowledge/code with the community.
Randy Walker
Enthusiast
Enthusiast
Posts: 478
Joined: Sun Jul 25, 2004 4:21 pm
Location: US

Search PureBasic Forum

Post by Randy Walker »

(Should this be a sticky somewhere?)

PROBLEM:
The forum search feature can render some useless results when attemting to find terms it decides should be ignored. A simple example of this is the term EN_CHANGE. First thing the forum search will do is cast out the underscore and suddenly your single-word search term becomes two separate words (EN + CHANGE). Next it will cast out the ''EN'' because the word is considered to be too short. Placing the whole term in double quotes doesn't help because the forum search will cast out the quotes before it proceeds to disect and destroy the desired search term. Search results end up looking something like this:
  • Search found 7653 matches
    Search term used: +change ignored: en
SOLUTION:
Very effective way to search any forum is to use google. You will need to isolate your search to show only the results from the PureBasic forum. You can do this with the special ''site:'' + ''domain" keyword.
For our purposes, using the example above, go to google and make the first search term (single-word, no-spaces) like this:
  • site:forums.purebasic.com
Next, you need to type in a way that will tell google your search term is important AND you do not want it disected. The plus sign says this term is important and the quotes say do not disect, so the actual search term you are looking for would look something like this:
  • +"EN_CHANGE"
Put it all together into the Google search box and it looks like this:
  • site:forums.purebasic.com +"EN_CHANGE"
(Notice there is a space used here ^ after the .com and before the +''EN_CHANGE'')

Try to find ''in a way'' in the forum search and you get nothing, but not using Google. Try the following in Google for some interesting results:
  • site:forums.purebasic.com +''in a way''
    site:forums.purebasic.com +''in a way'' +''in a way''
    site:forums.purebasic.com +''in a way'' +''in a way'' +''in a way''
    site:forums.purebasic.com +''in a way'' +''in a way'' +''in a way'' +''in a way''
- - - - - - - - - - - - - - - -
Randy
IF (PureBasic > PowerBasic) AND (PowerBasic > Visual_Basic) THEN PureBasic RULES!!!!
User avatar
skywalk
Addict
Addict
Posts: 3960
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Search PureBasic Forum

Post by skywalk »

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
kvitaliy
Enthusiast
Enthusiast
Posts: 162
Joined: Mon May 10, 2010 4:02 pm

Re: Search PureBasic Forum

Post by kvitaliy »

A simple search on the main forum PureBasic:

Code: Select all

;{ Windows
Enumeration
  #Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
  #Frame3D_1
  #Text_2
  #Text_3
  #Text_4
  #Text_5
  #String_6
  #String_7
  #String_8
  #String_9
  #Container_10
  #Option_11
  #Option_12
  #Option_13
  #Option_14
  #Button_15
  #HyperLink_16
EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu

;}
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 156, 142, 626, 346, "Search the forums for PureBasic (Google)", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
   
      FrameGadget(#Frame3D_1, 5, 15, 605, 155, "Setting")
      TextGadget(#Text_2, 10, 40, 140, 20, "with all of the words:")
      TextGadget(#Text_3, 10, 65, 135, 20, "with the exact phrase")
      TextGadget(#Text_4, 10, 91, 135, 20, "with any words")
      TextGadget(#Text_5, 10, 115, 135, 20, "NOT containing the words")
      StringGadget(#String_6, 160, 40, 420, 20, "")
      StringGadget(#String_7, 160, 65, 420, 20, "")
      StringGadget(#String_8, 160, 90, 420, 20, "")
      StringGadget(#String_9, 160, 115, 420, 20, "")
      ButtonGadget(#Button_15, 165, 270, 235, 25, "Start search")
      HyperLinkGadget(#HyperLink_16, 5, 320, 280, 20, "The most accurate search", #Blue, #PB_HyperLink_Underline)
      GadgetToolTip(#HyperLink_16, "The clipboard is selected forum")

      ContainerGadget(#Container_10, 10, 190, 600, 70)
        OptionGadget(#Option_11, 5, 5, 285, 15, "Russian Forum"): 
        OptionGadget(#Option_12, 5, 25, 285, 15, "English Forum"):SetGadgetState(#Option_12,1)
        OptionGadget(#Option_13, 295, 5, 285, 15, "German Forum")
        OptionGadget(#Option_14, 295, 25, 285, 15, "French Forum")
      CloseGadgetList()
   
  EndIf
EndProcedure

OpenWindow_Window_0()

;{- Event loop
Repeat
  Event = WaitWindowEvent()
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #Frame3D_1
      ElseIf EventGadget = #Button_15
        Inquiry$=""
        If GetGadgetState(#Option_11)
           Forum$="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fpurebasic.info%2FphpBB3ex";http://purebasic.info/phpBB3ex/
           ElseIf  GetGadgetState(#Option_12)
           Forum$="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.purebasic.fr%2Fenglish"
           ElseIf  GetGadgetState(#Option_13)
           Forum$="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.purebasic.fr%2Fgerman"
           ElseIf  GetGadgetState(#Option_14)
           Forum$="http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.purebasic.fr%2Ffrench"
        EndIf 
         
           
            If Len(GetGadgetText(#String_6))>2
                Inquiry1$="+"+URLEncoder(GetGadgetText(#String_6))
                Else
                Inquiry1$=""
            EndIf
            If Len(GetGadgetText(#String_7))>2
                Inquiry2$="+"+Chr(34)+URLEncoder(GetGadgetText(#String_7))+Chr(34)
                Else
                Inquiry2$=""
            EndIf
            If Len(GetGadgetText(#String_8))>2
             For i=1 To Len(GetGadgetText(#String_8))
                word$=StringField(GetGadgetText(#String_8), i, " ")
                If Len(word$)
                Inquiry3$=Inquiry3$+" | "+word$
                EndIf
             Next i
             Inquiry3$=URLEncoder(Inquiry3$)
            Else
                Inquiry3$=""
            EndIf
            If Len(GetGadgetText(#String_9))>2
            For i=1 To Len(GetGadgetText(#String_9))
                word$=StringField(GetGadgetText(#String_9), i, " ")
                If Len(word$)
                Inquiry4$=Inquiry4$+"+-"+word$
                EndIf
             Next i
             Inquiry4$=URLEncoder(Inquiry4$)
            Else
                Inquiry4$=""
            EndIf
            Inquiry$= Forum$+Inquiry1$+Inquiry2$+Inquiry3$+Inquiry4$
           
            RunProgram(Inquiry$)
       
             
      ElseIf EventGadget = #HyperLink_16
        If GetGadgetState(#Option_11)
           SetClipboardText("http://purebasic.info/phpBB3ex/")
           ElseIf  GetGadgetState(#Option_12)
           SetClipboardText("http://www.purebasic.fr/english")
           ElseIf  GetGadgetState(#Option_13)
           SetClipboardText("http://www.purebasic.fr/german")
           ElseIf  GetGadgetState(#Option_14)
           SetClipboardText("http://www.purebasic.fr/french")
        EndIf
      RunProgram("http://www.google.com/advanced_search")
      EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_0
        CloseWindow(#Window_0)
        Break
      EndIf
  EndSelect
ForEver
;
;}

Last edited by kvitaliy on Mon Aug 15, 2016 5:47 pm, edited 2 times in total.
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Re: Search PureBasic Forum

Post by Rings »

Randy Walker wrote:(Should this be a sticky somewhere?)
done, and also splitted topic into
http://www.purebasic.fr/english/viewtop ... 17&t=48957
thx
SPAMINATOR NR.1
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Search PureBasic Forum

Post by c4s »

I suggest to use "purebasic.fr" instead of "forums.purebasic.com" as the search url. The search engine of your choice will prefer results in your native language anyway and if you're searching for something really specific you might get helpful codes from the German and French forum as well! (hint: website translators ;))
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: Search PureBasic Forum

Post by Zebuddi123 »

Changed line 85 to

85 Inquiry2$="+"+URLEncoder(Chr(34)+GetGadgetText(#String_7)+Chr(34))

changed position of chr(34) for the " to be in the right place when searching with exact phrase
was

85 Inquiry2$="+"+Chr(34)+URLEncoder(GetGadgetText(#String_7))+Chr(34)

:)
malleo, caput, bang. Ego, comprehendunt in tempore
kvitaliy
Enthusiast
Enthusiast
Posts: 162
Joined: Mon May 10, 2010 4:02 pm

Re: Search PureBasic Forum

Post by kvitaliy »

Zebuddi123 wrote:Changed line 85 to

85 Inquiry2$="+"+URLEncoder(Chr(34)+GetGadgetText(#String_7)+Chr(34))

changed position of chr(34) for the " to be in the right place when searching with exact phrase
was

85 Inquiry2$="+"+Chr(34)+URLEncoder(GetGadgetText(#String_7))+Chr(34)

:)
Ok!
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: Search PureBasic Forum

Post by Zebuddi123 »

@kvitaliy

Sorry was in a rush yesterday!!! thanks for the code its a great little program. using it all the time set as a tool in my pb ide

Thanks for sharing

Zebuddi
malleo, caput, bang. Ego, comprehendunt in tempore
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: Search PureBasic Forum

Post by Joris »

My 5 cents on Search PureBasic Forum :

I experience that much more results can be found with a Google Search like this "PureBasic bitblt", in this case if bitblt is what to look for.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Re: Search PureBasic Forum

Post by utopiomania »

Google using searches like this: bitblit site:purebasic.com.. :)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Search PureBasic Forum

Post by blueznl »

Doin' that for ages in CodeCaddy...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
tj1010
Enthusiast
Enthusiast
Posts: 621
Joined: Mon Feb 25, 2013 5:51 pm
Location: US or Estonia
Contact:

Re: Search PureBasic Forum

Post by tj1010 »

I use this sometimes. It's basically reductive search used to find un-fixed PB bugs. I used Delay() and top-level pagination to avoid stressing the server on top of not parsing and requesting anything.

Code: Select all

;Un-fixed bugs reported on PB forums finder thing
EnableExplicit
InitNetwork()
Dim fmz.s(3,1)
fmz(0,0)="4"
fmz(0,1)="Windows Bugs"
fmz(1,0)="23"
fmz(1,1)="Linux Bugs"
fmz(2,0)="24"
fmz(2,1)="OSX Bugs"
fmz(3,0)="37"
fmz(3,1)="Doc Bugs"
Define look.l=30,i.l=0,ii.l=0,*buffer,html$,posts.l
Declare unsolved(html$)

Debug "<html><header></header><body style="+Chr(34)+"background-color:#000;color:#0f0;"+Chr(34)+">"
For i = 0 To ArraySize(fmz())
  Debug "<h1>"+fmz(i,1)+"</h1>"
  *buffer=ReceiveHTTPMemory("http://www.purebasic.fr/english/viewforum.php?f="+fmz(i,0))
  If *buffer
    html$=PeekS(*buffer,MemorySize(*buffer),#PB_UTF8)
    FreeMemory(*buffer)
    unsolved(html$)
    ;get thread count
    For ii=3000 To 0 Step -1
      If CountString(html$,"&start="+Str(ii))>0
        posts=ii+30
        Break
      EndIf
    Next
    ;paginate
    Repeat
      *buffer=ReceiveHTTPMemory("http://www.purebasic.fr/english/viewforum.php?f="+fmz(i,0)+"&start="+Str(look))
      If *buffer
        html$=PeekS(*buffer,MemorySize(*buffer),#PB_UTF8)
        FreeMemory(*buffer)
        unsolved(html$)
      Else
        Break
      EndIf
      look=look+30
      If look>posts : Break : EndIf
      Delay(Random(15000,5000))
    ForEver
    look=30 : posts=0
  EndIf
Next
Debug "</body></html>"
End

Procedure unsolved(html$)
  Protected title.s
  Protected url.s
  Protected pos.l
  Repeat
    pos=FindString(html$,"topictitle",pos+1)
    If Not pos : Break : EndIf
    title=Mid(html$,pos+12,FindString(html$,"<",pos+12)-(pos+12))
    url=Mid(html$,FindString(html$,"href="+Chr(34),pos-100)+6,FindString(html$,Chr(34),(FindString(html$,"href="+Chr(34),pos-100)+6))-(FindString(html$,"href="+Chr(34),pos-100)+6))
    url=ReplaceString(url,"&","&")
    url=ReplaceString(url,"./","http://www.purebasic.fr/english/")
    If CountString(url,"&sid=")>0 : url=ReplaceString(url,Mid(url,FindString(url,"&sid="),37),"") : EndIf
    If CountString(title,"Done")=0 And CountString(title,"done")=0
      Debug "<a href="+Chr(34)+url+Chr(34)+">"+title+"</a><br>"
    EndIf
    title="" : url=""
  ForEver
EndProcedure
I wonder if stuff like this still works on Google:

Code: Select all

site:purebasic.fr inurl:/english/ ("assembly" | "push" | "jnz" | "_(") -inurl:f=12
The truth hurts.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Search PureBasic Forum

Post by Keya »

for PB searches i just google with "inurl:purebasic", which can also help find Russian and Chinese and other non-purebasic.com English contributions (and also searches purebasic.fr though im not sure if that makes a difference to purebasic.com). Agree that phpBB's search is almost useless, which took me all of 1 week as a PB newbie to realise lol, but is good for searching specifically for a couple things like authors, or specifically searching topics instead of message bodies.

Another thing i find handy to exploit is PB's unique "_" suffix on API's which can make googling for PB-specific API-specific code easy. For example, just do a search for "FindWindow_" and the top results are all Purebasic, even without adding "inurl:purebasic" or anything, and despite google being drowned in various source codes from all languages calling that not-uncommon API
Post Reply