Daily Archives

Articles indexed Tuesday April 6 2010

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

  • Python: combining making two scripts into one

    - by Alex
    I have two separately made python scripts one that makes a sine wave sound based off time, and another that produces a sine wave graph that is based off the same time factors. I need help combining them into one running file. Here's the first: from struct import pack from math import sin, pi import time def au_file(name, freq, freq1, dur, vol): fout = open(name, 'wb') # header needs size, encoding=2, sampling_rate=8000, channel=1 fout.write('.snd' + pack('>5L', 24, 8*dur, 2, 8000, 1)) factor = 2 * pi * freq/8000 factor1 = 2 * pi * freq1/8000 # write data for seg in range(8 * dur): # sine wave calculations sin_seg = sin(seg * factor) + sin(seg * factor1) fout.write(pack('b', vol * 64 * sin_seg)) fout.close() t = time.strftime("%S", time.localtime()) ti = time.strftime("%M", time.localtime()) tis = float(t) tis = tis * 100 tim = float(ti) tim = tim * 100 if __name__ == '__main__': au_file(name='timeSound.au', freq=tim, freq1=tis, dur=1000, vol=1.0) import os os.startfile('timeSound.au') and the second is this: from Tkinter import * import math import time t = time.strftime("%S", time.localtime()) ti = time.strftime("%M", time.localtime()) tis = float(t) tis = tis / 100 tim = float(ti) tim = tim / 100 root = Tk() root.title("This very moment") width = 400 height = 300 center = height//2 x_increment = 1 # width stretch x_factor1 = tis x_factor2 = tim # height stretch y_amplitude = 50 c = Canvas(width=width, height=height, bg='black') c.pack() str1 = "sin(x)=white" c.create_text(10, 20, anchor=SW, text=str1) center_line = c.create_line(0, center, width, center, fill='red') # create the coordinate list for the sin() curve, have to be integers xy1 = [] xy2 = [] for x in range(400): # x coordinates xy1.append(x * x_increment) xy2.append(x * x_increment) # y coordinates xy1.append(int(math.sin(x * x_factor1) * y_amplitude) + center) xy2.append(int(math.sin(x * x_factor2) * y_amplitude) + center) sinS_line = c.create_line(xy1, fill='white') sinM_line = c.create_line(xy2, fill='yellow') root.mainloop()

    Read the article

  • facing outsourced wages, can i still eat and survive as a computing science major ?

    - by wefwgeweg
    offshore outsourced programmers charge fraction of what costs a North American developer. should I still pursue my major as computing science ? Why would companies spend more on North American/local developers where they can get the same quality if not better job done offshore ? I am just concerned for the development labor market, the free market wants the lowest cost provider. not just programming but many high skilled labor such as engineering, scientists, artists and etc. perhaps i should become a lawyer ?

    Read the article

  • Prepared transactions with Postgres 8.4.3 on CentOS

    - by peter
    I have set 'max_prepared_transactions' to 20 in the local postgres.config and yet the transaction fails with the following error trace (but only on Linux). Since in Windows the same code works seamlessly I am wandering if this isn't an issue of permission. What would be the solution? Thanks Peter 372300 [Atomikos:7] WARN atomikos - XA resource 'XADBMS': rollback for XID '3137332E3230332E3132362E3139302E746D30303030313030303037:3137332E3230332E3132362E3139302E746D31' raised -3: the XA resource detected an internal error org.postgresql.xa.PGXAException: Error rolling back prepared transaction at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:357) at com.atomikos.datasource.xa.XAResourceTransaction.rollback(XAResourceTransaction.java:873) at com.atomikos.icatch.imp.RollbackMessage.send(RollbackMessage.java:90) at com.atomikos.icatch.imp.PropagationMessage.submit(PropagationMessage.java:86) at com.atomikos.icatch.imp.Propagator$PropagatorThread.run(Propagator.java:62) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) at java.lang.Thread.run(Thread.java:595) Caused by: org.postgresql.util.PSQLException: ERROR: prepared transaction with identifier "1096044365_MTczLjIwMy4xMjYuMTkwLnRtMDAwMDEwMDAwNw==_MTczLjIwMy4xMjYuMTkwLnRtMQ==" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:299) at org.postgresql.xa.PGXAConnection.rollback(PGXAConnection.java:347)

    Read the article

  • Gridview with row headers

    - by Seagull
    I am using the ASP.NET3.5 gridview control in a new project. My problem is that the gridview presents data in basic tabular format, whereas I want a grid with row header / grouping behaviors. An example of this would be Outlook web interface, which can group emails by date, as well as allowing you to select individual emails to display. My problem: I can't see how this could be easily done with Gridview? I did find a product called Telerik that has a seemingly fancy Gridview, but I am hesitant to spend money on a single components that now also locks me into a third-party framework...

    Read the article

  • Can I give a different id to define Cakephp model associations?

    - by gacrux
    I have an one to many association in which a Thing can have many Statuses defined as below: Status Model: class Status extends AppModel { var $name = 'Status'; var $belongsTo = array( 'Thing' => array( 'className' => 'Thing', 'foreignKey' => 'thing_id', ); } Thing Model: class Thing extends AppModel { var $name = 'Thing'; var $belongsTo = array( // other associations ); var $hasMany = array( 'Status' => array( 'className' => 'Status', 'foreignKey' => 'thing_id', 'dependent' => false, 'order' => 'datetime DESC', 'limit' => '10', ), // other associations ); } This works OK, but I would like Thing to use a different id to connect to Status. E.g. Thing would use 'id' for all of it's other associations but use 'thing_status_id' for it's Status association. How can I best do this?

    Read the article

  • What's it like being a financial programmer?

    - by Mike
    As a student who's done an internship at a Silicon Valley company(non-financial), I'm curious to know what it's like working for a financial company doing software development. I'd expect the hours to be longer, and the pay to be higher. Specifically, I have the following questions: What's the work/life balance really like? Are you expected to work 80 hours a week most weeks? For those who have worked in non-financial software engineering jobs, how does being a financial software engineer compare in terms of work/life balance? How much does it pay? I'm curious as to starting(i.e. just got a BS) pay, as well as "top out" pay. (I'd prefer concrete numbers - ballpark is fine). Also, bonuses would be useful information. What jobs do financial programmers typically have? Are most just general software engineers, or do people typically have very specialized(i.e. AI or systems) backgrounds? Also, do most programmers have PhDs? Are programmers typically required to be at work, or are financial companies generally flexible about letting programmers work from home? When at work, do programmers have to dress formally? What are the technology environments like? Are finance companies using state-of-the-art hardware and software, or are they generally more conservative in upgrading their equipment? What programming languages are typically used? If VBA(shudder) is used, is it a large part of a finance company's workflow? If you could turn back the clock, would you still be a financial programmer? I'm going to keep this post open a little bit longer to get some more responses.

    Read the article

  • Boost bind function

    - by Gokul
    Hi, I have a abstract base class A and a set of 10 derived classes. The infix operator is overloaded in all of the derived classes class A{ void printNode( std::ostream& os ) { this->printNode_p(); } void printNode_p( std::ostream& os ) { os << (*this); } }; There is a container which stores the base class pointers. I want to use boost::bind function to call the overloaded infix operator in each of its derived class. I have written like this std::vector<A*> m_args .... std::ostream os; for_each( m_args.begin(), m_args.end(), bind(&A::printNode, _1, os) ); What is the problem with this code? Thanks, Gokul.

    Read the article

  • What are some C++ Standard Library usage best practices?

    - by apphacker
    I'm learning C++ and the book I'm reading (The C++ Programming Language) says to not reinvent the wheel, to rely on the standard libraries. In C, I often end up creating a linked list, and link list iteration over and over again (maybe I'm doing that wrong not sure), so the ideas of containers available in C++, and strings, and algorithms really appeal to me. However I have read a little online, and heard some criticisms from my friends and coworkers about STL, so I thought I maybe I'd pick some brains here. What are some best practices for using STL, and what lessons have you learned about STL?

    Read the article

  • Beginning OS X & iPhone Development: Reference texts

    - by twinbornJoint
    My programming experience is limited to xhtml, css, php, sql and some javascript. The books I have are: Programming in Objective-C 2nd Edition Beginning iPhone Development Cocoa(R) Programming for Mac(R) OS X (Paperback) Is there anything else I will need to get started on my journey into iPhone/OS X development?

    Read the article

  • Objective C for beginners

    - by Golfgod130
    I was just asked to talk about Objective C to a bunch of High School student for 20 minutes. They have no experience with programming at all. What topics should I cover? Should I define vocab such as Method, Class, Variable? Or should I do something else? Any comments are helpful!

    Read the article

  • Forgot Microsoft Virtual PC's password

    - by Kanini
    I have a Microsoft Virtual PC on which I run Windows 2003 Server. I am right now in the system, but have forgotten the password. So, while I can continue to work now, if I were to lock the computer or shut it down, I am locked out. Questions How can I ensure that the Virtual PC automatic lock does not happen? (Giving me time to try and remember the password or for future users, to look up this question!) How can I find out/reset my password?

    Read the article

  • 24Hrs of PASS is back - and I won't use the phone this time

    - by simonsabin
    It was very amusing going to PASS and the MVP summit this year and people coming up to me asking how my baby was. Well thats not so amusing, how they know I‘ve got a baby is. During the last 24hrs of PASS my wife was overdue having our 3rd child, she had gone out and so I was on alert if the phone rang. Guess what it rang half way through my presentation on reporting services tips and tricks, luckily it wasn’t my wife but we did have the baby the next day. That was close. So 24hrs of PASS is back...(read more)

    Read the article

  • MYSQL Select and group by date

    - by Gil
    I'm not sure how create a right query to get the result I'm looking for. What I have is 2 tables. first has ID, Name columns and second has date and adminID, which is referenced from table 1 column ID. Now, what I want to get is basically number of times each admin loged in per day during the month. From structure like this one I want to get per day and month data so result would be similar to 1, 2, 2 march total 5 for admin 4. ID | Date ------------------ 4 | 2010/03/01 4 | 2010/03/04 4 | 2010/03/04 4 | 2010/03/05 4 | 2010/03/05

    Read the article

  • jQuery .queue() not working as expected

    - by Andrew
    The page in question is right here: http://s289116086.onlinehome.us/lawjournaltv/index.php I'm 90% of the way there, I'm just assuming there's an error with my syntax. Focus on the blue callout area with "Workers' Compensation" as the title: Basically, I've created a little slideshow there with the controls at the top and when you click on any of them both the callout and the background are to slide. As you can see it's working now, but the problem is that I want the new background to slide in over the old one. I've tried several things including the queue() method, delay(), and adding everything else to the animate() callback with no success (right now the background goes black and then the new image slides in). You guys have never let me down before, so I'm hoping this is an easy fix. Thanks in advance!

    Read the article

  • Join tables to get sold products

    - by latvian
    Hi, I am joining two tables 'sales/order_item_collection' and 'sales/orders' by 'order_id', so that afterward i can filter sold products by 'store_id' and 'product_name' Here is the code: $orderTable = Mage::getSingleton('core/resource')-getTableName('sales/order'); $itemsCollection= Mage::getResourceModel('sales/order_item_collection') -join(array('ord'=$orderTable),'e.order_id = ord.entity_id'); Why is this join not working? Thank you

    Read the article

  • How can I catch runtime error in C++

    - by Yan Cheng CHEOK
    By referring to http://stackoverflow.com/questions/315948/c-catching-all-exceptions try { int i = 0; int j = 0/i; /* Division by 0 */ int *k = 0; std::cout << *k << std::endl; /* De-reference invalid memory location. */ } catch (...) { std::cout << "Opps!" << std::endl; } The above run-time error are unable to be detected. Or, am I having wrong expectation on C++ exception handling feature?

    Read the article

  • how to add "Existing solution folder recursively" to my VS2005 solution

    - by user36753
    I tried drag and drop from the explorer, but no luck with following error: "Folders cannot be dropped or pasted as solution items. Choose an individual document instead." I know we can create each folders/subfolders manually and add each file, but any quick way to do this on visual studio 2005? Updated: Thank you for the reply, but I do not want the folders to be added under any project, It should appear as a separate node inside my solution, like any other project. In this case the show all files does not work, since the solution itself does not have any folder, it is only if we select any project it works. I know we can create each folders/subfolders manually and add each file, but any quick way, because there are few hundreds of files.

    Read the article

  • SQL storing data about columns

    - by Chris
    I'm learning SQL Server Compact for a program I'm writing that requries a local database. I have multiple tables, each with different columns and I'd like to mark each column as being a certain type (not a data type, just an integer tag) to let the program know what to do with it. I'm clueless about SQL. How does one do this?

    Read the article

  • List service and services status under Win-7

    - by Ronaldo Junior
    I have a service monitor app that monitors the status of three other servers app - you know those kind of green, red status stuff, start, stop, etc. The problem is that it shows the wrong state in Windows 7 even if the user is the administrator. The start, stop buttons are disabled and the install button enabled, the status color is grey which is also wrong. The start button should be enabled with the service status showing green - the apps are running. If the application is run with the setting "run as administrator" then it behaves normally. The application is written in Delphi 7 and works perfectly in other versions of Windows. This line of code: OpenSCManager(PChar(sMachine),Nil,SC_MANAGER_ALL_ACCESS) always return 0 under Win7, causing the problem. Any ideas and if possible, any workaround apart from "run as administrator". Regards Ronaldo

    Read the article

  • How does ImageView just redraw part of its content when invalidate(Rect) is called?

    - by imax366
    Hi, guys I am new to Android development, just reading docs and trying the APIs. I am quit confused how ImageView managed to draw just a part of its content after an invalidate(Rect) invocation. I've checked ImageView.java, found no other drawing method except onDraw(Canvas), but onDraw(Canvas) only cut the drawable only if it is beyound the view's visible boundary. I also read the implementation of View.invalidate(Rect), I think the key of this function is calling to mParent.invalidateChild(this, r); However, I think the parent view doesn't know how to draw the child in the given Rect, it finally has to call some method of it child to paint out. Has anybody investigated this part of codes? Would you please give me some guide?

    Read the article

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