Search Results

Search found 293 results on 12 pages for 'javier martinez'.

Page 9/12 | < Previous Page | 5 6 7 8 9 10 11 12  | Next Page >

  • Using Windows and MMSystem in Delphi

    - by Jose Martinez
    Hi I am making a program to open and close the cd reader in which I have thought to write data to CD, the problem is the basis of the problem, which use "uses Windows 'and' uses MMSystem" but the problem is that when I use both at the same time being "uses Windows, MMSystem" gives an error and the program does not compile, I am using Delphi 2010, the strange thing is that when I use only one either Windows or MMSystem works fine and compiles. The error when I try to compile is: 'Could not find program' The code in question is this: mciSendString ('Set cdaudio door open wait', nil, 0, handle); I have two things to ask you first is how I avoid the error when using the two (Windows and MMSystem) and the other question was if he could open the CD player without using MMSystem, bone using Windows API, but not where to start The source : program Project1; {$APPTYPE CONSOLE} uses SysUtils,Windows,MMSystem; procedure opencd; begin mciSendString('Set cdaudio door open wait', nil, 0, 0); end; begin try Writeln('test'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. Image :

    Read the article

  • TextBlock Wrapping in WPF Layout

    - by Joel Martinez
    Hi, I'm trying to figure out how to do something similar to the twitter silverlight app that Scott Guthrie demoed recently in WPF: http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx Unfortunately, I seem to be having a hard time understanding the wpf layout system in some fundamental way. I've been trying various combinations of horizontalalignment/stretch, width/auto at different levels in the hierarchy, and I can't seem to get the "message" textblock to wrap without assigning an explicit width. All I want is for the text to wrap based on the width of the window (or whatever is the parent container). <Window x:Class="TweeterWin.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" Loaded="Window_Loaded"> <ScrollViewer Height="auto" > <ListBox Name="tweetList" Height="auto" > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Height="132"> <Image Source="{Binding Avatar}" Height="73" Width="73" VerticalAlignment="Top" Margin="0,10,8,0"/> <StackPanel > <TextBlock Text="{Binding User}" TextWrapping="Wrap" Foreground="#FFC8AB14" FontSize="15" /> <TextBlock Text="{Binding Message}" TextWrapping="Wrap" FontSize="10" /> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </ScrollViewer> </Window> As a follow up, if anyone can send any links my way that might help me understand some of these layout fundamentals. I think I understand the main layout options (canvas, grid, stackpanel, etc.), but I dont' understand why I can't get this textblock to wrap in this scenario. Thanks!

    Read the article

  • Python 3: regex to split on successions of newline characters

    - by Beau Martínez
    I'm trying to split a string on newline characters (catering for Windows, OS X, and Unix text file newline characters). If there are any succession of these, I want to split on that too and not include any in the result. So, for when splitting the following: "Foo\r\n\r\nDouble Windows\r\rDouble OS X\n\nDouble Unix\r\nWindows\rOS X\nUnix" The result would be: ['Foo', 'Double Windows', 'Double OS X', 'Double Unix', 'Windows', 'OS X', 'Unix'] What regex should I use?

    Read the article

  • Dojo: drag and drop Stop Drag

    - by Jose L Martinez-Avial
    Hi, I'm trying to use Dojo dnd Source(1.4.2) to create an interface where I can move some objects from a Source to a Target. It is working fine, but I want to change the behaviour in order to execute a check before actually doing the D&D, so if the check fails, an error message is shown to the user, and the D&D is not made. I've tried the following example I found in a blog: dojo.subscribe("/dnd/drop", function(source,nodes,iscopy) { if (nodes[0].id == 'docs_menu'){ dojo.publish("/dnd/cancel"); dojo.dnd.manager().stopDrag(); alert("Drop is not permitted"); } } ); But it fails saying that this.avatar is null. Does anybody know how to do this? Thanks. Jose

    Read the article

  • Python 3: receive user input including newline characters

    - by Beau Martínez
    I'm trying to read in the following text from the command-line in Python 3 (copied verbatim, newlines and all): lcbeika rraobmlo grmfina ontccep emrlin tseiboo edosrgd mkoeys eissaml knaiefr Using input, I can only read in the first word as once it reads the first newline it stops reading. Is there a way I could read in them all without iteratively calling input?

    Read the article

  • Global "ajax call" notification with asp.net mvc/jquery

    - by Joel Martinez
    I need to be notified any time a largeish asp.net mvc web application makes an ajax call to the server. We're using both jquery, and the built-in Ajax.* methods to do the remote calls, and I would like a global way of knowing when we make a call without having to manually inject some sort of "IsMakingCall" method to every request. The root problem we're trying to solve is session timeout. If the user leaves a page up and goes to lunch (for example), they get errors when they get back because the ajax call is returning the login page instead of the expected json or partial html result. My idea was to have a js timer which would be reset any time we make an ajax call. That way, if the timer runs out (ie. their session has now timed out) I can just auto-log them out. This is how sites like bank of america and mint.com work. Thanks!

    Read the article

  • Python 3: unpack inner lists in list comprehension

    - by Beau Martínez
    I'm running the following code on a list of strings to return a list of its words: words = [re.split('\\s+', line) for line in lines] However, I end up getting something like: [['import', 're', ''], ['', ''], ['def', 'word_count(filename):', ''], ...] As opposed to the desired: ['import', 're', '', '', '', 'def', 'word_count(filename):', '', ...] How can I unpack the lists re.split('\\s+', line) produces in the above list comprehension? Naïvely, I tried using * but that doesn't work. (I'm looking for a simple and Pythonic way of doing; I was tempted to write a function but I'm sure the language accommodates for this issue.)

    Read the article

  • Python 3: timestamp to datetime: where does this additional hour come from?

    - by Beau Martínez
    I'm using the following functions: # The epoch used in the datetime API. EPOCH = datetime.datetime.fromtimestamp(0) def timedelta_to_seconds(delta): seconds = (delta.microseconds * 1e6) + delta.seconds + (delta.days * 86400) seconds = abs(seconds) return seconds def datetime_to_timestamp(date, epoch=EPOCH): # Ensure we deal with `datetime`s. date = datetime.datetime.fromordinal(date.toordinal()) epoch = datetime.datetime.fromordinal(epoch.toordinal()) timedelta = date - epoch timestamp = timedelta_to_seconds(timedelta) return timestamp def timestamp_to_datetime(timestamp, epoch=EPOCH): # Ensure we deal with a `datetime`. epoch = datetime.datetime.fromordinal(epoch.toordinal()) epoch_difference = timedelta_to_seconds(epoch - EPOCH) adjusted_timestamp = timestamp - epoch_difference date = datetime.datetime.fromtimestamp(adjusted_timestamp) return date And using them with the passed code: twenty = datetime.datetime(2010, 4, 4) print(twenty) print(datetime_to_timestamp(twenty)) print(timestamp_to_datetime(datetime_to_timestamp(twenty))) And getting the following results: 2010-04-04 00:00:00 1270339200.0 2010-04-04 01:00:00 For some reason, I'm getting an additional hour added in the last call, despite my code having, as far as I can see, no flaws. Where is this additional hour coming from?

    Read the article

  • How to read Hibernate mapping

    - by Lluis Martinez
    Hi, I need to know which physical column is associated to a persistent's attribute. e.g. Class LDocLine has this attribute private Integer lineNumber; which is mapped in hibernate like this : The method I need is something like : getColumn("LDocLine","lineNumber) = "LINENUMBER" I assume its existence internally, but not sure if it's in the public api. Thanks in advance

    Read the article

  • Regex to match words and those with an apostrophe

    - by Beau Martínez
    I'm looking for a regex to only match words, possibly including numbers, and possibly with an apostrophe at the beginning, middle, or end; and ignore everything else. So these would be matched verbatim: 'bout it's persons' But these would be ignored: ' '' However, for words like 'open', open should be matched.

    Read the article

  • Prevent Windows Explorer from interfering with Directory operations.

    - by Bruno Martinez
    Sometimes, no "foo" directory is left after running this code: string folder = Path.Combine(Path.GetTempPath(), "foo"); if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); Process.Start(@"c:\windows\explorer.exe", folder); Thread.Sleep(TimeSpan.FromSeconds(5)); Directory.Delete(folder, false); Directory.CreateDirectory(folder); It seems Windows Explorer keeps a reference to the folder, so the last CreateDirectory has nothing to do, but then the original folder is deleted. How can I fix the code?

    Read the article

  • Regex to split on successions of newline characters

    - by Beau Martínez
    I'm trying to split a string on newline characters (catering for Windows, OS X, and Unix text file newline characters). If there are any succession of these, I want to split on that too and not include any in the result. So, for when splitting the following: "Foo\r\n\r\nDouble Windows\r\rDouble OS X\n\nDouble Unix\r\nWindows\rOS X\nUnix" The result would be: ['Foo', 'Double Windows', 'Double OS X', 'Double Unix', 'Windows', 'OS X', 'Unix'] What regex should I use?

    Read the article

  • SELECT SUM returns a row when there are no records

    - by Jose L Martinez-Avial
    Hi, I'm finding some problems with a query that returns the sum of a field from a table for all the records that meet certain conditions. I expected to receive a "No records found' when there were no records, but instead I'm receiving a null result. SQL> SELECT * FROM DUAL WHERE 1=2; no rows selected SQL> SELECT SUM(dummy) FROM DUAL WHERE 1=2; SUM(DUMMY) ---------- SQL> Is there any way to not receive any record in that case?

    Read the article

  • Bored with CS. What can I study that will make an impact?

    - by Eric Martinez
    So I'm going to an average university, majoring in CS. I haven't learned a damn thing and am in my third year. I've come to be really bored with studying CS. Initially, I was kind of misinformed and thought majoring in CS would make me a good "product creator". I make my money combining programming and business/marketing. But I have always done programming for the love of the art. I find things like algorithms interesting and want to be able to use CS to solve real world problems. I like the idea of bioinformatics and other hybrid studies. I'm not good enough, yet I hope, to really make a significant effort in those areas but I aspire to be. What are some other fields, open problems, and otherwise cool stuff to apply CS knowledge to in the real world? I'm really looking for something that will motivate me and re-excite me to continue studying CS. Edit: Like someone mentioned below. I am very interesting in the idea of being able to use computer science to help answer fundamental questions of life and the universe. But I'm not sure what is possible or how to begin.

    Read the article

  • ORA-01722: invalid number

    - by Lluis Martinez
    I'm getting the infamous invalid number Oracle error. Hibernate is issuing an INSERT with a lot of columns, I want to know just the name of the column giving the problem. Is it possible? I hate Oracle messages, in 15 years they haven't improved a bit (the reason why is beyond my imagination). FYI the insert is this: insert into GEM_INVOICE_HEADER (ENDORSEE_ACCOUNT_ID, INVOICE_CODE, APPROVAL_ORGAN, APROVAL_DATE, APROVAL_REFERENCE, BALANCE_BASE_AMOUNT, BALANCE_DEDUCT_AMOUNT, BALANCE_TOTAL_AMOUNT, BALANCE_VAT_AMOUNT, BALANCE_VAT_DED_AMOUNT, BALANCE_VAT_NOT_DED_AMOUNT, DESCRIPTION, SUPPLIER_INVOICE_NUMBER, INVOICE_DATE, RECEIPT_DATE, MEMO, VAT_INTRACOM, INVOICE_BASE_AMOUNT, INVOICE_VAT_AMOUNT, INVOICE_VAT_DED_AMOUNT, INVOICE_VAT_NOT_DED_AMOUNT, INVOICE_DEDUCT_AMOUNT, INVOICE_TOTAL_AMOUNT, VAT_EXEMPT, RECTIFICATION_SIGN, REASON, LOT, FILE_ID, RETAINED, INSTITUTION_ID, PERIOD_CODE, IS_RECTIFIED, DEFAULT_OFFBUDGET_ACCOUNT, OFFBUDGET_DOC_ID, PHASE_OF_ACCOUNTING, ACCOUNTED_OFF_BUDGET, CANCEL_DOC_ID, BUDGET_TYPE, INVOICE_TYPE, SOURCE_ID, STATE_ID, MANAGER_UNIT_ID, DOCUMENT_TYPE_CODE, ACCOUNTED_DOC_ID, ACCOUNTING_LIST, ENDORSEE_ID, PAYMASTER_ID, SUPPLIER_ID, SUPPLIER_ACCOUNT_ID, PAY_JUSTIFY_ID, PETTY_CASH_ID, DBOID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

    Read the article

  • Button in a WPF ListItem

    - by Joel Martinez
    Hi, I'm a bit new to WPF. I am working on a list UI where each item in the list will have a set of corresponding buttons to operate on that particular data item. Coming from a web background, I normally would have bound the value into a hidden element in that particular list item or something. However, I just need to find the corresponding technique in this WPF world :-)

    Read the article

  • conditional selection of decimal-format in xslt

    - by Jose L Martinez-Avial
    Hi all, I'm trying to modify the decimal-format of a stylesheet based on certain information of an XML. More exaclty, I've a XML like this <?xml version="1.0" encoding="ISO-8859-1"?> <REPORT> <LANGUAGE>2</LANGUAGE> <MYVALUE>123456.78</MYVALUE> </REPORT> I'm trying to define the decimal format as european if the language is 2, and default otherwse. So I've created the following template <xsl:template match="REPORT"> <xsl:if test="$language=2"> <xsl:decimal-format decimal-separator=',' grouping-separator='.' /> </xsl:if> <xsl:value-of select ="format-number(MYVALUE,'###.###,00')"/> </xsl:template> So it shows the number in european format or in standard format. But I'm getting the following error xsl:decimal-format is not allowed in this position in the stylesheet! If I try to put the decimal-format outside the template, then I get the message that the xsl:if is not allowed in this position in the sthylsheet. How can I change the decimal-format based in the XML? Thanks Jose

    Read the article

  • Integrate with Hawk Monitoring System

    - by Joel Martinez
    Hello, I am looking to integrate an existing product with Hawk (http://www.hawkms.com/), which our application support team uses to keep an eye on operations. I've never used the product so I was wondering if anyone could point me to some resources about how to expose performance data so that it can be monitored with Hawk. Specifically, the technologies we're using is asp.net and wcf ... but resources on other technology stacks would still be useful if they are available. Thanks!

    Read the article

  • Existing LINQ extension method similar to Parallel.For?

    - by Joel Martinez
    The linq extension methods for ienumerable are very handy ... but not that useful if all you want to do is apply some computation to each item in the enumeration without returning anything. So I was wondering if perhaps I was just missing the right method, or if it truly doesn't exist as I'd rather use a built-in version if it's available ... but I haven't found one :-) I could have sworn there was a .ForEach method somewhere, but I have yet to find it. In the meantime, I did write my own version in case it's useful for anyone else: using System.Collections; using System.Collections.Generic; public delegate void Function<T>(T item); public delegate void Function(object item); public static class EnumerableExtensions { public static void For(this IEnumerable enumerable, Function func) { foreach (object item in enumerable) { func(item); } } public static void For<T>(this IEnumerable<T> enumerable, Function<T> func) { foreach (T item in enumerable) { func(item); } } } usage is: myEnumerable.For<MyClass>(delegate(MyClass item) { item.Count++; });

    Read the article

  • How can I get read-ahead bytes?

    - by Bruno Martinez
    Operating systems read from disk more than what a program actually requests, because a program is likely to need nearby information in the future. In my application, when I fetch an item from disk, I would like to show an interval of information around the element. There's a trade off between how much information I request and show, and speed. However, since the OS already reads more than what I requested, accessing these bytes already in memory is free. What API can I use to find out what's in the OS caches? Alternatively, I could use memory mapped files. In that case, the problem reduces to finding out whether a page is swapped to disk or not. Can this be done in any common OS?

    Read the article

  • Select elements based on class and element type

    - by Beau Martínez
    How can I select all elements within an HTML document with a specific class and specific element type? I'm trying to select all anchors with the class title loggedin from an HTML document (and then open them within the browser). These are within parragraphs with the class title. They are leafs in the following DOM tree: + body + div class='content' + div id='siteTable' class='sitetable linklisting' + div class='thing id-t3_xxxx xxx xxx link' + div class='entry unvoted' + p class='title' + a class='title loggedin ' Where x indicates variable content. (I'm looking to do this in raw JavaScript, ie, not in jQuery.)

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12  | Next Page >