Daily Archives

Articles indexed Friday March 12 2010

Page 24/130 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Which XML library for what purposes?

    - by John Mee
    A search for "python" and "xml" returns a variety of libraries for combining the two. This list probably faulty: xml.dom xml.etree xml.sax xml.parsers.expat PyXML beautifulsoup? HTMLParser htmllib sgmllib Be nice if someone can offer a quick summary of when to use which, and why.

    Read the article

  • Atomically increment a field using SubSonic 3 ActiveRecord.

    - by cantabilesoftware
    I'm tring to increment a field in a MySQL database using SubSonic 3 ActiveRecord. In SQL, this is what I'm after: UPDATE people SET messages_received=messages_received+1 WHERE people_id=@id_to; I tried the following, but it didn't seem to work (messages_received always seemed to be 1): _db.Update<person>() .Set("messages_received").EqualTo(x => x.messages_received == x.messages_received + 1) .Where(x => x.people_id == idTo) .Execute(); This did work: string sql="UPDATE people SET messages_received=messages_received+1 WHERE people_id=@id_to"; var q=new SubSonic.Query.QueryCommand(sql, _db.Provider); q.AddParameter("id_to", idTo); q.Provider.ExecuteQuery(q); So I have a solution, but I'm just wondering if it's possible to do this without resorting to plain SQL?

    Read the article

  • Micro Second resolution timestamps on windows.

    - by Nikhil
    How to get micro second resolution timestamps on windows? I am loking for something better than QueryPerformanceCounter, QueryPerformanceFrequency (these can only give you an elapsed time since boot, and are not necessarily accurate if they are called on different threads - ie QueryPerformanceCounter may return different results on different CPUs. There are also some processors that adjust their frequency for power saving, which apparently isn't always reflected in their QueryPerformanceFrequency result.) There is this, http://msdn.microsoft.com/en-us/magazine/cc163996.aspx but it does not seem to be solid. This looks great but its not available for download any more. http://www.ibm.com/developerworks/library/i-seconds/ This is another resource. http://www.lochan.org/2005/keith-cl/useful/win32time.html But requires a number of steps, running a helper program plus some init stuff also, I am not sure if it works on multiple CPUs Also looked at the Wikipedia link on the subject which is interesting but not that useful. http://en.wikipedia.org/wiki/Time_Stamp_Counter If the answer is just do this with BSD or Linux, its a lot easier thats fine, but I would like to confirm this and get some explanation as to why this is so hard in windows and so easy in linux and bsd. Its the same damm hardware...

    Read the article

  • Health Check: Mandriva

    <b>The H Open:</b> "Mandriva began life in July 1998 as Linux Mandrake in France in Gael Duval's bedroom after he ported a KDE 1.0 desktop onto Red Hat Linux 5.1, uploaded the result onto two FTP servers, went away on holiday, and came back to find that he had a popular and successful Linux distribution on his hands."

    Read the article

  • Apahce - How to disable gzip content encoding (eg DEFLATE) for one set of URLs?

    - by Rory McCann
    I have a ubuntu apache webserver and I have enabled mod_deflate to gzip all the content. However there's one folder I'd like to disable the mod_deflate for. I was going to do something like this: <Location /myfolder> RemoveOutputFilter DEFLATE </Location> But that doesn't work. Rational: I am trying to debug an XMLRPC server and I am using wireshark to see what gets past in the HTTP requests, since the replies are gzipped, I can't see what's going on.

    Read the article

  • Representing xml through a single class

    - by Charles
    I am trying to abstract away the difficulties of configuring an application that we use. This application takes a xml configuration file and it can be a bit bothersome to manually edit this file, especially when we are trying to setup some automatic testing scenarios. I am finding that reading xml is nice, pretty easy, you get a network of element nodes that you can just go through and build your structures quite nicely. However I am slowly finding that the reverse is not quite so nice. I want to be able to build a xml configuration file through a single easy to use interface and because xml is composed of a system of nodes I am having a lot of struggle trying to maintain the 'easy' part. Does anyone know of any examples or samples that easily and intuitively build xml files without declaring a bunch of element type classes and expect the user to build the network themselves? For example if my desired xml output is like so <cook version="1.1"> <recipe name="chocolate chip cookie"> <ingredients> <ingredient name="flour" amount="2" units="cups"/> <ingredient name="eggs" amount="2" units="" /> <ingredient name="cooking chocolate" amount="5" units="cups" /> </ingredients> <directions> <direction name="step 1">Preheat oven</direction> <direction name="step 2">Mix flour, egg, and chocolate</direction> <direction name="step 2">bake</direction> </directions> </recipe> <recipe name="hot dog"> ... How would I go about designing a class to build that network of elements and make one easy to use interface for creating recipes? Right now I have a recipe object, an ingredient object, and a direction object. The user must make each one, set the attributes in the class and attach them to the root object which assembles the xml elements and outputs the formatted xml. Its not very pretty and I just know there has to be a better way. I am using python so bonus points for pythonic solutions

    Read the article

  • Extract text and image from a pdf in a selected area or coordinates

    - by yercaudARUN
    Hi All, I have a specific requirement of extracting text and images from a specific area in a pdf file.The area might be a selected or highlighted or from a given set of coordinates. When i went through, all the approaches are to extract images and text entirely from the PDF on not in a specified location. I tried with iTextSharp,Syncfussion,Apose but couldn figure out a better approach for this. If somebody could help me out in this it would be greatfull. Can you share your ideas and suggestion on how to implement this in .net. Regards, Arun.M

    Read the article

  • PHP problem with getimagesize()

    - by RobHardgood
    I'm using the getimagesize() function in PHP and it keeps returning an error: getimagesize(image.php?name=username&pic=picture) [function.getimagesize]: failed to open stream: No such file or directory I'm not doing anything strange with it. The only problem I can imagine is that the path URL is another PHP script that returns a page with an image header, and there is an ampersand in that URL. Here is my code: $location = "image.php?name=username&pic=picture"; $size = getimagesize($location);

    Read the article

  • How do I find the root path of a website from a dll?

    - by Biff MaGriff
    I have a C# website. It references several compiled dlls. My dlls need to access folders on the website. How do I find the root path of the website from the dlls? I've tried System.Environment.CurrentDirectory - "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE" Assembly.GetExecutingAssembly().Location - C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files...... I was going to use System.Web.HttpContext.Current.Server.MapPath() but System.Web.HttpContext.Current is null. Thanks!

    Read the article

  • Matlab cell length

    - by AP
    Ok I seem to have got the most of the problem solved, I just need an expert eye to pick my error as I am stuck. I have a file of length [125 X 27] and I want to convert it to a file of length [144 x 27]. Now, I want to replace the missing files (time stamps) rows of zeros. (ideally its a 10 min daily average thus should have file length of 144) Here is the code I am using: fid = fopen('test.csv', 'rt'); data = textscan(fid, ['%s' repmat('%f',1,27)], 'HeaderLines', 1, 'Delimiter', ','); fclose(fid); %//Make time a datenum of the first column time = datenum(data{1} , 'mm/dd/yyyy HH:MM') %//Find the difference in minutes from each row timeDiff = round(diff(datenum(time)*(24*60))) %//the rest of the data data = cell2mat(data(2:28)); newdata=zeros(144,27); for n=1:length(timeDiff) if timeDiff(n)==10 newdata(n,:)=data(n,:); newdata(n+1,:)=data(n+1,:); else p=timeDiff(n)/10 n=n+p; end end Can somebody please help me to find the error inside my for loop. My output file seems to miss few timestamped values. %*********************************************************************************************************** Can somebody help me to figure out the uiget to read the above file?? i am replacing fid = fopen('test.csv', 'rt'); data = textscan(fid, ['%s' repmat('%f',1,27)], 'HeaderLines', 1, 'Delimiter', ','); fclose(fid); With [c,pathc]=uigetfile({'*.txt'},'Select the file','C:\data'); file=[pathc c]; file= textscan(c, ['%s' repmat('%f',1,27)], 'HeaderLines', 1, 'Delimiter', ','); And its not working % NEW ADDITION to old question p = 1; %index into destination for n = 1:length(timeDiff) % if timeDiff(n) == 10 % newfile(p,:) = file(n,:); % newfile(p+1,:)=file(n+1,:); % p = p + 1; % else % p = p + (timeDiff(n)/10); % end q=cumsum(timeDiff(n)/10); if q==1 newfile(p,:)=file(n,:); p=p+1; else p = p + (timeDiff(n)/10); end end xlswrite('testnewws11.xls',newfile); even with the cumsum command this code fails when my file has 1,2 time stamps in middle of long missing ones example 8/16/2009 0:00 5.34 8/16/2009 0:10 3.23 8/16/2009 0:20 2.23 8/16/2009 0:30 1.23 8/16/2009 0:50 70 8/16/2009 2:00 5.23 8/16/2009 2:20 544 8/16/2009 2:30 42.23 8/16/2009 3:00 71.23 8/16/2009 3:10 3.23 My output looks like 5.34 3.23 2.23 0 0 0 0 0 0 0 0 0 5.23 544. 42.23 0 0 0 3.23 Any ideas?

    Read the article

  • Unique Key in MySql

    - by Vinodtiru
    I have a table with four Columns. Col1, Col2, Col3, and Col4. Col1, Col2, Col3 is string and Col4 is a integer primary key with Auto Increment. Now my requirement is to have unique combination of Col2 and Col3. I mean to say like. Insert into table(Col1,Col2,Col3) Values('val1','val2','val3'); Insert into table(Col1,Col2,Col3) Values('val4','val2','val3'); the second statement has to throw error as the same combination of 'val2','val3' is present in the table. But i cant make it as a primary key as i need a auto increment column and for that matter the col4 has to be primary. Please let me know a approach by which i can have both in my table. Any kind of help is appreciated. Thanks.

    Read the article

  • Check if a file is real or a symbolic link

    - by mattdwen
    Is there a way to tell using C# if a file is real or a symbolic link? I've dug through the MSDN W32 docs (http://msdn.microsoft.com/en-us/library/aa364232(VS.85).aspx), and can't find anything for checking this. I'm using CreateSymbolicLink from here, and it's working fine.

    Read the article

  • Unexpected result from printf

    - by Sandeep
    #include<stdio.h> int main() { printf("He %c llo",65); } Output: He A llo #include<stdio.h> int main() { printf("He %c llo",13); } Output: llo. It doesnt print He. I can understand that 65 is ascii value for A and hence A is printed in first case but why llo in second case. Thanks

    Read the article

  • How to bulk insert data from ref cursor to a temporary table in PL/SQL

    - by Sambath
    Could anyone tell me how to bulk insert data from a ref cursor to a temporary table in PL/SQL? I have a procedure that one of its parameters stores a result set, this result set will be inserted to a temporary table in another stored procedure. This is my sample code. CREATE OR REPLACE PROCEDURE get_account_list ( type_id in account_type.account_type_id%type, acc_list out sys_refcursor ) is begin open acc_list for select account_id, account_name, balance from account where account_type_id = type_id; end get_account_list; CREATE OR REPLACE PROCEDURE proc1 ( ... ) is accounts sys_refcursor; begin get_account_list(1, accounts); --How to bulk insert data in accounts to a temporary table? end proc1; In SQL Server, I can write as code below CREATE PROCEDURE get_account_list type_id int as select account_id, account_name, balance from account where account_type_id = type_id; CREATE PROCEDURE proc1 ( ... ) as ... insert into #tmp_data(account_id, account_name, balance) exec get_account_list 1 How can I write similar to the code in SQL Server? Thanks.

    Read the article

  • Colorbox modal opening/closing another Colorbox modal

    - by CmdrTallen
    Greetings. I have a need to have a 'child' modal opended from a colorbox modal. Form - anchor - opens modal ('parent') - model has another anchor - open modal 'child' The problem is that when the 'child' modal closes via the $.fn.colorbox.close() Method this seems to close all the colorbox modal windows. I just need to close the 'child' (the second opened from the first modal), after I set a hidden on the 'parent' modal. Any suggestions on how to close just the second colorbox window? Using jQuery 1.3.2 and Colorbox 1.3.5

    Read the article

  • Looking for Go equivalent of scanf.

    - by Stephen Hsu
    I'm looking for the Go equivalent of scanf(). I tried with following code: 1 package main 2 3 import ( 4 "scanner" 5 "os" 6 "fmt" 7 ) 8 9 func main() { 10 var s scanner.Scanner 11 s.Init(os.Stdin) 12 s.Mode = scanner.ScanInts 13 tok := s.Scan() 14 for tok != scanner.EOF { 15 fmt.Printf("%d ", tok) 16 tok = s.Scan() 17 } 18 fmt.Println() 19 } I run it with input from a text with a line of integers. But it always output -3 -3 ... And how to scan a line composed of a string and some integers? Changing the mode whenever encounter a new data type? The Package documentation: Package scanner A general-purpose scanner for UTF-8 encoded text. But it seems that the scanner is not for general use. Updated code: func main() { n := scanf() fmt.Println(n) fmt.Println(len(n)) } func scanf() []int { nums := new(vector.IntVector) reader := bufio.NewReader(os.Stdin) str, err := reader.ReadString('\n') for err != os.EOF { fields := strings.Fields(str) for _, f := range fields { i, _ := strconv.Atoi(f) nums.Push(i) } str, err = reader.ReadString('\n') } r := make([]int, nums.Len()) for i := 0; i < nums.Len(); i++ { r[i] = nums.At(i) } return r }

    Read the article

  • Server 2003 on domain wont let domain user have local profile

    - by RobW
    I have a few servers that are acting in this behavior, you log in and always get put into a temporary profile. The server is licensed for TS. The user I am testing with has local admin rights so it doesn't seem to be a permission issue on the server. I'll first get a message that the users roaming profile cannot be found, even though we dont use roaming profiles. I then get another message immediately after saying a local profile could not be loaded, so it will only use a temp profile. Any help would be greatly appreciated.

    Read the article

  • View Remote Desktop access logs on Win 2003

    - by NealWalters
    Is there a history log of each use of Remote Desktop. I'd like to view and audit IP addresses. I'm running a dedicated server hosted by a web hosting company. Had some problems recently, and trying to validate if anyone besides me actually logged on (i.e. if user/pass is compromised). Thanks, Neal Walters

    Read the article

  • How can I recover a Fedora 12 installation that is showing signs of disk errors?

    - by Bob Cross
    I am currently overseas (i.e., very far from my normal library of tools) and my primary machine that would normally act as the data server in the performance test that we're trying to run is failing to boot to Fedora 12 properly. This is a machine that, as of yesterday, was booting fine. However, this morning, very strange portions of the boot process were complaining with messages such as "unexpected 0x0 in rpcbind" and "bad file descriptor" (I don't have the error in front of me - scavenged a windows installation to get onto serverfault). Eventually, the boot hung for a long time at the NFS service and then brought up what looked like the KDE login screen but neither the mouse nor keyboard functioned. In olden days, I would try to get to a point where I could manage to run fsck and pray that the bad sectors would come back into alignment just long enough for me to scrape the critical data off of the machine. However, now that we live in the future, it seems like our options in situations like this should be a little more varied. Is there a way to recover a Fedora 12 installation with bad disk sectors that won't boot properly? For completeness, I am comfortable working with bootable recovery distros-on-CD and such but I don't know which one is likely to work best with modern Fedora. In the absence of guidance, I'm frantically torrenting the Fedora 12 Live CD and DVD, hoping to try rescue mode before tomorrow morning.

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >