Ok so now that I have my unions and memory issues resolved, now I need to fix this screwed up data that I have in my database.
I have a badly created Document Control system that stores all the documents in the database in 2 tables: Current and Versioned (those are aliases.) Current obviously holds all the current documents and the Versioned table has all the old versions. The problem is though that not all the information corresponds with the correct records. For example, if you have 5 versions of a document, the version notes (which we use for ISO) for the most recent version (5) actually are associated with Version 4, along with the date it was submitted. Also, the original document version (1) has version notes and a submitted date with it as well, but obviously the first version can't have version notes so those are actually referring to the next version (2). If this sounds confusing its because it is. I don't know who designed this damn thing, but as a lesson let me say to NOT use Tribune's BMS content Management system for your document control because they don't do good database design and they blatantly steal their code from Wrox's "How to build an Intranet" book.
So anyways I need to figure out how to get these records to correspond to the correct versions, so basically every record actually refers to the next record. Also it should be noted that SOME of the information does correspond, so I only need to move information from certain fields, not the entire row.
SqlDataAdapter da = new SqlDataAdapter("SELECT d.mdItemID AS CurrentID, d.mdFileDescription AS CurrentFile, d.mdFileName as CurrentFileName, tblUser.usUserName AS Creator, " + "d.mdCreatedDate AS OriginalDocDate, tblMics_Docs_Versions.mvSubItemID AS OldID, " + "tblMics_Docs_Versions.mvFileName as OldFileName, usr2.usUserName as ModifiedBy, tblMics_Docs_Versions.mvNotes AS VersionNotes, " + "tblDepartment.dpNAME AS DepartmentName, tblMics_Docs_Versions.mvVersionedDate AS sort_date " + "FROM tblMics_Docs d INNER JOIN tblDepartment ON d.mdDepartmentID = tblDepartment.dpID " + "INNER JOIN tblUser On d.mdCreatedByUserID = tblUser.usUserID JOIN tblMics_Docs_Versions ON d.mdItemID = tblMics_Docs_Versions.mvItemID " + "INNER JOIN tblUser usr2 on tblMics_Docs_Versions.mvCheckedInByUserID = usr2.UsUserID " + "WHERE d.mdArchived = 0 UNION " + "SELECT d.mdItemID AS CurrentID, d.mdFileDescription AS CurrentFile, d.mdFileName as CurrentFileName, " + "tblUser.usUserName AS Creator, d.mdCreatedDate AS SubmittedDate, null, null, null, null, tblDepartment.dpNAME, getdate() as sort_date " + "FROM tblMics_Docs d INNER JOIN tblDepartment ON d.mdDepartmentID = tblDepartment.dpID " + "INNER JOIN tblUser On d.mdCreatedByUserID = tblUser.usUserID JOIN tblMics_Docs_Versions ON d.mdItemID = tblMics_Docs_Versions.mvItemID " + "INNER JOIN tblUser usr2 on tblMics_Docs_Versions.mvCheckedInByUserID = usr2.UsUserID WHERE d.mdArchived = 0 ORDER BY mdItemID ASC, sort_date ASC", con);
Int16 currID; int lastID = 0; int VerNum = 1; //This code below is used to add the version numbers to the documents because the CM system //Doesn't keep track and just uses a Count statement in its SQL code.
foreach (DataRow dr in ds.Tables[0].Rows) { currID = System.Convert.ToInt16(dr["CurrentID"]); if ( currID == lastID )
I can try and post pictures of this in action if that'll help. Unfortunately my SQL skills aren't that good and I haven't had alot of experience with datasets. Thanks.
So need some opinions here. What would YOU recommend as spec. for a box to host a website (.Net,Windows 2k3,IIS 6) with, let's say, approx. 100,000 hits/mo., intranet, and database (SQLServer 2k5). Content is dynamic and served from the db, but no ecommerce or other db transactions?
I posted this in another group but got like no responses.
Ok so now that I have my unions and memory issues resolved, now I need to fix this screwed up data that I have in my database.
I have a badly created Document Control system that stores all the documents in the database in 2 tables: Current and Versioned (those are aliases.) Current obviously holds all the current documents and the Versioned table has all the old versions. The problem is though that not all the information corresponds with the correct records. For example, if you have 5 versions of a document, the version notes (which we use for ISO) for the most recent version (5) actually are associated with Version 4, along with the date it was submitted. Also, the original document version (1) has version notes and a submitted date with it as well, but obviously the first version can't have version notes so those are actually referring to the next version (2). If this sounds confusing its because it is. I don't know who designed this damn thing, but as a lesson let me say to NOT use Tribune's BMS content Management system for your document control because they don't do good database design and they blatantly steal their code from Wrox's "How to build an Intranet" book.
So anyways I need to figure out how to get these records to correspond to the correct versions, so basically every record actually refers to the next record. Also it should be noted that SOME of the information does correspond, so I only need to move information from certain fields, not the entire row.
SqlDataAdapter da = new SqlDataAdapter("SELECT d.mdItemID AS CurrentID, d.mdFileDescription AS CurrentFile, d.mdFileName as CurrentFileName, tblUser.usUserName AS Creator, " + "d.mdCreatedDate AS OriginalDocDate, tblMics_Docs_Versions.mvSubItemID AS OldID, " + "tblMics_Docs_Versions.mvFileName as OldFileName, usr2.usUserName as ModifiedBy, tblMics_Docs_Versions.mvNotes AS VersionNotes, " + "tblDepartment.dpNAME AS DepartmentName, tblMics_Docs_Versions.mvVersionedDate AS sort_date " + "FROM tblMics_Docs d INNER JOIN tblDepartment ON d.mdDepartmentID = tblDepartment.dpID " + "INNER JOIN tblUser On d.mdCreatedByUserID = tblUser.usUserID JOIN tblMics_Docs_Versions ON d.mdItemID = tblMics_Docs_Versions.mvItemID " + "INNER JOIN tblUser usr2 on tblMics_Docs_Versions.mvCheckedInByUserID = usr2.UsUserID " + "WHERE d.mdArchived = 0 UNION " + "SELECT d.mdItemID AS CurrentID, d.mdFileDescription AS CurrentFile, d.mdFileName as CurrentFileName, " + "tblUser.usUserName AS Creator, d.mdCreatedDate AS SubmittedDate, null, null, null, null, tblDepartment.dpNAME, getdate() as sort_date " + "FROM tblMics_Docs d INNER JOIN tblDepartment ON d.mdDepartmentID = tblDepartment.dpID " + "INNER JOIN tblUser On d.mdCreatedByUserID = tblUser.usUserID JOIN tblMics_Docs_Versions ON d.mdItemID = tblMics_Docs_Versions.mvItemID " + "INNER JOIN tblUser usr2 on tblMics_Docs_Versions.mvCheckedInByUserID = usr2.UsUserID WHERE d.mdArchived = 0 ORDER BY mdItemID ASC, sort_date ASC", con);
Int16 currID; int lastID = 0; int VerNum = 1; //This code below is used to add the version numbers to the documents because the CM system //Doesn't keep track and just uses a Count statement in its SQL code.
foreach (DataRow dr in ds.Tables[0].Rows) { currID = System.Convert.ToInt16(dr["CurrentID"]); if ( currID == lastID )
I can try and post pictures of this in action if that'll help. Unfortunately my SQL skills aren't that good and I haven't had alot of experience with datasets. Thanks.
RESOLVED: I gave up on trying to do this in SQL and instead implemented an array to store the inconsistent values and then put them in their correct places.
Profile["uid"] = "43"; // Error: the property cannot be set for anonimous user Profile["utype"] = "President"; Response.Output.Write(Profile["uid"] + " " + Profile["utype"]);
I pointed out an error in the comments above. I thought that once user is authenticated, it's assumed that I'm accessing him, when I use Profile. How do I do it properly? (Read a few articles, didn't find it.)
2) A Membership Provider has the connection string, which tells authentication system where to store everything. Well, I went to that weird directory deep in VS.NET folders, and found the default provider, and edited it. Now membership works with my remote db properly. But, will it work when I move it to the website hosting? Doesn't seem to me that that file I edited will move along with the website. What do I do then?
This is an approach question, if you have some time. :) 3) We have a database of clients' data. This database, however, has no authentication fields, like passwords, usernames, and so on. I decided that authentication should be implemented separately, using Membership Providers. I've prepared a separate database for that purpose, edited the Provider, and tables were created perfectly. So I thought, I'm gonna use the User Profiles in order to store the client's id in the authentication database, which is the same id as the one stored in the client data db. This way I'm kind of connecting the two databases together. There are a couple of reasons I'm doing it. First - if I was to put all the data into User Profiles, without using separate database, it'd be slow and ineffective. Second - some clients are already in the database before they even registered on the website. (database is created independently of them). Therefore, if they do register, all I would need to do, is bind their authentication info to their actual data in the other database. Is this a good approach for the whole thing?
Another long post, I know. Thanks for all the help so far!
Am I the only person remaining on this planet, who strongly believes that one's resume needs to be rock-solid down to the most minute detail? A resume is the very first impression that a prospective employer will ever have of you. And if it is filled with BASIC spelling and grammatical errors, what kind of impression does that give me, if you're going to be writing code that cannot afford to have syntax errors?
"... to meet company standers... that do not match company standers..."
"... analyzing systems, and administrate different database engines..."
"Analyses, design, deployment..."
"After creating the ERD model and thereby creating the database, and database, and ETL processes."
These are all from one person's 4 page resume, that I was asked to interview this morning. Doesn't anyone bother to proof-read their resumes any more?!?!
I need to use a number of DateTimePicker controls on a Windows Forms 2.0 database-linked application that I'm putting together.
The DateTimePicker control doesn't support null values, and despite trying to work around it for many hours and trying numerous 'solutions' found on the web, I'm still no closer to a fix than when I started.
A null value for a date field in the database currently yields a control with todays date entered in. Whereas it needs to be obvious in the application that no date has yet been entered.
Also, if a record has say a birth date entered in, and then another record is switched to which has a null value for that birth date field, then the birth date field remains unchanged (making it appear that record 2 has the same birth date as record 1, even though in actuality - no birth date has yet been chosen for record 2).
The variety of solutions on the web seem to be pretty much all pre-.Net 2.0, and don't have the desired result on .Net 2.0.
Can anyone help me out here? Many thanks in advance!
I’m looking into how one would set up an RSS feed a smallish website for fun/learning. I think my preferred method is to have a function that is called when the journal is updated that generates a static RSS page, rather than have the RSS feed query the database itself.
I like this method because an RSS feed isn’t really what I think of when I think dynamic content – it’s the same for every visitor. If you have 50-100 visitors between updates, you just saved yourself 49-99 database calls. It also feels more secure. If you’re querying a database, there is potential to fall victim to a injection attack. Well, the point where one updated the journal is still vulnerable, but that’s true in either method.
I was looking at how some of the blogging software generates RSS, but they all query the database directly from the feed. Is there something I’m missing? Why is this method so overwhelmingly preferred?
I love how whenever I run into a problem and I post it here, it's always something that I know I should already know how to do.
Seriously, this should be something really easy, right?
The project that I'm working on, and really haven't had much time to deal with lately due to other stuff, is the same one that I'm always working on when I post here: A document tracking system for my mom's work.
A whilie ago I ran into problems converting the system to an older version of PHP (it works fine now, in that regard), and now this.
It works just fine, and does everything I want. I'm now trying to clean it up from slow and clunky code that was only used for the purpose of making sure the hard stuff worked (ironically, i had little to no problems doing the complicated logic stuff).
So when bringing up the application, the user is given a form to fill out that essentially sends an e-mail, and has a vague e-mail feel to it anyway. The user has 10 drop-down menus for a maximum of 10 users. In the database, there is a table with all the users available. As a quick and dirty way of populating the list of names, I just wrote a small function that queries the database and plugs the names into the drop-down box. Well, right now, since there are 10 boxes, it does that 10 times. And it's SLOOOOOOW. My mom and I both knew that this wasn't how it was going to stay, it was just an easy way of testing the stuff that would.
So, now that I'm backtracking slightly, I'm running into problems. What I want to do is pop the results of the query into an aray that mimics the structure of the table. Many rows, two columns. I set up a 2-d array, or tried to at least. The book I have isn't exactly clear on that topic, so I used what I thought I knew from regular programming languages and tried to apply that to this. Apparently it didn't work.
I'm not sure why this doesn't work, so I'm just going to post the code used in here. Unfortunately, when I try and access the array with:
It doesn't do anything. So I don't really know what I'm doing wrong. I may be going about this way too hard. I wanted to just use the explode() function, but i couldn't think of how to get it to differentiate between what would go in one column versus another, and figured it would just plug it all into a 1-d array. So yeah, any help you can offer would be greatly appreciated.
//This function pulls the users from the webusers table for use in choosing a recipient function get_users() { **Database Connect Information Removed**
if (!$users_connect || !$db_select) { die("Problem connecting or selecting a database."); } //end if
$query = "SELECT ename, eaddr FROM webusers ORDER BY ename"; $result = mysql_db_query("test", $query); $num_of_users = mysql_num_rows($result); $users[$num_of_users][2] = array(); $i = 0; while (list($ename, $eaddr) = mysql_fetch_row($result)) { $users[$i][0] = $eaddr; $users[$i][1] = $ename; $i++; } //end while
How do you guys deal with test data that comes from a database? I've got unit tests running that check , for example that data is inserted, fetched, and updated from the database corrrectly, but obviously the data changes as it goes, which creates a lot of work (i.e., manually going in and changing all the expected values). There must be a less-retarded way to do this... any suggestions?
Ok im trying to instal XMB forum software onto a server. I created the database etc etc config and everything seemed to be going ok and then, when its finially installing I keep getting this error
Checking PHP version.......................................................OK Checking Directory Structure...............................................OK Checking Required Files....................................................OK Checking Database Files....................................................OK Checking Database API......................................................OK Checking Database Connection Security......................................OK Checking Database Connection............................................... Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /homepages/11/d161790790/htdocs/Forum/install/index.php on line 997 ERROR
Database Connection XMB could not connect to the specified database. The database returned "error 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I looked on the net and cant really make any sense of whats going on. Any ideas? Im 2 steps away from chucking my pc out the window.
I am currently attending uc berkeley majoring in computer science. As part of the program at Berkeley, we get a lot of choice in the upper division computer science courses we take. Two upper division cs courses get chosen from a short list of six, two more from a short list of about fifteen, and two more from a long list which consists of technical electives in various related disciplines like math, engineering, and operations research. This variety is great -- if not a little overwhelming.
I'm just an undergraduate student with no clue of the Big Wide World around me; I want to make choices that are both practical and fun. When I graduate, I want to either work on a software team, or as a server-side internet developer. Here are some of the core courses I am thinking about taking - only there's not room in my schedule to take them. So my question is, I assume people reading this have spent some time in the Big Wide World, so, what courses would you look for in someone you were hiring into your company? (oh, and the mandatory courses I've already taken are Structure and Interpretation of computer programs, in Scheme, Data Structures, in Java, and Machine Structures, in C and Assembly.) Let's say you were sitting across the table from me, looking at my resume. Which one(s) of these courses would most pique your interest? Assume that as a student, I'm interested in all of the courses listed below, so the advice "take what you are most interested in" unfortunately won't help me much. Thanks for any feedback!
List of courses on my personal short list, needs to be pruned: User Interface Design and Development Software Engineering Foundations of Computer Graphics Operating Systems and System Programming Programming Languages and Compilers Introduction to Database Systems Introduction to Artificial Intelligence Introduction to Communication Networks Computing with Data Industrial Design and Human Factors Industrial and Commercial Data Systems Introduction to Design of Human Work Systems and Organizations
I am in the process of backing up my databases as part of moving them to a different server. I will not be posting any articles during this time. Any comments for the next few hours may be lost. I will let you know once everything is up and running on the new server.
Lot’s of [...]
I'm trying to create a database to record all the ENV variables for website visits. I haven't used mysql before, though I have a good deal of experience with MS Access and DB2, so I feel confident when working with SQL.
I created a database called sitetrack, connected to it with: use sitetrack;
When I do this I get the following error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' SERVER_ADDR VARCHAR, HTTP_ACCEPT_LANGUAGE VARCHAR, SERVER_PROTOCOL VARCHAR, TZ ' at line 3
It looks to me that there's something wrong with the "SERVER_ADDR VARCHAR," line, but I can't see what. I don't see SERVER_ADDR listed in the reserved words on any document I've come across. Could someone offer any advice or direct me to documentation that would help me figure this out?
I've got this function. I know there's a better way to get the keys and values of arrays, but I can't think of it. Do you have any ideas?
EDIT >>>
Basically, the function takes two arrays in, and looks for keys in array2 (minus a frm_ prepending for form submission) that match keys in array1. I take the key from array1 and put the value of array2 in the output array.
array2 is the $_SESSION array. array1 is an array of values from a database entry. Fields from a form are saved in the $_SESSION array so I can fill them in if there was an error on insertion.
<<<
function joinData($array1, $array2) {
$len1 = count($array1); //length of array 1 - speeds up loops
$len2 = count($array2); //length of array 2
$keys1 = array_keys($array1); //keys of array1
$vals1 = array_values($array1); //values of array 1
$keys2 = array_keys($array2); //keys of array2
$vals2 = array_values($array2); //values of array 2
$output = array(); //what we send out
for($i=0;$i<$len1;$i++) { //foreach element in array 1
for($j=0;$j<$len2;$j++) { //search each element in array 2
if( ($keys1[$i] == ereg_replace("frm_","",$keys2[$j])) ) { //until we find a key that matches after stripping frm_
$output[$keys1[$i]] = $vals2[$j]; // overwrite the value in array1; array2 takes precidence
break; // go to next element in array 1 - speeds up process (function is O(n log n), instead of O(n^2))
}
}
}
return $output; //send back the new values
}
Hello, long time lurker, first time poster here. :)
I'm currently working with your typical sandbox Northwind Database and C# .NET. I have set up a Datagrid class to spit out the contents of a certain table in the database (Employees). However, one of the fields in the database, "Photo", currently takes a Binary representation of an image.
My goal is to take the binary and convert it into a relevant image for display on a website, all in a Datagrid control.
Would anybody know of a way to go about doing this, or at least point me in the right direction?
H. D. Moore (hdm[at]metasploit.com) has devised a Ruby based search engine that finds malicious windows software (viruses, trojans etc.) using standard Google queries. The Malware search engine finds Web sites hosting malicious files after an user enters the name of a virus or Trojan horse.
Currently the signature database is small but still contains dangerous viruses [...]