Search Results

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

Page 26/788 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • The name capture does not exist in the current context ERROR

    - by Haxed
    Hi I am developing a campera capture application. I am currently using EmguCV 2.0. I get an error with the following line of code : Image image = capture.QueryFrame(); I have added all the required references of EmguCV like Emgu.CV,Emgu.CV.UI, Emgu.CV.ML, Emgu.Util, but still it gives a error saying : Error 1 The name 'capture' does not exist in the current context C:\Documents and Settings\TLNA\my documents\visual studio 2010\Projects\webcamcapture\webcamcapture\Form1.cs 27 38 webcamcapture I got this code from here. The full program code is given below:- using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Emgu.CV; using Emgu.CV.UI; using Emgu.CV.Structure; using Emgu.CV.ML; namespace webcamcapture { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { Image<Bgr, Byte> image = capture.QueryFrame(); pictureBox1.Image = image.ToBitmap(pictureBox1.Width, pictureBox1.Height); } } }

    Read the article

  • (C#) Get index of current foreach iteration

    - by Graphain
    Hi, Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop? For instance, I currently do something like this depending on the circumstances: int i=0; foreach (Object o in collection) { ... i++; } Answers: @bryansh: I am setting the class of an element in a view page based on the position in the list. I guess I could add a method that gets the CSSClass for the Objects I am iterating through but that almost feels like a violation of the interface of that class. @Brad Wilson: I really like that - I've often thought about something like that when using the ternary operator but never really given it enough thought. As a bit of food for thought it would be nice if you could do something similar to somehow add (generically to all IEnumerable objects) a handle on the enumerator to increment the value that an extension method returns i.e. inject a method into the IEnumerable interface that returns an iterationindex. Of course this would be blatant hacks and witchcraft... Cool though... @crucible: Awesome I totally forgot to check the LINQ methods. Hmm appears to be a terrible library implementation though. I don't see why people are downvoting you though. You'd expect the method to either use some sort of HashTable of indices or even another SQL call, not an O(N) iteration... (@Jonathan Holland yes you are right, expecting SQL was wrong) @Joseph Daigle: The difficulty is that I assume the foreach casting/retrieval is optimised more than my own code would be. @Jonathan Holland: Ah, cheers for explaining how it works and ha at firing someone for using it.

    Read the article

  • WordPress Conditional: Only show if current page title is equal to post meta

    - by Wade D Ouellet
    Hey, I am calling a bunch of posts under a certain post type in WordPress which works but I am trying to add a conditional that will check first if those post's custom meta field (labeled "disc") is equal to the current post's title. Here is what I have but this conditional does not seem to work: <?php $pages = get_posts('numberposts=9999&post_type=song&post_status=publish&order=ASC&orderby=date'); $i = 1; foreach( $pages as $page ) { $content = $page->post_title; if( empty($content) ) continue; $content = apply_filters('the_content', $content); ?> <?php if(get_post_meta($page->ID, "p30-disc", true)=="the_title()") { ?> <tbody class="vevent"> <?php if ($i%2===0) { ?><tr class="gigpress-row gigpress-alt"> <?php } else { ?><tr class="gigpress-row"><?php } ?> <td><?php echo $page->post_title ?></td> <td><?php echo get_post_meta($page->ID, "p30-length", true); ?></td> <td><a href="http://itunes.com/<?php echo get_post_meta($page->ID, "p30-itunes-song", true); ?>">BUY</a></td> </tr> <tr class="gigpress-info"> <td colspan="3"><?php echo $page->post_content ?></td> </tr> </tbody> <?php $i++; } } ?> When I simply echo "get_post_meta($page-ID, "p30-disc", true)" or "the_title()" it spits out their proper values, which are equal, so obviously something is just wrong with that conditional. Thanks, Wade

    Read the article

  • displaying music current time & duration from AVFoundation

    - by msb
    I have a view-based iphone application that has a single play-pause button that plays an mp3 file. At the time of invoking my doPlayPauseButton() method, I 'd like to show the current time and total duration of this mp3 through the AVAudioPlayer instance I've created, called myAudioPlayer. I have placed two labels at the UI and i'm trying to assign the currentTime and duration properties to these label when the playing begins but my attempts have failed. Here's my play/pause loop, any help would be appreciated: -(IBAction) doPlayPauseButton:(UIButton *)theButton { if(myAudioPlayer.playing) { [myActivityIndicatorView stopAnimating]; myActivityIndicatorView.hidden = YES; //I think I need a myAudioPlayer.currentTime call of some sort for my labels. [myAudioPlayer pause]; [theButton setTitle:@"Play" forState:UIControlStateNormal]; [myTimer invalidate]; } else { [myActivityIndicatorView startAnimating]; myActivityIndicatorView.hidden = NO; myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(doTimer) userInfo:nil repeats:YES]; [myAudioPlayer play]; [theButton setTitle:@"Pause" forState:UIControlStateNormal];

    Read the article

  • Authenticated WCF: Getting the Current Security Context

    - by bradhe
    I have the following scenario: I have various user's data stored in my database. This data was entered via a web app. We'd like to expose this data back to the user over a web service so that they can integrate their data with their applications. We would also like to expose some business logic over these services. As such we do not want to use OData. This is a multi-tenant application so I only want to expose their data back to them and not other users. Likewise, the business logic we expose should be relative to the authenticated user. I would like let the user use an OASIS scheme to authenticate with the web service -- WCF already allows for this out of the box as far as I understand -- or perhaps we can issue them certificates to authenticate with. That bit hasn't really been worked out yet. Here is a bit of pseudo-code of how I envision this would work within the service: function GetUsersData(id) var user := Lookup User based on Username from Auth Context var data := Get Data From Repository based on "user" return data end function For the business logic scenario I think it would look something like this: function PerformBusinessLogic(someData) var user := Lookup User based on Username from Auth Context var returnValue := Perform some logic based on supplied data return returnValue end function The hard bit here is getting the current username (or cert info in the cert scenario) that the user authenticated with! Does WCF even enable this scenario? If not would WSE3 enable this? Thanks,

    Read the article

  • TCL How to read , extract and count the occurent in .txt file (Current Directory)

    - by Passion
    Hi Folks, I am beginner to scripting and vigorously learning TCL for the development of embedded system. I have to Search for the files with only .txt format in the current directory, count the number of cases of each different "Interface # nnnn" string in .txt file, where nnnn is a four or 32 digits max hexadecimal no and o/p of a table of Interface number against occurrence. I am facing implementation issues while writing a script i.e, Unable to implement the data structure like Linked List, Two Dimensional array. I am rewriting a script using multi dimension array (Pass values into the arrays in and out of procedure) in TCL to scan through the every .txt file and search for the the string/regular expression ‘Interface # ’ to count and display the number of occurrences. If someone could help me to complete this part will be much appreciated. Search for only .txt extension files and obtain the size of the file Here is my piece of code for searching a .txt file in present directory set files [glob *.txt] if { [llength $files] > 0 } { puts "Files:" foreach f [lsort $files] { puts " [file size $f] - $f" } } else { puts "(no files)" } I reckon these are all the possible logical steps behind to complete it i) Once searched and find the .txt file then open all .txt files in read only mode ii) Create a array or list using the procedure (proc) Interface number to NULL and Interface count to zero 0 iii) Scan thro the .txt file and search for the string or regular expression "interface # iv) When a match found in .txt file, check the Interface Number and increment the count for the corresponding entry. Else add new element to the Interface Number list v) If there are no files return to the first directory My o/p is like follows Interface Frequency 123f 3 1232 4

    Read the article

  • Get the current array key in a multi dimensional array

    - by johlton
    Hi *, I have a session array *$_SESSION['cart']* with some items in it. The structure ist like this (via *print_r*): Array ( [2-1] => Array ( [color] => 7 [articlenumber] => WRG70 10 [quantity] => 1 [price] => 17.50 ) [3-8] => Array ( [color] => 2 [articlenumber] => QRG50 02 [quantity] => 1 [price] => 13.50 ) ) Looping over the values for display is fine ... foreach($_SESSION['cart'] as $item_array) { foreach($item_array as $item => $value) { echo $value . ' | '; } } ... since it results in something like this: 7 | WRG70 10 | 1 | 17.50 | 2 | QRG50 02 | 1 | 13.50 | But Now: How can I output the matching key (e.g. '2-1') as well? I tried some array functions like key() & current but couldn't get it to work (one of these days). Any quick hint on this? Thanks a lot and best from Berlin Fabian

    Read the article

  • Take Current Snapshot of DB and send it to FTP in same PHP Scripts: Advice Needed

    - by Rachel
    Not sure if I can do it this way. I want to get current snapshot of the database and send it via FTP Server, both of this functionality should be implemented in PHP scripts. Here are the steps I am thinking on right now. In my php scripts(basically am extending an PDO into my Dao class and then preparing the query), $qry = SELECT * FROM MyTablename; $stmt = $this->prepare($qry); $stmt = $this->execute(); Now I will store $stmt in csv file using fputcsv or I will execute the sql command from the script itself and than try to store the result in the $file(csv file) note here that I do not have any csv file with me at this point to basically I will have to create one and let's say its $file, so then $file = fputcsv($stmt); or $file = exec("Select * from MyTablename"); Will this put all records in the file ? If yes, then I will use FTP Functionality to transfer file to the FTP Folder. I am not sure if this approach would work and also have concerns regarding the need of preparing the $qry Any suggestions or different approach advised would be highly appreciated. Thanks !!!

    Read the article

  • How to display my server's current response time to an average user

    - by Jason
    Sorry, I'm not really sure of the right way to ask this one so bear with me... We have a web application that runs on a set of servers at a data center (not in our offices) We want to be able to somehow 'advertise' to our clients/users that the availability or response time of our servers has met a standard throughout the day. I am being asked to come up with a standard metric that we can easily advertise on our login screen that shows current "standard response time" checked every x minutes. My thinking is that I need to capture something like the results of a traceroute from a server (either in our office, amazon, etc..) to one of the data center servers and come up with a Red/Yellow/Green type of a notifier for the login screen to let the user know that our tests are responding normally and if they are having delay issues it could be their network or connection to the internet. We have lots of clients in rural areas that have poor connectivity and we are trying to let them know any slowness might be on their end, not ours. I've got the LAMP stack to work with, but this could also be some other system all together as long as it can update the main server with the results. I already have pingdom reports that are available, but that's a bit more than people want to read sometimes. Any ideas on what I can do?

    Read the article

  • Download Current WSJ.com Prime Rate

    - by Registered User
    I need to automatically download the current Wall Street Journal Prime Rate and load the data into my database. What is the best method for downloading this data automatically? I have come up with three possible solutions for doing this: Scrape a HTML web page from WSJ. Parse a RSS news feed from WSJ. Use some API that I haven't found from WSJ. Regarding solution 1, although I don't like solution 1 since it could easily break, it's the only one that I have worked out from end to end. It appears I can scrape this page with a WebRequest / WebResponse and read the text in this code: <tr> <td style="text-align:left" class="colhead">&nbsp;</td> <td class="colhead">Latest</td> <td class="colhead">Wk ago</td> <td class="colhead">High</td> <td class="colhead">Low</td> </tr> <tr> <td class="text">U.S.</td> <td style="font-weight:bold;" class="num">3.25</td> <td class="num">3.25</td> <td class="num">3.25</td> <td class="num" style="border-right:0px">3.25</td> </tr> Regarding solution 2, although I can implement a RSS reader solution, I don't see a way to reliably anticipate verbiage for changes in the Prime Rate. Therefore, I don't think this is as safe or reliable a way to get the data as solution 1. Regarding solution 3, I haven't found any published API's for checking money rates like the Prime Rate. If anyone knows of a web service or other API for checking money rates, then please let me know.

    Read the article

  • Flex 4 / Flash 4 Add to Current State

    - by user163757
    I am having a little difficulty working with states in Flex (or Flash) 4. Lets say that my application has three states; the default (base) state, state 1, and state 2. State 1 should always be based on the base state, that's easy enough to accomplish. However, I would like state 2 to be based on the current state (either base or state 1). I can't for the life of me figure it out. I tried setting the basedOn property of state 1 to "this.currentState", but that just crashes my browser. <s:states> <s:State name="default"/> <s:State name="state1"/> <s:State name="state2" basedOn="{this.currentState}"/> </s:states> <s:TitleWindow id="configWindow" includeIn="state1" width="250" height="100%" close="configWindow_closeHandler(event)"/> <s:Panel id="settings" includeIn="state2" width="200" height="200"/>

    Read the article

  • Need to get 3 record for database on current date using sqlite

    - by Umaid
    SELECT rowid, Day, Advice from MainCategory where ((Day = ((cast(strftime('%d',date('now','-1 day')) as Integer)))) and (Month = (strftime('%m',date('now'))))) and ((Day = ((cast(strftime('%d',date('now')) as Integer)))) and (Month = (strftime('%m',date('now'))))) , ((Day = ((cast(strftime('%d',date('now','+1 day')) as Integer)))) and (Month = (strftime('%m',date('now',+1 month))))); What if i make my Month column in Integer data type then it would be. SELECT rowid, Month, Day, Advice from MainCategory where ((Day = ((cast(strftime('%d',date('now','-1 day')) as Integer)))) and (Month = (strftime('%m',date('now'))))) and ((Day = ((cast(strftime('%d',date('now')) as Integer)))) and (Month = (strftime('%m',date('now'))))) , ((Day = ((cast(strftime('%d',date('now','+1 day')) as Integer)))) and (Month = (strftime('%m',date('now',+1 month))))); Please note that I have over this scenerio when I am in middle of month but below query returns 2 records and 1 from begining from all 11 months as (feb is exclusive) then record will be 33 but i need three 3 records from the table and increment it on next button. Please write 3 querys one which return all three record on current date, next all 3 records must be incremented by 1 on every next button click finally all 3 records must be decremented by 1 on every previous button click keep last day and begining date on the month in minds else i have also achieved for middle of month. Running query but returns 33 records instead of 3. SELECT rowid,Month, Day, Advice from MainCategory where Day in ((cast(strftime('%d',date('now','-1 day')) as Integer)),(cast(strftime('%d',date('now')) as Integer)),(cast(strftime('%d',date('now','+1 day')) as Integer)));

    Read the article

  • Compiling code at runtime, loading into current appdomain.

    - by Richard Friend
    Hi Im compiling some code at runtime then loading the assembly into the current appdomain, however when i then try to do Type.GetType it cant find the type... Here is how i compile the code... public static Assembly CompileCode(string code) { Microsoft.CSharp.CSharpCodeProvider provider = new CSharpCodeProvider(); ICodeCompiler compiler = provider.CreateCompiler(); CompilerParameters compilerparams = new CompilerParameters(); compilerparams.GenerateExecutable = false; compilerparams.GenerateInMemory = false; foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { try { string location = assembly.Location; if (!String.IsNullOrEmpty(location)) { compilerparams.ReferencedAssemblies.Add(location); } } catch (NotSupportedException) { // this happens for dynamic assemblies, so just ignore it. } } CompilerResults results = compiler.CompileAssemblyFromSource(compilerparams, code); if (results.Errors.HasErrors) { StringBuilder errors = new StringBuilder("Compiler Errors :\r\n"); foreach (CompilerError error in results.Errors) { errors.AppendFormat("Line {0},{1}\t: {2}\n", error.Line, error.Column, error.ErrorText); } throw new Exception(errors.ToString()); } else { AppDomain.CurrentDomain.Load(results.CompiledAssembly.GetName()); return results.CompiledAssembly; } } This bit fails after getting the type from the compiled assembly just fine, it does not seem to be able to find it using Type.GetType.... Assembly assem = RuntimeCodeCompiler.CompileCode(code); string typeName = String.Format("Peverel.AppFramework.Web.GenCode.ObjectDataSourceProxy_{0}", safeTypeName); Type t = assem.GetType(typeName); //This works just fine.. Type doesntWork = Type.GetType(t.AssemblyQualifiedName); Type doesntWork2 = Type.GetType(t.Name); ....

    Read the article

  • serial port does not exist in current context: c#

    - by I__
    here's the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public class ThreadWork { private static SerialPort serialPort1; public static void DoWork() { serialPort1.Open(); serialPort1.Write("AT+CMGF=1\r\n"); //Thread.Sleep(500); serialPort1.Write("AT+CNMI=2,2\r\n"); //Thread.Sleep(500); serialPort1.Write("AT+CSCA=\"+4790002100\"\r\n"); //Thread.Sleep(500); serialPort1.DataReceived += serialPort1_DataReceived_1; } } private void Form1_Load(object sender, EventArgs e) { ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork); Thread myThread = new Thread(myThreadDelegate); myThread.Start(); } private void serialPort1_DataReceived_1(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { string response = serialPort1.ReadLine(); this.BeginInvoke(new MethodInvoker(() => textBox1.AppendText(response + "\r\n"))); } } } and i get an error on this line: string response = serialPort1.ReadLine(); it says:: Error 1 The name 'serialPort1' does not exist in the current context C:\Users\alexluvsdanielle\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs 44 31 WindowsFormsApplication1 what am i doing wrong?

    Read the article

  • How to change the link color of the current page with CSS

    - by Josh Curren
    How do I display the link for the current page different from the others? I would like to swap the colors of the text and background. This is what I currently have: The HTML: <div id="header"> <ul id="navigation"> <li class="bio"><a href="http://www.jacurren.com/">Home</a></li> <li class="theatre"><a href="http://www.jacurren.com/theatre.php">Theatre</a></li> <li class="prog"><a href="http://www.jacurren.com/programming.php">Programming</a></li> <li class="resume"><a href="http://www.jacurren.com/resume.php">R&eacute;sum&eacute;</a></li> <li class="portf"><a href="http://www.jacurren.com/portfolio.php">Portfolio</a></li> <li class="contact"><a href="http://www.jacurren.com/contact.php">Contact</a></li> </ul> </div> The CSS: #navigation{ margin:0; padding:0; background:#000000; height:34px; list-style:none; position: relative; top: 80px; } #navigation li{ float:left; clear:none; list-style:none; } #navigation li a{ color:#A60500; display:block; font-size:12px; text-decoration:none; font-weight:bold; padding:10px 18px; } #navigation li a:hover{ color:#640200; background-color:#000000; }

    Read the article

  • Type casting in C++ by detecting the current 'this' object type

    - by Elroy
    My question is related to RTTI in C++ where I'm trying to check if an object belongs to the type hierarchy of another object. The BelongsTo() method checks this. I tried using typeid, but it throws an error and I'm not sure about any other way how I can find the target type to convert to at runtime. #include <iostream> #include <typeinfo> class X { public: // Checks if the input type belongs to the type heirarchy of input object type bool BelongsTo(X* p_a) { // I'm trying to check if the current (this) type belongs to the same type // hierarchy as the input type return dynamic_cast<typeid(*p_a)*>(this) != NULL; // error C2059: syntax error 'typeid' } }; class A : public X { }; class B : public A { }; class C : public A { }; int main() { X* a = new A(); X* b = new B(); X* c = new C(); bool test1 = b->BelongsTo(a); // should return true bool test2 = b->BelongsTo(c); // should return false bool test3 = c->BelongsTo(a); // should return true } Making the method virtual and letting derived classes do it seems like a bad idea as I have a lot of classes in the same type hierarchy. Or does anybody know of any other/better way to the do the same thing? Please suggest.

    Read the article

  • XSLT - Comparing preceding-sibling's elements with current's node element

    - by siondream
    Hello, I have this XML file: <recursos> <recurso url="http://w3c.com"> <descripcion>Consorcio W3C</descripcion> <tipo>externo</tipo> <idioma>ingles</idioma> <contenido>General</contenido> <unidad>Unidad 2</unidad> </recurso> <recurso url="http://html.com"> <descripcion>Especificación HTML</descripcion> <tipo>externo</tipo> <idioma>castellano</idioma> <contenido>HTML</contenido> <version>4.01</version> <unidad>Unidad 3</unidad> </recurso> </recursos> I want to compare one "recurso"'s preceding sibling element "unidad" with the "unidad" of the current "recurso" to check if they're different. I was trying: <xsl:if test="preceding-sibling::recurso[position()=1]::unidad != unidad"> </xsl:if> But I know it's horribly wrong :( I hope you could help me, thank you very much.

    Read the article

  • PHP unlink OR rewrite own/current file by itself

    - by Email
    Hi Task: Cut or erase a file after first walk-through. i have an install file called "index.php" which creates another php file. <? /* here some code*/ $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "<?php \n echo 'hallo, *very very long text*'; \n ?>"; fwrite($fh, $stringData); /*herecut"/ /*here some code */ after the creation of the new file this file is called and i intent to erase the filecreation call since it is very long and only needed on first install. i therefor add to the above code echo 'hallo, *very very long text*'; \n ***$new= file_get_contents('index.php'); \n $findme = 'habanot'; $pos = strpos($new, $findme); if ($pos === false) { $marker='herecut';\n $new=strstr($new,$marker);\n $new='<?php \n /*habanot*/\n'.$new;\n $fh = fopen('index.php', 'w') or die 'cant open file'); $stringData = $new; fwrite($fh, $stringData); fclose($fh);*** ?>"; fwrite($fh, $stringData);]} Isnt there an easier way or a function to modify the current file or even "self destroy" a file after first call? Regards

    Read the article

  • Getting the full-name of the current user, returns an empty string (C#/C++)

    - by Nir
    I try to get the full-name of the current log-in user (Fullname, not username). The following code C#, C++ works fine but on XP computers not connected to the Net, I get empty string as result if I run it ~20 minutes after login (It runs OK whithin the first ~20 minutes after login) A Win32 API (GetUserNameEx) is used rather that PrincipalContext since it PrincipalContext may takes up to 15 seconds when working offline. Any Help why am I getting an empty string as result though a user full name is specified??? - C# Code public static string CurrentUserFullName { get { const int EXTENDED_NAME_FORMAT_NAME_DISPLAY = 3; StringBuilder userName = new StringBuilder(256); uint length = (uint) userName.Capacity; string ret; if (GetUserNameEx(EXTENDED_NAME_FORMAT_NAME_DISPLAY, userName, ref length)) { ret = userName.ToString(); } else { int errorCode = Marshal.GetLastWin32Error(); throw new Win32Exception("GetUserNameEx Failed. Error code - " + errorCode); } return ret; } } [DllImport("Secur32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern bool GetUserNameEx(int nameFormat, StringBuilder lpNameBuffer, ref uint lpnSize); - Code in C++ #include "stdafx.h" #include <windows.h> #define SECURITY_WIN32 #include <Security.h> #pragma comment( lib, "Secur32.lib" ) int _tmain(int argc, _TCHAR* argv[]) { char szName[100]; ULONG nChars = sizeof( szName ); if ( GetUserNameEx( NameDisplay, szName, &nChars ) ) { printf( "Name: %s\n", szName); } else { printf( "Failed to GetUserNameEx\n" ); printf( "%d\n", GetLastError() ); } return 0; }

    Read the article

  • preg_match to find the current directory in a URL

    - by Ian
    I'm trying to detect the current section of a site that a user is viewing by checking for the final directory in the URL. I'm using a PHP and regex to do it and I think I'm close but unfortunately not quite there yet. Here's what I currently have: <?php $url = $_SERVER['REQUEST_URI_PATH'] = preg_replace('/\\?.*/', '', $_SERVER['REQUEST_URI']); $one = '/one/'; $two = '/three/'; $three = '/three/'; $four = '/four/'; $five = '/five/'; echo $url; if (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($one)) == $one) { // URI path starts with "/one/" echo "The section is one."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($two)) == $two) { // URI path starts with "/two/" echo "The section is two."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($three)) == $three) { // URI path starts with "/three/" echo "The section is three."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($four)) == $four) { // URI path starts with "/four/" echo "The section is four."; } elseif (substr($_SERVER['REQUEST_URI_PATH'], 0, strlen($five)) == $five) { // URI path starts with "/five/" echo "The section is five."; } ?> I've placed in the echo before the if statements just to get confirmation of the value of $url. This outputs /currentdirectory/file.php However the conditions themselves don't match anything and my individual echo for each section never displays. Also if there's a simpler way of doing it then I'm open to suggestions. Thanks

    Read the article

  • Run function in current element by get short code inside

    - by happi
    In stead of adding an ID (IdAddMore) to run script inside ID(widget1) like that : <div class="widget" id="widget1"> <div class="content"> <div id="IdAddMore"></div> <script type='text/javascript'> $("#IdAddMore").selectme({ Numpost:3, Postyle : "Enter your style", }); </script> </div> </div> (widget is added automatically when I add more new widget, It means I can have widget3, widget10, ....Index(3,10..) is any and is not sorted.) Widget is a HTML/JS widget. I want run selectme by short code instead of repeating script in each widget. <div class="widget" id="widget1"> <div class="content"> [3][mystyle] </div> </div> <div class="widget" id="widget50"> <div class="content"> [4][yourstyle] </div> </div> ........... How can I write only script to catch short code in current element is added : I write script below but it does not work. Check for me, thanks your help. <script type='text/javascript'> var getdata = document.getElementsByClassName(".content").innerText || document.getElementById(".content").textContent; var thevalue = []; getdata.replace(/\[(.*?)\]/g, function(g0,g1){thevalue.push(g1);}); $(".widget").selectme({ Numpost:thevalue[0], Postyle: ""+thevalue[1]+"", }); </script>

    Read the article

  • How to use Geocoder to get the current location zip code

    - by Noble6
    I am trying to get the zip code of the users current location.I have a teditText in MyActivity which should get populated based on the zip code I get from this activity. public class LocationActivity extends MyActivity { double LATITUDE; double LONGITUDE; Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); { try { List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1); if(addresses != null) { Address returnedZip = addresses.get(0); StringBuilder currentZip = new StringBuilder("Address:\n"); for(int i=0; i<returnedZip.getMaxAddressLineIndex(); i++) { strcurrentZip.append(returnedZip.getPostalCode()); } m_zip.setText(strcurrentZip.toString()); } else { m_zip.setText("No zip returned!"); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); m_zip.setText("zip not found!"); } } } I am not getting any response,the app logcat does not show any errors but the the editText field I want to populate remains blank.

    Read the article

  • GetUserDetails error Error 27 The name 'IMGUserLabel' does not exist in the current context

    - by FBEvo1
    I need to get the users name displayed next to the Users picture. The Picture works great however the IMGUserLabel says it not in context. . can you help me solve this? public void GetUserDetails(int id) { string getUserDetail = "Select ID,Email,Name,Country,Convert(varchar (20), RegisterDate, 106) RegisterDate,Convert(varchar (20), LastLogin, 106) LastLogin ,Description,ImageName FROM [User] where Id='" + id + "'"; dt = dbClass.ConnectDataBaseReturnDT(getUserDetail); if (dt.Rows.Count > 0) { IMGUserLabel.Text = dt.Rows[0]["Name"].ToString(); NameLabel.Text = dt.Rows[0]["Name"].ToString(); UserImage.ImageUrl = "~/UserImage/" + dt.Rows[0]["ImageName"].ToString(); lblCreated.Text = dt.Rows[0]["RegisterDate"].ToString(); LabelLastLogin.Text = dt.Rows[0]["LastLogin"].ToString(); lblCreated.Text = dt.Rows[0]["RegisterDate"].ToString(); LabelAboutMe.Text = dt.Rows[0]["Description"].ToString(); } } ///////////// .Aspx ////////// <a href="<%#GetUserDetails(GetUser(Int Id)%>"> <asp:Label ID="IMGUserLabel" runat="server" Text="Label" Font-Names="Segoe UI" Font-Size="Larger" ForeColor="White" src="<%#GetUserDetails(GetUser(Int Id)%>"> </asp:Label> </a> he name 'IMGUserLabel' does not exist in the current context?

    Read the article

  • UIIMageView, warning: check_safe_call: could not restore current frame

    - by lukya
    Hi, I am changing the image in UIImageView based on accelerometer input. The images are stored in an array. The application runs fine for a while and then crashes. warning: check_safe_call: could not restore current frame I am not using "UIImage ImageNamed" method when populating the array. The total size of all images is around 12 Mb. But individual images are very light (<100 kb) and i am using only one image at a time from the array. Just in case there are any autoreleases, I have allocated a NSAutoreleasePool in view did load and am draining it in the didReceiveMemoryWarning method (which does get called 2, 3 times before the app crashes?). Following is the code that creates images array: //create autorelease pool as we are creating many autoreleased objects NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableArray *finalarr = [[NSMutableArray alloc] initWithCapacity:9]; NSLog(@"start loading"); for(int y = 0; y < 100; y+=10) { NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:10]; for(int x = 0; x < 10; x++) { NSString *imageName = [[NSString alloc] initWithFormat:@"0%d",y + x]; UIImage *img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:@"png"]]; [arr addObject:img]; [imageName release]; [img release]; } [finalarr addObject:arr]; [arr release]; } NSLog(@"done loading"); // Override point for customization after app launch viewController.imagesArray = finalarr; [finalarr release]; //retain the array of images [viewController.imagesArray retain]; //release the aurtorelease pool to free memory taken up by objects enqued for release [pool release]; As the app runs smoothly for a while, which means array creation is definitely not the problem. After this the following method is called from [accelerometer didAccelerate] -(BOOL)setImageForX:(int)x andY:(int)y { [self.imageView setImage:(UIImage*)[(NSArray*)[self.imagesArray objectAtIndex:y] objectAtIndex:x]]; return TRUE; } So the only code being executed is the "UIImageView setImage". But no objects are being created here. Please let me know if the code seems to have any leaks or i am doing something wrong. Thanks, Swapnil

    Read the article

  • Flash: How to preload upcoming SWF while current one plays

    - by pthesis
    I have a Flash slideshow that plays SWFs listed in an XML file. I would like to have the upcoming SWF load while the current one displays. I've tried all sorts of combinations of LoadMovie and LoadMovieNum, including creating an empty movie clip, but there's something I'm just not getting. Right now, after making the first round through all the files, it transitions smoothly from slide to slide, but I'd like for it to preload so that it transitions without the "Loading..." screen the first time around. It can be viewed here: slideshow Where should I put the LoadMovie line to load the next file (image[p+1]), and how should it look? function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; image = []; description = []; total = xmlNode.childNodes.length; for (i=0; i<total; i++) { image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; } firstImage(); } else { content = "file not loaded!"; } } xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("xmlfile.xml"); ///////////////////////////////////// back_btn.onRelease = function () { backImage(); }; next_btn.onRelease = function () { nextImage(); }; p = 0; function nextImage() { if (p<(total-1)) { p++; trace(this); _root.mc_loadfile.loadMovie (image[p]); _root.movie_name.text = image[p]; next_btn._visible = true; back_btn._visible = true; if (getBytesLoaded() == getBytesTotal()) slideshow(); } else if (p == (total-1)) { p = 0; firstImage(); } } function backImage() { clearInterval(myInterval); if (p>0) { --p; _root.mc_loadfile.loadMovie (image[p]); _root.movie_name.text = image[p]; next_btn._visible = true; if (p != 0) { back_btn._visible = true; } else { back_btn._visible = false; } slideshow(); } } I'd appreciate any help.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >