Daily Archives

Articles indexed Saturday June 12 2010

Page 10/74 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Sound Manager Classes for Windows (C# or C++ .Net 2.0)

    - by Yakov
    Hi guys! I need some classes for playing short wav sounds, this classes would load this wav files into memory when an instance created, play sounds in background when needed, release this wav files from memory when an instance disposed. How can I do this on C# for windows (.Net 2.0)? (Win API's sndPlaySound, OpenAL or may be any wrapper) Ideally I would love to find an exist solution that simple and able to solve my task. Do you know any solutions for this issue? Thankx for your time.

    Read the article

  • Simple java syncrhonization question

    - by Misha Koshelev
    Dear All: Was wondering, which is correct: Option One class A { public void methodOne() { synchronized(this) { modifyvalue notifyAll() } } public void methodTwo() { while (valuenotmodified) { synchronized(this) { wait() } } } Option Two class A { public void methodOne() { modifyvalue synchronized(this) { notifyAll() } } public void methodTwo() { while (valuenotmodified) { synchronized(this) { wait() } } } and why? Thank you Misha

    Read the article

  • Sqlite3 error after Rails 3 (beta 4) install

    - by elsurudo
    After Installing Rails 3, I get the following error regarding Sqlite3 when I try to do a migrate: dlsym(0x1037e5f10, Init_sqlite3_native): symbol not found - /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.bundle I am using Snow Leopard, if that makes a difference.

    Read the article

  • Strategies for serializing an object for auditing/logging purpose in .NET?

    - by Jiho Han
    Let's say I have an application that processes messages. Messages are just objects in this case that implements IMessage interface which is just a marker. In this app, if a message fails to process, then I want to log it, first of all for auditing and troubleshooting purposes. Secondly I might want to use it for re-processing. Ideally, I want the message to be serialized into a format that is human-readable. The first candidate is XML although there are others like JSON. If I were to serialize the messages as XML, I want to know whether the message object is XML-serializable. One way is to reflect on the type and to see if it has a parameter-less constructor and the other is to require IXmlSerializable interface. I'm not too happy with either of these approaches. There is a third option which is to try to serialize it and catch exceptions. This doesn't really help - I want to, in some way, stipulate that IMessage (or a derived type) should be xml-serializable. The reflection route has obvious disadvantages such as security, performance, etc. IXmlSerializable route locks down my messages to one format, when in the future, I might want to change the serialization format to be JSON. The other thing is even the simplest objects now must implement ReadXml and WriteXml methods. Is there a route that involves the least amount of work that lets me serialize an arbitrary object (as long as it implements the marker interface) into XML but not lock future messages into XML?

    Read the article

  • Why might a silverlight ListBox on Windows Phone not allow me scroll all the way down to the bottom?

    - by Byron Sommardahl
    I have a ListBox in a grid that gets databound when the page loads... pretty straightforward. The problem I'm having is that, after the box is databound, I can scroll... but not all the way to the bottom of the list. It stops an item or two short and won't let me scroll anymore. Here's the listbox XAML: <Grid x:Name="ContentGrid" Grid.Row="2"> <ListBox x:Name="lbFeed" ItemsSource="{Binding Items}" SelectionChanged="lbFeed_SelectionChanged" VerticalAlignment="Top" Width="480"> <ListBox.ItemTemplate> <DataTemplate x:Key="MyDataTemplate"> <StackPanel Orientation="Vertical" Width="430"> <TextBlock Text="Some text" TextAlignment="Center" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid> I can post more code, but I'm still getting my feet wet in XAML and I'm not sure what might be causing this. If you need more context, let me know and I'll add it here.

    Read the article

  • How to deal with "partial" dates (2010-00-00) from MySQL in Django?

    - by Etienne
    In one of my Django projects that use MySQL as the database, I need to have a date fields that accept also "partial" dates like only year (YYYY) and year and month (YYYY-MM) plus normal date (YYYY-MM-DD). The date field in MySQL can deal with that by accepting 00 for the month and the day. So 2010-00-00 is valid in MySQL and it represent 2010. Same thing for 2010-05-00 that represent May 2010. So I started to create a PartialDateField to support this feature. But I hit a wall because, by default, and Django use the default, MySQLdb, the python driver to MySQL, return a datetime.date object for a date field AND datetime.date() support only real date. So it's possible to modify the converter for the date field used by MySQLdb and return only a string in this format 'YYYY-MM-DD'. Unfortunately the converter use by MySQLdb is set at the connection level so it's use for all MySQL date fields. But Django DateField rely on the fact that the database return a datetime.date object, so if I change the converter to return a string, Django is not happy at all. Someone have an idea or advice to solve this problem? How to create a PartialDateField in Django ? EDIT Also I should add that I already thought of 2 solutions, create 3 integer fields for year, month and day (as mention by Alison R.) or use a varchar field to keep date as string in this format YYYY-MM-DD. But in both solutions, if I'm not wrong, I will loose the special properties of a date field like doing query of this kind on them: Get all entries after this date. I can probably re-implement this functionality on the client side but that will not be a valid solution in my case because the database can be query from other systems (mysql client, MS Access, etc.)

    Read the article

  • Can I create a new project based on an abandoned one licenced under GNU GPL v2?

    - by Jared Pearson
    I've found a SourceForge project with a solid core that I would like to improve. The project hasn't been updated since 2007 so I assume it is "dead". I sent an e-mail asking to become a contributor to the listed project manager last week but still haven't received a response. The project is licensed under the GNU GPL v2. I would like to contribute to the current project but that doesn't appear to be possible. Can I modify the current source version of the project and release this modified project? I would keep the same license on the modified project.

    Read the article

  • Using Linq methods causes missing references to DependencyObject in WindowsBase

    - by Jason Coyne
    I have some c# source that I want to compile using CodeDom within my application (for a plugin) Everything works fine, except if I use a Linq extension function on some of my collections var dict = new Dictionary<KeyType, ValueType>(); .... dict.Any(KV=>KV.Key == "Some Key); When I try to compile source that has this code, it CodeDom complains that I am missing a reference to DependencyObject in WindowsBase. I do not understand why this is happening. Neither the Dictionary class, or the Any extension method reference that class, which apparently is part of Windows.Forms I would normally just ignore the quirk, make the CodeDom add a reference and move on, but Apparently WindowsBase is special and is not always distributed and I don't want to cause issues for users that may not have it installed correctly.

    Read the article

  • Displaytag export option is not working

    - by Nirmal
    Hello All, I am using Displaytag framework for pagination & exporting purpose. In that i am also using Strut2Tiles Integration. Whenever i am calling any action class it will returning me a list & through Displaytag i am successfully displaying record on my page. For that my jsp page's code looks like : <s:set name="selectedPageSize" value="selectedPageSize" scope="request"/> <s:set value="accountList" scope="request" name="accountList"/> <display:table name="accountList" export="true" class="table" requestURI="" id="accountList" pagesize="${selectedPageSize}" > <display:setProperty name="export.pdf" value="true" /> <display:column property="id" sortable="true" class="sort-title"/> <display:column property="name" sortable="true"/> <display:column property="contactPerson" sortable="true"/> <display:column property="phone1" sortable="true"/> <display:column property="phone2" sortable="true"/> <display:column property="fax" sortable="true"/> <display:column property="email" sortable="true"/> <display:column property="webSite" sortable="true"/> <display:column property="address1" sortable="true"/> <display:column property="address2" sortable="true"/> <display:column property="countryId.name" title="Country" sortable="true"/> <display:column property="stateId.name" title="State" sortable="true"/> <display:column property="countryId.name" title="City" sortable="true"/> <display:column property="isDeleted" sortable="true"/> <display:column title="Delete"> <s:url id="removeUrl" action="finance/deleteAccount.action"> <s:param name="id" value="#attr.accountList.id" /> </s:url> <s:a href="%{removeUrl}" theme="ajax" targets="accountList">Remove</s:a> </display:column> <display:column title="Update"> <s:url id="updateUrl" action="finance/updateAccount.action"> <s:param value="#attr.accountList.id" name="id"/> </s:url> <s:a href="%{updateUrl}&action=update" targets="accountlist">Update</s:a> </display:column> Actually this page is displaying through tiles configuration. Here i have enabled the export option, so it is showing me the exporting options like CSV, EXCEL, XML. But whenver i am clicking on that CSV link, my web browser hanged, means nothing is displayed on it For that exporting solution i have also added filter in my web.xml. My web.xml looks like: <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>ResponseOverrideFilter</filter-name> <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class> </filter> <filter-mapping> <filter-name>ResponseOverrideFilter</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ResponseOverrideFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <listener> <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/classes/webApplicationContext.xml</param-value> </context-param> <welcome-file-list> <welcome-file>jsp/welcome.jsp</welcome-file> </welcome-file-list> I have also included following list of libraries of displaytag : 1) displaytag-1.2.jar 2) displaytag-export-poi-1.2.jar 3) displaytag-portlet-1.2.jar The exception that i am getting is : 2009-05-09 12:02:38,234 DEBUG (org.displaytag.tags.TableTag:1524) - Exportfilter NOT enabled 2009-05-09 12:02:38,312 WARN (org.displaytag.tags.TableTag:63) - Exception: [.TableTag] Unable to reset response before returning exported data. You are not using an export filter. Be sure that no other jsp tags are used before display:table or refer to the displaytag documentation on how to configure the export filter (requires j2ee 1.3). ApplicationDispatcher[/PaginationTry2] PWC1231: Servlet.service() for servlet jsp threw exception Exception: [.TableTag] Unable to reset response before returning exported data. You are not using an export filter. Be sure that no other jsp tags are used before display:table or refer to the displaytag documentation on how to configure the export filter (requires j2ee 1.3). Plz reply, i am stuck with this problem.

    Read the article

  • Integration tests - "no exceptions are thrown" approach. Does it make sense?

    - by Andrew Florko
    Sometimes integration tests are rather complex to write or developers have no enough time to check output - does it make sense to write tests that make sure "no exceptions are thrown" only? Such tests provide some input parameters set(s) and doesn't check the result, but only make sure code not failed with exception? May be such tests are not very useful but appropriate in situations when you have no time?

    Read the article

  • what does the '~' mean in python?

    - by hidroto
    what does the '~' mean in python? i found this BF interpreter in python a while ago. import sys #c,i,r,p=0,0,[0]*255,raw_input() c=0 i=0 p=raw_input() r=[0]*255 while c<len(p): m,n,u=p[c],0,r[i] if m==">":i+=1 if m=="<":i-=1 if m=="+":r[i]+=1 if m=="-":r[i]-=1 if m==".":sys.stdout.write(chr(u)) if m=="[": if ~u: while 1: m=p[c] if m=="]":n-=1 if m=="[":n+=1 if ~n:break c+=1 if m=="]": if u: while 1: m=p[c] if m=="]":n-=1 if m=="[":n+=1 if ~n:break c-=1 c+=1 and i want to know what it does because i want to make one on my ti 84 (and a PF one) BF is http://en.wikipedia.org/wiki/Brainfuck and PF is something similar

    Read the article

  • core dump during std::_List_node_base::unhook()

    - by Ron
    I have a program where std::list is used. The program uses threads which act on the std::list as producers and consumers. When a message is dealt with by the consumer, it is removed from the list using pop_front(). But, during pop_front, there is a core dump. The gdb trace is as below. could you help getting me some insights into this issue? (gdb) bt full 0 0xf7531d7b in std::_List_node_base::unhook () from /usr/lib/libstdc++.so.6 No symbol table info available. 1 0x0805c600 in std::list ::_M_erase (this=0x806b08c, __position={_M_node = 0x8075308}) at /opt/target/usr/include/c++/4.2.0/bits/stl_list.h:1169 __n = (class std::_List_node<myMsg> *) 0x0 2 0x0805c6af in std::list ::pop_front (this=0x806b08c) at /opt/target/usr/include/c++/4.2.0/bits/stl_list.h:750 No locals. 3 0x0805afb6 in Base::run () at ../../src/Base.cc:342 nSentBytes = 130 tmpnm = {_vptr.myMsg = 0x80652c0, m_msg = 0x8075140 "{0130,MSG_TYPE=ND_FUNCTION,ORG_PNAME=P01vm01Ax,FUNCTION=LOG,PARAM_CNT=3,DATETIME=06/12/2010 02:59:26.187,LOGNAME=N,ENTRY=Debug 0 }", m_from = 0x8096ee0 "P01vm01Ax", m_to = 0x0, static m_logged = false, static m_pLogMutex = {_data = {_lock = 0, __count = 0, __owner = 0, __kind = 0, _nusers = 0, {_spins = 0, _list = {_next = 0x0}}}, __size = '\0' , __align = 0}} newMsg = {_vptr.myMsg = 0x80652c0, m_msg = 0x0, m_from = 0x0, m_to = 0x0, static m_logged = false, static m_pLogMutex = {_data = {_lock = 0, __count = 0, __owner = 0, __kind = 0, _nusers = 0, {_spins = 0, _list = {_next = 0x0}}}, __size = '\0' , __align = 0}} strBuffer = "{0440,MSG_TYPE=NG_FUNCTION,ORG_PNAME=mach01./opt/abc/VAvsk/abc/comp/DML/gendrs.pl.17560,DST_PNAME=P01vm01Ax,FUNCTION=DRS_REPLICATE,CAUSE_DML_ERROR=N,CORRUPT_DATA=N,CORRUPT_HEADER=N,DEBUG=Y,EXTENDED_RU"... fds = {{fd = 5, events = 1, revents = 0}} retval = 0 iWaitTime = 0 4 0x0805b277 in startRun () at ../../src/Base.cc:454 No locals. 5 0xf7effe7b in start_thread () from /lib/libpthread.so.0 No symbol table info available. 6 0xf744d82e in clone () from /lib/libc.so.6 No symbol table info available.

    Read the article

  • How to add a local image in my firefox entension?

    - by jin
    I am developing a firefox extension and create a table and in it add a image , and I create a image with : var _img = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "xul:image"); and then I found I couldn't set its attribute "src" with a local image just like use its Url: chrome:\...., so I have to locate it in a web url:http:\ , but a problem will arise, when the http:\ couldn't be visted, How to do? if can I set the attribute of a image with a local url? Thank you very much!

    Read the article

  • Getting the highest owner of a ToolStripDropDownItem

    - by andyperfect
    I'm currently working on a project in which at one point, the user may right click a button which brings up a contextMenuStrip. I am already able to find the owner accurately from that strip, and manipulate the button clicked as follows: Dim myItem As ToolStripMenuItem = CType(sender, ToolStripMenuItem) Dim cms As ContextMenuStrip = CType(myItem.Owner, ContextMenuStrip) Dim buttonPressed As DataButton = DirectCast(cms.SourceControl, DataButton) But now for the tricky part. Within this contextmenuStrip, I have a DropDown menu with multiple items in there. I would assume you would be able to work your way up the ladder doing casts like above in the manner of ToolStripDrowpDownItem > ToolStripDropDownMenu > ToolStripMenuItem > ContextMenuStrip Unfortunately, when I try to get the sourcecontrol from this menuStrip, it return Nothing. Any ideas on how I can get the button that was pressed from this toolStripMenuItem? My current code is as follows (in which the sourceControl is Nothing) Dim myItem As ToolStripDropDownItem = CType(sender, ToolStripDropDownItem) Dim dropDown As ToolStripDropDownMenu = CType(myItem.Owner, ToolStripDropDownMenu) Dim menuItem As ToolStripMenuItem = CType(dropDown.OwnerItem, ToolStripMenuItem) Dim cms As ContextMenuStrip = CType(menuItem.Owner, ContextMenuStrip) Dim buttonPressed As DataButton = DirectCast(cms.SourceControl, DataButton) Any ideas on how to go about doing what I did in that first method, but just working my way up from further down the ladder?

    Read the article

  • Filter rows from Cursor so they don't show up in ListView

    - by Richard
    I have a Cursor that returns rows I use with a SimpleCursorAdapter to populate a ListView. I would like to filter some of the rows so they don't get displayed in my ListView. I use the data from the rows elsewhere in my Activity so I don't want to change my SQL to filter them with a WHERE clause. What is the best way to keep a row from being displaying in my ListView? Ideally I would check a column in my row and then only add rows to the ListView that satisfy a condition.

    Read the article

  • Fill Combo-box via DataSource Using Values from Various Columns

    - by peace
    Employee emp = new Employee(); comHandledBySQt.DataSource = emp.GetDataFromTable("1"); comHandledBySQt.DisplayMember = "FirstName"; The above code displays drop list of employees first names in a combo box. I want first name and last name to be displayed. How can i do it? I tried to include two columns FirstName and LastName as below but didn't work. comHandledBySQt.DisplayMember = "FirstName" + " " + "LastName"; Any help will be appreciated.

    Read the article

  • What would be the light way to render a JSP page without an App/Web Server

    - by kolrie
    First, some background: I will have to work on code for a JSP that will demand a lot of code fixing and testing. This JSP will receive a structure of given objects, and render it according to a couple of rules. What I would like to do, is to write a "Test Server" that would read some mock data out of a fixtures file, and mock those objects into a factory that would be used by the JSP in question. The target App Server is WebSphere and I would like to code, change, code in order to test appropriate HTML rendering. I have done something similar on the past, but the JSP part was just calling a method on a rendering object, so I created an Ad Hoc HTTP server that would read the fixture files, parse it and render HTML. All I had to do was run it inside RAD, change the HTML code and hit F5. So question pretty much goes down to: Is there any stand alone library or lightweight server (I thought of Jetty) that would take a JSP, and given the correct contexts (Request, Response, Session, etc.) render the proper HTML?

    Read the article

  • Rails Associations - Callback Sequence/Magic

    - by satynos
    Taking following association declaration as an example: class Post has_many :comments end Just by declaring the has_many :comments, ActiveRecord adds several methods of which I am particularly interested in comments which returns array of comments. I browsed through the code and following seems to be the callback sequence: def has_many(association_id, options = {}, &extension) reflection = create_has_many_reflection(association_id, options, &extension) configure_dependency_for_has_many(reflection) add_association_callbacks(reflection.name, reflection.options) if options[:through] collection_accessor_methods(reflection, HasManyThroughAssociation) else collection_accessor_methods(reflection, HasManyAssociation) end end def collection_accessor_methods(reflection, association_proxy_class, writer = true) collection_reader_method(reflection, association_proxy_class) if writer define_method("#{reflection.name}=") do |new_value| # Loads proxy class instance (defined in collection_reader_method) if not already loaded association = send(reflection.name) association.replace(new_value) association end define_method("#{reflection.name.to_s.singularize}_ids=") do |new_value| ids = (new_value || []).reject { |nid| nid.blank? } send("#{reflection.name}=", reflection.class_name.constantize.find(ids)) end end end def collection_reader_method(reflection, association_proxy_class) define_method(reflection.name) do |*params| force_reload = params.first unless params.empty? association = association_instance_get(reflection.name) unless association association = association_proxy_class.new(self, reflection) association_instance_set(reflection.name, association) end association.reload if force_reload association end define_method("#{reflection.name.to_s.singularize}_ids") do if send(reflection.name).loaded? || reflection.options[:finder_sql] send(reflection.name).map(&:id) else send(reflection.name).all(:select => "#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").map(&:id) end end end In this sequence of callbacks, where exactly is the actual SQL being executed for retrieving the comments when I do @post.comments ?

    Read the article

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