Daily Archives

Articles indexed Friday April 23 2010

Page 12/115 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Dynamic Form Help for PHP and MySQL

    - by Tony
    The code below works as far as inserting records from a file into MySQL, but it only does so properly if the columns in the file are already ordered the same way as in the database. I would like for the user to be able to select the drop down the corresponds to each column in their file to match it up with the columns in the database (the database has email address, first name, last name). I am not sure how to accomplish this. Any ideas? <?php $lines =file('book1.csv'); foreach($lines as $data) { list($col1[],$col2[],$col3[]) = explode(',',$data); } $i = count($col1); if (isset($_POST['submitted'])) { DEFINE ('DB_USER', 'root'); DEFINE ('DB_PASSWORD', 'password'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'csvimport'); // Make the connection: $dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); for($d=1; $d<$i; $d++) { $q = "INSERT into contacts (email, first, last) VALUES ('$col3[$d]', '$col1[$d]', '$col2[$d]')"; $r = @mysqli_query ($dbc, $q); } } echo "<form action =\"handle2.php\" method=\"post\">Email<br /> <select name =\"email\"> <option value='col1'>$col1[0]</option> <option value='col2'>$col2[0]</option> <option value='col3'>$col3[0]</option> </select><br /><br /> First Name <br /> <select name=\"field2\"> <option value='col1'>$col1[0]</option> <option value='col2'>$col2[0]</option> <option value='col3'>$col3[0]</option> </select><br /><br /> Last Name <br /> <select name=\"field3\"> <option value='col1'>$col1[0]</option> <option value='col2'>$col2[0]</option> <option value='col3'>$col3[0]</option> </select><br /><br /> <input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"hidden\" name=\"submitted\" value=\"TRUE\" /> </form>"; ?>

    Read the article

  • What am I doing wrong for this submenu to not appear?

    - by Doug
    I'm new to jQuery, so please bear with me. I'm trying to make my submenu appear on hover. The second set of <ul> is for submenu. $(document).ready(function(){ $('ul.menu.li').hover( function() { $('ul', this).css('display', 'block'); }, function() { $('ul', this).css('display', 'none'); }); }); <ul id="menu"> <li><a href="#">Item 1</a><li> <ul> <li>Hi</li> </ul> <li><a href="#">Item 2</a></li> </ul>

    Read the article

  • Why "alt" attribute for <img> tag has been considered mandatory by the HTML validator .. ?

    - by infant programmer
    Is there any logical or technical reason (with the W3C validation) for making alt as required attribute .. This is my actual problem:though my page is perfect enough with respect to W3C validation rules .. Only error I am getting is line XX column YY - Error: required attribute "ALT" not specified I know the significance of "alt" attribute and I have omitted that where it is unnecessary .. (to be more elaborate .. I have added the image to increase the beauty of my page and I don't want alt attribute to show irrelevant message to the viewer) getting rid of the error is secondary .. rather I am curious to know whether is it a flaw with validation rules .. ?? I thank stackOverflow and all the members who responded me .. I got my doubt clarified .. :-)

    Read the article

  • What is the maximum distance from an anchor point to a bezier curve?

    - by drawnonward
    Given a cubic bezier curve P0,P1,P2,P3 with the following properties: • Both P1 and P2 are on the same side of the line formed by P0 and P3. • P2 can be projected onto the line segment formed by P0 and P3 but P1 cannot. What is the T value for the point on the curve farthest from P3? Here is an image with an example curve. The curve bulges on the left, so there is a point on the curve farther from P3 than P0. I found this reference for finding the minimum distance from an arbitrary point to a curve. Is trial and error the only way to solve for maximum distance as well? Does it make any difference that the point is an anchor on the curve? Thanks

    Read the article

  • Capture link clickthrough events from Javascript

    - by Silver Dragon
    In order to track the overall user clickstream, I'd like to fire a javascript event, if the user right-clicks, and select "Open in new Tab" (or middle-clicks in most browsers) on a link. Most of these links are linking outside of my site, and I'd like to interfere with overall browser experience (such as: status bar, etc) as little as possible. What options are there to solve this?

    Read the article

  • Diff tool that can compare sub-sections of files

    - by EvilPuppetMaster
    I'm looking for a diff tool that will allow me to compare just a sub-section of a file with a section of another file, or even of itself. Preferably eclipse based but will take all suggestions. Yes I know I can copy out the two sections into different files and compare those, but that is very tedious when you are trying to do a large amount of refactoring. Basically I'm trying to remove as much duplicated code as possible from a code base that is suffering from a great deal of ctrl-V 'inheritance' ;-) However the pasted parts have evolved apart a little over time.

    Read the article

  • Silverlight 4 Training Kit

    - by Latest Microsoft Blogs
    We recently released a new free Silverlight 4 Training Kit that walks you through building business applications with Silverlight 4.  You can browse the training kit online or alternatively download an entire offline version of the training kit Read More......(read more)

    Read the article

  • Silverlight 4 Training Kit

    We recently released a new free Silverlight 4 Training Kit that walks you through building business applications with Silverlight 4.  You can browse the training kit online or alternatively download an entire offline version of the training kit.  The training material is structured on teaching how to use the new Silverlight 4 features to build an end to end business application. The training kit includes 8 modules, 25 videos, and several hands on labs. Below is a breakdown and links...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Strange IIS/Asp.net Exception Message

    - by Element
    I have a standard asp.net 2.0 application running on IIS 6. I have noticed some strange exception messages in the logs. They seem to be caused by random spam bots trying to submit forms. They are strange because the request string is huge and all the exception details in the event manager are messed up, they have been replaced with %21,%22, etc.. as seen in the screen shot. Is this some kind of exploit or just a bug in the asp.net exception handler/logger ? UPDATE: I traced the requests that are causing this strange log event to a bug in IE8 that causes it to request scriptresource.axd?d={html from page} as described in these links: MS Connect SO - Invalid Webresource.axd SO - IE8 Dropping Memory Pages I am still not sure why these requests would break the IIS log event like seen above, they are just long strings of jiberish being sent to the server, maybe someone reading this can shed some light on it.

    Read the article

  • Paste a list of dates in format of "mm/dd/yy" to iWork-Numbers

    - by David.Chu.ca
    I have trouble to paste a list of strings in the format of 'mm/dd/yy' into iWork-Numbers. For example, I have a list of strings(text in VIM): 04/01/10 04/03/10 04/13/10 I copy those strings and then paste into my iWork-Numbers worksheet. The result will be: 2004-01-10 2004-03-10 04/13/10 It looks like that Numbers (mac workseet application in iWork) tries to convert the first two digits into year, then the next two into month if less than 12 and last two digits to a day, for the first two rows. For the third(04/13/10), since the middle two digits are 13 and cannot be a month, then this row is pasted as it is (actually it is what I need). Is there any way to paste whatever as they are, without any "smart date conversion"? Do I have to change settings in Numberers or Mac OS's System preference?

    Read the article

  • Windows 7 sticky notes - better alternative?

    - by Ben
    Hi guys, i like the post it sidebar app in windows 7, but it offers almost no features and so I'm looking for an alternative. Some of this features would be nice: - easy font formatting - better resizeable - an simple alert function It should be small and simple to use, and not bloated with tons of features which are not often neede. I was searching for a while but cant find something propper. Anybody has an idea? Thanks!

    Read the article

  • How to use sum and count functions

    - by Odette
    hi guys I am trying to get the total count and total sum per salesperson but its not working in my WITH query Currently I have: WITH CALC1 AS (SELECT B.OTSMAN AS SALESMAN, COUNT(B.ONINUM) AS COUNT, SUM(B.OVSVAL) AS SVAL FROM @[email protected] AS B WHERE B.OCSGRP <> 'INT' AND B.OCSGRP <> 'INX' AND B.OCPSBR IN (@OCPSBR@) AND B.ICMATX <> '705' AND B.OCSGRP NOT LIKE 'S/%' GROUP BY B.OTSMAN, B.ONINUM ORDER BY B.OTSMAN ASC) SELECT SALESMAN, COUNT, SVAL FROM CALC1 ORDER BY SALESMAN THE RESULT IS: AM 1 79.03 AM 40 1337.70 AM 48 4627.15 AM 42 2727.40 AM 1 111.79 AM 1 1110.00 AM 52 3018.77 How do i change my query so I only get one record with the total count and value per salesperson? AM 1 13,011.84

    Read the article

  • How do you fix issues with the debugger for the Android plug-in for Eclipse not attaching?

    - by user279112
    I have been trying to program something for the Android mobile phone, using Eclipse and the Android plug-in for that IDE, and my debugger used to attach just fine. But then it has suddenly started having consistent issues attaching. I just get that message about how the process is waiting for the debugger attach, and then it just won't. What determines whether the attachment glitches so seems to have something to do with what the code is that I'm trying to debug, as it seems to be drastically more of an issue with some versions of my code than with others (on the same app). How do I fix this? Now before you answer, please understand that I have researched this issue already. I have found a couple of solutions that have worked with other people, but which do not work for me. One of which is setting the debuggable property in the main manifest file as true, and the other is going into Dev Tools and into some settings menu, and from there selecting the process and essentially saying to the fake phone, "Debug this process". Neither has really worked. Any other ideas? And just in case...I've run into one blasted technical issue like this after another trying to program for that stupid phone. And I'm not the only one who's having these issues; when I go online to research these issues, it is always very easy for me to find many people who have the same issues, and who are having to use the shottiest, sloppiest, most "ghetto" solutions to work around these issues. I know that many people have created good applications for that phone, but I don't see how I'm supposed to do that when the SDK and the plug-in just don't work half the time. Does anybody know how I may put all this trash behind me, once and for all? Thanks for your answers to either question!

    Read the article

  • List getting cleared every button click inside Update Panel?

    - by sah302
    No this isn't a copy of this question: http://stackoverflow.com/questions/654423/button-in-update-panel-is-doing-a-full-postback I've got a drop down inside an update panel, and I am trying to get it to allow the person using the page to add users to a list that is bound to a gridview. The list is a global variable, and on page_load I set that to the gridview's datasource and databind it. However, anytime I click the 'add a user' button, or the button to remove the user from the list. It appears like it is doing a full post back even though all these elements are inside the update Panel. Code Behind: Public accomplishmentTypeDao As New AccomplishmentTypeDao() Public accomplishmentDao As New AccomplishmentDao() Public userDao As New UserDao() Public facultyDictionary As New Dictionary(Of Guid, String) Public facultyList As New List(Of User) Public associatedFaculty As New List(Of User) Public facultyId As New Guid Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Page.Title = "Add a New Faculty Accomplishment" ddlAccomplishmentType.DataSource = accomplishmentTypeDao.getEntireTable() ddlAccomplishmentType.DataTextField = "Name" ddlAccomplishmentType.DataValueField = "Id" ddlAccomplishmentType.DataBind() facultyList = userDao.getListOfUsersByUserGroupName("Faculty") For Each faculty As User In facultyList facultyDictionary.Add(faculty.Id, faculty.LastName & ", " & faculty.FirstName) Next If Not Page.IsPostBack Then ddlFacultyList.DataSource = facultyDictionary ddlFacultyList.DataTextField = "Value" ddlFacultyList.DataValueField = "Key" ddlFacultyList.DataBind() End If gvAssociatedUsers.DataSource = associatedFaculty gvAssociatedUsers.DataBind() End Sub Protected Sub deleteUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) facultyId = New Guid(e.CommandArgument.ToString()) associatedFaculty.Remove(associatedFaculty.Find(Function(user) user.Id = facultyId)) gvAssociatedUsers.DataBind() upAssociatedFaculty.Update() End Sub Protected Sub btnAddUser_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAddUser.Click facultyId = New Guid(ddlFacultyList.SelectedValue) associatedFaculty.Add(facultyList.Find(Function(user) user.Id = facultyId)) gvAssociatedUsers.DataBind() upAssociatedFaculty.Update() End Sub Markup: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="upAssociatedFaculty" runat="server" UpdateMode="Conditional"> <ContentTemplate> <p><b>Created By:</b> <asp:Label ID="lblCreatedBy" runat="server"></asp:Label></p> <p><b>Accomplishment Type: </b><asp:DropDownList ID="ddlAccomplishmentType" runat="server"></asp:DropDownList></p> <p><b>Accomplishment Applies To: </b><asp:DropDownList ID="ddlFacultyList" runat="server"></asp:DropDownList> &nbsp;<asp:Button ID="btnAddUser" runat="server" Text="Add Faculty" /></p> <p> <asp:GridView ID="gvAssociatedUsers" runat="server" AutoGenerateColumns="false" GridLines="None" ShowHeader="false"> <Columns> <asp:BoundField DataField="Id" HeaderText="Id" Visible="False" /> <asp:TemplateField ShowHeader="False"> <ItemTemplate> <span style="margin-left: 15px;"> <p><%#Eval("LastName")%>, <%#Eval("FirstName")%> <asp:Button ID="btnUnassignUser" runat="server" CausesValidation="false" CommandArgument='<%# Eval("Id") %>' CommandName="Delete" OnCommand="deleteUser" Text='Remove' /></p> </span> </ItemTemplate> </asp:TemplateField> </Columns> <EmptyDataTemplate> <em>There are currently no faculty associated with this accomplishment.</em> </EmptyDataTemplate> </asp:GridView> </p> </ContentTemplate> </asp:UpdatePanel> Now I thought the point of an update panel was to be able to update things inside of it without doing a full post_back and reloading the page. So if that's the case, why is it calling page_load everytime I click the buttons? I ran this code and debug and I see that even before any of the code associated with button press fires, page_load runs again. I tried putting the gvAssociatedUser.Datasource = associatedFaculty and the line below inside the Page.IsPostBack check, that prevented the page from working. I tried every combination of settings of the update panel for ChildrenAsTriggers and UpdateMode, and none of them worked. I know this is something simple, but all the combinations I've tried won't get it to work. How can I make this thing work? Edited: It wasn't causing a full postback so I was wrong as to the cause. I thought the page was doing a full post back thus resetting my associatedFaculty list global variable, but it isn't doing a full postback. The issue I am having is everytime I click btnAddUser it will add one element to the associatedFaculty list and thus bound to gvAssociatedusers. This works the first time, but the second time I click it, it overwrites the first element. So it appears like my associatedFaculty list is getting reset each time I click the button?

    Read the article

  • Validating result of JsonConvert.DeserializeObject (think "try parse") using JSON.Net

    - by Riri
    I have incoming messages that I need to try and parse in my own objects structure. SOme of these are well formed JSON obejcts and some are just nonsense. I use JsonConvert.DeserializeObject<MyObject>(incmoingString); to do this. This however sometimes gives me a exception when the incoming is total garbage. Other times I get a non-complete object structure when the incoming string is kind of OK - and finally it sometimes work. I've wrapped the conversion in a try/catch and than manually validate that I've gotten the properties I need to the deserialized result. Is there a better way to do this?

    Read the article

  • Jquery datepicker: disable federal holidays

    - by Abu Hamzah
    i am working on asp.net using C# and using jquery datepicker my question is, how can i disable dates which are federal holidays? i have a dynamic dates which comes from sql server. anybody have done something similar or any idea how can i achieve this? $(document).ready(function () { $('#endDate').datepicker({ showOn: 'button', buttonImage: '../images/Calendar.png', buttonImageOnly: true, onSelect: function () { }, onClose: function () { $(this).focus(); } }); $('#startDate').datepicker({ showOn: 'button', buttonImage: '../images/Calendar.png', buttonImageOnly: true, onSelect: function (dateText, inst) { $('#endDate').datepicker("option", 'minDate', new Date(dateText)); } , onClose: function () { $(this).focus(); } }); }); Thanks.

    Read the article

  • Help with a simple switch statement

    - by revive
    I need to find the value of a variable and use it to add a class to a div, based on a switch statement. For example, my variable is $link and if $link has google.com IN IT at all, I need $class to equal 'google', if $link as yahoo.com IN IT at all, $class then needs to equal 'yahoo' So, I need something like this, but I'm not sure how/or if to use preg_match or something to check and see if the $link variable has the value we are looking for in it - see 'case' text below: switch ($link) { case 'IF link has Google.com in it': $class = 'google'; break; case 'IF link has Yahoo.com in it': $class = 'yahoo'; break; default: # code... break; } OR if there is a better way to do this, please let me know :D Thanks

    Read the article

  • Best Linux filesystem for MySQL with a 100% SELECT workload

    - by gmemon
    I have a MySQL database that contains millions of rows per table and there are 9 tables in total. The database is fully populated, and all I am doing is reads i.e., there are no INSERTs or UPDATEs. Data is stored in MyISAM tables. Given this scenario, which linux file system would work best? Currently, I have xfs. But, I read somewhere that xfs has horrible read performance. Is that true? Should I shift the database to an ext3 file system? Thanks

    Read the article

  • Binding a WPF ComboBox to a different ItemsSource within a ListBox DataTemplate

    - by tjans
    I have a ListBox that contains a textbox and a combobox in its datatemplate: <ListBox Height="147" Margin="158,29,170,0" Name="PitcherListBox" VerticalAlignment="Top" ItemsSource="{Binding SomeCollectionOfObjects}" Background="Black"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBox Text="{Binding Path=Name}" /> <ComboBox ItemsSource="{Binding LocalArrayOfIntsProperty}" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> I want to bind the listbox to a collection of objects (which I've done successfully), but I want the combobox in the above datatemplate to have its itemssource set to a local property on the window (array of ints). I still want the combobox to have a two-way bind between its selected item and a property on the collection of objects... I have the following in code: PitcherListBox.DataContext = this; Basically in the end, I want the combobox within the listbox to have a different itemssource than the listbox itself. I can't seem to figure out how to change the ComboBox's ItemsSource in XAML. Can someone provide me some feedback? Thanks!

    Read the article

  • Adding time zone hours difference to time

    - by Hwang
    I know there's a much better and correct way to do it, but i need a temporarily solutions. I need to add in extra hours to the time, and the day will change automatically too. How should I change the code below? package { public class getTime { private var today:Date=new Date(); private var hour:uint=today.getHours(); private var minute:uint=today.getMinutes(); private var month:uint=today.getMonth(); private var monthArray:Array=new Array('January','February','March','April','May','June','July','August','September','October','November','December'); private var time:String = getUSClockTime(today.getHours(), today.getMinutes()); public var dateNtime:String=(time+", " +today.getDate()+" "+monthArray[month]+" "+today.getFullYear());; public function getTime() { } private function getUSClockTime(hrs:uint, mins:uint):String { var modifier:String="PM"; var minLabel:String=doubleDigitFormat(mins); if (hrs>12) { hrs=hrs-12; } else if (hrs == 0) { modifier="AM"; hrs=12; } else if (hrs < 12) { modifier="AM"; } return (doubleDigitFormat(hrs) + ":" + minLabel + " " + modifier); } private function doubleDigitFormat(num):String { if (num<10) { return ("0" + num); } return num; } } }

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >