Daily Archives

Articles indexed Saturday May 15 2010

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

  • Setting the comment of a column to that of another column in Postgresql

    - by dland
    Suppose I create a table in Postgresql with a comment on a column: create table t1 ( c1 varchar(10) ); comment on column t1.c1 is 'foo'; Some time later, I decide to add another column: alter table t1 add column c2 varchar(20); I want to look up the comment contents of the first column, and associate with the new column: select comment_text from (what?) where table_name = 't1' and column_name = 'c1' The (what?) is going to be a system table, but after having looked around in pgAdmin and searching on the web I haven't learnt its name. Ideally I'd like to be able to: comment on column t1.c1 is (select ...); but I have a feeling that's stretching things a bit far. Thanks for any ideas. Update: based on the suggestions I received here, I wound up writing a program to automate the task of transferring comments, as part of a larger process of changing the datatype of a Postgresql column. You can read about that on my blog.

    Read the article

  • rewrite URL for PUT request

    - by benjisail
    Hi, I changed the way my URL are working on my server. It is now www.myserver.com/service instead of www.myserver.com/test/service I have added a RedirectMatch 301 to my Apache conf file to redirect any access to www.myserver.com/test to www.myserver.com/. I am receiving file to this server via an HTTP PUT at this URL for example : www.myserver.com/test/service/put/myfile.xml The server sending the file don't handle the 301 HTTP status code so the files didn't arrived anymore. Is there a way to rewrite the URL when it is a PUT Request in order to don't miss any file? Thanks, Benjamin

    Read the article

  • How do I get the sums of the digits of a large number in Haskell?

    - by Tim
    I'm a C++ Programmer trying to teach myself Haskell and it's proving to be challenging grasping the basics of using functions as a type of loop. I have a large number, 50!, and I need to add the sum of its digits. It's a relatively easy loop in C++ but I want to learn how to do it in Haskell. I've read some introductory guides and am able to get 50! with sum50fac.hs:: fac 0 = 1 fac n = n * fac n - 1 x = fac 50 main = print x Unfortunately at this point I'm not entirely sure how to approach the problem. Is it possible to write a function that adds (mod) x 10 to a value and then calls the same function again on x / 10 until x / 10 is less than 10? If that's not possible how should I approach this problem? Thanks!

    Read the article

  • Service design or access to another process

    - by hotyi
    I have a cache service,it's works as .net remoting, i want to create another windows service to clean up the that cache service by transfer the objects from cache to files. because they are in separate process, is their any way i could access that cache service or do i have to expose a method from the cache service to do that clean up work? the "clean up" means i want to serialize the object from Cache to file and these saved file will be used for further process. let me explain this application more detail. the application is mainly a log service to log all the coming request and these request will be saved to db for further data mining. we have 2 design for this log system 1) use MSMQ, but seems it's performance is not good enough, we don't use it. 2) we design a cache service, each request will be saved into the cache, and we need another function to clean up the cache by serialize the object to file.

    Read the article

  • Initializing structs in C++

    - by Neil Butterworth
    As an addendum to this question, what is going on here: #include <string> using namespace std; struct A { string s; }; int main() { A a = {0}; } Obviously, you can't set a std::string to zero. Can someone provide an explanation (backed with references to the C++ Standard, please) about what is actually supposed to happen here? And then explain for example): int main() { A a = {42}; } Are either of these well-defined? Once again an embarrassing question for me - I always give my structs constructors, so the issue has never arisen before.

    Read the article

  • overload Equals, is this wrong?

    - by Zka
    Reading some piece of code and I keep seeing this : public override bool Equals (object obj) { if (obj == null || this.GetType ().Equals (obj.GetType())) return false; //compare code... } Shouldn't it be like this (note the !): public override bool Equals (object obj) { if (obj == null || !this.GetType ().Equals (obj.GetType())) return false; //compare code... } Or does the equals perform differently in this case?

    Read the article

  • How can I bind events to strongly typed datasets of different types?

    My application contains several forms which consist of a strongly typed datagridview, a strongly typed bindingsource, and a strongly typed table adapter. I am using some code in each form to update the database whenever the user leaves the current row, shifts focus away from the datagrid or the form, or closes the form. This code is the same in each case, so I want to make a subclass of form, from which all of these forms can inherit. But the strongly typed data objects all inherit from component, which doesn't expose the events I want to bind to or the methods I want to invoke. The only way I can see of gaining access to the events is to use: Type(string Name).GetEvent(string EventName).AddEventHandler(object Target,Delegate Handler) Similarly, I want to call the Update method of the strongly typed table adapter, and am using Type(string Name).GetMethod(String name, Type[] params).Invoke(object target, object[] params). It works ok, but it seems very heavy handed. Is there a better way? Here is my code for the main class: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data; using System.Data.SqlClient; using System.ComponentModel; namespace MyApplication { public class AutoSaveDataGridForm: Form { private DataRow PreviousRow; public Component Adapter { private get; set; } private Component dataGridView; public Component DataGridView { private get { return dataGridView; } set { dataGridView = value; Type t = dataGridView.GetType(); t.GetEvent("Leave").AddEventHandler(dataGridView, new EventHandler(DataGridView_Leave)); } } private Component bindingSource; public Component BindingSource { private get { return bindingSource; } set { bindingSource = value; Type t = bindingSource.GetType(); t.GetEvent("PositionChanged").AddEventHandler(bindingSource, new EventHandler(BindingSource_PositionChanged)); } } protected void Save() { if (PreviousRow != null && PreviousRow.RowState != DataRowState.Unchanged) { Type t = Adapter.GetType(); t.GetMethod("Update", new Type[] { typeof(DataRow[]) }).Invoke(Adapter, new object[] { new DataRow[] { PreviousRow } }); } } private void BindingSource_PositionChanged(object sender, EventArgs e) { BindingSource bindingSource = sender as BindingSource; DataRowView CurrentRowView = bindingSource.Current as DataRowView; DataRow CurrentRow = CurrentRowView.Row; if (PreviousRow != null && PreviousRow != CurrentRow) { Save(); } PreviousRow = CurrentRow; } private void InitializeComponent() { this.SuspendLayout(); // // AutoSaveDataGridForm // this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.AutoSaveDataGridForm_FormClosed); this.Leave += new System.EventHandler(this.AutoSaveDataGridForm_Leave); this.ResumeLayout(false); } private void DataGridView_Leave(object sender, EventArgs e) { Save(); } private void AutoSaveDataGridForm_FormClosed(object sender, FormClosedEventArgs e) { Save(); } private void AutoSaveDataGridForm_Leave(object sender, EventArgs e) { Save(); } } } And here is a (partial) form which implements it: public partial class FileTypesInherited :AutoSaveDataGridForm { public FileTypesInherited() { InitializeComponent(); } private void FileTypesInherited_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'sharedFoldersInformationV2DataSet.tblFileTypes' table. You can move, or remove it, as needed. this.tblFileTypesTableAdapter.Fill(this.sharedFoldersInformationV2DataSet.tblFileTypes); this.BindingSource = tblFileTypesBindingSource; this.Adapter = tblFileTypesTableAdapter; this.DataGridView = tblFileTypesDataGridView; } }

    Read the article

  • In Haskell, how can you sort a list of infinite lists of strings?

    - by HaskellNoob
    So basically, if I have a (finite or infinite) list of (finite or infinite) lists of strings, is it possible to sort the list by length first and then by lexicographic order, excluding duplicates? A sample input/output would be: Input: [["a", "b",...], ["a", "aa", "aaa"], ["b", "bb", "bbb",...], ...] Output: ["a", "b", "aa", "bb", "aaa", "bbb", ...] I know that the input list is not a valid haskell expression but suppose that there is an input like that. I tried using merge algorithm but it tends to hang on the inputs that I give it. Can somebody explain and show a decent sorting function that can do this? If there isn't any function like that, can you explain why? In case somebody didn't understand what I meant by the sorting order, I meant that shortest length strings are sorted first AND if one or more strings are of same length then they are sorted using < operator. Thanks!

    Read the article

  • Makefile variable initialization and export

    - by Michael
    somevar := apple export somevar update := $(shell echo "v=$$somevar") all: @echo $(update) I was hoping to apple as output of command, however it's empty, which makes me think export and := variable expansion taking place on different phases. how to overcome this?

    Read the article

  • Cluster Graph Visualization using python

    - by AlgoMan
    I am assembling different visualization tools that are available in python language. I found the Treemap. (http://pypi.python.org/pypi/treemap/1.05) Can you suggest some other tools that are available. I am exploring different ways of visualization of web data.

    Read the article

  • Why doesn't negative values for the second index in a jagged array work in Python?

    - by univerio
    For example, if I have the following (data from Project Euler): s = [[75], [95, 64], [17, 47, 82], [18, 35, 87, 10], [20, 4, 82, 47, 65], [19, 1, 23, 75, 3, 34], [88, 2, 77, 73, 7, 63, 67], [99, 65, 4, 28, 6, 16, 70, 92], [41, 41, 26, 56, 83, 40, 80, 70, 33], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29], [53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14], [70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57], [91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48], [63, 66, 4, 68,89, 53, 67, 30, 73, 16, 69, 87, 40, 31], [4, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23]] Why does s[1:][:-1] give me the same thing as s[1:] instead of (what I want) [s[i][:-1] for i in range(1,len(s))]. In other words, why does Python ignore my second index?

    Read the article

  • How to search cvs comment history

    - by Chris Noe
    I am aware of this command: cvs log -N -w<userid> -d"1 day ago" Unfortunately this generates a formatted report with lots of newlines in it, such that the file-path, the file-version, and the comment-text are all on separate lines. Therefore it is difficult to scan it for all occurrences of comment text, (eg, grep), and correlate the matches to file/version. (Note that the log output would be perfectly acceptable, if only cvs could perform the filtering natively.) EDIT: Sample output. A block of text like this is reported for each repository file: RCS file: /data/cvs/dps/build.xml,v Working file: build.xml head: 1.49 branch: locks: strict access list: keyword substitution: kv total revisions: 57; selected revisions: 1 description: ---------------------------- revision 1.48 date: 2008/07/09 17:17:32; author: noec; state: Exp; lines: +2 -2 Fixed src.jar references ---------------------------- revision 1.47 date: 2008/07/03 13:13:14; author: noec; state: Exp; lines: +1 -1 Fixed common-src.jar reference. =============================================================================

    Read the article

  • Play mp3 stream from http URL on Windows Mobile 6.0

    - by Thyphuong
    After a short period of time learning about how to play a mp3 http url on windows mobile 6.0, I found that very less dll support that (until now, I just found out Bass.dll work nice). So I intend to change to another way to approach the goal. Here's my idea: Get a stream from http url. Decode the mp3 stream. Play the result from step 2. Coz I'm new on this field, so feel free and explain to me what I'm wrong and/or show me the way.

    Read the article

  • Silverlight Security

    Here are some interesting links about Silverlight security (I learnt a lot from the first document): Silverlight security whitepaper: > http://download.microsoft.com/download/A/1/A/A1A80A28-907C-4C6A-8036-782E3792A408/Silverlight Security Overview.docx This reading gives you a lot of insight into features like Isolated Storage, Local Messaging, Cross-Site Scripting (XSS), Sandbox, Validate input, https, . Shawn Wildermuths session at MIX10: > Securing Microsoft Silverlight Applications ...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

  • WCF RIA Services feedback

      If you use or plan to use WCF RIA Services, here is your chance to shape the future of this product, vote or propose features for vNext in this page: http://dotnet.uservoice.com/forums/57026-wcf-ria-services You can find help and ask questions on the current release of RIA Services on the official forum: http://forums.silverlight.net/forums/53.aspx ...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

  • SQL SERVER List All the DMV and DMF on Server

    “How many DMVs and DVFs are there in SQL Server 2008?” – this question was asked to me in one of the recent SQL Server Trainings. Answer is very simple: SELECT name, type, type_desc FROM sys.system_objects WHERE name LIKE 'dm_%' ORDERBY name Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Query, [...]...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

  • Linking Linux MIT Kerberos with a Windows 2003 Active Directory

    - by Beerdude26
    Greetings, I was wondering how one might link a Linux MIT Kerberos with a Windows 2003 Active Directory to achieve the following: A user, [email protected], attempts to log in at an Apache website, which runs on the same server as the Linux MIT Kerberos. The Apache module first asks the local Linux MIT Kerberos if he knows a user by that name or realm. The MIT Kerberos finds out it isn't responsible for that realm, and forwards the request to the Windows 2003 Active Directory. The Windows 2003 Active Directory replies positively and gives this information to the Linux MIT Kerberos, which in turn tells this to the Apache module, which grants the user access to its files. Here is an image of the situation: http://img179.imageshack.us/img179/5092/linux2k3.png (I'm not allowed to embed images just yet.) The documentation I have read concerning this issue often differ from this problem: Some discuss linking up a MIT Kerberos with an Active Directory to gain access to resources on the Active Directory server; While another uses the link to authenticate Windows users to the MIT Kerberos through the Windows 2003 Active Directory. (My problem is the other way around.) So what my question boils down to, is this: Is it possible to have a Linux MIT Kerberos server pass through requests for a Active Directory realm, and then have it receive the reply and give it to the requesting service? (Although it's not a problem if the requesting service and the Windows 2003 Active Directory communicate directly.) Suggestions and constructive criticism are greatly appreciated. :)

    Read the article

  • How to reject a call without delay in ring on windows mobile?

    - by Mayur
    Hello, I am trying to write a code to reject the incoming call programatically on windows mobile 6. my requirement is to achieve this without a single ring. I tried using systemstate property but it gives deley of one ring. I even tried with OpenNETCF's tapi wrapper but still i am getting the same result. Can anybody tell me what actually can I do to achieve this? Thanks in advance.

    Read the article

  • How can I turn a string of text into a BigInteger representation for use in an El Gamal cryptosystem

    - by angstrom91
    I'm playing with the El Gamal cryptosystem, and my goal is to be able to encipher and decipher long sequences of text. I have come up with a method that works for short sequences, but does not work for long sequences, and I cannot figure out why. El Gamal requires the plaintext to be an integer. I have turned my string into a byte[] using the .getBytes() method for Strings, and then created a BigInteger out of the byte[]. After encryption/decryption, I turn the BigInteger into a byte[] using the .toByteArray() method for BigIntegers, and then create a new String object from the byte[]. This works perfectly when i call ElGamalEncipher with strings up to 129 characters. With 130 or more characters, the output produced is garbled. Can someone suggest how to solve this issue? Is this an issue with my method of turning the string into a BigInteger? If so, is there a better way to turn my string of text into a BigInteger and back? Below is my encipher/decipher code. public static BigInteger[] ElGamalEncipher(String plaintext, BigInteger p, BigInteger g, BigInteger r) { // returns a BigInteger[] cipherText // cipherText[0] is c // cipherText[1] is d BigInteger[] cipherText = new BigInteger[2]; BigInteger pText = new BigInteger(plaintext.getBytes()); // 1: select a random integer k such that 1 <= k <= p-2 BigInteger k = new BigInteger(p.bitLength() - 2, sr); // 2: Compute c = g^k(mod p) BigInteger c = g.modPow(k, p); // 3: Compute d= P*r^k = P(g^a)^k(mod p) BigInteger d = pText.multiply(r.modPow(k, p)).mod(p); // C =(c,d) is the ciphertext cipherText[0] = c; cipherText[1] = d; return cipherText; } public static String ElGamalDecipher(BigInteger c, BigInteger d, BigInteger a, BigInteger p) { //returns the plaintext enciphered as (c,d) // 1: use the private key a to compute the least non-negative residue // of an inverse of (c^a)' (mod p) BigInteger z = c.modPow(a, p).modInverse(p); BigInteger P = z.multiply(d).mod(p); byte[] plainTextArray = P.toByteArray(); String output = null; try { output = new String(plainTextArray, "UTF8"); } catch (Exception e) { } return output; }

    Read the article

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