Search Results

Search found 18677 results on 748 pages for 'current'.

Page 92/748 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • scrollTo (jQuery) won't work in firefox

    - by William
    For some reason, firefox seems to ignore my scrollTo function even though it works in chrome and safari. Here's an example link: http://blog.rainbird.me/post/2358248459/blowholes-are-awesome Chrome and Safari will automatically scroll to the top of the image (with an offset of 20 pixels) It doesn't work in firefox. I'm baffled! code: $(document).ready(function() { $(".photoShell img").lazyload({ placeholder: "http://william.rainbird.me/boston-polaroid/white.gif", threshold: 200 }); window.viewport = { height: function() { return $(window).height(); }, width: function() { return $(window).width(); }, scrollTop: function() { return $(window).scrollTop(); }, scrollLeft: function() { return $(window).scrollLeft(); } }; $(".photoShell img").hide(); $(".photoShell .caption").hide(); $(".photoShell img").load(function() { var maxWidth = viewport.width() - 40; // Max width for the image if(maxWidth > 960){ maxWidth = 960; } var maxHeight = viewport.height() - 50; // Max height for the image var ratio = 0; // Used for aspect ratio var width = $(this).width(); // Current image width var height = $(this).height(); // Current image height // Check if the current width is larger than the max if(width > maxWidth){ ratio = maxWidth / width; // get ratio for scaling image $(this).css("width", maxWidth); // Set new width $(this).css("height", height * ratio); // Scale height based on ratio height = height * ratio; // Reset height to match scaled image width = width * ratio; // Reset width to match scaled image } // Check if current height is larger than max if(height > maxHeight){ ratio = maxHeight / height; // get ratio for scaling image $(this).css("height", maxHeight); // Set new height $(this).css("width", width * ratio); // Scale width based on ratio width = width * ratio; // Reset width to match scaled image } $(this).parents('div.photoShell').css("width", $(this).width() + 22); $(this).parents('div.photoShell').addClass('loaded'); $(this).next(".caption").show(); var scrollNum = $(this).parents('div.photoShell').offset().top; $.scrollTo(scrollNum - 20, {duration: 700, axis:"y"}); $(this).fadeIn("slow"); }).each(function() { // trigger the load event in case the image has been cached by the browser if(this.complete) $(this).trigger('load'); });

    Read the article

  • SQL - How to display the students with the same age?

    - by Cristian
    the code I wrote only tells me how many students have the same age. I want their names too... SELECT YEAR(CURRENT DATE-DATEOFBIRTH) AS AGE, COUNT(*) AS HOWMANY FROM STUDENTS GROUP BY YEAR(CURRENT DATE-DATEOFBIRTH); this returns something like this: AGE HOWMANY --- ------- 21 3 30 5 Thank you. TABLE STUDENTS COLUMNS: StudentID (primary key), Name(varchar), Firstname(varchar), Dateofbirth(varchar) I was thinking of maybe using the code above and somewhere add the function concat that will put the stundents' names on the same row as in

    Read the article

  • How to manipulate file paths intelligently in .Net 3.5?

    - by Hamish Grubijan
    Scenario: I am maintaining a function which helps with an install - copies files from PathPart1/pending_install/PathPart2/fileName to PathPart1/PathPart2/fileName. It seems that String.Replace() and Path.Combine() do not play well together. The code is below. I added this section: // The behavior of Path.Combine is weird. See: // http://stackoverflow.com/questions/53102/why-does-path-combine-not-properly-concatenate-filenames-that-start-with-path-dir while (strDestFile.StartsWith(@"\")) { strDestFile = strDestFile.Substring(1); // Remove any leading backslashes } Debug.Assert(!Path.IsPathRooted(strDestFile), "This will make the Path.Combine(,) fail)."); in order to take care of a bug (code is sensitive to a constant @"pending_install\" vs @"pending_install" which I did not like and changed (long story, but there was a good opportunity for constant reuse). Now the whole function: //You want to uncompress only the files downloaded. Not every file in the dest directory. private void UncompressFiles() { string strSrcDir = _application.Client.TempDir; ArrayList arrFiles = new ArrayList(); GetAllCompressedFiles(ref arrFiles, strSrcDir); IEnumerator enumer = arrFiles.GetEnumerator(); while (enumer.MoveNext()) { string strDestFile = enumer.Current.ToString().Replace(_application.Client.TempDir, String.Empty); // The behavior of Path.Combine is weird. See: // http://stackoverflow.com/questions/53102/why-does-path-combine-not-properly-concatenate-filenames-that-start-with-path-dir while (strDestFile.StartsWith(@"\"")) { strDestFile = strDestFile.Substring(1); // Remove any leading backslashes } Debug.Assert(!Path.IsPathRooted(strDestFile), "This will make the Path.Combine(,) fail)."); strDestFile = Path.Combine(_application.Client.BaseDir, strDestFile); strDestFile = strDestFile.Replace(Path.GetExtension(strDestFile), String.Empty); ZSharpLib.ZipExtractor.ExtractZip(enumer.Current.ToString(), strDestFile); FileUtility.DeleteFile(enumer.Current.ToString()); } } Please do not laugh at the use of ArrayList and the way it is being iterated - it was pioneered by a C++ coder during a .Net 1.1 era. I will change it. What I am interested in: what is a better way of replacing PathPart1/pending_install/PathPart2/fileName with PathPart1/PathPart2/fileName within the current code. Note that _application.Client.TempDir is just _application.Client.BaseDir + @"\pending_install". While there are many ways to improve the code, I am mainly concerned with the part which has to do with String.Replace(...) and Path.Combine(,). I do not want to make changes outside of this function. I wish Path.Combine(,) took an optional bool flag, but it does not. So ... given my constraints, how can I rework this so that it starts to suck less?

    Read the article

  • Get computed font size for DOM element in JS

    - by Pekka
    Is it possible to detect the computed font-size of a DOM element, taking into consideration generic settings made elsewhere (In the body tag for example), inherited values, and so on? A framework-independent approach would be nice, as I'm working on a script that should work standalone, but that is not a requirement of course. Background: I'm trying to tweak CKEditor's font selector plugin (source here) so that it always shows the font size of the current cursor position (as opposed to only when within a span that has an explicit font-size set, which is the current behaviour).

    Read the article

  • Connecting GPS coordinates taken from a database in Android using Overlay

    - by LordSnoutimus
    I am currently building an application that allows users to track where their phone has been on a Google Map. At the moment, when the onLocationChanged() method is called, the application stores the current GPS longitude and latitude in a database and calls the animateTo() method to the current position. Using SDK 1.5, how would I go about connecting these points with a coloured line drawn on the MapView using an Overlay?.

    Read the article

  • How to create session with iphone sdk ?

    - by jaydp13
    Hi, I made story book with iphone sdk . I created different views by coding. When user read story book I want to know that currently which view is read by user because I want to store value of current view and If user closed the application and start again at a time user can read from current. So guide me about the problem. Thanks !

    Read the article

  • In pdb how do you reset the list (l) command line count?

    - by Jorge Vargas
    From PDB (Pdb) help l l(ist) [first [,last]] List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With one argument, list 11 lines starting at that line. With two arguments, list the given range; if the second argument is less than the first, it is a count. The "continue the previous listing" feature is really nice, but how do you turn it off?

    Read the article

  • Change HttpContext.Request.InputStream

    - by user320478
    I am getting lot of errors for HttpRequestValidationException in my event log. Is it possible to HTMLEncode all the inputs from override of ProcessRequest on web page. I have tried this but it gives context.Request.InputStream.CanWrite == false always. Is there any way to HTMLEncode all the feilds when request is made? public override void ProcessRequest(HttpContext context) { if (context.Request.InputStream.CanRead) { IEnumerator en = HttpContext.Current.Request.Form.GetEnumerator(); while (en.MoveNext()) { //Response.Write(Server.HtmlEncode(en.Current + " = " + //HttpContext.Current.Request.Form[(string)en.Current])); } long nLen = context.Request.InputStream.Length; if (nLen > 0) { string strInputStream = string.Empty; context.Request.InputStream.Position = 0; byte[] bytes = new byte[nLen]; context.Request.InputStream.Read(bytes, 0, Convert.ToInt32(nLen)); strInputStream = Encoding.Default.GetString(bytes); if (!string.IsNullOrEmpty(strInputStream)) { List<string> stream = strInputStream.Split('&').ToList<string>(); Dictionary<int, string> data = new Dictionary<int, string>(); if (stream != null && stream.Count > 0) { int index = 0; foreach (string str in stream) { if (str.Length > 3 && str.Substring(0, 3) == "txt") { string textBoxData = str; string temp = Server.HtmlEncode(str); //stream[index] = temp; data.Add(index, temp); index++; } } if (data.Count > 0) { List<string> streamNew = stream; foreach (KeyValuePair<int, string> kvp in data) { streamNew[kvp.Key] = kvp.Value; } string newStream = string.Join("", streamNew.ToArray()); byte[] bytesNew = Encoding.Default.GetBytes(newStream); if (context.Request.InputStream.CanWrite) { context.Request.InputStream.Flush(); context.Request.InputStream.Position = 0; context.Request.InputStream.Write(bytesNew, 0, bytesNew.Length); //Request.InputStream.Close(); //Request.InputStream.Dispose(); } } } } } } base.ProcessRequest(context); }

    Read the article

  • check if a url has anything after the domain name

    - by raklos
    im using asp.net c#. I want to check if the current url has anything after the domain name. e.g for the if the current url www.example.com/ or www.example.com i want to set a bool to true. if it has anything after i want to set it to false. e.g. www.example.com/stuff should return false.

    Read the article

  • Command line tool in python in a fixed root directory ...

    - by koleto
    I would like to install my python application as a command line tool that should work entirelly inside the install directory (for example C:\Python26\Lib\site-packages\application) The problem is I would like to reffer in runtime to the submodules and resources from within the application directory three. If I install the app with [console_scripts] option the default path is the current directory. Is there a elegant way to keep the current execution path of the application to the site-packages directory? Thanks

    Read the article

  • As3 split strangeness

    - by coulix
    Hello coders, Super simple example: var Path:String="E:\SWF Security\Acess Current Path\Access SWF URL.swf" var Path1:Array = Path.split("\\") // Split using the backslash as delimiter (No limit the number of returned tokens) trace(Path1) What do you expect path1 to be ? E: ? No its E:SWF SecurityAcess Current PathAccess SWF URL.swf and i have no idea why.

    Read the article

  • Javascript timezone solution needed

    - by user198729
    I have unix timestamps from time zone X which is not known, the current timestamp(now()) in TZ X is known 1275143019, how to approach a javascript function so that it can generate the datetime in the users current TZ in the format 2010-05-29 15:32:35 ?

    Read the article

  • incrementing a table column's data by one || mySql

    - by Praveen Prasad
    iam having a table with columns like id || counter if i do something (some event) i want the counter's value(at a particular id) to increase by one , currently iam doing this : //get current value current_value = select counter from myTable where id='someValue' // increase value current_value++ //update table with current value update myTable set counter=current_value where id='someValue'; currently iam running 2 queries for this, please suggest me some way do it in one step.

    Read the article

  • SQL Server 2005: Insert a row in a table and update the same row

    - by vikas
    eg:table pkey --guid annualpay datefrom dateto--if null means current record percentannualincrease percent annual increase will be calculated only if there is a difference in newly inserted and previously existing last differing value. percentannualincrease = ([newannualpay-just previous pay(if different from current)]/newannualpay)*100 eg newid(),5000,today,null,0--very first row newid(),5000,today+1,null(*),0 newid,5500,today+2,null(*),?????????????--> need to be calculated before insert *--insert will close the previous record by updating dateto=null to todays date How can I do this stuff in a trigger???

    Read the article

  • Defined variables and arrays vs functions in php

    - by Frank Presencia Fandos
    Introduction I have some sort of values that I might want to access several times each page is loaded. I can take two different approaches for accessing them but I'm not sure which one is 'better'. Three already implemented examples are several options for the Language, URI and displaying text that I describe here: Language Right now it is configured in this way: lang() is a function that returns different values depending on the argument. Example: lang("full") returns the current language, "English", while lang() returns the abbreviation of the current language, "en". There are many more options, like lang("select"), lang("selectact"), etc that return different things. The code is too long and irrelevant for the case so if anyone wants it just ask for it. Url The $Url array also returns different values depending on the request. The whole array is fully defined in the beginning of the page and used to get shorter but accurate links of the current page. Example: $Url['full'] would return "http://mypage.org/path/to/file.php?page=1" and $Url['file'] would return "file.php". It's useful for action="" within the forms and many other things. There are more values for $Url['folder'], $Url['file'], etc. Same thing about the code, if wanted, just request it. Text [You can skip this section] There's another array called $Text that is defined in the same way than $Url. The whole array is defined at the beginning, making a mysql call and defining all $Text[$i] for current page with a while loop. I'm not sure if this is more efficient than multiple calls for a single mysql cell. Example: $Text['54'] returns "This is just a test array!" which this could perfectly be implemented with a function like text(54). Question With the 3 examples you can see that I use different methods to do almost the same function (no pun intended), but I'm not sure which one should become the standard one for my code. I could create a function called url() and other called text() to output what I want. I think that working with functions in those cases is better, but I'm not sure why. So I'd really appreciate your opinions and advice. Should I mix arrays and functions in the way I described or should I just use funcions? Please, base your answer in this: The source needs to be readable and reusable by other developers Resource consumption (processing, time and memory). The shorter the code the better. The more you explain the reasons the better. Thank you PS, now I know the differences between $Url and $Uri.

    Read the article

  • C++ vector pointer/reference problem

    - by sub
    Please take a look at this example: #include <iostream> #include <vector> #include <string> using namespace std; class mySubContainer { public: string val; }; class myMainContainer { public: mySubContainer sub; }; void doSomethingWith( myMainContainer &container ) { container.sub.val = "I was modified"; } int main( ) { vector<myMainContainer> vec; /** * Add test data */ myMainContainer tempInst; tempInst.sub.val = "foo"; vec.push_back( tempInst ); tempInst.sub.val = "bar"; vec.push_back( tempInst ); // 1000 lines of random code here int i; int size = vec.size( ); myMainContainer current; for( i = 0; i < size; i ++ ) { cout << i << ": Value before='" << vec.at( i ).sub.val << "'" << endl; current = vec.at( i ); doSomethingWith( current ); cout << i << ": Value after='" << vec.at( i ).sub.val << "'" << endl; } system("pause");//i suck } A hell lot of code for an example, I know. Now so you don't have to spend years thinking about what this [should] do[es]: I have a class myMainContainer which has as its only member an instance of mySubContainer. mySubContainer only has a string val as member. So I create a vector and fill it with some sample data. Now, what I want to do is: Iterate through the vector and make a separate function able to modify the current myMainContainer in the vector. However, the vector remains unchanged as the output tells: 0: Value before='foo' 0: Value after='foo' 1: Value before='bar' 1: Value after='bar' What am I doing wrong? doSomethingWith has to return void, I can't let it return the modified myMainContainer and then just overwrite it in the vector, that's why I tried to pass it by reference as seen in the doSomethingWith definition above.

    Read the article

  • Python matching some characters into a string

    - by roaksoax
    Hi All I'm trying to extract/match data from a string using regular expression but I don't seem to get it. I wan't to extract the highlighted characters from the following string: /xubuntu/daily/current/lucid-alternate-**i386**.iso This should also work in case of: /xubuntu/daily/current/lucid-alternate-**amd64**.iso Thanks a lot for your help.

    Read the article

  • How do I "DoEvents" in WPF?

    - by SLC
    I've read that the C# version is as follows: Application.Current.Dispatcher.Invoke( DispatcherPriority.Background, new Action(delegate { })); However I cannot figure out how to put the empty delegate into VB.NET, as VB.NET does not appear to support anonymous methods. Ideas? Edit: Possibly this? Application.Current.Dispatcher.Invoke( DispatcherPriority.Background, New Action(Sub() End Sub))

    Read the article

  • SQL Design Question regarding schema and if Name value pair is the best solution

    - by Aur
    I am having a small problem trying to decide on database schema for a current project. I am by no means a DBA. The application parses through a file based on user input and enters that data in the database. The number of fields that can be parsed is between 1 and 42 at the current moment. The current design of the database is entirely flat with there being 42 columns; some have repeated columns such as address1, address2, address3, etc... This says that I should normalize the data. However, data integrity is not needed at this moment and the way the data is shaped I'm looking at several joins. Not a bad thing but the data is still in a 1 to 1 relationship and I still see a lot of empty fields per row. So my concerns are that this does not allow the database or the application to be very extendable. If they want to add more fields to be parsed (which they do) than I'd need to create another table and add another foreign key to the linking table. The third option is I have a table where the fields are defined and a table for each record. So what I was thinking is to make a table that stores the value and then links to those two tables. The problem is I can picture the size of that table growing large depending on the input size. If someone gives me a file with 300,000 records than 300,000 x 40 = 12 million so I have some reservations. However I think if I get to that point than I should be happy it is being used. This option also allows for more custom displaying of information albeit a bit more work but little rework even if you add more fields. So the problem boils down to: 1. Current design is a flat file which makes extending it hard and it is not normalized. 2. Normalize the tables although no real benefits for the moment but requirements change. 3. Normalize it down into the name value pair and hope size doesn't hurt. There are a large number of inserts, updates, and selects against that table. So performance is a worry but I believe the saying is design now, performance testing later? I'm probably just missing something practical so any comments would be appreciated even if it’s a quick sanity check. Thank you for your time.

    Read the article

  • How do you get the client size in a Silverlight Application?

    - by Stefan
    I want to get the size of the browser window running my Silverlight Application? I've tried the following lines, but it always returns zero! public Page() { InitializeComponent(); Initialize(); } public void Initialize() { WorldLimits.Y = Application.Current.Host.Content.ActualHeight; WorldLimits.X = Application.Current.Host.Content.ActualWidth; gameCore = new GameCore(this); gameTime = DateTime.Now.TimeOfDay.TotalMilliseconds / 1000; }

    Read the article

  • jQuery - Set min-height of div

    - by Kenny Bones
    This is probably really easy for most of you. But I'm in need of a small snippet that looks up the current height of a div (the div has a dynamic height based on the content inside it) and then set that value in the css class's min-height value. Basically what this means is that I want this container to have it's min-height to be the exact same value as it's current height. This is probably a quick one :)

    Read the article

  • iPhone SDK: How to determine keyboard type within a UIKeyboardDidShowNotification?

    - by iPhone Developer
    Hello, I need to know the current keyboard type. I was setting an instance variable in - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField However, testing has shown that this is not always reliable because of the asynchronous nature of notifications. What I am wondering is if anyone can tell me how to determine the current keyboard type within a notification? - (void)keyboardDidShow:(NSNotification *) { // Need way to determine keyboard type here } Thanks.

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >