Search Results

Search found 19688 results on 788 pages for 'con current'.

Page 164/788 | < Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >

  • How do I print array values in a range when values are supplied?

    - by dcp3450
    My php reads in xml and I want to ouput the values within a given range. I have no way of knowing the size of the array or the range. However, I do know where to start; I have a $key that holds my current location. I also know where to stop; I have the word "ENDEVENTS" between each set. I want to get the values from my current position ($key) to my end position ("ENDEVENTS"). for example i may have an array set like this: Array( [0]=1 [1]=apple [2]=straw [3]=bike [4]=ENDEVENTS [5]=15 [6]=hair [7]=shirt [8]=nose [9]=kiwi [10]=ENDEVENTS ) My code knows when I'm on 15 (in this example $key=5). I want to print 6 through 9. I tried using foreach but it's thats causing issues with what I'm trying to produce. Any ideas?

    Read the article

  • How can I login linux using C or C++

    - by jnblue
    I need to programmely switch the current user to another,then the followed code should be executed in the environment(such as path,authority..) of another user. I've find the 'chroot()','setuid()' may be associated with my case, but these functions need the root authority, I don't have root authority, but I have the password of the second user. what should I do? I have tried shell "su - " can switch current user, can this command help me in my C++ code? Don't laugh at me if my question is very stupid, I'm a true freshman on linux. :) Thanks!

    Read the article

  • Sum variable range of cells using "today's" date as starting point.

    - by Jason
    How do you sum a variable range of cells based upon today's date in MS Excel 2003. Spreadsheet format: Variable range = # of days to sum Date range = listed in row 1, 1 day per cell (example A1=1/1/10, B1=1/2/10, C1=1/3/10....) Numbers to be summed - listed in row 2, X number per cell (example A2=8, B2=6, C2=1.....) example problem: IF variable range = 2 & Current Date = 1/2/10 then...Sum(b2:c2)=7 I am able to sum the entire row based upon current date using the following formula but am not able to add the variable range to the sum function. =SUMIF(A1:C1,"="&TODAY(),A2:C2)

    Read the article

  • Passing parameters among views in a navigation frame INSIDE a custom control

    - by NetWriter
    I created a silverlight 3 application with a navigation frame and 3 views: search, add and edit. I used the app file to pass parameters among the 3 pages, eg: ((App)Application.Current).SNIPSELECTED = currentSnip; Then in the receiving page: currentSnip = ((App)Application.Current).SNIPSELECTED; currentSnip is a SnipItem object: public class SnipItem { public string itemID {get;set;} public string category {get;set;} public string itemDescription {get;set;} public string codeSnip {get;set;} } This worked fine until I decided to make this entire application into a user control and put that inside a second silverlight application with its own navigation frame and app file. The app files are getting confused. The first app file with all my parameter passing is not being read. I know how to pass a simple parameter between views in the first application without the app file (in a query string), but how about these custom types like my currentSnip above?

    Read the article

  • Template or function arguments as implementation details in doxygen?

    - by Vincent
    In doxygen is there any common way to specify that some C++ template parameters of function parameters are implementation details and should not be specified by the user ? For example, a template parameter used as recursion level counter in metaprogramming technique or a SFINAE parameter in a function ? For example : /// \brief Do something /// \tparam MyFlag A flag... /// \tparam Limit Recursion limit /// \tparam Current Recursion level counter. SHOULD NOT BE EXPLICITELY SPECIFIED !!! template<bool MyFlag, unsigned int Limit, unsigned int Current = 0> myFunction(); Is there any doxygen normalized option equivalent to "SHOULD NOT BE EXPLICITELY SPECIFIED !!!" ?

    Read the article

  • how to escape slashes in perl command in unix script?

    - by understack
    end_date=$(date +"%m/%d/%Y") /usr/bin/perl -pi -e "s/_end_date_/${end_date}/g" filename I want to replace string '_end_date_' with current date. Since current date has slashes in it(yes I want the slashes), I need to escape them. How can I do this? I've tried several ways like replacing slashes with "\/" using sed and perl itself but it didn't work. Finally I used 'cut' to break date in 3 parts and escaped slashes but this solution doesn't look good. Any better solution?

    Read the article

  • dropdownlist format and then convert

    - by dinra
    i need a dropdownlist to show current month and year (January 2010) till January 2011, and an additional record of January 2011 +. But I want to save this in the database as 01/01/2010 format. also if the user selects current month then the record should be getdate() to go in database, else for any other month it should be 02/01/2010 (date = 01, first day of month). how do i do this in aspx.vb .net. i wrote a function to populate the dorpdownlist - Public Sub Load_dates(ByRef DDL As System.Web.UI.WebControls.DropDownList) Try Dim i As Integer Dim j As Integer For i = Now.Year To Now.Year For j = Now.Month To Now.Month + 11 DDL.Items.Add((j.ToString) + " " + (i.ToString)) Next Next Catch ex As Exception ReportError(ex) End Try End Sub this function only shows number like 01 2010 and 02 2010. how can i format this to show january 2010 and february 2010 and so on. please advice

    Read the article

  • How can I get the count of orders placed from my database?

    - by user1360564
    I am preparing a chart which will display the number of orders placed for a particular day in the current month and year. I wanted the count of orders placed for each day. I am showing the count of orders on the y-axis and the day on the x-axis. In my database, there is table called "order" in which order data is placed: order date, user_id, order_price, etc. For example, if on 4 July, 10 orders are placed, on 5 july, 20 orders are placed, and so on. How can I get the count of orders placed for day of the current month?

    Read the article

  • sql query is too slow, how to improve speed

    - by user1289282
    I have run into a bottleneck when trying to update one of my tables. The player table has, among other things, id, skill, school, weight. What I am trying to do is: SELECT id, skill FROM player WHERE player.school = (current school of 4500) AND player.weight = (current weight of 14) to find the highest skill of all players returned from the query UPDATE player SET starter = 'TRUE' WHERE id = (highest skill) move to next weight and repeat when all weights have been completed move to next school and start over all schools completed, done I have this code implemented and it works, but I have approximately 4500 schools totaling 172000 players and the way I have it now, it would take probably a half hour or more to complete (did not wait it out), which is way too slow. How to speed this up? Short of reducing the scale of the system, I am willing to do anything that gets the intended result. Thanks! *the weights are the standard folk style wrestling weights ie, 103, 113, 120, 126, 132, 138, 145, 152, 160, 170, 182, 195, 220, 285 pounds

    Read the article

  • return only one document for each filter defined in the query

    - by Garytxo
    Hi all, In one of my latest projects I use Solr 1.4 for searching products.However I have ran into a slight problem, which I aint sure if its possible to do using Solr. All products are indexed by "country" and "category" and the "id", "class" and "description" are stored values. I now have been requested to extract a sample list of products that we have for a give "category" and "ONLY RETURNING ONE" product for each country where the product is available. In my current implementation, I have a dismax query to get a list of all the countries that correspond to the catergory, then I call again solr to extract all products for each country, limiting the no. rows by the size of the countries found in the previous query. The problem I have with this current implementation is I can not be certain that I have one product for each country in the list. Therefore would anyone know if it possible to tell solr that you want only one product per country provided in the query? Any guidance would be useful.

    Read the article

  • how do I get the SDK version for an app running on the simulator programmatically?

    - by newbiez
    I am trying to get the version/build that is running on the simulator via code. Basically I am checking various features of my app using the simulator, and want to switch code paths on and off based on which SDK do I have set as current, instead than doing it by hand every time (my testing machine has different version of the SDK on it and I switch the current for testing purposes between 4.1 and 5.1). So the idea is that when the app launch on the simulator, I can read the build of the SDK and know trough matching (I have a function that does the matching and turn on and off the features) if I should run a specific code path or not. I know how to figure out if I am running on the sim or on a device, but cannot find references about how to get the version of the SDK via code, so I am basically stuck. Is there any function that I can call and that returns me the build or version of the currently installed iOS, while I am running the app on the simulator?

    Read the article

  • Anyone saw a worst written function than this? [closed]

    - by fvoncina
    string sUrl = "http://www.ipinfodb.com/ip_query.php?ip=" + ip + "&output=xml"; StringBuilder oBuilder = new StringBuilder(); StringWriter oStringWriter = new StringWriter(oBuilder); XmlTextReader oXmlReader = new XmlTextReader(sUrl); XmlTextWriter oXmlWriter = new XmlTextWriter(oStringWriter); while (oXmlReader.Read()) { oXmlWriter.WriteNode(oXmlReader, true); } oXmlReader.Close(); oXmlWriter.Close(); // richTextBox1.Text = oBuilder.ToString(); XmlDocument doc = new XmlDocument(); doc.LoadXml(oBuilder.ToString()); doc.Save(System.Web.HttpContext.Current.Server.MapPath(".") + "data.xml"); DataSet ds = new DataSet(); ds.ReadXml(System.Web.HttpContext.Current.Server.MapPath(".") + "data.xml"); string strcountry = "India"; if (ds.Tables[0].Rows.Count > 0) { strcountry = ds.Tables[0].Rows[0]["CountryName"].ToString(); }

    Read the article

  • Match Phrases (in array) in text string

    - by Tim Hanssen
    I'm using the Twitter API streaming to collect thousand of tweets every minute. They need to be matched to a list of keywords (can contain spaces). This is my current method: $text = preg_replace( '/[^a-z0-9]+/i', ' ', strtolower( $data['text'] ) ); $breakout = explode( " ", $text ); $result = array_intersect( $this->_currentTracks, $breakout ); I chop the tweet into words, and the matches them against my current keywords. This works well for all the keywords without a space ofc. If I wanted to find for example "Den Haag", It won't show up, because the string is exploded into words (based on the spaces). Any ideas about how I can do this in a quick way? Kind regards, Tim

    Read the article

  • Passing values between pages in JavaScript

    - by buni
    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Text; using System.Web.Services; using System.IO; namespace T_Smade { public partial class ConferenceManagement : System.Web.UI.Page { volatile int i = 0; protected void Page_Load(object sender, EventArgs e) { GetSessionList(); } public void GetSessionList() { string secondResult = ""; string userName = ""; try { if (HttpContext.Current.User.Identity.IsAuthenticated) { userName = HttpContext.Current.User.Identity.Name; } SqlConnection thisConnection = new SqlConnection(@"data Source=ZOLA-PC;AttachDbFilename=D:\2\5.Devp\my DB\ASPNETDB.MDF;Integrated Security=True"); thisConnection.Open(); SqlCommand secondCommand = thisConnection.CreateCommand(); secondCommand.CommandText = "SELECT myApp_Session.session_id FROM myApp_Session, myApp_Role_in_Session where myApp_Role_in_Session.user_name='" + userName + "' and myApp_Role_in_Session.session_id=myApp_Session.session_id"; SqlDataReader secondReader = secondCommand.ExecuteReader(); while (secondReader.Read()) { secondResult = secondResult + secondReader["session_id"].ToString() + ";"; } secondReader.Close(); SqlCommand thisCommand = thisConnection.CreateCommand(); thisCommand.CommandText = "SELECT * FROM myApp_Session;"; SqlDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { test.Controls.Add(GetLabel(thisReader["session_id"].ToString(), thisReader["session_name"].ToString())); string[] compare = secondResult.Split(';'); foreach (string word in compare) { if (word == thisReader["session_id"].ToString()) { test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session")); } } } thisReader.Close(); thisConnection.Close(); } catch (SqlException ex) { } } private Button GetButton(string id, string name) { Button b = new Button(); b.Text = name; b.ID = "Button_" + id + i; b.Command += new CommandEventHandler(Button_Click); b.CommandArgument = id; i++; return b; } private Label GetLabel(string id, string name) { Label tb = new Label(); tb.Text = name; tb.ID = id; return tb; } protected void Button_Click(object sender, CommandEventArgs e) { Response.Redirect("EnterSession.aspx?session=" + e.CommandArgument.ToString()); } } I have this code when a user clicks a button www.mypage/EnterSession.aspx?session=session_name in the EnterSession.aspx i have used the code below to track the current URL _gaq.push(['pageTrackerTime._trackEvent', 'Category', 'Action', document.location.href, roundleaveSiteEnd]); Now I would also like to track in the Action parameter the session_name from the previous page.see the code below from the previous page test.Controls.Add(GetButton(thisReader["session_name"].ToString(), "Join Session")); Some idea how to do it? Thanx

    Read the article

  • asp.net sharepoint development

    - by Daniel
    Hi all, Im my current project we need to interface with sharepoint to store and retrieve various documents. This has previously been done by referencing the Microsoft.Sharepoint dlls directly and going from there. As I don't know a lot about sharepoint yet I have been doing some research. Most of the examples I find actually refer to using the Sharepoint web services themselves (the various vti_bin ones shown in http://www.sharepointmonitor.com/2007/01/sharepoint-web-service/). I cant seem to find the differences in approaches. This current project was written a few years ago so maybe the web services weren't available then? Cheers

    Read the article

  • Incrementing through mysql PHP

    - by Rawdon
    I am looking at try to increment and decrement by three records through a table and present those records. Say if the id '4' is currently active. I want the to be display the ID's and category of 3.2.1 and 5.6.7 from an increment and decrement So far I have: $stmt = $db->query("SELECT id, category FROM test"); $stmt->execute(); while ($results = $stmt->fetch(PDO::FETCH_ASSOC)) { $current = $results['id']; $category = $results['category']; $next = array(array('slide_no' => $current, 'category' => $category)); } print_r($next); Now with this, I am getting back every row in the table. I'm now getting confused on how I could increment and decrement the records by 3 and make sure that the category will also increment correctly. Thank you very much.

    Read the article

  • git destroyed my changes

    - by mare
    I made a commit of my repository a week ago but never actually pushed it to the remote at github, which I did today. However, in the time from my commit I made many changes to the source. But just the initial commit was pushed to remote and while doing it, it also overwrote my local files. What can I do to get back my current files?? For better understanding, this is what I've done: Created new VS project and created a new git repository in it, Performed an initial scan, stage and commit but without adding a remote and performing a push, Worked on files for a week, (Today) Forgot to perform rescan, new stage and commit and just created new GitHub repository and performed this: git remote add origin [email protected]:myaccount/webshop.git git push origin master Now the files in GitHub repository are the ones from inital commit and those were also copied over my current files, so I'm in the initial commit stage now locally too, which is awful. Help appreciated

    Read the article

  • Best neural network for certain type of pattern analysis?

    - by fred basset
    Hi All, I'm working on a system that will send telemetry data on machine operation back to a central server for analysis. One of the machine parameters we're measuring is motor current drawn vs time. After an operation is finished we plan to send back an array of currents vs time to the server. A successful operation would have a pattern like a trapezoid, problematic operations would have a pattern completely different, more like a large spike in values. Can anyone recommend a type of neural network that would be good at classifying these 1D vectors of current values into a pass/fail type output? Thanks, Fred

    Read the article

  • Python read files in directory and concatenate

    - by JJ Beck
    I want to write a Python script that searches all folders in the current directory, looks for all .txt files, and creates a file that is a concatenation of all those files (in any order) in the current directory. If folders have subfolders, it should not search those subfolders. An example is main_folder folder_1 sub_folder file1.txt file2.txt folder_2 file3.txt The script is placed inside main_folder. It should create a file that is a concatenation of file2.txt and file3.txt (in any order) inside main_folder. My question is: How can I tell Python to traverse through the folders, look for .txt files, without going into the subfolders?

    Read the article

  • PHP/MySQL Interview - How would you have answered?

    - by martincarlin87
    I was asked this interview question so thought I would post it here to see how other users would answer: Please write some code which connects to a MySQL database (any host/user/pass), retrieves the current date & time from the database, compares it to the current date & time on the local server (i.e. where the application is running), and reports on the difference. The reporting aspect should be a simple HTML page, so that in theory this script can be put on a web server, set to point to a particular database server, and it would tell us whether the two servers’ times are in sync (or close to being in sync). This is what I put: // Connect to database server $dbhost = 'localhost'; $dbuser = 'xxx'; $dbpass = 'xxx'; $dbname = 'xxx'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (mysql_error()); // Select database mysql_select_db($dbname) or die(mysql_error()); // Retrieve the current time from the database server $sql = 'SELECT NOW() AS db_server_time'; // Execute the query $result = mysql_query($sql) or die(mysql_error()); // Since query has now completed, get the time of the web server $php_server_time = date("Y-m-d h:m:s"); // Store query results in an array $row = mysql_fetch_array($result); // Retrieve time result from the array $db_server_time = $row['db_server_time']; echo $db_server_time . '<br />'; echo $php_server_time; if ($php_server_time != $db_server_time) { // Server times are not identical echo '<p>Database server and web server are not in sync!</p>'; // Convert the time stamps into seconds since 01/01/1970 $php_seconds = strtotime($php_server_time); $sql_seconds = strtotime($db_server_time); // Subtract smaller number from biggest number to avoid getting a negative result if ($php_seconds > $sql_seconds) { $time_difference = $php_seconds - $sql_seconds; } else { $time_difference = $sql_seconds - $php_seconds; } // convert the time difference in seconds to a formatted string displaying hours, minutes and seconds $nice_time_difference = gmdate("H:i:s", $time_difference); echo '<p>Time difference between the servers is ' . $nice_time_difference; } else { // Timestamps are exactly the same echo '<p>Database server and web server are in sync with each other!</p>'; } Yes, I know that I have used the deprecated mysql_* functions but that aside, how would you have answered, i.e. what changes would you make and why? Are there any factors I have omitted which I should take into consideration? The interesting thing is that my results always seem to be an exact number of minutes apart when executed on my hosting account: 2012-12-06 11:47:07 2012-12-06 11:12:07

    Read the article

< Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >