Daily Archives

Articles indexed Thursday May 27 2010

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

  • Whats the deal with python?

    - by gmatt
    My interests in programming lie mainly in algorithms, and lately I have seen many reputable researchers write a lot of their code in python. How easy and convenient is python for scientific computing? Does it have a library of algorithms that compares to matlab's? Is Python a scripting language or does it compile? Is it a great language for prototyping an algorithm? How long would it take me to learn enough of it to be productive provided I know C well and OO programming somewhat? Is it OO based? Sorry for the condensed format of questions, but I'm very curious and was hoping a more experienced programmer could help me out.

    Read the article

  • Drag and Drop to explorer causing invalid FORMATETC (DV_E_FORMATETC) error

    - by JustABill
    I'm trying to use this excellent example to implement dropping virtual files into Windows Explorer. However, I'm stymied by this error. Towards the bottom, inside void System.Runtime.InteropServices.ComTypes.IDataObject.GetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC formatetc, out System.Runtime.InteropServices.ComTypes.STGMEDIUM medium) on the first call to ((System.Runtime.InteropServices.ComTypes.IDataObject)this).GetDataHere(ref formatetc, ref medium); I'm getting back a DV_E_FORMATETC error. As far as I can tell, all the elements of the FORMATETC struct that are being passed in are valid: cfFormat is "Shell IDList Array" (-16141), ptd is 0, dwAspect is DVASPECT_CONTENT, lindex is -1, and tymed is TYMED_HGLOBAL. I'm kind of confused how there'd be a problem anyway, since this was generated by explorer. I know very little about COM interaction, so any help would be greatly appreciated.

    Read the article

  • Please advise on handling the existing geek

    - by ranja
    Quick Story: I started a new job where everyone funneled their questions to 'the geek'. Being an experienced developer, I can do most of my assignments without consultation with the geek - thinks such as how to select the top 10 rows in a table. Question: Is there a preferred way of handling these cases without offending the existing geek while ensuring the best solution gets implemented? My issue is the the existing geek is very young and makes a lot of mistakes, but still sounds authoritative because the other coders are just out of school and don't know better.

    Read the article

  • Nokogiri find only inbound links

    - by astropanic
    I have an html document located on http://somedomain.com/somedir/example.html The document contains of four links: http://otherdomain.com/other.html http://somedomain.com/other.html /only.html test.html How I can get the full urls for the links in the current domain ? I mean I should get: http://somedomain.com/other.html http://somedomain.com/only.html http://somedomain.com/somedir/test.html The first link should be ignored because it does'nt match my domain

    Read the article

  • Play .WAV under Mono on Mac OS X (Snow Leopard)?

    - by Bob Denny
    The Mono 2.6 distribution contains System.Media.SoundPlayer, but attempts to play result in no sound (and no errors) on Mac OS X. All I can find with Google search is obscure references to ALSA. I posted to the Mono-OSX list, but there have been on replies there. I hope someone here has an answer. I think I need to tap into CoreAudio, but don't know how from Mono/C#.

    Read the article

  • Any benefits of using Windows Communication Foundation/ Web Services vs. a simple .aspx page for s

    - by Clay Nichols
    I'm working on a VB6 app that will do some very simple communication with a web server (passing value and getting back an anwer. Low bandwith and infrequent use). Someone suggested using WCF or Web Services. I'm wondering what the advantages are vs. just posting to an ASPX page like: Myserver.com/Functions.ASP?FunctionName=GetValue?UserName=BubbGump and returning some simple, easy to parse text, like one value per line.

    Read the article

  • Save blob to DB using hibernate

    - by Link123
    Hey! I tried save file to MySQL using blob with hibernate3. But I always have java.lang.UnsupportedOperationException: Blob may not be manipulated from creating session org.hibernate.lob.BlobImpl.excep(BlobImpl.java:127) Here some code. package com.uni.domain; public class File extends Identifier { private byte[] data; private String contentType; public byte[] getData() { return data; } public File() {} public void setData(byte[] photo) { this.data = photo; } public boolean isNew() { return true; } public String getContentType() { return contentType; } public void setContentType(String contentType) { this.contentType = contentType; } } package com.uni.domain; import org.hibernate.Hibernate; import org.hibernate.HibernateException; import org.hibernate.usertype.UserType; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import java.sql.*; import java.util.Arrays; public class PhotoType implements UserType { public int[] sqlTypes() { return new int[]{Types.BLOB}; } public Class returnedClass() { return byte[].class; } public boolean equals(Object o, Object o1) throws HibernateException { return Arrays.equals((byte[]) o, (byte[]) o1); } public int hashCode(Object o) throws HibernateException { return o.hashCode(); } public Object nullSafeGet(ResultSet resultSet, String[] strings, Object o) throws HibernateException, SQLException { Blob blob = resultSet.getBlob(strings[0]); return blob.getBytes(1, (int) blob.length()); } public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { st.setBlob(index, Hibernate.createBlob((byte[]) value)); } public Object deepCopy(Object value) { if (value == null) return null; byte[] bytes = (byte[]) value; byte[] result = new byte[bytes.length]; System.arraycopy(bytes, 0, result, 0, bytes.length); return result; } public boolean isMutable() { return true; } public Serializable disassemble(Object o) throws HibernateException { return null; . } public Object assemble(Serializable serializable, Object o) throws HibernateException { return null; . } public Object replace(Object o, Object o1, Object o2) throws HibernateException { return null; . } <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.uni.domain"> <class name="com.uni.domain.File"> <id name="id"> <generator class="native"/> </id> <property name="data" type="com.uni.domain.FleType"/> <property name="contentType"/> </class> </hibernate-mapping> Help me please. Where I’m wrong?

    Read the article

  • What notes should I be taking, if any, at the beginning of a project?

    - by Justin R.
    I was recently asked by a Team Leader (not mine) if I would be willing to undertake a programming project. The members of his team are currently pre-occupied with other more important projects. I graduated college two years ago, and up until now programming has only been a hobby of mine. Recently I decided that I would like to pursue a career in software development. I accepted his offer so that I can gain some real-world experience and start building a portfolio. In about an hour I'm scheduled to meet with the Team Leader to discuss the details of what he needs. From a short e-mail exchange with him, I know that the base project is to update an existing ASP.NET form—but I also think there's more to it than that. Considering that I'd like to eventually put this project in a portfolio, what kinds of notes should I take at the meeting?

    Read the article

  • stumped by WSGI module import errors

    - by rguha
    Hi, I'm writing a bare bones Python wsgi application and am getting stumped by module import errors. I have a .py file in the current directory which initially failed to import. By adding sys.path.insert(0, '/Users/guhar/Sites/acom') the import of the module worked. But I now try and import a module that I had installed via easy_install and it fails to import. I tried setting sys.path.insert(0, '/Library/Python/2.5/site-packages/') which contains the egg file, but to no avail. I would've thought that all packages under "/Library/Python/2.5/site-packages/" would be available to a WSGI application. Does anybody have any pointers?

    Read the article

  • Mapping Help in the EDM Designer

    The mapping details window that displays the mappings between an entity and database table(s) is pretty straightforward. When you join two related tables in a Table Per Hierarchy inheritance things can get a little confusing when it comes to the mappings for inherited properties. But did you know that the Mapping Details window uses the Properties window to help? Here are two entities in a TPH hierarchy. Customer inherits Contact. Customer maps to a Customers table which uses ContactID as...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

  • Response.Redirect in HttpModule

    - by AgentHunt
    Can I do a redirect to a custom page in an HttpModule? I have an HttpModule A which executes some javascript code when any aspx page is loaded. I would like to have a server side code check to see if the clients browsers supports cookies. Can I place that code in the HttpModule A? If so, in which event? Or do I need to have a new HttpHandler for both purposes? Also, is it possible to check for cookies in an HttpModule(without a response.redirect)? All solutions I have seen need 2 pages, 1 for setting the cookie and the other for checking if the cookie has actually been created. I am hoping there should be a way to check for cookies at one place. Thanks in advance

    Read the article

  • How to control a NSView, located in a dedicated NSWindow, from the main NSWindow designed to support

    - by Michael
    Hi, This is probably a simple problem for the high skilled Cocoa programmers, but I can't find how to control the graph in a separate window. I read carefully the Cocoa related books, go through many web notes,but I can't find a solution to my problem. The purpose is to use a dedicated window to draw the I=F(Vg) curves extracted by the GUI from a specific hardware. All the GUI and the hardware works fine ( thanks to the help provided by several members of stackoverflow) , but no way to send the parameters to the NSView to display the results. So far, the GUI class is based on a NSObject, the graphic class is NSView. Any idea, examples, links will be appreciated. Thank you so much. Michael

    Read the article

  • Visualization in "VisIt"

    - by Naveen
    Hi, Did any one over here work in "VisIt" visualization software? I have a dataset where the x, y, z coordinates are stored in separate bin files, i don't know how to visualize these files in VisIt, which would be the best file format to use. Till now, we were using Advanced Visual System (AVS) .fld files to read the data in AVS, now we have to switch to VisIt, don't know how to do it. Would appreciate if anyone can give some pointers in this direction.

    Read the article

  • How Can I Generate Equivalent Output Using the CryptoAPI and the .NET Encryption (TripleDESCryptoSer

    - by S. Butts
    I have some C#/.NET code that encrypts and decrypts data using TripleDES encryption. It sticks to the sample code provided at MSDN pretty closely. The encryption piece looks like the following: TripleDESCryptoServiceProvider _desProvider = new TripleDESCryptoServiceProvider(); //bytes for key and initialization vector //keyBytes is 24 bytes of stuff, vectorBytes is 8 bytes of stuff byte[] keyBytes; byte[] vectorBytes; FileStream fStream = File.Open(locationOfFile, FileMode.Create, FileAccess.Write); CryptoStream cStream = new CryptoStream(fStream, _desProvider.CreateEncryptor(keyBytes, vectorBytes), CryptoStreamMode.Write); BinaryWriter bWriter = new BinaryWriter(cStream); //write out encrypted data //raw data is a few bytes of binary information byte[] rawData; bWriter.Write(rawData); With encrypting and decrypting in C#, this all works like a charm. The problem is I need to write a small Win32 utility that will duplicate the encryption above. I have tried several methods using the CryptoAPI, and I simply do not get output that the .NET piece can decrypt, no matter what I do. Can someone please tell me what the equivalent C++ code is that will produce the same output? I am not certain just what methods of the CryptoAPI the .NET functions use to encrypt the data. What options are used, and what method of generating the key is used? Before someone suggests that I just write it in C# anyway, or create some common library bridge for them, those options are unfortunately off the table. It really has to work in Win32 with .NET and without using a DLL. I have some leeway in changing the C# code. I apologize in advance if this is bone-headed, as I am new to encryption.

    Read the article

  • ODBC: when is the best time to create my database?

    - by mawg
    I have a windows program which generates PGP forms which will be filled in later. Those PHP forms will populate a database. It looks very much like MySql, but I can't be certain, so let's call it ODBC. And, yes, it does have to be a windows program. There will also be PHP forms which query the database - examine which tables and fields it contains and then generates forms which can be used to search the database (e.g, it finds a table with fields "employee_name", etc and generates a form which lets you search based on employee name. Let's call that design time and run time. At design time, some manager or IT guy or similar gets to define the nature of the database and at runtime 1) a worker fills in the form daily and 2) management can extract reports. Here's my question: given that the database is defined at "design time" (and populated at run time), where and how is best to do so? 1 I could use an ODBC interface from the windows program, but I am having difficulty finding something good to work with Delphi. Things like ADO and firebird tend to expect you to already have a database and allow you to manipulate it, but I can find no code example of how to create a database and some tables, so ... 2 I could used DOS commands from Delphi in my windows program. I just tried and got a response to MySql --version, but am not sure if MySql etc are more interactive. That is, can I use a script file or a very long stacked command with semicolons and returns separating? e.g 'CREATE DATABASE db; CREATE TABLE t1;' 3) Since the best way to work with databases seems to be PHP, perhaps my windows program could spit out a PHP page which would, when run in a browser, create the database. I have tried to make this as uncomplicated as I can, but please feel free to ask questions. It may be that there are several valid ways, but there is probably one 'better' solution in terms of ease of implementation or maintenance. Better scratch option 3. What if the user later wants to come back and have the windows program change the input form? It needs to update the database too.

    Read the article

  • Get Path of Uploaded File using Python

    - by Ali
    Is it possible to get the full path of the file on the user's computer being uploaded to my site? Using os.path.abspath(fileitem.filename) simply gets me the address of where my script is executing from on my shared hosting server. FYI: fileitem = form['file'] and form = cgi.FieldStorage()

    Read the article

  • Regex to validate SMTP Responses?

    - by Alix Axel
    I'm writing a regular expression that can interactively validate SMTP responses codes, once the SMTP dialog is completed it should pass the following regex (some parentheses added for better readability): ^(220)(250){3,}(354)(250)(221)$ Or with(out) authentication: ^(220)(250)((334){2}(235))?(250){2,}(354)(250)(221)$ I'm trying to do rewrite the above regexes so that I can interactively check if the dialog is going as expected, otherwise politely send a QUIT command and close the connection saving bandwidth and time, but I'm having a hard time writing an optimal regex. So far I've managed to come up with: ^(220(250(334(235(250(354(250(221)?)?)?){0,})?){0,2})?)?$ Which, besides only matching authenticated connections, has some bugs... For instance, it matches: 220250334235250354250221 220250334334235250354250221 I've also tried the following modification: ^(220(250)?)?((334(235)?){2})?(250(354(250(221)?)?)?){0,}$ This one accepts non-authenticated responses but it fails to match 220250334 and wrongly matches 220250334334235250354250221 (at least 2 250 are needed before the 354 response code). Can someone help me out with this? Thanks in advance.

    Read the article

  • Succinct But Complete Example of WPF App?

    - by Eric J.
    Is there a succinct but complete example project or tutorial that brings together the pieces of the Microsoft stack for a complete application? WPF MVVM Business Objects EF Database I find plenty for WPF and plenty for EF, but am having trouble fully understanding how the EF generated classes relate to business objects, and how those business objects in turn fit into the MVVM pattern.

    Read the article

  • Will Apple bundle the Mono Touch runtime with every iPhone?

    - by Zoran Simic
    It strikes me as a good idea for Apple to negotiate with Novell and bundle the Mono Touch runtime (only the runtime of course) into every iPhone and iPod Touch. Perhaps even make it a "one time install" that automatically gets downloaded from the App Store the first time one downloads an app build with Mono Touch, making every subsequent Mono Touch app much lighter to download (without the runtime). Doing so would be similar in a way to adding Bootcamp to OS X: it would make it easier for C# developers to join the party, but that wouldn't mean these developers will all stick to C#... What convinced me to buy a Mac is Bootcamp - I figured I could always install Windows if I didn't like OS X (and I liked the hardware, so no problem there). 6 months later, I'm using OS X full time... Would there be any technical issues in doing so? I see only advantages for all parties, not one disadvantage to anyone (except maybe for the few unfortunate Apple employees who would have to test the crap out of the Mono Touch runtime before bundling it): Novell wins because Mono Touch becomes much more viable (Mono Touch apps become much lighter all of the sudden) Developers win because now there's one more tool in the tool belt Many C# Developers would be very interested by this Apple wins because that would bring even more attention to the platform, more revenue in developer fees, more potential great apps, etc Users win because less space is used by different Apps having copies of the same runtime accumulating on their devices Would there be a major technical obstacle in bundling Mono Touch to iPhone OS? Edit: Changed the title from "Should" to "Will Apple bundle the runtime?", I think the consensus on predicting that means a lot to those considering going with Mono Touch.

    Read the article

  • Basic class returns object reference instead of Array

    - by php-b-grader
    I have very basic class: class Customer { protected $id; protected $customer; public function __construct($customer_id) { $this->id = $customer_id; return $this->set_customer(); } protected function set_customer() { $query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'"); $this->customer = mysql_fetch_row($query); return $this->customer; } } $customer = new Customer($order->customer->id); print_r($customer); This is not doing what I want it to but I understand why... $customer returns a reference to the Customer Object... What I want is the MySQL row array from the mysql_fetch_row() - How do I return the array? What am I missing?

    Read the article

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