Daily Archives

Articles indexed Saturday May 29 2010

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

  • Can't get InputStream read to block...

    - by mark dufresne
    I would like the input stream read to block instead of reading end of stream (-1). Is there a way to configure the stream to do this? Here's my Servlet code: PrintWriter out = response.getWriter(); BufferedReader in = request.getReader(); try { String line; int loop = 0; while (loop < 20) { line = in.readLine(); lgr.log(Level.INFO, line); out.println("<" + loop + "html>"); Thread.sleep(1000); loop++; // } } catch (InterruptedException ex) { lgr.log(Level.SEVERE, null, ex); } finally { out.close(); } Here's my Midlet code: private HttpConnection conn; InputStream is; OutputStream os; private boolean exit = false; public void run() { String url = "http://localhost:8080/WebApplication2/NewServlet"; try { conn = (HttpConnection) Connector.open(url); is = conn.openInputStream(); os = conn.openOutputStream(); StringBuffer sb = new StringBuffer(); int c; while (!exit) { os.write("<html>\n".getBytes()); while ((c = is.read()) != -1) { sb.append((char) c); } System.out.println(sb.toString()); sb.delete(0, sb.length() - 1); try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } os.close(); is.close(); conn.close(); } catch (IOException ex) { ex.printStackTrace(); } } I've tried InputStream.read, but it doesn't block either, it returns -1 as well. I'm trying to keep the I/O streams on either side alive. I want the servlet to wait for input, process the input, then send back a response. In the code above it should do this 20 times. thanks for any help

    Read the article

  • Perl php script auto install?

    - by Dr Hydralisk
    I was think of learning Perl cause I hear around town its good for system admin things. Would it be possible to use it to automatically install a php script? I need to install a custom script on a few different server and wanted to know how I could make something in Perl to do it (like move scripts over to directory and stuff)?

    Read the article

  • Flex 3 ColumnChart: dynamically changing the column colors

    - by James
    When using a ColumnChart created in Flex 3, how can I to change the fill color of columns that meet a certain criteria? Example: I have 8 columns representing agreement percentages between groups of people and want to change the fill color (or otherwise highlight) of all the columns that have over 80% agreement.

    Read the article

  • SelectionChanged event binding in Silverlight+MVVM-Light

    - by Budda
    The handler of the "SelectionChanged" event of the ComboBox control has the following signature: void SelectionChangedMethod(object sender, SelectionChangedEventArgs e) How to bind to that property under Silverlight 4 and MVVM-Light to the corresponding method of the ViewModel object? As far as I know, I need to do something like this: public void Changed(Object obj, SelectionChangedEventArgs e) { // .... implement logic here } RelayCommand<Object, SelectionChangedEventArgs> _command; public ICommand ObjectSelectionChanged { get { if (_command == null) { _command = new RelayCommand<Object, SelectionChangedEventArgs>(Changed); } return _command; } } The problem is that RelayCommand class in the MVVM-Light framework doesn't support 2 generic parameters... Is there any solution or workaround for this case? How bind control event to the method with 2 parameters?

    Read the article

  • Create Duplicate Records on SELECT for Calendar Date Range

    - by peterallcdn
    Hey all, I've built a pretty shnazzy calendar system but there is one tweak that I need to make so that I'm completely happy with it. My calendar has three tables: calevents - The calendared event. caldates - The occurrences and date-range of each occurrence for each event. calcats - The categories that can be applied to an event. The short: For each calevent, there can be many caldates, one for each occurrence of calevent. So a calevent that repeats weekly and spans 3 days might have caldates like this: date_id date_eid date_start date_end 2 37 2010-06-21 2010-06-23 3 37 2010-06-28 2010-06-30 7 37 2010-07-05 2010-07-07 9 37 2010-07-12 2010-07-14 What I want to do, is when selecting all the caldates for a specified month such as 2010-06, to return not just the two records above, but instead a record for each date in the range of date_start and date_end for each caldate. So if I searched for 2010-06, I would get: date_id date_eid date_start date_end date_day 2 37 2010-06-21 2010-06-23 2010-06-21 2 37 2010-06-21 2010-06-23 2010-06-22 2 37 2010-06-21 2010-06-23 2010-06-23 3 37 2010-06-28 2010-06-30 2010-06-28 3 37 2010-06-28 2010-06-30 2010-06-29 3 37 2010-06-28 2010-06-30 2010-06-30 The Long: The reason I want to do this, is so when displaying a list of events(calevents) for a specified month, an occurrence(caldates) of that event will be displayed for EACH of the days it spans. I could do this with php by looping through each day of the current month and displaying a copy of each caldate if the month day falls between date_start and date_end. But doing it this way will prevent me from using record pagination if needed. For example, if for a specified month the following caldates were returned: date_id date_eid date_start date_end 2 37 2010-06-21 2010-06-27 94 53 2010-06-09 2010-07-08 Doing record pagination would see this as only 2 records("rows"). But looping through them with PHP would generate 29 "rows". So, I figure if I use mysql to create each row instead of PHP, I can achieve the same thing AND still be able to use pagination if a month has a lot of events/dates. As far as performance goes, I'm not sure which option is more efficient. Both would send the same amount of info to the browser, so it's really only the work required to generate the info that matters. My current query which fetches all the occurrences for a specified month, and to make things just a little more complicated... joins them with their event and category, looks like this: $sql_to_execute = " SELECT date_id, date_eid, date_start, date_end, event_id, event_title, event_category, event_private, event_location, SUBSTRING_INDEX(event_detailsstripped, ' ', 40) AS event_detailsstripped, event_time, event_starttime, event_endtime, event_active, cat_colour FROM ( caldates LEFT JOIN calevents ON caldates.date_eid = calevents.event_id ) LEFT JOIN calcats ON calevents.event_category = calcats.cat_id WHERE date_start <= '".mysql_real_escape_string($dbi_list_end_date)."' AND date_end >= '".mysql_real_escape_string($dbi_list_start_date)."' ".$dbi_category." ORDER BY date_start ASC "; Any help or advice would be greatly appreciated! Thanks, Peter

    Read the article

  • Finding Specific Descendant Nodes With XSL:Key

    - by DBA_Alex
    Given the following code: <database> <table name="table1"> <column name="id"/> <column name="created_at"/> </table> <table name="table2"> <column name="id"/> <column name="updated_at"/> </table> </database> I want to be able to test using an xsl:key if specific table has a specific column by name. For instance, I want to know if a table has a 'created_at' column so I can write specific code within the transformation. I've gotten a general key that will test if any table has a given column by name, but have not figured out how to make it specific to the table the transformation is currently working with. <xsl:key name="columnTest" match="column" use="@name"/> <xsl:for-each select="database/table"> <xsl:choose> <xsl:when test="key('columnTest', 'created_at')"> <xsl:text>true</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>false</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:for-each> So I end up with 'true' for all the tables. Any guidance would be appreciated.

    Read the article

  • WordPress: Prevent Showing of Sub Category Posts

    - by Carlos Pattrezzi
    Hi, I'd like to know how to prevent showing of sub-category posts. My home page lists all posts from three "main categories" (parent category), but unfortunately it's also listing some posts from the sub-categories. Here's the code that I'm using to get the posts from specific category: <h2>Category Name</h2> <ul> <?php $category_query = new WP_Query(array('category_name' => 'category1', 'showposts' => 5)); ?> <?php while ($profissionais_query->have_posts()) : $profissionais_query->the_post(); ?> <li> <a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_excerpt(); ?> </li> <?php endwhile; ?> </ul> Does anyone have an idea? Thank you.

    Read the article

  • selecting dropdownlist item in IronPython

    - by Meli
    I want to select a particular item in a dropdownlist by value, in asp.net using IronPython. I found I can do it like this listItem = ddl.Items.FindByValue(x) if listItem != None: listItem.Selected = True But I want to do it in one line

    Read the article

  • IE8 problems with .animate() of opacity property - descendant remains opaque throughout

    - by Fabian
    Basically I have something like this: <ul> <li> <a> <div class="trigger-layer"></div> <div class="title-layer">Text here</div> <div class="hover-layer"></div> </a> </li> </ul> I use jQuery to animate the <ul> as follow: $ul = xxx (where I assign the selector to var $ul) $ul.animate({opacity: 0}, 1000, function() {$ul.css("display", "none")}); However in IE8, as the <ul> fades off, the <div class="title-layer">Text here</div> remains clear and opaque. Finally the animation ends, the display: none; property is applied onto the <ul> and the text disappears aburptly.

    Read the article

  • A Solution For (IEnumerable<Base>)Derive; Yet?

    - by acidzombie24
    I have D1 and D2 which derive from B. When i write var ls = (IEnumerable<B>)(cond?lsD1:lsD2); I get a runtime cast error. IIRC this is a well known problem. My question is 1) Is this allowed yet? perhaps in .NET 4? I have 2010 but my project is a few months old, large and targets 3.5. 2) Is there a simple workaround? I only need to read the list not add anything or remove. Actually, ToArray() would probably work but is there another solution?

    Read the article

  • Read File/Directory properties with java

    - by Pizza
    How can I read the file information (for example size, line count, last modification, etc) from a file in the file-system or the directory content with JAVA? I need it for a linux operating system. Thanks Ps. This is my first question, althought I have user this forum for a while so please be kind :P

    Read the article

  • Application window sent behind other windows on closing different thread (C#)

    - by david.murrant
    I'm writing a Windows Forms Application in C#.NET On startup, the application displays a splash screen which is running in a separate thread. Whilst the splash screen is showing, the main application is initialising. Once the main application has finished initialising, the main form of the application is displayed, and the splash screen still shows over the top. Everything so far is as expected. Then, the Splash screen is closed, which causes that thread to exit. For some reason, at the point, the main application windows gets sent behind all other open Windows, notably the Windows Explorer window where you clicked the .exe file to run the application in the first place! What could be causing the windows to suddenly jump "behind" like this?

    Read the article

  • JIT-ing on FPGAs ?

    - by anon
    Many VMS, JVM/LLVM/... have JITs -- as the code is being interpreted, x86 instructions are created on the fly and executed. If there something similar to this for FPGAS? Is there someway where as an FPGA is running, I reconfigure it? [If so, please provide project / paper links. If not, what is the technology bottleneck that prevents this from happening?] Thanks!

    Read the article

  • SQL Saturday 40 - South Florida - July 31st 2010

    - by Herve Roggero
    Hi everyone - if you live in Florida, or if you will be in the area on July 31st come and see us! If would like to speak or attend, visit http://www.sqlsaturday.com/40/eventhome.aspx.  The event will be in Miramar, Florida - no too far from Fort Lauderdale. We had over 350 people show up last year and we will do better this year! We are also welcoming sponsors for this event. Thank you for spreading the word!

    Read the article

  • SQLAuthority News Guest Post FAULT Contract in WCF with Learning Video

    This is guest post by one of my very good friends and .NET MVP, Dhananjay Kumar. The very first impression one gets when they meet him is his politeness. He is an extremely nice person, but has superlative knowledge in .NET and is truly helpful to all of us. Objective: This article will give a [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Redirecting to login page

    - by Searock
    I have a download folder. So is it possible to redirect a user to a login page when he/she tries to download any of the files from the download folder. I have heard this can be achieved using .htaaccess, but I can't find a good tutorial. Thanks, Searock.

    Read the article

  • Will a CF code run on regular server?

    - by Joann
    I am tasked to integrate a CF code(about 70 lines) into our site then configure it to communicate to another site's server. However, our hosting site is just a typical server without CF support. Will the code run? All I know is that CF is Adobe's version of PHP and ASP. I have no experience coding it. Could you please enlighten me? From what I gathered from the internet, you have to have a CF server in order to run a CF code but the resources seem scarce. I just need someone knowledgeable to verify...

    Read the article

  • Removing a result from Queryset

    - by Enrico
    Is there a simple way to discard/remove the last result in a queryset without affecting the db? I am trying to paginate results in Django, but don't know the total number of objects for a given query. I was planning on using next/previous or older/newer links, so I only need to know if this is the first and/or last page. First is easy to check. To check for the last page I can compare the number of results with the pagesize or make a second query. The first method fails to detect the last page when the number of results in the last set equals the pagesize (ie 100 records get broken into 10 pages with the last page containing exactly 10 results) and I would like to avoid making a second query. My current thought is that I should fetch pagesize + 1 results from the db. If the queryset length equals 11, I know this is not the last page and I want to discard the last result in the queryset before passing the queryset to the template.

    Read the article

  • How to read properties file in Greek using Java

    - by Subhendu Mahanta
    I am trying to read from a properties file which have keys in English & values in greek.My code is like this: public class I18NSample { static public void main(String[] args) { String language; String country; if (args.length != 2) { language = new String("el"); country = new String("GR"); } else { language = new String(args[0]); country = new String(args[1]); } Locale currentLocale; ResourceBundle messages; currentLocale = new Locale(language, country); messages = ResourceBundle.getBundle("MessagesBundle",currentLocale, new CustomClassLoader("E:\\properties")); System.out.println(messages.getString("greetings")); System.out.println(messages.getString("inquiry")); System.out.println(messages.getString("farewell")); } } import java.io.File; import java.net.MalformedURLException; import java.net.URL; public class CustomClassLoader extends ClassLoader { private String path; public CustomClassLoader(String path) { super(); this.path = path; } @Override protected URL findResource(String name) { File f = new File(path + File.separator + name); try { return f.toURL(); } catch (MalformedURLException e) { e.printStackTrace(); } return super.findResource(name); } } MessagesBundle_el_GR.properties greetings=??µ. ?a??et? farewell=ep?f. a?t?? inquiry=t? ???e?s, t? ???ete I am compiling like this javac -encoding UTF8 CustomClassLoader.java javac -encoding UTF8 I18Sample.java When I run this I get garbled output.If the properies file is in English,French or German it works fine. Please help. Regards, Subhendu

    Read the article

  • How can I change the value or a static char* from a function? C++

    - by flyout
    I am trying to change the value of a "static char *" I define at startup, I do it from inside a function, and when this function returns the var I am trying to re-set the value doesn't retain it. Example: static char *X = "test_1"; void testFunc() { char buf[256]; // fill buf with stuff... X = buf; } How can I achieve this without using static for buf? Should I use another datatype? if so, which one?

    Read the article

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