Daily Archives

Articles indexed Monday October 15 2012

Page 7/19 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Android: Error trying to edit button text after thread sleep

    - by Vass
    (programming Android in Eclipse) I am trying to set up a delay in changing the text in a button. I am getting errors only after there is a delay and the text needs to be changed. Here is the simplified code without a while loop: final Button button_target = (Button) findViewById(R.id.button_target); Thread textChange = new Thread(new Runnable() { public void run(){ button_target.setText("fog"); try{ Thread.sleep(3000); }catch(InterruptedException e){} } }); textChange.start(); And now here is the code where a change of text on the button is required after the sleep which now causes and error and exit (forced): final Button button_target = (Button) findViewById(R.id.button_target); Thread textChange = new Thread(new Runnable() { public void run(){ button_target.setText("cat"); try{ Thread.sleep(3000); }catch(InterruptedException e){} button_target.setText("dog"); } }); textChange.start(); what am I doing to cause the error? Is there another method that I should do to be able to invoke a sleep or delay to the thread so that a text change operation can be performed? (the actual code has a while loop but I believe this form puts the error in highlight)

    Read the article

  • Python - Subprocess Popen and Thread error

    - by n0idea
    In both functions record and ftp, i have subprocess.Popen if __name__ == '__main__': try: t1 = threading.Thread(target = record) t1.daemon = True t1.start() t2 = threading.Thread(target = ftp) t2.daemon = True t2.start() except (KeyboardInterrupt, SystemExit): sys.exit() The error I'm receiving is: Exception in thread Thread-1 (most likely raised during interpreter shutdown): Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner File "/usr/lib/python2.7/threading.py", line 504, in run File "./in.py", line 20, in recordaudio File "/usr/lib/python2.7/subprocess.py", line 493, in call File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ File "/usr/lib/python2.7/subprocess.py", line 1237, in _execute_child <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'close' What might the issue be ?

    Read the article

  • Viewing directory containing MIME encoded email messages

    - by Mark
    I have an application which generates and sends MIME encoded messages (javax.mail.internet.MimeMessage) through an SMTP server. As part of the development process only, I'd like to be able to view these messages rather than send them (I know the sending works just fine, but there are restrictions on the domains within the dev environment which makes it a little difficult) I thought the easiest way would be to save the text for each message to a directory, then point "an app" at the directory and check them over. So the question is, what would be a good app to use? Is it as simple as configuring Outlook or another email client to do it? Thanks

    Read the article

  • Decoration View *above* cells in UICollectionView

    - by Dhiraj Gupta
    I've got a decoration view showing the way I want, in my UICollectionView. The position and size is right. The decoration view stays at the frame I'm setting for it in my layout. But, I want the decoration view to be above the cells, not below them. I tried setting the zIndex property on the UICollectionViewLayoutAttributes for the decoration view, but this has no effect - I tried logging out the zindex of the cells, and they're all returning 0, and my decoration view's zIndex is set to 20. I'm guessing having decoration views above the cells is not supported, at least in UICollectionViewFlowLayout? Someone please confirm this, thanks! In the meantime, I'm going back to having a custom UIView subclass as a subview in the parent controller of the collection view and laying out the frame of it in the - (void) viewWillLayoutSubviews() method.

    Read the article

  • UIWebview: Dynamically adding html content

    - by user739711
    I am making an app in which I get text from my server and display it in UIWebview. After some time more text is added and client(iphone) is notified about the additional-text. Now I want to inject this text into my UIWebview. Anybody know how to do it? One method is to update some text file and reload the content. But I dont want to reload the page. Another way can be to use javascript to check updates in a local file (which seems better). Is there any known better solution?

    Read the article

  • Using placeholders/variables in a sed command

    - by jesse_galley
    I want to store a specific part of a matched result as a variable to be used for replacement later. I would like to keep this in a one liner instead of finding the variable I need before hand. when configuring apache, and use mod_rewrite, you can specificy specific parts of patterns to be used as variables,like this: RewriteRule ^www.example.com/page/(.*)$ http://www.example.com/page.php?page=$1 [R=301,L] the part of the pattern match that's contained inside the parenthesis is stored as $1 for use later. So if the url was www.example.com/page/home, it would be replaced with www.example.com/page.php?page=home. So the "home" part of the match was saved in $1 because it was the part of the pattern inside the parenthesis. I want something like this functionality with a sed command, I need to automatically replace many strings in a SQL dump file, to add drop table if exist commands before each create table, but I need to know the table name to do this, so if the dump file contains something like: ... CREATE TABLE `orders` ... I need to run something like: cat dump.sql | sed "s/CREATE TABLE `(.*)`/DROP TABLE IF EXISTS $1\N CREATE TABLE `$1`/g" to get the result of: ... DROP TABLE IF EXISTS `orders` CREATE TABLE `orders` ... I'm using the mod_rewrite syntax in the sed command as a logical example of what I'm trying to do. Any suggestions?

    Read the article

  • Fragment savedInstanceState is always null (Android support lib)

    - by Evgeny Egorov
    I wrote a simple test project, but I cant understand why I always receive savedInstanceState = null in lifecycle methods onCreate, onCreateView and onActivityCreated. I change the screen orientation, see the log, but state not saved. Tell me please where is my mistake. Thanks. The code of fragment class is: public class TestFragment extends Fragment { private String state = "1"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { //never works state = savedInstanceState.getString("state"); } //always prints 1 Toast.makeText(getActivity(), state, Toast.LENGTH_SHORT).show(); return inflater.inflate(R.layout.fragment_layout, container, false); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString("state", "2"); Log.e("", "saved 2"); } }

    Read the article

  • Fixed div background

    - by Fahad
    I want to create a layout where I want to display an image to the left and content on the right. The image should stay constant when the content scrolls. The css I'm using: <style type="text/css"> html, body { margin:0; padding:0; } #page-container { margin:auto; width:900px; background-color:Black; background-image:url('images/desired_layout.png'); background-attachment: fixed; background-repeat:no-repeat; } #main-image { float:left; width:250px; height:687px; background-image:url('images/desired_layout.png'); background-attachment:fixed; background-repeat:no-repeat; } #content { margin-left:250px; background-color:Olive; height:800px; width:650px; } </style> The HTML: <div id="page-container"> <div id="main-image"></div> <div id="content"></div> </div> Alot of time on this site and I have understood that background-attachment:fixed positions the image in the entire viewport and not the element it is applied to. My question is how do I go about creating that kind of layout? I do not want to give that image as a background image, as if the window is resized, it might get hidden. I want scrollbars to appear if the window size is less than 900px( my page width) so that the image can be viewed at all times. That happens with this code, however I would like the image to start at my element instead. How do I go about doing this?? Thanks in Advance :)

    Read the article

  • Validation of method parameters

    - by Anton Tsivarev
    I have a RESTful web service. For implementation using JAX-RS (Jersey). Have the following method: public void foo (@PathParam ("name") String uuid) { ... } I need to do validation of input parameters. And if data invalid throw WebApplicationException. I added my custom annotation CheckUuid (extends ): public void foo (@PathParam ("name") @CheckUuid String uuid) { ... } Is it possible to do validation using annotations on a stage when the method chosen, but not yet called? For example using PreProcessInterceptor?

    Read the article

  • dropdown under a nav button css/html

    - by MannfromReno
    I have a navcontainer with buttons in the container. I need to make a dropdown list for only one of the buttons. How would this be accomplished with CSS/HTML. Here is my code: HTML: <div id="navcontainer"> <a href="/home.html" class="button" style="width: 115px">About Us</a> <a href="/quote.html" class="button" style="width: 170px">Request a Quote</a> <a href="/affiliates.html" class="button" style="width: 115px">Affiliates</a> <a href="/pricing.html" class="button" style="width: 170px">Pricing & Plans</a> <a href="/addservices.html" class="button" style="width: 190px">Additional Services</a> <a href="/service.html" class="button" style="width: 165px">Service Details</a> <a href="/watering.html" class="button" style="width: 108px">Watering</a> </div> CSS: #navcontainer { float: right; width: 1040px; height: 45px; text-align: center; line-height: 45px; color: #fff; margin-bottom: 6px; } .button { text-align: center; background: #226426; color: #fff; width: 100px; height: 45px; float: left; text-decoration: none; font-family: Arial, sans-serif; font-size: 15px; font-weight: bold; border-right: solid 1px #91b293; border-top: solid 1px #91b293; border-bottom: solid 1px #91b293; } Do I need to make this into a ul or can I keep it as is, and just add a dropdown to the Services button? Thanks for your help.

    Read the article

  • create tree/XML structure from SQL query c#

    - by Tim Bassett
    Here is my current issue. I need to display a tree like structure displaying a recall roster. Our DBA created a stored procedure that returns [level],[name],[contact_info]. Example looks like: [1] [test name1] [contact info] [2] [sub to1] [contact info] [3] [sub to2] [contact info] [4] [sub to3] [contact info] [3] [sub to2] [contact info] [2] [sub to1] [contact info] etc... It's sorted in the order of the hierarchy I haven't really worked with XML much but is that the way to go in loading/presenting this data. Currently when I retrieving the data I'm returning it in a datatable. There may also be a need to export this data to Excel. Can anyone point me a good direction to go with this?

    Read the article

  • Refactoring two methods down to one

    - by bflemi3
    I have two methods that almost do the same thing. They get a List<XmlNode> based on state OR state and schoolType and then return a distinct, ordered IEnumerable<KeyValuePair<string,string>>. I know they can be refactored but I'm struggling to determine what type the parameter should be for the linq statement in the return of the method (the last line of each method). I thank you for your help in advance. private IEnumerable<KeyValuePair<string, string>> getAreaDropDownDataSource() { StateInfoXmlDocument stateInfoXmlDocument = new StateInfoXmlDocument(); string schoolTypeXmlPath = string.Format(STATE_AND_SCHOOL_TYPE_XML_PATH, StateOfInterest, ConnectionsLearningSchoolType); var schoolNodes = new List<XmlNode>(stateInfoXmlDocument.SelectNodes(schoolTypeXmlPath).Cast<XmlNode>()); return schoolNodes.Select(x => new KeyValuePair<string, string>(x.Attributes["idLocation"].Value, x.Value)).OrderBy(x => x.Key).Distinct(); } private IEnumerable<KeyValuePair<string, string>> getStateOfInterestDropDownDataSource() { StateInfoXmlDocument stateInfoXmlDocument = new StateInfoXmlDocument(); string schoolTypeXmlPath = string.Format(SCHOOL_TYPE_XML_PATH, ConnectionsLearningSchoolType); var schoolNodes = new List<XmlNode>(stateInfoXmlDocument.SelectNodes(schoolTypeXmlPath).Cast<XmlNode>()); return schoolNodes.Select(x => new KeyValuePair<string, string>(x.Attributes["stateCode"].Value, x.Attributes["stateName"].Value)).OrderBy(x => x.Key).Distinct(); }

    Read the article

  • Visual Studio 2010 compilation general error c1010070

    - by user1747455
    I wrote a little "hello world" program to test my computer, but when i sompile the program there's an error: ------ Build started: Project: hi, Configuration: Debug Win32 ------ Build started 15/10/2012 22:36:48. InitializeBuildStatus: Touching "Debug\hi.unsuccessfulbuild". Link: hi.vcxproj - D:\MSVS\hi\Debug\hi.exe Manifest: Debug\hi.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. {q~ 0H Build FAILED. Time Elapsed 00:00:02.34 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== the creepiest thing i think would be that line of "OH"... i wonder if there's any way to solve this...please help. Many thanks. edit: i tried changing the character set into "multi-byte" and turning "embed manifest"(from "manifest tools") off, but it still cant solve the error

    Read the article

  • IntelliSense: expression must have integral or enum type

    - by user1743737
    Guys i need someone fix this problem ? when i compile that code i have this error: Error: IntelliSense: expression must have integral or enum type i have problem in this part: Console(0, V("seta sv_hostname " + servername + ";\n")); so how i can fix that if (strncmp(command, V("exec config_mp"), 14) == 0) { if (GAME_MODE == 'D') { CIniReader iniReader(V(".\\teknogods.ini")); char *servername = iniReader.ReadString(V("Settings"),V("Servername"),""); if (strcmp(servername,"") == 0) { info("Server name set to defult."); } else { //Console(0, V("seta scr_teambalance 1;\n")); Console(0, V("seta sv_hostname " + servername + ";\n")); info("server name set to: %s.", servername); } } }

    Read the article

  • jquery show hide div's with a href tag

    - by user1736794
    I have some jquery which reveals and hides new div's based on which button is pressed. Rather than buttons i would like to insert my own text/image and have them work in the same way, revealing and hiding the new windows. Here is the jquery: <script> $(document).ready(function(){ $(".buttons").click(function () { var divname= this.value; $("#"+divname).show("slow").siblings().hide("slow"); }); }); </script> Here is the code for one of the buttons which i would like changed to a a href tag. <input type="button" id="button1" class="buttons" value="div1"></input> Any help will be greatly appreciated. Thanks. Pia

    Read the article

  • fullscreen map not displayed correctly

    - by user1747168
    I want the map to be opened on full-screen. I've tried this: <div class="b-firm-map-content" id="map"></div> <a href="#" onclick="test2();return false;" >full screen</a> function test2(){ var width = $(window).width()-3; var height = $(window).height(); $('#map').css({ 'width': width, 'height': height - 40 , 'position': 'absolute ', 'z-index' : '900' }); } but it result in: http://pixs.ru/showimage/Snimokpng_5811285_6065704.png http://pixs.ru/showimage/Snimok1png_4265065_6065745.png My map not completely displayed.

    Read the article

  • Facebook redirect after login not working when url is dynamic

    - by dythffvrb
    This is my code: $loginUrl = $facebook->getLoginUrl(array( 'scope' => 'publish_actions', 'redirect_uri' => 'http://mysite.com/', )); It works but if I remove redirect_uri it doesn't work anymore. $loginUrl = $facebook->getLoginUrl(array( 'scope' => 'publish_actions' )); According to Facebook domcumentation redirect_uri is optional. https://developers.facebook.com/docs/reference/php/facebook-getLoginUrl/ Im trying to redirect the users to the same url they were on before logging in. Update: This problem occurs when the url is mysite.com/post23 but when url is mysite.com/staticpage or mysite.com there are no problems Any workarounds? EDIT: It looks like a bug, it doesn't work with certain url in the same site I wil try and report it to Facebook.

    Read the article

  • How is this relation in 4th normal form? Is the dependency trivial?

    - by squ
    I have a question that concerns multi value dependency. The relation looks like this: R(A,B) with A -->> B (A multi value determines B) I've been told that this relation is in 4th normal form, but I don't really se how. I know that if the multi value dependency is trivial, then it doesn't violate the 4th normal form. But is this trivial? It would be trivial if it, for example, looked like this: {A,B} -->> B But the first dependency example shouldn't be trivial. The other rule for 4th NF says that A in this case needs to be a super key of the relation, but it isn't. As far as I can tell, A isn't a super key, since {A,B} is needed to identify a tuple. So the question is, why is this in 4th normal form? It seems to be violating both of the rules.

    Read the article

  • wxpython - Running threads sequentially without blocking GUI

    - by ryantmer
    I've got a GUI script with all my wxPython code in it, and a separate testSequences module that has a bunch of tasks that I run based on input from the GUI. The tasks take a long time to complete (from 20 seconds to 3 minutes), so I want to thread them, otherwise the GUI locks up while they're running. I also need them to run one after another, since they all use the same hardware. (My rationale behind threading is simply to prevent the GUI from locking up.) I'd like to have a "Running" message (with varying number of periods after it, i.e. "Running", "Running.", "Running..", etc.) so the user knows that progress is occurring, even though it isn't visible. I'd like this script to run the test sequences in separate threads, but sequentially, so that the second thread won't be created and run until the first is complete. Since this is kind of the opposite of the purpose of threads, I can't really find any information on how to do this... Any help would be greatly appreciated. Thanks in advance! gui.py import testSequences from threading import Thread #wxPython code for setting everything up here... for j in range(5): testThread = Thread(target=testSequences.test1) testThread.start() while testThread.isAlive(): #wait until the previous thread is complete time.sleep(0.5) i = (i+1) % 4 self.status.SetStatusText("Running"+'.'*i) testSequences.py import time def test1(): for i in range(10): print i time.sleep(1) (Obviously this isn't the actual test code, but the idea is the same.)

    Read the article

  • Getting the responseText from XMLHttpRequest-Object

    - by Sammy46
    I wrote a cgi-script with c++ to return the query-string back to the requesting ajax object. I also write the query-string in a file in order to see if the cgi script works correctly. But when I ask in the html document for the response Text to be shown in a messagebox i get a blank message. here is my code: js: <script type = "text/javascript"> var XMLHttp; if(navigator.appName == "Microsoft Internet Explorer") { XMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { XMLHttp = new XMLHttpRequest(); } function getresponse () { XMLHttp.open ("GET", "http://localhost/cgi-bin/AJAXTest?" + "fname=" + document.getElementById('fname').value + "&sname=" + document.getElementById('sname').value,true); XMLHttp.send(null); } XMLHttp.onreadystatechange=function(){ if(XMLHttp.readyState == 4) { document.getElementById('response_area').innerHTML += XMLHttp.readyState; var x= XMLHttp.responseText alert(x) } } </script> First Names(s)<input onkeydown = "javascript: getresponse ()" id="fname" name="name"> <br> Surname<input onkeydown = "javascript: getresponse();" id="sname"> <div id = "response_area"> </div> C++: int main() { QFile log("log.txt"); if(!log.open(QIODevice::WriteOnly | QIODevice::Text)) { return 1; } QTextStream outLog(&log); QString QUERY_STRING= getenv("QUERY_STRING"); //if(QUERY_STRING!=NULL) //{ cout<<"Content-type: text/plain\n\n" <<"The Query String is: " << QUERY_STRING.toStdString()<< "\n"; outLog<<"Content-type: text/plain\n\n" <<"The Query String is: " <<QUERY_STRING<<endl; //} return 0; } I'm happy about every advice what to do! EDIT: the output to my logfile works just fine: Content-type: text/plain The Query String is: fname=hello&sname=world I just noticed that if i open it with IE8 i get the query-string. But only on the first "keydown" after that IE does nothing.

    Read the article

  • How to have comments from FB app in website appear on the websites fb fanpage?

    - by Nathan Jon Grant
    I m a graphic designer and have created a website in Joomla that uses a "lightbox" (ignite gallery) plugin to view images from the site. I have created a facebook 'website' app that allows for comments to be posted via facebook in the lightbox (also a like button) - all of which are really just options that you allow in the ignite gallery options. Everything seems to work fine, I can comment and it will appear under the photo in the lightbox, as I asked it too, it also sends a copy of the comment to the commenter's facebook page with links. How do I also get the comments from the website (lightbox plugin) to also appear on the clients "fan page" that already exists?? Much appreciate any help..

    Read the article

  • What is the Coded UI feature of VS2010 and VS2012?

    - by TATWORTH
    A question recently arose as to what is coded UI? It is a feature of the ultimate and premium versions of Visual Studio 2012 (and 2010).It is described as "Automate user interface tests to validate application UI"Here are some useful links about it:http://codedui101.blogspot.co.uk/2011/07/what-is-codedui.htmlhttp://msdn.microsoft.com/en-us/vstudio/ee957688.aspxhttp://msdn.microsoft.com/en-us/library/dd286726.aspxhttp://www.microsoft.com/visualstudio/eng/products/comparehttp://www.dotnetcurry.com/ShowArticle.aspx?ID=798http://channel9.msdn.com/Blogs/kmcgrath/Introduction-to-Creating-Coded-UI-Tests-with-Visual-Studio-2010

    Read the article

  • Presenting at VS Live! Orlando in December

    - by Steve Michelotti
    I’ll be presenting at VS Live! December 10-14 in Orlando, FL. I’ll be presenting Azure Web Sites. This is the session abstract: Azure Web Sites brings a whole new level of power and simplicity to cloud computing. This demo-heavy session will show numerous features that allow you to deploy your site in a matter of seconds. Whether you are building a completely custom app or deploying from one of the numerous templates provided (such as WordPress), you’ll be up and running in no time. Want to use Node.js or PHP and deploy from Git? No problem! Azure Web Sites gives you the power of elastic scaling while still providing streamlined development and an effortless deployment experience. This presentation will also cover features including monitoring, custom domains, working with SQL databases or more!   SPECIAL OFFER: As a speaker, I can extend $500 savings on the 5-day package. Register here: http://bit.ly/VOSPK19Reg  and use code VOSPK19. The great part about Visual Studio Live!: four events in one! This year, the event will be co-located with SQL Server Live!, SharePoint Live!, and Cloud & Virtualization Live!. You can customize your conference agenda and attend ANY sessions from all four events. Register now: http://bit.ly/VOSPK19Reg

    Read the article

  • Why is access to my database very slow?

    - by Fabien
    I have a mysql database that used to work perfectly fine, but now it is dead slow on startup. When I type in $> mysql -u foo bar I get the following usual message for about 30 seconds before I get a prompt : Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Of course, I tried it and it goes a lot faster : $> mysql -u foo bar -A But why do I have to wait so long in regular startup ? This is not a very big database, and data does not seem to be corrupted (everything looks fine after startup). I have no other client connecting to the mysql server at the same time (only one process is shown with the command show full processlist) and I have already restarted the mysqld service. What's going on ?

    Read the article

  • Optimal Instance Size for EC2 Sharepoint Server

    - by Rob Wilkerson
    I'm surprised that I can't find any info about this, but I'm not a Windows admin and just a novice EC2 user. I have a client who wants to stand up a Sharepoint server on EC2 for internal use. The team is small (10-20) folks and traffic will be light. Mostly, the client is looking for one place to store documents (and revisions of documents) while making access easy for authenticated users anywhere in the world. They've settled on Sharepoint and have other EC2 instances so that seems like the natural fit, but I'm trying to figure out what to recommend for them. I'm currently thinking about a Medium instance. I'm afraid to go smaller because I think Windows would need a fair amount of memory just to run, but I'm very open to suggestions. Any advice would be much appreciated. I expect that the storage itself would happen in an EBS mount, but again, suggestions welcome. Thanks for your input.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >