overwraith 83 Newbie Poster

Does anybody know whether System.Data.SqlLite has the capability to do a Change notification callback when one of it's tables is changed? I know that Python can do it by calling the C api, but This is kind of beyond me. I know I have done this before on an oracle system, and I know it is possible on a Sql server system, the problem being I have an appication that I wanted to avoid the network overhead and simply use an in-memory database.

overwraith 83 Newbie Poster

I actually have decided to open source my project. Here is the link:
Click Here
If anybody has any idea why the modal is not working please post back.

overwraith 83 Newbie Poster

I have a bootstrap view which I am trying to get a modal working for. Unfortunately the modal is displaying as part of the page, not invisable. So it is displaying with it's content as part of the page. Here is my code:

        <!-- Placing excel upload modal here... -->
        @using (Html.BeginForm("UploadExcel", "Home", FormMethod.Post, new { enctype = "multipart/form-data", @class = "form-horizontal" })) {
            <div class="modal fade" id="excelModal" role="dialog">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                            <h4 class="modal-title">Excel Upload</h4>
                        </div>
                        <div class="modal-body">
                            <p>Please upload an excel file that contains the data you are wishing to include in the report parameters.</p>
                        </div>
                        <div class="modal-footer">

                            <div>
                                <div class="form-group">
                                    @Html.Label("Excel File:", new { @class = "control-label col-md-2" })
                                    <div class="col-md-10">
                                        <input id="excelFile"
                                               name="excelFile"
                                               type="file" />
                                        <button class="btn btn-primary"
                                                type="button"
                                                ng-click="ExcelUpload()">
                                            Submit
                                        </button>
                                    </div>
                                </div>
                            </div>

                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        </div>
                    </div>
                </div>
            </div>
        }

I Just added some panneling, but was wondering if you could find any issues with it. Thanks.

overwraith 83 Newbie Poster

I have a question about the dining philosopher problem. This is not about homework. I seem to have solved it, does it actually relate to anything? Is there any software that actually requires it?

overwraith 83 Newbie Poster

I hope it is not too intrusive for me to provide a little sample code... The object relational mapper would probably be your own responsibility. Object relational mappers pull objects out of the database and map them to properties in your objects, the model. You would have to determine the resulting byte array lengths and then create a table in the database with those byte array lengths, you could also do that on the fly with nhibernate creating the table for you.

        /// <summary>
        /// Object to be saved to database. 
        /// </summary>
        public class MyObject {
            /// <summary>
            /// Fingerprint to save to database. 
            /// </summary>
            public byte[] Fingerprint {
                get; set;
            }

            public MyObject() {

            }

            /// <summary>
            /// Set the fingerprint byte array object. 
            /// </summary>
            public void SetFingerprint(Stream stream) {
                using (HashAlgorithm hash = CreateHashAlgorithim()) {
                    Fingerprint = hash.ComputeHash(stream);
                }
            }//end method

            public HashAlgorithm CreateHashAlgorithim() {
                //options md5, sha1, and sha512
                return MD5.Create();
            }//end method
        }//end class
overwraith 83 Newbie Poster

I have refactored the code based on an online example. I believe the problem with the other code is probably encoding, or something. You switch everything to ASCII and things seem to work better. Also the crypto streams seem to work when both encrypt and decrypt are set to write mode. The following is what works:

/*Author: Cameron Block*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.IO;
using System.Net;
using System.Diagnostics;
using System.Configuration;

namespace GadsdenReporting.Models {
    /// <summary>
    /// FtpCredential stores passwords in the database, and uploads files to remote FTP sites. 
    /// </summary>
    public class FtpCredential {
        private const int CHARS_AVAILABLE = 32;

        public FtpCredential() {
            PasswordEncrypted = new byte[GetSymmetricAlgorithim().BlockSize * GetEncodingNumBytes() * CHARS_AVAILABLE];
        }

        /// <summary>
        /// The encrypted password of the ftp site. 
        /// </summary>
        public byte[] PasswordEncrypted {
            get; set;
        }

        /// <summary>
        /// Gets the underlying symmetric algorithim for the object's password capability. 
        /// </summary>
        /// <returns></returns>
        public SymmetricAlgorithm GetSymmetricAlgorithim() {
            return Rijndael.Create();
        }//end method

        /// <summary>
        /// Gets the key from the web config, pads it with null bytes so that it is valid. 
        /// </summary>
        /// <param name="crypt"></param>
        /// <returns></returns>
        public byte[] GetKey(SymmetricAlgorithm crypt) {
            int keySize = crypt.LegalKeySizes[0].MinSize / 8;
            return Encoding.ASCII.GetBytes(System.Configuration.ConfigurationManager.AppSettings["EncryptionKey"].PadRight(keySize, '\0').ToCharArray(), 0, keySize);
        }//end method

        /// <summary>
        /// Gets the initialization vector from the web config, pads it with null bytes so that it is valid. 
        /// </summary>
        /// <param name="crypt"></param>
        /// <returns></returns>
        public byte[] GetIV(SymmetricAlgorithm crypt) {
            int ivSize = crypt.BlockSize / …
overwraith 83 Newbie Poster

I am trying to write some symmetric cryptography for holding an FtpCredential in the database, unfortunately I am having a few problems, one of which is getting back gobbley gook from a crypto decoder. I have trimmed it down to just the bare minimum code.
Please look at the SetPassword method and the GetPassword method.

/*Author: Cameron Block*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.IO;
using System.Net;
using System.Diagnostics;
using System.Configuration;

namespace Reporting.Models {
    /// <summary>
    /// FtpCredential stores passwords in the database, and uploads files to remote FTP sites. 
    /// </summary>
    public class FtpCredential {
        private const int CHARS_AVAILABLE = 32;

        public FtpCredential() {
            PasswordEncrypted = new byte[GetSymmetricAlgorithim().BlockSize * GetEncodingNumBytes() * CHARS_AVAILABLE];
        }

        /// <summary>
        /// The encrypted password of the ftp site. 
        /// </summary>
        public byte[] PasswordEncrypted {
            get; set;
        }

        /// <summary>
        /// Sets the password for this FtpCredential. 
        /// </summary>
        /// <param name="password"></param>
        public void SetPassword(String password) {
            using (SymmetricAlgorithm crypt = Rijndael.Create()) {
                //crypt.Padding = PaddingMode.Zeros;
                int keySize = crypt.LegalKeySizes[0].MinSize / 8;
                int ivSize = crypt.BlockSize / 8;

                byte[] key = Encoding.UTF8.GetBytes(System.Configuration.ConfigurationManager.AppSettings["dEncryptionKey"].PadRight(keySize, '\0').ToCharArray(), 0, keySize);
                byte[] iv = Encoding.UTF8.GetBytes(System.Configuration.ConfigurationManager.AppSettings["EncryptionIV"].PadRight(ivSize, '\0').ToCharArray(), 0, ivSize);

                ICryptoTransform transform = crypt.CreateEncryptor(key, iv);
                MemoryStream ms = new MemoryStream();
                CryptoStream csWriter = new CryptoStream(ms, crypt.CreateEncryptor(), CryptoStreamMode.Write);
                StreamWriter writer = new StreamWriter(csWriter);
                writer.Write(password);
                writer.Flush();
                csWriter.FlushFinalBlock();

                PasswordEncrypted = ms.ToArray();

                writer.Close();
            }
        }//end method

        /// <summary>
        /// Un-encrypts the password for this FtpCredential. 
        /// </summary>
        /// <returns></returns>
        public String GetPassword() {
            using (SymmetricAlgorithm crypt = GetSymmetricAlgorithim()) …
overwraith 83 Newbie Poster

I am creating a reporting engine, it is kind of novel. The only question I have is what are some of the wierder scheduling related things you guys have seen for you cyclical computer programs to date. I am trying to cover as many fringe cases as I can, and just want a little bit of input. This would be fringe cases for example scheduling a quarterly report to be delivered 4 times a year etc.

overwraith 83 Newbie Poster

I was hoping to create retail software. The software developers who would end up recieving it would inevitably get free lunch if they got the software as is. All I wanted was a procedure, but it may not be possible. The library function would have worked in theory, but it does not appear to in reality.

overwraith 83 Newbie Poster

I have a web application I am trying to obfuscate portions of it, but use library mode so that all the public portions of the application should appear with names unchanged so it is accessible to the web. So I am trying to obfuscate some parts and not others. The sites I have visited appear to support it but I am getting an exception:
Click Here

Here is my Dotfuscator.xml file which is on the root of the project.

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v1.1.dtd">
<dotfuscator version="1.1">
  <propertylist>
    <property name="SourceDirectory" value="This Path Will Be Replaced By Visual Studio" />
    <property name="SourceFile" value="This Filename Will Be Replaced By Visual Studio" />
  </propertylist>
  <global>
    <!--set library option -->
    <option>library</option>
  </global>
  <trigger>
    <filelist>
      <file dir="${SourceDirectory}\" name="${SourceFile}" />
    </filelist>
  </trigger>
  <output>
    <file dir="${SourceDirectory}\Dotfuscator\" />
  </output>
</dotfuscator>

Here are my post build events:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\PreEmptive Solutions\Dotfuscator and Analytics Community Edition  \dotfuscatorCLI.exe" /q /p=SourceDirectory=$(TargetDir),SourceFile=$(TargetFileName) $(ProjectDir)Dotfuscator.xml
copy $(TargetDir)Dotfuscator\$(TargetFileName) $(TargetDir)$(TargetFileName)
rmdir /S /Q $(TargetDir)Dotfuscator

I get this error though, so there is something wrong with the obfuscation:

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

I believe this is due to the obfuscator obfuscating too much, eg public variables and methods getting obfuscated. This should be possible, it just isn't working for me. If anyone …

overwraith 83 Newbie Poster

I have a workaround of sorts, I will be looking into entity framework Identity framework for future projects, but instead of a cookie I will be using Session variables to store user name on the server. After the user logs in the user will have a session variable populated with their user name/email address, If the variable is null the user is re-directed to the login page. The user name can be used with a standard cookie, but it is not advisable to use a password cookie of the standard nature.

In addition here is an example of my IsValidLogin method:

        public bool IsValidLogin(Login login) {
            bool isValid = false;
            ISession session = OpenSession();
            using (ITransaction tx = session.BeginTransaction()) {
                User user = session.Query<User>()
                        .Where(usr => usr.EmailAddress.ToLower() == login.EmailAddress.ToLower() && usr.IsActive == true)
                        .ToList()
                        .First();

                isValid = user.ComparePassword(login.Password);
            }
            return isValid;
        }//end method

I added another method where the program checks if the user has been banned or not, Ex: IsActive.

Here is my Login method on the login controller;

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Login(Models.Login login) {

            if (login.RememberMe) {
                HttpCookie cookie = new HttpCookie("AdHockeyLogin");
                cookie.Values.Add("UserName", login.EmailAddress);
                cookie.Values.Add("RememberMe", login.RememberMe.ToString());
                cookie.Expires = DateTime.Now.AddDays(15);
                Response.Cookies.Add(cookie);
            }

            if (ModelState.IsValid) {
                if (login.IsValid()) {
                    //log the user login attempt
                    log.Debug(String.Format("User {0} logged in. ", login.EmailAddress));

                    Session["USER_NAME"] = login.EmailAddress.ToString();
                    Session["PASSWORD"] = login.Password.ToString();

                    return RedirectToAction("Index", "Home");
                }
                else {
                    ModelState.AddModelError("", "Incorrect email or password. ");
                }
            }
            return View("index", login);
        }//end method
overwraith 83 Newbie Poster

Don't even bother with inhertiance, allow the C# code to have an interface, but make the mapping files solely oriented toward the persistance of the concrete objects. Essentially it becomes a simple class oriented mapping file. I think I have one mapping for the abstract class Template, but It is essentially just mappings for all the concrete classes with no nhibernate polymorphisism included. It's not really an answer but it works. In addition my properties for the aggregates, the templates each becomes it's own list in a seperate list variable without the polymorphic list. So instead of a list of multiple classes, I get 3 lists with single classes. This could be why a book I read proposed lists of seperate objects as opposed to a polymorphic list of multiple objects. So I have 3 lists of templates, each a different type of template.

overwraith 83 Newbie Poster

I don't know exactly how I got this to work, but I think I used more linq than the previous example. I will post everything of import;

        public List<User> GetGroupUsersPaged(int groupId, int pageNumber, int pageSize) {
            List<User> users = null;
            ISession session = OpenSession();
            using (ITransaction tx = session.BeginTransaction()) {
                users = session.Query<Group>()
                        .Where(grp => grp.GroupId == groupId)
                        .SelectMany(grp => grp.Users)
                        .Skip((pageNumber - 1) * pageSize)
                        .Take(pageSize)
                        .ToList();
            }

            if (users == null)
                return new List<User>();

            return users;
        }//end method

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
  <class name="AdHockey.Models.User, AdHockey" table="&quot;USER&quot;" lazy="false" schema="cblock">
    <id name="UserId" access="property" type="int" column="USER_ID">
      <generator class="native"/>
    </id>

    <property name="FirstName" access="property" column="FIRST_NAME" length="64" />
    <property name="LastName" access="property" column="LAST_NAME" length="64" />
    <property name="PasswordHash" access="property" column="PASSWORD_HASH" length="256" />

    <property name="TelephoneNumber" access="property" column="TELEPHONE_NUM" length="12" />
    <property name="EmailAddress" access="property" column="EMAIL_ADDRESS" length="64" />

    <!-- IsActive property used for locking accounts. -->
    <property name="IsActive" access="property" column="IS_ACTIVE" length="64" />

     <!--Many to many relationship with user table.--> 
    <bag name="Groups" access="property" lazy="false" table="GRP_USR_BRIDGE" cascade="none" schema="cblock" inverse="false">
      <key>
        <column name="USER_ID" />
      </key>
      <many-to-many column="GROUP_ID" class="AdHockey.Models.Group, AdHockey" />
    </bag>

     <!--Many to many relationship with user table.--> 
    <bag name="Reports" access="property" lazy="false" table="RPT_USR_BRIDGE" schema="cblock" inverse="false">
      <key>
        <column name="USER_ID" />
      </key>
      <many-to-many column="REPORT_ID" class="AdHockey.Models.Report, AdHockey" />
    </bag>

  </class>
</hibernate-mapping>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Configuration;

namespace AdHockey.Models {
    public class User {
        /// <summary>
        /// Unique identifier for group used by program and database layer. 
        /// </summary>
        public int UserId {
            get; set;
        }

        /// <summary>
        /// User's first name. 
        /// …
overwraith 83 Newbie Poster

Of the two answers pty'
s is closest to the mark. I am researching database backup strategies now, and am realizing that the RMAN backup prompt is the way to go, with the Backup Database command. Since the command line is involved this would require a batch command (batch script) run over a network connection with a server residing on the database server. Perhaps I am borrowing too much responsibility from the DBA's in regaurds to the backup. They should be backing up everything of importance, therefore it may not even be worth the effort on my part. It is possible to run a batch command over a socket or service like WCF or nancy, but it is in fact borrowing too much responsibility from the DBA's. This is actually what I needed to know. It would be cool, but I think not necessarily worth the effort. Thanks.

overwraith 83 Newbie Poster

rproffitt, you are being obstinate, I have no idea what types of backup scripts would look like for a Database Administrator (DBA). I am fishing in the dark here if you know nothing then don't post at all. Of course I am willing to do my own work, but I have absolutely no idea what the scripts the DBA's would use. If you are not a DBA you should probably not be posting.

Even information sources would be a valid post here, or a synopsis of what is entailed in a backup.

overwraith 83 Newbie Poster

For the time being Oracle with Microsoft backend. I can typically understand bash and batch however. Batch more than bash. So you're saying there is shell script involved?

overwraith 83 Newbie Poster

I suppose I really just need info on what commands are used for table backups, and whether or not anyone knows of any scripts already online for such stuff. google has not provided very well in this case.

overwraith 83 Newbie Poster

The web part is not really required, since I could do that easy. The SQL/DBA tools would be what is required. Perhaps one will wander by.

overwraith 83 Newbie Poster

Is it possible to make a web page that takes up responsibility for backing up a web applications tables(Oracle DB, and perhaps SQL server I am trying to be multi db supportive)? Essentially I want to create a database backup script that is kicked off by pressing a button on a web page. I have no idea what a dba backup script would look like. Ideally I would place the backup someplace secured, and I can impersonate accounts. I could also use a Quarts .NET cron job, the main hurdle is I don't know anything about DBA tools.

overwraith 83 Newbie Poster

Your community is lame. I have posted about 3 discussions here about professional programming and no-body could help.

overwraith 83 Newbie Poster

Here is the User object;

/*Author: Cameron Block*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Configuration;

namespace CameronBlog.Models {
    /// <summary>
    /// Representation of users in the blogging system. 
    /// </summary>
    public class User {

        /// <summary>
        /// Unique identifier for group used by program and database layer. 
        /// </summary>
        public int UserId {
            get; set;
        }

        /// <summary>
        /// The user's email address. 
        /// </summary>
        public String EmailAddress {
            get; set;
        }

        /// <summary>
        /// A hash of the users password is stored in the database and used for logins. 
        /// Storing a hash is more secure than storing plaintext. 
        /// No Company should have a comprehensive plaintext wordlist of it's users. 
        /// SHA-256 with a byte array storage size of 256
        /// </summary>
        public byte[] PasswordHash {
            get; set;
        }

        public User() {

        }

        public void SetPassword(String password) {
            //get salt from web config
            byte[] salt = Encoding.UTF8.GetBytes(System.Configuration.ConfigurationManager.AppSettings["salt"].ToString());
            byte[] passBytes = Encoding.UTF8.GetBytes(password);

            //perpend salt to password
            byte[] catPass = salt.Concat(passBytes).ToArray();

            //call all the hash algorithims here
            HashAlgorithm hashAlg = SHA512.Create();
            this.PasswordHash = hashAlg.ComputeHash(catPass);
        }//end method

        public bool ComparePassword(String password) {
            //get salt from web config
            byte[] salt = Encoding.UTF8.GetBytes(System.Configuration.ConfigurationManager.AppSettings["salt"].ToString());
            byte[] passBytes = Encoding.UTF8.GetBytes(password);

            //perpend salt to password
            byte[] catPass = salt.Concat(passBytes).ToArray();

            //call all the hash algorithims here
            HashAlgorithm hashAlg = SHA512.Create();

            byte[] incomingHash = hashAlg.ComputeHash(catPass);

            if (incomingHash.SequenceEqual(this.PasswordHash))
                return true;

            return false;
        }//end method
    }//end class

}//end namespace

P.S. There may be a length problem with the site.

overwraith 83 Newbie Poster

Here is the Login Model;

/*Author: Cameron Block*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

using CameronBlog.Repositories;

namespace CameronBlog.Models {
    /// <summary>
    /// The object associated with the login procedure. 
    /// </summary>
    public class Login {

        /// <summary>
        /// The User's Email Address. 
        /// </summary>
        [Required]
        [Display(Name = "User Name")]
        public String EmailAddress {
            get; set;
        }//end property

        /// <summary>
        /// The User's password. 
        /// </summary>
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public String Password {
            get; set;
        }//end property

        /// <summary>
        /// Login control can remember users when they log in next time. 
        /// </summary>
        [Display(Name = "Remember Me")]
        public bool RememberMe {
            get; set;
        }//end property

        public bool IsValid() {
            try {
                using (UserRepository usrRepo = new UserRepository()) {
                    usrRepo.BeginTransaction();
                    return usrRepo.IsValidLogin(this);
                }
            }
            catch (Exception ex) {
                return false;
            }
        }//end method

    }//end class

}//end namespace
overwraith 83 Newbie Poster

Here is the markup;

<!-- Author: Cameron Block -->
@model CameronBlog.Models.Login

@{
    ViewBag.Title = "Login";
}

<div class="jumbotron">
    <h1>Login</h1>
    <p class="lead">Log into Cameron's Web Blog. </p>
</div>

@using (Html.BeginForm("Login", "Login", new { @class = "form-horizontal" })) {
    @Html.ValidationSummary(true, "Login Failed. Check your login credentials. ");
    <div class="row">
        <div class="col-md-5">
            <div class="form-group">
                @Html.LabelFor(login => login.EmailAddress, new { @class = "control-label col-sm-3" })
                <div class="col-sm-9 form-control-static">
                    @Html.TextBoxFor(login => login.EmailAddress, new { @class = "form-control" })
                    @Html.ValidationMessageFor(login => login.EmailAddress)
                </div>

            </div>
            <div class="form-group">
                @Html.LabelFor(login => login.Password, new { @class = "control-label col-sm-3" })
                <div class="col-sm-9 form-control-static">
                    @Html.PasswordFor(login => login.Password, new { @class = "form-control" })
                    @Html.ValidationMessageFor(login => login.Password)
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-6 form-control-static">
                    @Html.CheckBoxFor(login => login.RememberMe, new { @class = "form-control  col-sm-4" })
                </div>
                @Html.LabelFor(login => login.RememberMe, new { @class = "col-sm-4" })
            </div>
        </div>
    </div>
    <input type="submit" class="btn btn-primary" value="Log In" />
}
overwraith 83 Newbie Poster

Here is the login controller;

/*Author: Cameron Block*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

using CameronBlog.Models;

namespace CameronBlog.Controllers {
    public class LoginController : Controller {
        // GET: Login
        public ActionResult Index() {
            return View();
        }//end method

        [HttpGet]
        public ActionResult Login() {
            return View();
        }//end method

        [HttpPost]
        public ActionResult Login(Models.Login login) {
            if (ModelState.IsValid) {
                if (login.IsValid()) {
                    FormsAuthentication.SetAuthCookie(login.EmailAddress, login.RememberMe);
                    bool isauth = User.Identity.IsAuthenticated;
                    return RedirectToAction("Index", "Home");
                }
                else {
                    ModelState.AddModelError("", "Incorrect email or password. ");
                }
            }
            return View(login);
        }//end method

        public ActionResult Logout() {
            FormsAuthentication.SignOut();
            return RedirectToAction("Index", "Home");
        }//end method

    }//end class

}//end namespace
overwraith 83 Newbie Poster

The following lines do not work. The bool is always false. I have been having trouble getting danni's site to work so if the reply is too short it's 'cuz I typed in the longer version three times and got errrors.

FormsAuthentication.SetAuthCookie(login.EmailAddress, login.RememberMe);
bool isauth = User.Identity.IsAuthenticated;

overwraith 83 Newbie Poster

Actually those two things appear to be right. It looks like when I posted the xml danni's site converted & quot; to actual quotation marks. The Quotation marks are specified because in my oracle database the USER keyword is a reserved word, so it needs escaped in the mapping file. I have removed the keyword virtual from the user primary key, but it still does not work. My appologies for the condition of the markup, the site seems to want to compress xml.

overwraith 83 Newbie Poster

I have the following error as part of my nhibernate project;
Could not find a setter for property '0' in class 'AdHockey.Models.User'
The following is my model;

    public class User {
        /// <summary>
        /// Unique identifier for group used by program and database layer. 
        /// </summary>
        public virtual int UserId {
            get; set;
        }

        /// <summary>
        /// User's first name. 
        /// </summary>
        public String FirstName {
            get; set;
        }

        /// <summary>
        /// User's last name. 
        /// </summary>
        public String LastName {
            get; set;
        }

        /// <summary>
        /// Used to turn off user accessibility for instance when there are forensic investigations going on. 
        /// </summary>
        public bool IsActive {
            get; set;
        }

        /// <summary>
        /// A hash of the users password is stored in the database and used for logins. 
        /// Storing a hash is more secure than storing plaintext. 
        /// No Company should have a comprehensive plaintext wordlist of it's users. 
        /// SHA-256 with a byte array storage size of 256
        /// </summary>
        public byte[] PasswordHash {
            get; set;
        }

        /// <summary>
        /// The groups a user is associated with. 
        /// </summary>
        public IList<Group> Groups {
            get; set;
        }

        /// <summary>
        /// The reports a user is scheduled to recieve. 
        /// </summary>
        public IList<Report> Reports {
            get; set;
        }

        public User() {
            IsActive = true;
        }
    }//end class

The following is my mapping file;

<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true"> <class name="AdHockey.Models.User, AdHockey" table=""USER"" lazy="false" schema="cblock"> <id name="UserId" access="property" type="int" column="USER_ID"> <generator class="native"/> </id> …
overwraith 83 Newbie Poster

I am creating an application that uses NHibernate, an object relational mapper that is a port of the Java Object relational mapper hibernate. Currently I am trying to represent my entities via hibernate xml files. The application I have right now is throwing an error I am thinking may be related to an object hirerarchy I have in the application. I have a set of Template objects which are used to store a template to the database which the View will act on polymorphically. I am using an Oracle XE database. I will post the code for the template I am testing, the repository, the hibernate XML, and the error text.

Error text: Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index
Error Full Text: [ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.Collections.ArrayList.get_Item(Int32 index) +14715788
Oracle.DataAccess.Client.OracleParameterCollection.GetParameter(Int32 index) +18
NHibernate.Type.Int32Type.Set(IDbCommand rs, Object value, Int32 index) +50
NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index) +496
NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session) +902
NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session) +272
NHibernate.Action.EntityInsertAction.Execute() +222
NHibernate.Engine.ActionQueue.Execute(IExecutable executable) +41
NHibernate.Engine.ActionQueue.ExecuteActions(IList list) +89
NHibernate.Engine.ActionQueue.ExecuteActions() +20
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) +222
NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) +169
NHibernate.Impl.SessionImpl.Flush() +256
NHibernate.Transaction.AdoTransaction.Commit() +195
AdHockey.Repositories.ReportRepository.Update(Report entity) …

overwraith 83 Newbie Poster

I am trying to build a program for transferring files to an arduino project with an attached sd card. I have some code, it does some interesting stuff, but it's not quite what I want it to do. What I need it to do is to be able to transfer binary files to the arduino where I will save them to the sd. There are going to be several parts of this project. One part will probably be a shell script or C# script (windows) where I will transfer the files via COM. Another part will be the arduino code which will have to be able to distinguish between individual files, and will need to be able to recognize when seperate files are sent. Ultimately the shell script/C# whatever part will be sending file after file to the arduino, perhaps in a loop in a specific folder.

The arduino part will proably be coded in the "Processing" language, the default language for arduino development. At some point I will probably migrate to teensy if I can get the logic down right. Arduino is easier for the time being.

Some of the things that are hanging me up are that I have to figure out a way how to switch between the files, and transmit file names, etc. I will be delving into a sockets book I have laying around, perhaps that can shed some light on the subject. The binary transmission and reception is also a problem, as well as …

overwraith 83 Newbie Poster

Actually I should make my own base 64 decoder app, just in case there's anything sensitive going on. Actually due to the fact that the code has been changing from day to day, that's the more worrying aspect about it. I'll figure it out. I have told people about it. I think some more security is being implemented soon.

overwraith 83 Newbie Poster

Since there are public and private keys on all three computers, of which private keys don't get transmitted, and we are talking about encryption which by it's nature protects data in some state or another from tampering, you can be fairly sure that the destination has recieved it's contents unfettered. The thing about encryption is that it essentially transmits a stream whereby if any single byte is removed, the entire transmission becomes corrupted, and is dropped, and then retransmitted. It's like playing music in the background when you presume that you are being audio recorded, so that people can't copy and paiste bytes where they choose them to be. The background music changes would be noticable. Now the key store question, sure somebody could probably make some sort of script which could access this, somebody else would know more about whether that was possible or not, but the question here is not how to protect it on the destination computer, it's how to potect it in transit.

overwraith 83 Newbie Poster

Well, congrats you picked all the hard ones to learn. JK. I think OOP is a much better way to go most of the time. It seems easier to think of things as objects. Also be aware that the PI doesn't have much bandwidth. Which should be fine for a file server application. If you wanted to throw together an ftp server, that would probably require a lot of code, I haven't been exposed to that myself. If you want to make a web upload, that would probably be easier, but would require a site. A socket connection of some kind would actually probably do the trick a little bit better for your purposes. But I don't know.

Perhaps there's some pre-baked software somewhere?

overwraith 83 Newbie Poster

Do you know much programming? Reason I ask is that if you intend to code your own 'server' software, you could implement a journaling type setup for your hard drive. You could do this with application code, doing so just requires some interesting interfaces etc. First found out about the template from mongo db, acutally had a nice little diagram. Basically you keep a journal of transactions as a temp file. It is a 3 way write. source -> jounal -> dest. If not, I don't necessarily know how you would do it. If you get a hard drive, you should probably check the operating voltages, since the raspberry pi's are notorious for not providing enough voltage for power hungry peripherals.

P.S. sounds a little like a drop box to me... jk.

overwraith 83 Newbie Poster

Sorry, it's 3 way encryption, there are basically 3 parties involved, and the way the crypto works it requires that all 3 parties communicate. There are public and private keys, some that are and are not transmitted. Basically the way it works is through some magic mathematical crypto functions where a private key and a public key can decrypt the transmission. Some passwords are public, but some aren't. It's a little bit difficult to explain, but it basically hinges on the fact that you are communicating with a third trusted party, and the transmissions are enctypted.

There is such thing as an SSL strip hack, but the users or the web page should be coded in such a way that the web page fails to display something, or the user should notice that their browser is not communicating with a crypted site.

Yes, you should not assume that the user is a good guy either, I was just explaining that forensics should be able to tell if someone is definitively a bad guy. A few times my home net has been through the grinder, and articles of law that say "the user is responsible for the security of their own network" sometimes stick in my craw, especially where some of the techniques used would have been virtually impossible to defend against anyway. sorry. You're right though security should assume that everybody is the bad guy first, before they authenticate, law should assume that everybody is innocent until proven guilty. That's …

overwraith 83 Newbie Poster

Hey guys, have you ever had an application where it was necessary to stuff a large base 64 string into a ticket tracking application? It's a javascript variable which is being stuffed. I am seeing some strange stuff in one of my work place's web sites. I was wondering if perhaps there was probably just something innocent, like web asm, or something. It doesn't look like JSON or anything. It looks like byte codes or something. (I DID NOT WRITE THIS APPLICATION)

I don't want to post any of the code here since that wouldn't be cool, but I figured I should probably ask about this since it could be a bad thing, and I am new enough that I don't really know what is ok, and what is not when it comes to production code.

I would like to tell somebody, but I tend to be a little bit of an alarmist, so sometimes I don't necessarily trust my own judgement. I would like to not get fired for accidentally flagging something that is just business as usual.

overwraith 83 Newbie Poster

I also got an error while compiling a library on a linux development virtual machine. If anybody knows how to get make to build correctly that could be very helpful.

devmint-virtual-machine rflechner-raspberrycam-2fa7c69d10aa # make
cc -shared -fPIC RaspberryCam.o log.o src.o src_file.o src_raw.o src_test.o src_v4l1.o src_v4l2.o  parse.o dec_jpeg.o  -lgd -o RaspberryCam.so
/usr/bin/ld: RaspberryCam.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
RaspberryCam.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [RaspberryCam] Error 1
devmint-virtual-machine rflechner-raspberrycam-2fa7c69d10aa # 
overwraith 83 Newbie Poster

I was wondering if there were any USB powered web cams for the Raspberry pi that are specifically No-IR. I know about the camera module which plugs directly into the board, I was wondering however if there are any alternatives, usb powered so I could perhaps plug in more than one camera simultaneously. RPI has application logic, so I can use C# + Mono to code some .NET apps to use the cameras. I also anticipate eventually the RPI will have more memory allocated to subsequent models, but even if they don't some of the newer versions have 1gb of RAM, so I don't anticipate any problems. One of the most intersting things that I have learned with No-Ir cameras is that many things have IR Distance sensors (lasers) built in which you wouldn't necessarily want to have as close to your face as they frequently are. Point and case... Iphones/droids and the light sensors on the fronts of them.

So basically guys, a NO-IR camera can see wavelengths that we can't.

Also if you find any code/books which regaurdless of language discuss camera operations please post info/titles/links etc.

overwraith 83 Newbie Poster

What exactly is this encog stuff? I remeber buying a book on C# web bots by the same guy that made encog, and all I got out of it was poorly documented loops conditionals and logic. At least I think the same guy that wrote encog wrote this stuff. Http programming recipies C# by Mr Heaton?

overwraith 83 Newbie Poster

They have some good points. You see, when you use ssh, or ssl, or some form of encryption you not only verify that no-one has modified the transmission in transit, you have what is called 'attribution' because you know that 'this transmission' has come from 'this address', and you know that it has not been tweaked in transit because you know that it is encrypted. You therefore have attribution because you know which device did what damage. Don't jump to the conclusion that the user is automatically the bad guy, take into account whether there has been malware planted on his compter, etc before you jump to conclusions, but you're forensic investigator and net admin if he they are competent and honest will be able to tell you more or less who's to blame. Many applications aren't life ending, therefore you can just block specific users.

There are also tools which can alert you to exactly what is being transmitted to your servers, network sniffers come to mind, but you have to learn all the tricks/filters associated with your specific protocol. Make sure you have permission to run one on your network.

Firewalls are good to have, and many can log suspicious activity on your network.

VLAN'ing users is also a good idea, it keeps users seperated from each other so they can't necessarily share malware if you know what I mean. It would probably play hell with whatever info sharing is supposed to occur however.

Above all, figure out …

overwraith 83 Newbie Poster

You mean you want these two classes to be, perhaps used in the same array, or code etc as if they were the same type of object?
Perhaps the adapter pattern is what you are looking for? I haven't used it that much so I defer the example code to the following link.

Click Here

overwraith 83 Newbie Poster

Ok, so the keyword I was missing was that it actually needs to have the "Iterator" Keyword. I had actually looked at that page, and I completely missed that nuance the first time. Thanks ddanbe!

overwraith 83 Newbie Poster

Am having some difficulty, I had some code that had a static helper method in C#, and now I am looking to port it to vb, but unfortunately vb doesn't seem to have a yield return operator. How do most vb developers do this, and why is there no yield return, it kind of strikes me as a bit odd since C# is going all LINQ, and the only way to tweak Linq is to use custom IEnumerables etc. Code goes something like this in C#.

public static IEnumerable<String> MyMethod(Arg arg){
    while(...){
        yield return myValue;
    }
}//end method
overwraith 83 Newbie Poster

No! do not let the vampires take over the world! JK

overwraith 83 Newbie Poster

Actually, I have specified not to use the secure search, due to it being too difficult to use, and having unsatisfactory searching features. The spooky feature is quite literally a firefox/IE google thing. Actually I have discovered something interesting, when I use a different search engine a lot of the creepy factor goes away. This is interesting. Ok, I am switching to another search engine.

How would one get different email addresses every n days? It seems there would be a lot of accounts to re-set up, and I don't think that cox would let us get random email addresses every few months. Is that an AV specific feature? Is that specifically for Avast?

overwraith 83 Newbie Poster

Ok, I just want to make sure of something here. Could I have a few people type in "computer glasses" as a search query into google, and scroll down the page, and see if you see that text/button that says "How come my left eye twitches?" or something to that effect.

overwraith 83 Newbie Poster

That is awesome. Thanks man. I will try things out. AVG on my computer also just flagged some cookies, so I will try things out and see if I am still getting spooky results. Additionally I showed my dad some of these spooky results, and he's a sys-admin/vmware type. He agreed with me, some of these results were pretty spooky.

Ideally I will be able to set up a virtual machine to do most of my browsing which will be relatively easy to use, and won't persist anything. That's what I was doing for a long time, it's just vmware player wouldn't allow some settings out of the box. Now got a better version, VMWare workstation. Should allow better copy/paiste/file download.

Sometimes I don't post back here consistantly. Got things going on you know.

If anybody has any other things I could learn about making my browser safer that would be great. It seems like I have been under a bad star for a long time now.

I suppose I should ask, is there any way to tell if DNS, or something was being manipulated? I wouldn't think there would be, not on my end. If there was something being manipulated it would have been outside my router, which would mean I literally wouldn't be able to intercept anything.

overwraith 83 Newbie Poster

Ok, am thinking it did not solve the problem. Must be something else.

overwraith 83 Newbie Poster

It seems you are missing a few tags... What you will find in software dev- is that things are often organized into toolchains, and you can mix'n match. For instance if you know python, you're going to pretty much work on a lot of OS/script specific stuff, you'll probably also know C, and C++. I am not sure what else a python dev will know, it is not as familiar to me.

If you know .NET, you'll probably work with either C#, or VB, possibly both. You'll learn SQL for sure, because that's the defacto for interfacing and querying with the database. There are a few options for databases, MySQL, Oracle, SQL Server (Microsoft) etc. Typically C#, and VB developers work with SQL Server, but I have seen VB jobs which use Oracle. The Database was originally the solution for enterprise islands of information. When you have more than one DB things tend to get messy, so if you ever have the option don't mix'n match the databases.

Most Web developers will need to know JavaScript, HTML, CSS, and probably some sort of server side scripting language like ASP.NET, or PHP, Server side JS, etc. If your languages are mostly Microsoft specific you'll probably need ASP.NET, although I am seeing lots of JS jobs out there too.

So essentially what you need to know is that when you develop, you can't really choose only one language to develop in, you're developing infrastructure. Infrastructure requires quite a few tools to do …

overwraith 83 Newbie Poster

Ok, I may have figured it out. I just deleted my entire browsing history using google's advanced delete options. I think that has solved the problem. Some-one may have weighted my browsing to favor certain things. My account password has changed a few times since I set it up. All the same if any body else has any other ideas concerning this spooky search results please share. I am thinking I solved the problem. You see, once somebody who I found out to not be a very good friend was in my house alone with my old computer. So I am thinking the douche bag may have set up some kind of script on that old computer to F*** with my google account search results.

overwraith 83 Newbie Poster

So, a few times I have typed in some specific searches into google, and ultimately come up with some really spooky coming back to me from google. I don't really want to share what I was searching for, it's highly specific however, and it smacks of past experiences I have had in life however. It's almost like someone was somehow manipulating my web traffic to freak me out. Does any one know anything that would cause this, and how would I go about fixing the problem? Let's just assume somebody is in a position to either MITM me, or even do some tracker schenanigans.

For example though, say I searched for something related to physics, for instance "em spectrum wikipedia" and in the search results questions like "why is my eye twitching" come back. Now let's just assume that my experiences have exposed me to large amounts of IR light, which has caused my eye to twitch on occasion. The results are very spooky to me, how the hell would somebody manipulate my search results like this? Would tracker sites do this, or manipulation of the traffic en-route? All or most of my traffic appears to be https encrypted, and traffic from google should be TLS encrypted which should be a hell of a lot better than https.

This is a highly odd discussion, sorry folks, but it is a real problem, and I don't really know how somebody would be messing with me in this way. I try not …