[Release-28th May 2009]Code Snippet Viewer v0.5.1 + Code Snippet Creator v0.5.0

Search This thread

scilor

Senior Member
Jan 5, 2008
1,270
36
@scilor.com
www.scilor.com
With this tool you can lookup CodeSnippets on the Go! Just add them to the Access Database, convert it with the included tool "Code Snippet Creator" and copy it to your Device and start "Code Snippet Viewer"

The Viewer is Tested on my Stock HTC Kaiser - But it should run on any Touchscreen powered WM Device with netcfv2

Code:
Code Snippet Viewer v0.5.1
 ---
 1. Copy the "Release" dir on your Windows Mobile Device with .NETcf2
 2. Run "CodeSnippetViewer.exe" on Device


- Version 0.5.1
  .Fix

- Version 0.5.0
  .Release

Code:
Code Snippet Creator v0.5.0
 ---
 1. Run "csviewer.exe" on Desktop PC
 2. Press "Create Database" Button to create "CodeSnippets.txt"
 3. Copy "CodeSnippets.txt" to your Device, where "CodeSnippetViewer.exe" is located

 The Snippets are read out of the "CodeSnippets.mdb", feel free to add your Snippets there, and Post it on XDA-Developers

- Version 0.5.0
  .Release


Download
http://www.scilor.com/codesnippets.html



If you have suggestions to improve this, just post it here!
 

Attachments

  • ConfigScreen.jpg
    ConfigScreen.jpg
    23.8 KB · Views: 420
  • SearchScreen.jpg
    SearchScreen.jpg
    14 KB · Views: 223
  • SelectScreen.jpg
    SelectScreen.jpg
    20.8 KB · Views: 302
  • SnippetsScreen.jpg
    SnippetsScreen.jpg
    30.4 KB · Views: 426
Last edited:

DJ_Tolja

Member
Mar 16, 2008
21
0
Broksen
what is it for?

sorry for this question im just a newbie,
when i see it right r u german, so pm me pls in german if u can THX!
 

Lifear

Senior Member
Jan 24, 2007
297
35
i have tested your app. but it doesnt work. when i use your sample files, it works, but when i generate a new txt from my mdb, there is an error starting the app. ArgumentOutOfRangeException

here is my exported *.txt. I love this program. great work. i try to sync the mdb with a mysql db in the the net. so i can add new snippets online and sync them back to the device.... i have a cms on my website, where i have some modules which i can use for this. it works also with syntax highligtning (on the net) for some of the programming languages.
 

Attachments

  • CodeSnippets.txt
    11.3 KB · Views: 23

scilor

Senior Member
Jan 5, 2008
1,270
36
@scilor.com
www.scilor.com
Thank you for your feedback, but I have the problem, that it doesnt works in the emulator anymore, I do not know why, it worked before xD

I'll If I can find teh problem.
 

Lifear

Senior Member
Jan 24, 2007
297
35
many thx. i will try this @home, because i am now @work :) i will try to make an exporter with PHP for my online version to, when i have it done, i can mail them to you. this exporter should be easy to code. i can also make an importer, so that you can import a textfile.

the next idea could it be, that you mobile can add a new recordset with a new snippet, so the sync ist complete... but this only an idea by me...
 

scilor

Senior Member
Jan 5, 2008
1,270
36
@scilor.com
www.scilor.com
Here you have the needed code for exporting from SQL to textfile (Routine from the Creator):
I have stripped it down just to show the important things
Code:
        oRS.Open "SELECT * FROM CodeSnippets ORDER BY ProgrammingLanguage ASC, Category ASC, UnderCategory ASC", oConn, adOpenKeyset
        
        oRS.MoveFirst
        txtData = oRS.RecordCount & vbNewLine
        For I = 1 To oRS.RecordCount

            TempData = oRS.Fields("ID").Value & ">{.+.}<" & _
                        oRS.Fields("ProgrammingLanguage").Value & ">{.+.}<" & _
                        oRS.Fields("Category").Value & ">{.+.}<" & _
                        oRS.Fields("UnderCategory").Value & ">{.+.}<" & _
                        oRS.Fields("Snippet").Value
            txtData = txtData & Replace(TempData, vbNewLine, ".>-NewLine-<.") & vbNewLine
            'This Replaces all linebreaks in the Tempdata and attaches it to txtData and also adds a line break afterwards
            
        oRS.MoveNext
        DoEvents
        Next
    oRS.Close
oConn.Close
Call frmViewer.txt_WriteAll(PathTo & "CodeSnippets.txt", txtData)

Here Is a php I wrote from sketch without testing:

Code:
'Connect to the DB first

$newLine = '
';
'Sry that is a new line I do know if "\n" works instead

$SQLString = "SELECT * FROM CodeSnippets ORDER BY ProgrammingLanguage ASC, Category ASC, UnderCategory ASC";
    if ($SQLAnswer = mysql_query($SQLString))
    {
    	$txtData = mysql_num_rows($SQLAnswer).$newLine;
    	
		while($row = mysql_fetch_object($SQLAnswer))
        {
        	$TempData = $row->ID.'>{.+.}<';
        	$TempData .=  $row->ProgrammingLanguage.'>{.+.}<';
        	$TempData .=  $row->Category.'>{.+.}<';
        	$TempData .=  $row->UnderCategory.'>{.+.}<';
        	$TempData .=  $row->Snippet;
        	
        	$txtData .= $newLine.str_replace('.>-NewLine-<.', $newLine, $TempData).$newLine;
            
        }
    }

'Write $txtData to a File!
 

Lifear

Senior Member
Jan 24, 2007
297
35
the rapidshare link show the old version. Can you please update the file or the link?
 

Lifear

Senior Member
Jan 24, 2007
297
35
i have done the online version. there is a *.sql file included, this generates the needed MySQL tables. Also there is a slightly modified *.mdb. i have only modified the Formular.

next there are the needed php an html files for the webserver. the html file is a template, so anyone can modify it.

Update:
i have done some Additions. Included is now EditArea a OpenSource Syntax Highlightning Script. Also i have added a new version of the SQL table, since there is a new field "highlight", this is only for the JavaScript, this field will not be exported in any way.

Now you can manualy add a ProgrammingLanguage or Category by the textfield OR you can choose one from existing Selectbox.

The last time i have forgotten to say, that you must configure the MySQL connection in the common.php. have a look at the following block and put in the right values:

Code:
define("DATABASE_NAME","");
define("DATABASE_USER","");
define("DATABASE_PASSWORD","");
define("DATABASE_HOST","");
 

Attachments

  • OnlineSnippets.zip
    310 KB · Views: 16
Last edited:

Lifear

Senior Member
Jan 24, 2007
297
35
there is no new *.exe file in the zip :-( the directory contains only some txt files :-( please reupload the file.