Software per FORUM

Stato
Discussione chiusa ad ulteriori risposte.
Ultima modifica:
Ragazzi, 10 minuti fa vi ho scritto una risposta dettagliata poi premendo invio mi è uscito "Il sito è sotto manutenzione."


Il code di .NET CMS è da pazzoidi, commentarlo è solo superfluo, i coder pazzoidi lo comprendono al volo come fosse un elemento cristallino.. [snip offtopic]. a voi basti sapere che .NET CMS sul piano delle caratteristiche e prestazioni eclissa qualsiasi prodotto analogo permettendo di far girare centinaia di siti web con il forum e tutto il resto anche se installato su un computer con cpu pentium, senza database, ecc..
Halloween è già passato dolcetto o scherzetto non si fa più.
il codice è da incompetenti non commentarlo, da quando esiste la programmazione il commento del codice è una delle primissime regole. Qualunque programmatore, fin dai primi approcci sa che i commenti nel codice sono cosa indispensabile su progetti estesi, sopratutto quando il codice viene ripreso in mano a mesi di distanza. Anche una sola riga di commento può salvare ore di tempo! Commenti superflui o da pazzoidi, ma stiamo scherzando!!!!!!!!!!!!! Ma vedo che sei abituato a scrivere male, praticamente tutti i controlli si chiamano con i nomi di default Button1,Button2,Button3...
Sulle prestazioni è a dir poco ridicolo, rispetto agli altri cms che utilizzano database è lento da paura. E lo affermo perchè lo sto provando e confrontando con altri 4 prodotti CMS.
Puoi sperare che sia veloce, ma non puoi prendere per il culo perchè la gente se ne accorge subito.
in realtà una forma di database la usi, ovvero l'XML. Percio' di fondo il database lo usi, ma lo usi MALISSIMO!!!! Spargendo una valanga di file abbandonati al file system e all'io-manager con tutti i svantaggi che ne derivano e zero vantaggi. che tristezza.
Sul piano che possa far girare "enne" siti web hai scoperto l'acqua calda, è una cosa che si fa da sempre dapprima su lato server linux con .htaccess e aspirewrite in windows, e a seguire con codice basta una pagina con una manciata di righe di codice condizionale far scegliere l'opportuno database o sorgente dati portandolo a presso in una variabile di sessione.
Ti pare che una società che hosta e realizza siti web, debba predisporre un server per ogni host? Sarebbe follia allo stato puro. Scoperto l'acqua calda, sono cose che si fanno da quando esiste il web.


MA L'ASSURDITA' ASSOLUTA ARRIVA SUBITO: l'utente deve fare una ricerca nel forum, come funziona?.... ... ... attende l'indicizzazione di google!!! STO CMS E' UN ABOMINIO!


Non sto nemmeno li a quotare il resto delle cose che hai scritto perchè è uno spreco di calorie.
Sto leggendo cose da fantascienza!
i dati volabili... vogliamo parlarne? massiì facciamoci male.
persistent.vb no dico avete visto cosa fa persistent.vb? intanto mette un commento, ed è subito inutile.
in pratica tutto è serializzato, e richiama la funzione SaveObject che sparpaglia dati su file xml o di altra natura binaria. E se dovesse andare in errore? hehe non esiste la gestione dell'errore, dunque il codice crasha uscendone senza valore e con perdita dati. Figo eh. Stessa cosa vale per la funzione DeleteObject e il resto delle sub/function.
Ma ammesso che per cu1o funzioni sempre dove sta la novità rispetto un database? in niente. Pero' con la penalità che non è gestito. Inoltre se non si salva i dati si perdono c'è poco da fare, e in questo caso se si salvano vengono sparpagliati in file, assoggettandodoli a frammentazione, FS e qualunque altro genere di male di sistema.
Per non parlare della sicurezza, completamente assente!
Affermi che per scrupolo tutte le operazioni di accesso al disco, non fanno uso diretto dei metodi di scrittura del framework, avresti scritto un modulo che rende sicure queste operazioni. MA CHE CAXXO STIAMO DICENDO????
ecco il codice del famigerato modulo nello spoiler
'© By Andrea Bruno
'Open source, but: This source code (or part of this code) is not usable in other applications


Imports Microsoft.VisualBasic
Imports System.Xml.Serialization


Namespace WebApplication


Public Module FileManager
Private Const Timeout As Integer = 30000 'Milliseconds
Private Const TryEvery As Integer = 250 'Milliseconds
Private Locker As New LockByKeyString


'Private LockFileOperations As New Object


Public Sub Serialize(ByVal Obj As Object, ByVal NameFile As String)
Dim KeyLock As String = LCase(NameFile)
Dim Er As Exception
Try
SyncLock Locker.LockKey(KeyLock)
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Dim Stream As New System.IO.FileStream(NameFile, System.IO.FileMode.Create)
Try
Dim xml As New XmlSerializer(Obj.GetType)
Dim xmlns As New XmlSerializerNamespaces
xmlns.Add(String.Empty, String.Empty)
xml.Serialize(Stream, Obj, xmlns)
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
Finally
If Stream IsNot Nothing Then
Stream.Close()
Stream.Dispose()
End If
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try


If Er IsNot Nothing Then
Log("Error", 1000, "Serialize", NameFile, Er.Message)
End If


End Sub


Public Function Deserialize(ByVal NameFile As String, Optional ByVal Type As Type = Nothing) As Object
'Parameter "Type" is need for XML deserialization
If System.IO.File.Exists(NameFile) AndAlso New IO.FileInfo(NameFile).Length <> 0 Then
Dim Obj As Object
Dim KeyLock As String = LCase(NameFile)
Dim Er As Exception
Try
SyncLock Locker.LockKey(KeyLock)
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Dim Stream As New System.IO.FileStream(NameFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)
Try
Dim XML As New XmlSerializer(Type)
Obj = XML.Deserialize(Stream)
Er = Nothing
Catch ex As Exception
Er = ex
If Err.Number = 5 Then
Exit Do
End If
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
Finally
If Stream IsNot Nothing Then
Stream.Close()
Stream.Dispose()
End If
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try


If Er IsNot Nothing Then
Log("Error", 1000, "Deserialize", NameFile, Er.Message)
End If


Return Obj
End If
End Function




Function ReadXml(ByVal File As String) As System.Xml.XmlDocument
'Read XML data source from file
Dim Xml As New System.Xml.XmlDocument
Xml.Load(File)
Return Xml
End Function


Function ReadAll(ByVal File As String, Optional ByVal GenerateErrorIfNotExists As Boolean = False) As String
'!!! If need read record from file, see function "RecordsFromTextFile"
Dim KeyLock As String = LCase(File)
Try
SyncLock Locker.LockKey(KeyLock)


If System.IO.File.Exists(File) Then
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Dim Stream As System.IO.StreamReader
Try
Stream = New System.IO.StreamReader(File)
ReadAll = Stream.ReadToEnd()
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
Finally
If Stream IsNot Nothing Then
Stream.Close()
Stream.Dispose()
End If
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
Else
If GenerateErrorIfNotExists Then
Err.Raise(70, , "File not found: " & File)
End If
End If
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try


End Function


Function ReadAllRows(ByVal File As String, Optional ByVal RemoveEmpty As Boolean = True) As String()
If RemoveEmpty Then
Dim Data As String = ReadAll(File)
If Data IsNot Nothing Then
Return Data.Split(vbCrLf.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
End If
Else
Dim KeyLock As String = LCase(File)
Try
SyncLock Locker.LockKey(KeyLock)
If System.IO.File.Exists(File) Then
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Dim Stream As System.IO.StreamReader
Try
ReadAllRows = System.IO.File.ReadAllLines(File)
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
Finally
If Stream IsNot Nothing Then
Stream.Close()
Stream.Dispose()
End If
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
Else
'If GenerateErrorIfNotExists Then
Err.Raise(70, , "File not found: " & File)
'End If
End If
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try
End If
End Function


Function ReadAllBinary(ByVal File As String, Optional ByVal GenerateErrorIfNotExists As Boolean = False) As Byte()
Dim KeyLock As String = LCase(File)
Try
SyncLock Locker.LockKey(KeyLock)
Dim FileInfo As New System.IO.FileInfo(File)
If FileInfo.Exists Then
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Dim Stream As System.IO.FileStream
Try
Stream = New System.IO.FileStream(File, IO.FileMode.Open, IO.FileAccess.Read)
ReDim ReadAllBinary(Stream.Length - 1)
Stream.Read(ReadAllBinary, 0, Stream.Length)
'BinaryReader.Close()
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
Finally
If Stream IsNot Nothing Then
Stream.Close()
Stream.Dispose()
End If
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
Else
If GenerateErrorIfNotExists Then
Err.Raise(1)
End If
End If
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try
End Function


Sub WriteAllBinary(ByVal Data As Byte(), ByVal File As String, Optional ByVal Append As Boolean = False)
Dim KeyLock As String = LCase(File)
Try
SyncLock Locker.LockKey(KeyLock)
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Dim Stream As System.IO.StreamWriter
Try
Stream = New System.IO.StreamWriter(File, Append, System.Text.Encoding.ASCII)
Dim BinaryWriter As New System.IO.BinaryWriter(Stream.BaseStream)
BinaryWriter.Write(Data)
'Stream.Write(Data)
BinaryWriter.Close()
BinaryWriter = Nothing
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
Finally
If Stream IsNot Nothing Then
Stream.Close()
Stream.Dispose()
End If
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try


End Sub


Sub WriteAll(ByVal Data As String, ByVal File As String, Optional ByVal Append As Boolean = False, Optional ByVal BackUp As Boolean = True)
Dim TmpFile As String
Dim Delete As Boolean
Dim KeyLock As String = LCase(File)
Try
SyncLock Locker.LockKey(KeyLock)


If BackUp AndAlso Append = False AndAlso System.IO.File.Exists(File) Then
TmpFile = File & ".tmp"
End If


Dim NTry, NTryError As Integer
Do
NTry = NTryError
Dim Stream As System.IO.StreamWriter
Try
Stream = New System.IO.StreamWriter(IIf(TmpFile Is Nothing, File, TmpFile), Append)
Stream.Write(Data)
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
Finally
If Stream IsNot Nothing Then
Stream.Close()
Stream.Dispose()
End If
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)


If TmpFile IsNot Nothing Then
If NTry = NTryError Then
NTry = 0 : NTryError = 0
Do
Try
System.IO.File.Replace(TmpFile, File, File & ".old")
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
End If
'Delete outside of SinkLock block
Delete = True
End If
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try


If Delete Then
FileManager.Delete(TmpFile)
End If
End Sub


Sub WriteToAppend(ByVal Data As String, ByVal File As String)
WriteAll(Data, File, True)
End Sub


Function Delete(ByVal File As String) As Boolean
Dim Successfull As Boolean
Dim KeyLock As String = LCase(File)
Try
SyncLock Locker.LockKey(KeyLock)
If System.IO.File.Exists(File) Then
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Try
System.IO.File.Delete(File)
Successfull = True
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
End If
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try
Return Successfull
End Function


Public Function DeleteDirectory(ByVal Path As String, Optional ByVal Recursive As Boolean = True)
'In .NET 2.0 delete directory cause a restart of web application! Please use only spooler to delete directories!


'Strong control to verify accident delete of important directory!
If Path.StartsWith(MapPath(ReadWriteDirectory)) Then
If Len(Path) > Len(ReadWriteDirectory) Then


Dim Successfull As Boolean
Dim KeyLock As String = LCase(Path)
Try
SyncLock Locker.LockKey(KeyLock)
If System.IO.Directory.Exists(Path) Then
Dim NTry, NTryError As Integer
Do
NTry = NTryError
Try
System.IO.Directory.Delete(Path, Recursive)
Successfull = True
Catch ex As Exception
NTryError += 1
System.Threading.Thread.Sleep(TryEvery)
End Try
Loop Until NTry = NTryError Or NTryError > (Timeout / TryEvery)
End If
End SyncLock
Locker.UnlockKey(KeyLock)
Catch ex As Exception
Locker.UnlockKey(KeyLock)
Throw ex
End Try
Return Successfull
End If
End If
End Function


'Private Function SpoolerFile() As String
' Return MapPath(ReadWriteDirectory & "/DelDirectorySpooler.txt")
'End Function


'Sub DeleteDirectoryAddToSpooler(ByVal Path As String)
' If IO.Directory.Exists(Path) Then
' IO.File.SetAttributes(Path, IO.FileAttributes.Hidden)
' WriteToAppend(Path & vbCr, SpoolerFile)
' End If
'End Sub


'Sub DeleteDirectoryInSpooler()
' Dim DirList As String = ReadAll(SpoolerFile)
' If DirList <> "" Then
' Dim Dirs As String() = Split(DirList, vbCr)
' For Each Dir As String In Dirs
' 'Strong control to verify accident delete of important directory!
' If Dir.StartsWith(MapPath(ReadWriteDirectory)) Then
' If Len(Dir) > Len(ReadWriteDirectory) Then
' DeleteDirectory(Dir)
' End If
' End If
' Next
' Delete(SpoolerFile)
' End If
'End Sub


Function Extension(ByVal File As String) As String
Dim Point As Integer = InStrRev(File, ".")
If Point Then
Return LCase(Mid(File, Point + 1))
End If
End Function


Function FileName(ByVal PathNameFile As String) As String
Dim Separator As Integer = InStrRev(PathNameFile, "\")
If Separator Then
Return LCase(Mid(PathNameFile, Separator + 1))
End If
End Function


End Module


End Namespace
ebbene? E' tutto System.IO.FileStream, e System.IO.File, dunque non solo utilizzi il metodo IO manger del framework ma l'hai concetrato in un unico file privo di completi controlli.
poi mi cade l'occhio su DeleteDirectory e vedo na cosa strana ReadWriteDirectory, e mi domando "ma che cosa è? non è un comando aspnet.", infatti è una VARIABILE PUBBLICA che invece di essere dichiarata come COSTANTE è inizializzata come stringa, che viene riempita da una FUNZIONE RW_Directory() che a sua volta ritorna una stringa fissa con Return "App_Data". Alla faccia della buona programmazione! amazing facepalm
ma poi un casino di cose tipo:
- ma caxxo, mi iscrivo due utenti con stessa mail e me lo lascia fare.
- del modulo zip.vb non hai inventato un bel niente, IO.Compression, GZipStream sono nativamente presenti nel NET.
- cose interessanti come il PDF sono puri copia incolla di codice pubblico vbPDF (2012.4) | vbPDF, vbPDFParser e clsPDFCreator
- non esiste CMS che non utilizzi l'ftp!
ho guardato a balzi si e no un 10% di questo progetto e ho trovato un sacco di casini e controsensi, chissa' cosa salta fuori se dovessi setacciarlo da cima a fondo!

siamo quasi giunti alla fine... ma prima voglio tornare sulle le prestazioni... ooohhhh le prestazioni... messo in locale sul server senza nessuno che si connette, fatto passare un crawler per il benchmark, bhe credetemi facevo tempo ordinare e mangiare la pizza.

MA TUTTO QUANTO SOPRA SCRITTO NON E' NULLA CONFRONTO LA CIGLIEGINA CHE VI STO PER DIRE:
STO CA2Z0 DI SOFTWARE SALVA I PROFILI DEGLI UTENTI IN CHIARO SU FILE!!!! PASSWORD IN CHIAROOOOOO ALLA MERCE' di lamer, e del webmaster liberissimo di leggersi pe pass in chiaro!!!!
app_data/users/nomeutente.xml
non esiste nessun CMS al mondo che scriva le password in chiaro, è un abominio sto prodotto!!! E non basta correggere sta mega caxxata è proprio tutto il concetto progettuale un casino di codice.
Sono innorridito.
 
Preddy te lo giuro... se non mi fossi trattenuto sarei caduto dalla sedia per le risate! Comunque speed 2 post ho scritto in questa discussione... non contando questo... ce gente come mavin o domokun che hanno scritto molti post solo per litigare non inerenti alla discussione
 
Stato
Discussione chiusa ad ulteriori risposte.