Daily Archives

Articles indexed Sunday March 21 2010

Page 3/85 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Calling gawk from python

    - by chavanak
    Hi, I am trying to call gawk from python in this manner. import os import string import codecs ligand_file=open( "2WTKA_ab.txt", "r" ) #Open the receptor.txt file ligand_lines=ligand_file.readlines() # Read all the lines into the array ligand_lines=map( string.strip, ligand_lines ) ligand_file.close() for i in ligand_lines: os.system ( " gawk %s %s"%( "'{if ($2==""i"") print $0}'", 'unique_count_a_from_ac.txt' ) ) My problem is that "i" is not being replaced by the value it represent. The value "i" represents is an integer and not a string. Can anyone help me out? Cheers, Chavanak

    Read the article

  • Using antlr and the DLR together -- AST conversion

    - by RCIX
    I have an AST generated via ANTLR, and I need to convert it to a DLR-compatible one (Expression Trees). However, it would seem that i can't use tree pattern matchers for this as expression trees need their subtrees at instantiation (which i can't get). What solution would be best for me to use?

    Read the article

  • Twitter search API VS Operators

    - by supermogx
    I've found this page about the Twitter search API and some operators : http://search.twitter.com/operators But is it possible to make a search like : All posts containing the words "ipod OR ipad" AND all posts containing the words "funny OR joke" ? Like : "happy AND hour" OR "ipod AND ipad" this doesn't look like it's possible.

    Read the article

  • Use only alpha channel of texture in OpenGL?

    - by Chris
    Hey, I'm trying to draw a constant color to the framebuffer and blend it using the alpha channel from an RGBA texture. I've been looking at glBlendFunc and glBlendColor, but can't seem to figure out a way to ignore the RGB values from the texture. I'm thinking I'll have to pull out the alpha values myself and make a second texture with GL_ALPHA. Is there a better way to do this? Thanks!

    Read the article

  • How come BraceMatch() doesn't work when a lexer is set in wxStyledTextCtrl?

    - by George Edison
    I have the following chunk of C++ code that gets called when } is pressed: int iCurPos = GetCurrentPos(); InsertText(iCurPos,wxT("}")); int iPos = BraceMatch(iCurPos); This works fine (iPos gets the position of the matching brace) except when I call SetLexer(...) beforehand. Then it returns -1? How can I get it to work? Edit: I should point out that the above code is being called from the EVT_KEY_DOWN handler in a wxStyledTextCtrl-derived class.

    Read the article

  • When is a C++ terminate handler the Right Thing(TM)?

    - by Joseph Garvin
    The C++ standard provides the std::set_terminate function which lets you specify what function std::terminate should actually call. std::terminate should only get called in dire circumstances, and sure enough the situations the standard describes for when it's called are dire (e.g. an uncaught exception). When std::terminate does get called the situation seems analagous to being out of memory -- there's not really much you can sensically do. I've read that it can be used to make sure resources are freed -- but for the majority of resources this should be handled automatically by the OS when the process exits (e.g. file handles). Theoretically I can see a case for if say, you needed to send a server a specific message when exiting due to a crash. But the majority of the time the OS handling should be sufficient. When is using a terminate handler the Right Thing(TM)? Update: People interested in what can be done with custom terminate handlers might find this non-portable trick useful.

    Read the article

  • Exchange Web Services, try to use ExchangeImpersonationType ...

    - by howmanytimes
    I am trying to use EWS, first time trying to use the ExchangeServiceBinding. The code I am using is below: _service = new ExchangeServiceBinding(); //_service.Credentials = new NetworkCredential(userName, userPassword, this.Domain); _service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; _service.Url = this.ServiceURL; ExchangeImpersonationType ei = new ExchangeImpersonationType(); ConnectingSIDType sid = new ConnectingSIDType(); sid.PrimarySmtpAddress = this.ExchangeAccount; ei.ConnectingSID = sid; _service.ExchangeImpersonation = ei; The application is an aspnet 3.5 trying to create a task using EWS. I have tried to use impersonation because I will not know the logon user's domain password, so I thought impersonation would be the best fit. Any thoughts on how I can utilize impersonation? Am I setting this correctly, I get an error while trying to run my application. I also tried without impersonation just to try to see if I can create a task, no luck either. Any help would be appreciated. Thanks.

    Read the article

  • Do I correctly understand what a class is?

    - by Matt
    I've had trouble finding a clear, concise laymans definition of a class. Usually, they give general ideas without specifically spelling it out, and I'm wondering if I'm understanding this correctly. As I understand it, a class is the set of code that controls an object. For example, in an app that has a button for 'Yes' and a button for 'No', and a text box for output, the code that tells the computer what to do when the user uses the Yes button is one class, the code for hitting No is another class, and an object is the two buttons and what they do together to influence the output box. Am I right, or am I confusing terms here? Thanks

    Read the article

  • Javascript Detect Control Key Held on Mouseup

    - by Michael Mikowski
    I've searched a good deal, and can't seem to find a satisfactory solution. I hope someone can help. While I am using jQuery, I am also writing many thousands of lines of Javascript. So a "pure" javascript solution is just fine. I'm trying to determine if the control key is physically held down on a mouseup event. That's it; there are no other preconditions. Does anyone know how to do this reliably, cross-browser? I've tried storing this in a state variable by noting when the key is pressed and released: // BEGIN store control key status in hash_state $().bind('keydown','ctrl',function( arg_obj_e ){ hash_state.sw_ctrldn = true; console.debug( hash_state.sw_ctrldn ); }); $().bind('keyup','ctrl',function( arg_obj_e ){ hash_state.sw_ctrldn = false; console.debug( hash_state.sw_ctrldn ); }); // END store control key status in hash_state However, this really doesn't work. If you test this using firebug and watch the console, you will see that auto-repeat seems to happen, and the value toggles. I inspected the mouseup event to see if there is anything useful there, but to no avail: var debugEvent = function( arg_obj_e ){ var str = ''; for ( var attr in arg_obj_e ){ str += attr + ': ' + arg_obj_e[attr] + '\n'; } console.debug(str); } Any help would be appreciated.

    Read the article

  • SQL Server to PostgreSQL - Migration and design concerns

    - by youwhut
    Currently migrating from SQL Server to PostgreSQL and attempting to improve a couple of key areas on the way: I have an Articles table: CREATE TABLE [dbo].[Articles]( [server_ref] [int] NOT NULL, [article_ref] [int] NOT NULL, [article_title] [varchar](400) NOT NULL, [category_ref] [int] NOT NULL, [size] [bigint] NOT NULL ) Data (comma delimited text files) is dumped on the import server by ~500 (out of ~1000) servers on a daily basis. Importing: Indexes are disabled on the Articles table. For each dumped text file Data is BULK copied to a temporary table. Temporary table is updated. Old data for the server is dropped from the Articles table. Temporary table data is copied to Articles table. Temporary table dropped. Once this process is complete for all servers the indexes are built and the new database is copied to a web server. I am reasonably happy with this process but there is always room for improvement as I strive for a real-time (haha!) system. Is what I am doing correct? The Articles table contains ~500 million records and is expected to grow. Searching across this table is okay but could be better. i.e. SELECT * FROM Articles WHERE server_ref=33 AND article_title LIKE '%criteria%' has been satisfactory but I want to improve the speed of searching. Obviously the "LIKE" is my problem here. Suggestions? SELECT * FROM Articles WHERE article_title LIKE '%criteria%' is horrendous. Partitioning is a feature of SQL Server Enterprise but $$$ which is one of the many exciting prospects of PostgreSQL. What performance hit will be incurred for the import process (drop data, insert data) and building indexes? Will the database grow by a huge amount? The database currently stands at 200 GB and will grow. Copying this across the network is not ideal but it works. I am putting thought into changing the hardware structure of the system. The thought process of having an import server and a web server is so that the import server can do the dirty work (WITHOUT indexes) while the web server (WITH indexes) can present reports. Maybe reducing the system down to one server would work to skip the copying across the network stage. This one server would have two versions of the database: one with the indexes for delivering reports and the other without for importing new data. The databases would swap daily. Thoughts? This is a fantastic system, and believe it or not there is some method to my madness by giving it a big shake up. UPDATE: I am not looking for help with relational databases, but hoping to bounce ideas around with data warehouse experts.

    Read the article

  • Programming language detection in PHP

    - by nandu
    I need to detect which programming language is used in a code snippet, there is any library to do this? I already read this http://stackoverflow.com/questions/475033/detecting-programming-language-from-a-snippe, but I rather use a tested and working library.

    Read the article

  • SQL Server 2005 Default Backup Plan

    - by tylerl
    I noticed that a newly imported database on SQLServer 2005 had configured itself (without my knowledge) to perform daily backups; but it's not deleting old files and quickly filling up the disk. I don't know how the backup job got configured (maybe that's something that gets transferred when you move a database?) but I'm having trouble modifying it. The backup runs as part of SQL Server Agent job called "Daily Backups". This job runs a package called "(SSIS Packages)\Maintenance Plans\Backup Plan" -- which I can't find. The "Management\Maintenance Plans" area for my server is empty. I imagine I could delete the existing plan and re-create it manually, but I was hoping to just modify what was already there, since all that's missing is deleting old files.

    Read the article

  • Problem creating socket with C++ in winsock2

    - by Ash85
    Hi, I'm having the weirdest problem causing me headaches. Consider the following code: // Create and bind socket std::map<Connection, bool> clients; unsigned short port=6222; struct sockaddr_in local_address, from_address; int result; char buffer[10000]; SOCKET receive_socket; local_address.sin_family = AF_INET; local_address.sin_addr.s_addr = INADDR_ANY; local_address.sin_port = htons(port); receive_socket = socket(AF_INET,SOCK_DGRAM,0); What's happening is receive_socket is not binding, I get SOCKET_ERROR. When I debug the program and check receive_socket, it appears to just be garbled crap. I put a breakpoint on the 'std::map' line. When I step into each line of the above code, the debug cursor jumps straight from the 'unsigned short port' line to the first 'local_address.sin' line, even though I am using step into (F11), it does not stop at struct, int, char or SOCKET lines, it jumps straight over them. At this point I hover my mouse over local_address, from_address, result, buffer and receive_socket. They are all full of garbled crap. Is this because I have not defined these variables yet? I've also noticed that when I reach the bottom of the above code, local_address.sin_port is set to 19992, but it should be 6222?

    Read the article

  • How to add icons to a PopUpMenuButton in Flex 3 using an XML file

    - by user168610
    Hi, I've been looking at the following example for populating a PupUpMenuButton http://blog.flexexamples.com/2008/02/21/creating-a-custom-label-function-on-a-flex-popupmenubutton-control/ and would like to add icons to each menu. Ideally, I would specify the icon in the xml and assign it in a similar way to using labelFunction for the text. I'm pretty new to Flex and would appreciate some guidance with this. The only information I've found via google is to create a menu as follows (seems I can't include more than one url, but it is an example that creates a menu object using the following function): private function initMenu():void { menu = new Menu(); menu.dataProvider = xmlList; menu.labelField = "@label"; menu.iconField = "@icon"; } but I would really prefer to build it all from the XML file. Many thanks, Bryn

    Read the article

  • Auto load a specific link at various time intervals

    - by user228837
    Here's what I need to do. I'm using Google Chrome. I have page that auto-reloads every 5 seconds using a script: javascript: timeout=prompt("Set timeout [s]"); current=location.href; if(timeout>0) setTimeout('reload()',1000*timeout); else location.replace(current); function reload() { setTimeout('reload()',1000*timeout); fr4me='<frameset cols=\'*\'>\n<frame src=\''+current+'\'/>'; fr4me+='</frameset>'; with(document){write(fr4me);void(close())}; } I found that script by Googling. The reason why the page auto-reloads every 5 seconds is I'm waiting for a specific link or url to appear in the page. It appears at random times. Once I see the link I'm waiting for, I immediately click the link. That's fine. But I want more. What I want is the page will auto-reload and I want it to auto-detect the the link I'm waiting for. Once the script finds the link I'm waiting for, it automatically loads that link on a new tab or page. For example, I'm auto-reloading www.example.com. I'm waiting for a specific url "BUY NOW". When the page auto-reloads, it checks if there's a url "BUY NOW". If it sees one, it should automatically open that link. Thanks.

    Read the article

  • Rails: Ajax: Changes Onload

    - by Jay Godse
    Hi. I have a web layout of a for that looks something like this <html> <head> </head> <body> <div id="posts"> <div id="post1" class="post" > <!--stuff 1--> </div> <div id="post2" class="post" > <!--stuff 1--> </div> <!-- 96 more posts --> <div id="post99" class="post" > <!--stuff 1--> </div> </div> </body> </html> I would like to be able to load and render the page with a blank , and then have a function called when the page is loaded which goes in and load up the posts and updates the page dynamically. In Rails, I tried using "link_to_remote" to update with all of the elements. I also tweaked the posts controller to render the collection of posts if it was an ajax request (request.xhr?). It worked fine and very fast. However the update of the blank div is triggered by clicking the link. I would like the same action to happen when the page is loaded so that I don't have to put in a link. Is there a Rails Ajax helper or RJS function or something in Rails that I could use to trigger the loading of the "posts" after the page has loaded and rendered (without the posts)? (If putsch comes to shove, I will just copy the generated JS code from the link_to_remote call and have it called from the onload handler on the body).

    Read the article

  • Dynamic Table CheckBoxes not having a "Checked" true value

    - by LuvlyOvipositor
    I have been working on a web app using ASP.NET with the code base as C#. I have a dynamic table that resizes based on a return from a SQL query; with a check box added in the third cell of each row. The checkbox is assigned an ID according to an index and the date. When users hit the submit button, the code is supposed to get a value from each row that is checked. However, when looping through the rows, none of the check boxes ever have a value of true for the Checked property. The ID persists, but the value of the checkbox seems to be lost. Code for adding the Checkboxes: cell = new TableCell(); CheckBox cb = new CheckBox(); cell.ApplyStyle(TS); cb.ID = index.ToString() + " " + lstDate.SelectedItem.Text.ToString(); if (reader["RestartStatus"].ToString() == "0") { cb.Checked = false; cb.Enabled = true; } else { cb.Checked = true; } cell.Controls.Add(cb); The code for getting the checkbox value: for (int i = 0; i < CompTable.Rows.Count; i++) { int t3 = CompTable.Rows[i].Cells[2].Controls.Count; Control temp = null; if (t3 0) { temp = CompTable.Rows[i].Cells[2].Controls[0]; } string t2 = i.ToString() + " " + lstDate.SelectedItem.Text.ToString(); if ( temp != null && ((CheckBox)temp).ID == i.ToString() + " " + lstDate.SelectedItem.Text.ToString()) { //Separated into 2 if statements for debugging purposes //ID is correct, but .Checked is always false (even if all of the boxes are checked) if (((CheckBox)temp).Checked == true) { tlist.Add(CompTable.Rows[i].Cells[0].Text.ToString()); } } }

    Read the article

  • Is `hg pull --rebase` analogous to `svn update`?

    - by allyourcode
    This question assumes there's a "blessed" central repository that members of a team clone from push to when they have contributions that they want other team members to see pull from when they want to see other people's contributions. etc. If so, I would assume hg update is not analogous to svn update (why would there be two commands that do exactly the same thing?). From what I can gather, hg update more like svn revert. Is that correct? Update: My understanding of rebase is largely based on the "A common case" section on this page: http://mercurial.selenic.com/wiki/RebaseProject

    Read the article

  • Heuristic to identify if a series of 4 bytes chunks of data are integers or floats

    - by flint
    What's the best heuristic I can use to identify whether a chunk of X 4-bytes are integers or floats? A human can do this easily, but I wanted to do it programmatically. I realize that since every combination of bits will result in a valid integer and (almost?) all of them will also result in a valid float, there is no way to know for sure. But I still would like to identify the most likely candidate (which will virtually always be correct; or at least, a human can do it). For example, let's take a series of 4-bytes raw data and print them as integers first and then as floats: 1 1.4013e-45 10 1.4013e-44 44 6.16571e-44 5000 7.00649e-42 1024 1.43493e-42 0 0 0 0 -5 -nan 11 1.54143e-44 Obviously they will be integers. Now, another example: 1065353216 1 1084227584 5 1085276160 5.5 1068149391 1.33333 1083179008 4.5 1120403456 100 0 0 -1110651699 -0.1 1195593728 50000 These will obviously be floats. PS: I'm using C++ but you can answer in any language, pseudo code or just in english.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >