Search Results

Search found 183 results on 8 pages for 'chr'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Efficient file buffering & scanning methods for large files in python

    - by eblume
    The description of the problem I am having is a bit complicated, and I will err on the side of providing more complete information. For the impatient, here is the briefest way I can summarize it: What is the fastest (least execution time) way to split a text file in to ALL (overlapping) substrings of size N (bound N, eg 36) while throwing out newline characters. I am writing a module which parses files in the FASTA ascii-based genome format. These files comprise what is known as the 'hg18' human reference genome, which you can download from the UCSC genome browser (go slugs!) if you like. As you will notice, the genome files are composed of chr[1..22].fa and chr[XY].fa, as well as a set of other small files which are not used in this module. Several modules already exist for parsing FASTA files, such as BioPython's SeqIO. (Sorry, I'd post a link, but I don't have the points to do so yet.) Unfortunately, every module I've been able to find doesn't do the specific operation I am trying to do. My module needs to split the genome data ('CAGTACGTCAGACTATACGGAGCTA' could be a line, for instance) in to every single overlapping N-length substring. Let me give an example using a very small file (the actual chromosome files are between 355 and 20 million characters long) and N=8 import cStringIO example_file = cStringIO.StringIO("""\ header CAGTcag TFgcACF """) for read in parse(example_file): ... print read ... CAGTCAGTF AGTCAGTFG GTCAGTFGC TCAGTFGCA CAGTFGCAC AGTFGCACF The function that I found had the absolute best performance from the methods I could think of is this: def parse(file): size = 8 # of course in my code this is a function argument file.readline() # skip past the header buffer = '' for line in file: buffer += line.rstrip().upper() while len(buffer) = size: yield buffer[:size] buffer = buffer[1:] This works, but unfortunately it still takes about 1.5 hours (see note below) to parse the human genome this way. Perhaps this is the very best I am going to see with this method (a complete code refactor might be in order, but I'd like to avoid it as this approach has some very specific advantages in other areas of the code), but I thought I would turn this over to the community. Thanks! Note, this time includes a lot of extra calculation, such as computing the opposing strand read and doing hashtable lookups on a hash of approximately 5G in size. Post-answer conclusion: It turns out that using fileobj.read() and then manipulating the resulting string (string.replace(), etc.) took relatively little time and memory compared to the remainder of the program, and so I used that approach. Thanks everyone!

    Read the article

  • connect to mysql server using realbasic

    - by Gbolahan
    Hello, tried connecting to mysql server in realbasic using the folowing code: dim db as MySQLCommunityServer db=New MySQLCommunityServer db.host="192.168.240.129" db.port=3306 db.databaseName="test" db.userName="test" db.Password="test" If db.Connect() then txt1.Text = "Connected" else txt1.Text = "Connection failed!"+ chr(13)+db.ErrorMessage end if and i get the following message connection failed! any suggestions.. Thanks

    Read the article

  • Picture changing in vb6

    - by Dario Dias
    I was trying this script from a pdf file.I got stuck where the target image should change to exploding image if clicked but the target image does not change from the standing image.Please Help! Option Explicit Dim fiPlayersScore As Integer Dim fiNumberofMisses As Integer Dim fbTargetHit As Boolean Private Sub Form_Load() Randomize imgTarget.Enabled = False imgTarget.Visible = False cmdStop.Enabled = False lblGameOver.Visible = False lblGameOver.Enabled = False End Sub Private Sub cmdStart_Click() Dim lsUserResponse As String Dim lbResponse As Boolean lsUserResponse = InputBox("Enter a level from 1 to 3." & _ (Chr(13)) & "" & (Chr(13)) & "1 being the Easiest and 3 being the " & _ "Hardest.", "Level Select", "1") lbResponse = False If lsUserResponse = "1" Then Timer1.Interval = 1500 lbResponse = True ElseIf lsUserResponse = "2" Then Timer1.Interval = 1000 lbResponse = True ElseIf lsUserResponse = "3" Then Timer1.Interval = 750 lbResponse = True Else MsgBox ("Game Not Started.") lbResponse = False End If If lbResponse = True Then cmdStart.Enabled = False imgTarget.Picture = imgStanding.Picture frmMain.MousePointer = 5 fbTargetHit = False Load_Sounds cmdStop.Enabled = True fiPlayersScore = 0 fiNumberofMisses = 0 lblScore.Caption = fiPlayersScore lblMisses.Caption = fiNumberofMisses Timer1.Enabled = True lblGameOver.Visible = False lblGameOver.Enabled = False End If End Sub Private Sub cmdStop_Click() Unload_Sounds frmMain.MousePointer = vbNormal Timer1.Enabled = False imgTarget.Enabled = False imgTarget.Visible = False cmdStart.Enabled = True cmdStop.Enabled = False cmdStart.SetFocus lblGameOver.Visible = True lblGameOver.Enabled = True End Sub Private Sub Form_Click() MMControl1.Command = "Play" MMControl1.Command = "Prev" fiNumberofMisses = fiNumberofMisses + 1 lblMisses.Caption = fiNumberofMisses If CheckForLoose = True Then cmdStop_Click lblMisses.Caption = fiNumberofMisses Exit Sub End If End Sub Private Sub imgTarget_Click() MMControl2.Command = "Play" MMControl2.Command = "Prev" Timer1.Enabled = False imgTarget.Picture = imgExplode.Picture '**I AM STUCK HERE** pauseProgram fiPlayersScore = fiPlayersScore + 1 Timer1.Enabled = True If CheckForWin = True Then cmdStop_Click lblScore.Caption = fiPlayersScore Exit Sub End If lblScore.Caption = fiPlayersScore fbTargetHit = True imgStanding.Enabled = False imgTarget.Visible = False imgTarget.Enabled = False Timer1.Enabled = True End Sub Public Sub Load_Sounds() 'Set initial property values for blaster sound MMControl1.Notify = False MMControl1.Wait = True MMControl1.Shareable = False MMControl1.DeviceType = "WaveAudio" MMControl1.FileName = _ "C:\Temp\Sounds\Blaster_1.wav" 'Open the media device MMControl1.Command = "Open" 'Set initial property values for grunt sound MMControl2.Notify = False MMControl2.Wait = True MMControl2.Shareable = False MMControl2.DeviceType = "WaveAudio" MMControl2.FileName = _ "C:\Temp\Sounds\Pain_Grunt_4.wav" 'Open the media device MMControl2.Command = "Open" End Sub Private Sub Timer1_Timer() Dim liRandomLeft As Integer Dim liRandomTop As Integer imgTarget.Visible = True If fbTargetHit = True Then fbTargetHit = False 'imgTarget.Picture = imgStanding.Picture End If liRandomLeft = (6120 * Rnd) liRandomTop = (4680 * Rnd) imgTarget.Left = liRandomLeft imgTarget.Top = liRandomTop imgTarget.Enabled = True imgTarget.Visible = True End Sub Public Function CheckForWin() As Boolean CheckForWin = False If fiPlayersScore = 5 Then CheckForWin = True lblGameOver.Caption = "You Win.Game Over" End If End Function Public Function CheckForLoose() As Boolean CheckForLoose = False If fiNumberofMisses = 5 Then CheckForLoose = True lblGameOver.Caption = "You Loose.Game Over" End If End Function Private Sub Form_QueryUnload(Cancel As Integer, _ UnloadMode As Integer) Unload_Sounds End Sub Public Sub Unload_Sounds() MMControl1.Command = "Close" MMControl2.Command = "Close" End Sub Public Sub pauseProgram() Dim currentTime Dim newTime currentTime = Second(Time) newTime = Second(Time) Do Until Abs(newTime - currentTime) = 1 newTime = Second(Time) Loop End Sub

    Read the article

  • Point-free in Haskell

    - by wwrob
    I have this code that I want to make point-free; (\k t -> chr $ a + flip mod 26 (ord k + ord t -2*a)) How do I do that? Also are there some general rules for point free style other than "think about this amd come up with something"?

    Read the article

  • Mistake in the Asc() VB function?

    - by Alexander
    Hello! Could you please tell why the Asc() function returns incorrect result? Dim TestChar = Chr(128) Dim CharInt = Asc(TestChar) ' this is a mistake on Windows 7 x64. Asc(TestChar) returns 136 instead of 128 I executed this code on another computer and the result was 128. Thanks.

    Read the article

  • Complex type support in process flow &ndash; XMLTYPE

    - by shawn
        Before OWB 11.2 release, there are only 5 simple data types supported in process flow: DATE, BOOLEAN, INTEGER, FLOAT and STRING. A new complex data type – XMLTYPE is added in 11.2, in order to support complex data being passed between the process flow activities. In this article we will give a simple example to illustrate the usage of the new type and some related editors.     Suppose there is a bookstore that uses XML format orders as shown below (we use the simplest form for the illustration purpose), then we can create a process flow to handle the order, take the order as the input, then extract necessary information, and generate a confirmation email to the customer automatically. <order id=’0001’>     <customer>         <name>Tom</name>         <email>[email protected]</email>     </customer>     <book id=’Java_001’>         <quantity>3</quantity>     </book> </order>     Considering a simple user case here: we use an input parameter/variable with XMLTYPE to hold the XML content of the order; then we can use an Assign activity to retrieve the email info from the order; after that, we can create an email activity to send the email (Other activities might be added in practical case, but will not be described here). 1) Set XML content value     For testing purpose, we will create a variable to hold the sample order, and then this will be used among the process flow activities. When the variable is of XMLTYPE and the “Literal” value is set the true, the advance editor will be enabled.     Click the “Advance Editor” shown as above, a simple xml editor will popup. The editor has basic features like syntax highlight and check as shown below:     We can also do the basic validation or validation against schema with the editor by selecting the normalized schema. With this, it will be easier to provide the value for XMLTYPE variables. 2) Extract information from XML content     After setting the value, we need to extract the email information with the Assign activity. In process flow, an enhanced expression builder is used to help users construct the XPath for extracting values from XML content. When the variable’s literal value is set the false, the advance editor is enabled.     Click the button, the advance editor will popup, as shown below:     The editor is based on the expression builder (which is often used in mapping etc), an XPath lib panel is appended which provides some help information on how to write the XPath. The expression used here is: “XMLTYPE.EXTRACT(XML_ORDER,'/order/customer/email/text()').getStringVal()”, which uses ‘/order/customer/email/text()’ as the XPath to extract the email info from the XML document.     A variable called “EMAIL_ADDR” is created with String data type to hold the value extracted.     Then we bind the “VARIABLE” parameter of Assign activity to “EMAIL_ADDR” variable, which means the value of the “EMAIL_ADDR” activity will be set to the result of the “VALUE” parameter of Assign activity. 3) Use the extracted information in Email activity     We bind the “TO_ADDRESS” parameter of the email activity to the “EMAIL_ADDR” variable created in above step.     We can also extract other information from the xml order directly through the expression, for example, we can set the “MESSAGE_BODY” with value “'Dear '||XMLTYPE.EXTRACT(XML_ORDER,'/order/customer/name/text()').getStringVal()||chr(13)||chr(10)||'   You have ordered '||XMLTYPE.EXTRACT(XML_ORDER,'/order/book/quantity/text()').getStringVal()||' '||XMLTYPE.EXTRACT(XML_ORDER,'/order/book/@id').getStringVal()”. This expression will extract the customer name, the quantity and the book id from the order to compose the message body.     To make the email activity work, we need provide some other necessary information, Such as “SMTP_SERVER” (which is the SMTP server used to send the emails, like “mail.bookstore.com”. The default PORT number is set to 25. You need to change the value accordingly), “FROM_ADDRESS” and “SUBJECT”. Then the process flow is ready to go.     After deploying the process flow package, we can simply run the process flow to check if the result is as expected (An email will be sent to the specified email address with proper subject and message body).     Note: In oracle 11g, there is an enhanced security feature - ACL (Access Control List), which restrict the network access within db, so we need to edit the list to allow UTL_SMTP work if you are using oracle 11g. Refer to chapter “Access Control Lists for UTL_TCP/HTTP/SMTP” and “Managing Fine-Grained Access to External Network Services” for more details.       In previous releases, XMLTYPE already exists in other OWB objects, like mapping/transformation etc. When the mapping/transformation is dragged into a process flow, the parameters with XMLTYPE are mapped to STRING. Now with the XMLTYPE support in process flow, the XMLTYPE will map to XMLTYPE in a more natural way, and we can leverage the new data type for the design.

    Read the article

  • Strange Flash AS3 xml Socket behavior

    - by Rnd_d
    I have a problem which I can't understand. To understand it I wrote a socket client on AS3 and a server on python/twisted, you can see the code of both applications below. Let's launch two clients at the same time, arrange them so that you can see both windows and press connection button in both windows. Then press and hold any button. What I'm expecting: Client with pressed button sends a message "some data" to the server, then the server sends this message to all the clients(including the original sender) . Then each client moves right the button 'connectButton' and prints a message to the log with time in the following format: "min:secs:milliseconds". What is going wrong: The motion is smooth in the client that sends the message, but in all other clients the motion is jerky. This happens because messages to those clients arrive later than to the original sending client. And if we have three clients (let's name them A,B,C) and we send a message from A, the sending time log of B and C will be the same. Why other clients recieve this messages later than the original sender? By the way, on ubuntu 10.04/chrome all the motion is smooth. Two clients are launched in separated chromes. windows screenshot Can't post linux screenshot, need more than 10 reputation to post more hyperlinks. Listing of log, four clients simultaneously: [16:29:33.280858] 62.140.224.1 >> some data [16:29:33.280912] 87.249.9.98 << some data [16:29:33.280970] 87.249.9.98 << some data [16:29:33.281025] 87.249.9.98 << some data [16:29:33.281079] 62.140.224.1 << some data [16:29:33.323267] 62.140.224.1 >> some data [16:29:33.323326] 87.249.9.98 << some data [16:29:33.323386] 87.249.9.98 << some data [16:29:33.323440] 87.249.9.98 << some data [16:29:33.323493] 62.140.224.1 << some data [16:29:34.123435] 62.140.224.1 >> some data [16:29:34.123525] 87.249.9.98 << some data [16:29:34.123593] 87.249.9.98 << some data [16:29:34.123648] 87.249.9.98 << some data [16:29:34.123702] 62.140.224.1 << some data AS3 client code package { import adobe.utils.CustomActions; import flash.display.Sprite; import flash.events.DataEvent; import flash.events.Event; import flash.events.IOErrorEvent; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.events.SecurityErrorEvent; import flash.net.XMLSocket; import flash.system.Security; import flash.text.TextField; public class Main extends Sprite { private var socket :XMLSocket; private var textField :TextField = new TextField; private var connectButton :TextField = new TextField; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(event:Event = null):void { socket = new XMLSocket(); socket.addEventListener(Event.CONNECT, connectHandler); socket.addEventListener(DataEvent.DATA, dataHandler); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); addChild(textField); textField.y = 50; textField.width = 780; textField.height = 500; textField.border = true; connectButton.selectable = false; connectButton.border = true; connectButton.addEventListener(MouseEvent.MOUSE_DOWN, connectMouseDownHandler); connectButton.width = 105; connectButton.height = 20; connectButton.text = "click here to connect"; addChild(connectButton); } private function connectHandler(event:Event):void { textField.appendText("Connect\n"); textField.appendText("Press and hold any key\n"); } private function dataHandler(event:DataEvent):void { var now:Date = new Date(); textField.appendText(event.data + " time = " + now.getMinutes() + ":" + now.getSeconds() + ":" + now.getMilliseconds() + "\n"); connectButton.x += 2; } private function keyDownHandler(event:KeyboardEvent):void { socket.send("some data"); } private function connectMouseDownHandler(event:MouseEvent):void { var connectAddress:String = "ep1c.org"; var connectPort:Number = 13250; Security.loadPolicyFile("xmlsocket://" + connectAddress + ":" + String(connectPort)); socket.connect(connectAddress, connectPort); } } } Python server code from twisted.internet import reactor from twisted.internet.protocol import ServerFactory from twisted.protocols.basic import LineOnlyReceiver import datetime class EchoProtocol(LineOnlyReceiver): ##### name = "" id = 0 delimiter = chr(0) ##### def getName(self): return self.transport.getPeer().host def connectionMade(self): self.id = self.factory.getNextId() print "New connection from %s - id:%s" % (self.getName(), self.id) self.factory.clientProtocols[self.id] = self def connectionLost(self, reason): print "Lost connection from "+ self.getName() del self.factory.clientProtocols[self.id] self.factory.sendMessageToAllClients(self.getName() + " has disconnected.") def lineReceived(self, line): print "[%s] %s >> %s" % (datetime.datetime.now().time(), self, line) if line=="<policy-file-request/>": data = """<?xml version="1.0"?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> <!-- Policy file for xmlsocket://ep1c.org --> <cross-domain-policy> <allow-access-from domain="*" to-ports="%s" /> </cross-domain-policy>""" % PORT self.send(data) else: self.factory.sendMessageToAllClients( line ) def send(self, line): print "[%s] %s << %s" % (datetime.datetime.now().time(), self, line) if line: self.transport.write( str(line) + chr(0)) else: print "Nothing to send" def __str__(self): return self.getName() class ChatProtocolFactory(ServerFactory): protocol = EchoProtocol def __init__(self): self.clientProtocols = {} self.nextId = 0 def getNextId(self): id = self.nextId self.nextId += 1 return id def sendMessageToAllClients(self, msg): for client in self.clientProtocols: self.clientProtocols[client].send(msg) def sendMessageToClient(self, id, msg): self.clientProtocols[id].send(msg) PORT = 13250 print "Starting Server" factory = ChatProtocolFactory() reactor.listenTCP(PORT, factory) reactor.run()

    Read the article

  • Accessing XML file using JavaScript And ASP.net |VB code

    - by Bubba
    Am trying to read in data from an xml file but using javascript which is embedded into my asp.net|vb code. I am new to asp.net but coming from a programming background. so I declared the xml objects for the appropriate browsers, as well as the name of the local xml to read data from, I then start by appending the create the table tag and then append it to the div tag in hack5.aspx I declare the variable that will represent/ hold the xml returned data object. I then run a for loop , before creating a row tag and then appending it to the div tag in hack5.aspx I then create the a row tag and then appending it to the div tag in hack5.aspx | then create a TextNode which is passed to variable, then create a td and append to div . then lastly append the textnode to td this format is the same for creating another 13 td tags that are to hold the data. The main problem is when I run the script - I see nothing display on my screen . no errors are shown, but with your sample code runs smoothly. So the first file hack5.aspx is as follows: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="hack5.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Diplaying MessageBox from ASP.NET</title> </head> <body> <form id="form1" runat="server"> <div id="showtime" > </div> </form> </body> </html> The next file hack5.aspx.vb is as follows: Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim scriptString as String = "<script language=JavaScript> if (window.XMLHttpRequest) " scriptString += " { " scriptString += " xhttp=new XMLHttpRequest(); " scriptString += " } " scriptString += " else " scriptString += " { " scriptString += " xhttp=new ActiveXObject('Microsoft.XMLHTTP'); " scriptString += " } " scriptString += " xhttp.open('GET','yes.xml',false); " scriptString += " xhttp.send(null);" scriptString += " xmlDoc= xhttp.responseXML; " scriptString += " var table1 = document.createElement('table'); " scriptString += " document.getElementById('showtime').appendChild(table1); " scriptString += " var x=xmlDoc.getElementsByTagName('Table'); " scriptString += " for (i=0;i<x.length;i++) " scriptString += " { " scriptString += " var assessment = document.createTextNode(x[i].getElementsByTagName('Assessment')[0].childNodes[0].nodeValue);" scriptString += " var row1 = document.createElement('tr'); " scriptString += " document.getElementById('showtime').appendChild(row1); " scriptString += " var column1 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column1); " scriptString += " column1.appendChild(assessment); " scriptString += " var Issue_Date = document.createTextNode(x[i].getElementsByTagName('Issue_Date')[0].childNodes[0].nodeValue);" scriptString += " var column2 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column2); " scriptString += " column2.appendChild(Issue_Date); " scriptString += " var Due_Date = document.createTextNode(x[i].getElementsByTagName('Due_Date')[0].childNodes[0].nodeValue);" scriptString += " var column3 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column3); " scriptString += " column3.appendChild(Due_Date); " scriptString += " var Interest = document.createTextNode(x[i].getElementsByTagName('Interest')[0].childNodes[0].nodeValue);" scriptString += " var column4 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column4); " scriptString += " column4.appendChild(Interest); " scriptString += " var Summary = document.createTextNode(x[i].getElementsByTagName('Summary')[0].childNodes[0].nodeValue);" scriptString += " var column5 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column5); " scriptString += " column5.appendChild(Summary);" scriptString += " var Amount_Due= document.createTextNode(x[i].getElementsByTagName('Amount_Due')[0].childNodes[0].nodeValue);" scriptString += " var column6 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column6); " scriptString += " column6.appendChild(Amount_Due);" scriptString += " var IEduty = document.createTextNode(x[i].getElementsByTagName('IEduty')[0].childNodes[0].nodeValue);" scriptString += " var column7 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column7); " scriptString += " column7.appendChild(IEduty);" scriptString += " var LEsurtax = document.createTextNode(x[i].getElementsByTagName('LEsurtax')[0].childNodes[0].nodeValue);" scriptString += " var column8 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column8); " scriptString += " column8.appendChild(LEsurtax);" scriptString += " var CEsurtax = document.createTextNode(x[i].getElementsByTagName('CEsurtax')[0].childNodes[0].nodeValue);" scriptString += " var column9 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column9); " scriptString += " column9.appendChild(CEsurtax);" scriptString += " var EXduty = document.createTextNode(x[i].getElementsByTagName('EXduty')[0].childNodes[0].nodeValue);" scriptString += " var column10 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column10); " scriptString += " column10.appendChild(EXduty);" scriptString += " var IMvat = document.createTextNode(x[i].getElementsByTagName('IMvat')[0].childNodes[0].nodeValue);" scriptString += " var column11 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column11); " scriptString += " column11.appendChild(IMvat);" scriptString += " var SYSfee = document.createTextNode(x[i].getElementsByTagName('SYSfee')[0].childNodes[0].nodeValue);" scriptString += " var column12 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column12); " scriptString += " column12.appendChild(SYSfee);" scriptString += " var AItax = document.createTextNode(x[i].getElementsByTagName('AItax')[0].childNodes[0].nodeValue);" scriptString += " var column13 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column13); " scriptString += " column13.appendChild(AItax);" scriptString += " var Cduty = document.createTextNode(x[i].getElementsByTagName('Cduty')[0].childNodes[0].nodeValue);" scriptString += " var column14 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column14); " scriptString += " column14.appendChild(Cduty);" scriptString += " } " scriptString += " <" scriptString += "/" scriptString += "script>" If(Not ClientScript.IsStartupScriptRegistered("clientScript")) ClientScript.RegisterClientScriptBlock(Me.GetType(),"clientScript", scriptString) End If End Sub End Class And finally the xml file is as follows: <?xml version="1.0" encoding="utf-8" ?> <DataSet xmlns="http://tempuri.org/"> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="Table"> <xs:complexType> <xs:sequence> <xs:element name="UserName" type="xs:string" minOccurs="0" /> <xs:element name="Password" type="xs:string" minOccurs="0" /> <xs:element name="UserLevel" type="xs:string" minOccurs="0" /> <xs:element name="FName" type="xs:string" minOccurs="0" /> <xs:element name="LName" type="xs:string" minOccurs="0" /> <xs:element name="Branch" type="xs:string" minOccurs="0" /> <xs:element name="Department" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <NewDataSet xmlns=""> <Table diffgr:id="Table1" msdata:rowOrder="0"> <Assessment>CHR/A157/2009</Assessment> <Issue_Date>20/10/2009</Issue_Date> <Due_Date>01/11/2009</Due_Date> <Interest>2.00</Interest> <Summary>BENTLEY 2009</Summary> <Amount_Due>28000000.00</Amount_Due> <IEduty>3000000.00</IEduty> <LEsurtax>4000000.00</LEsurtax> <CEsurtax>5000000.00</CEsurtax> <EXduty>0.00</EXduty> <IMvat>5000000.00</IMvat> <SYSfee>8000000.00</SYSfee> <AItax>2000000.00</AItax> <Cduty>1000000.00</Cduty> </Table> <Table diffgr:id="Table1" msdata:rowOrder="1"> <Assessment>CHR/A167/2009</Assessment> <Issue_Date>20/10/2009</Issue_Date> <Due_Date>01/11/2009</Due_Date> <Interest>2.00</Interest> <Summary>BENTLEY 2009</Summary> <Amount_Due>24000000.00</Amount_Due> <IEduty>3000000.00</IEduty> <LEsurtax>4000000.00</LEsurtax> <CEsurtax>5000000.00</CEsurtax> <EXduty>0.00</EXduty> <IMvat>1000000.00</IMvat> <SYSfee>8000000.00</SYSfee> <AItax>2000000.00</AItax> <Cduty>1000000.00</Cduty> </Table> <Table diffgr:id="Table1" msdata:rowOrder="2"> <Assessment>CHR/A196/2009</Assessment> <Issue_Date>11/11/2009</Issue_Date> <Due_Date>21/11/2009</Due_Date> <Interest>2.00</Interest> <Summary>BENTLEY 2009</Summary> <Amount_Due>20000000.00</Amount_Due> <IEduty>3000000.00</IEduty> <LEsurtax>4000000.00</LEsurtax> <CEsurtax>5000000.00</CEsurtax> <EXduty>0.00</EXduty> <IMvat>1000000.00</IMvat> <SYSfee>4000000.00</SYSfee> <AItax>2000000.00</AItax> <Cduty>1000000.00</Cduty> </Table> </NewDataSet> </diffgr:diffgram> </DataSet>

    Read the article

  • Insert Hyperlink via VBA

    - by Martin
    I have a Word VBA macro that loops through a directory and writes down the file path of files selected for some criteria into a new Word document. Works well as plain text (as part of a loop): wdDocResults.Content.InsertAfter objFile.Path & Chr(13) However, I'd like them to be hyperlinks. The following works as single macro, but when called from within another script, it does nothing at all (no matter if path is provided as variable or string, or as H:... or \\MyServernameAsNetDrive...): ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= objFile.Path, _ SubAddress:="", ScreenTip:="", TextToDisplay:=objFile.Path If try to select the current line in order to make sure something is selected at the right place -- error: out of memory": wrdDocResults.Content.InsertAfter objFil.Path Selection.Expand wdLine ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= objFile.Path, _ SubAddress:="", ScreenTip:="", TextToDisplay:=objFile.Path I also tried inserting a string resembling the Hyperlink field code ({ Hyperlink "..." }, which is of course not recognized... Any help is appreciated... Thanks in advance!

    Read the article

  • Improve efficiency when using parallel to read from compressed stream

    - by Yoga
    Is another question extended from the previous one [1] I have a compressed file and stream them to feed into a python program, e.g. bzcat data.bz2 | parallel --no-notice -j16 --pipe python parse.py > result.txt The parse.py can read from stdin continusuoly and print to stdout My ec2 instance is 16 cores but from the top command it is showing 3 to 4 load average only. From the ps, I am seeing a lot of stuffs like.. sh -c 'dd bs=1 count=1 of=/tmp/7D_YxccfY7.chr 2>/dev/null'; I know I can improve using the -a in.txtto improve performance, but with my case I am streaming from bz2 (I cannot exact it since I don't have enought disk space) How to improve the efficiency for my case? [1] Gnu parallel not utilizing all the CPU

    Read the article

  • Importing tab delimited file into array in Visual Basic 2013 [migrated]

    - by JaceG
    I am needing to import a tab delimited text file that has 11 columns and an unknown number of rows (always minimum 3 rows). I would like to import this text file as an array and be able to call data from it as needed, throughout my project. And then, to make things more difficult, I need to replace items in the array, and even add more rows to it as the project goes on (all at runtime). Hopefully someone can suggest code corrections or useful methods. I'm hoping to use something like the array style sMyStrings(3,2), which I believe would be the easiest way to control my data. Any help is gladly appreciated, and worthy of a slab of beer. Here's the coding I have so far: Imports System.IO Imports Microsoft.VisualBasic.FileIO Public Class Main Dim strReadLine As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sReader As IO.StreamReader = Nothing Dim sRawString As String = Nothing Dim sMyStrings() As String = Nothing Dim intCount As Integer = -1 Dim intFullLoop As Integer = 0 If IO.File.Exists("C:\MyProject\Hardware.txt") Then ' Make sure the file exists sReader = New IO.StreamReader("C:\MyProject\Hardware.txt") Else MsgBox("File doesn't exist.", MsgBoxStyle.Critical, "Error") End End If Do While sReader.Peek >= 0 ' Make sure you can read beyond the current position sRawString = sReader.ReadLine() ' Read the current line sMyStrings = sRawString.Split(New Char() {Chr(9)}) ' Separate values and store in a string array For Each s As String In sMyStrings ' Loop through the string array intCount = intCount + 1 ' Increment If TextBox1.Text <> "" Then TextBox1.Text = TextBox1.Text & vbCrLf ' Add line feed TextBox1.Text = TextBox1.Text & s ' Add line to debug textbox If intFullLoop > 14 And intCount > -1 And CBool((intCount - 0) / 11 Mod 0) Then cmbSelectHinge.Items.Add(sMyStrings(intCount)) End If Next intCount = -1 intFullLoop = intFullLoop + 1 Loop End Sub

    Read the article

  • PHP Calculating Text to Content Ratio

    - by James
    I am using the following code to calculate text to code ratio. I think it is crazy that no one can agree on how to properly calculate the result. I am looking any suggestions or ideas to improve this code that may make it more accurate. <?php // Returns the size of the content in bytes function findKb($content){ $count=0; $order = array("\r\n", "\n", "\r", "chr(13)", "\t", "\0", "\x0B"); $content = str_replace($order, "12", $content); for ($index = 0; $index < strlen($content); $index ++){ $byte = ord($content[$index]); if ($byte <= 127) { $count++; } else if ($byte >= 194 && $byte <= 223) { $count=$count+2; } else if ($byte >= 224 && $byte <= 239) { $count=$count+3; } else if ($byte >= 240 && $byte <= 244) { $count=$count+4; } } return $count; } // Collect size of entire code $filesize = findKb($content); // Remove anything within script tags $code = preg_replace("@<script[^>]*>.+</script[^>]*>@i", "", $content); // Remove anything within style tags $code = preg_replace("@<style[^>]*>.+</style[^>]*>@i", "", $content); // Remove all tags from the system $code = strip_tags($code); // Remove Extra whitespace from the content $code = preg_replace( '/\s+/', ' ', $code ); // Find the size of the remaining code $codesize = findKb($code); // Calculate Percentage $percent = $codesize/$filesize; $percentage = $percent*100; echo $percentage; ?> I don't know the exact calculations that are used so this function is just my guess. Does anyone know what the proper calculations are or if my functions are close enough for a good judgement.

    Read the article

  • how to speed up this code? [migrated]

    - by dot
    I have some code that's taking over 3 seconds to complete. I'm just wondering if there's a faster way to do this. I have a string with anywhere from 10 to 70 rows of data. I break it up into an array and then loop through the array to find specific patterns. $this->_data = str_replace(chr(27)," ",$this->_data,$count);//strip out esc character $this->_data = explode("\r\n", $this->_data); $detailsArray = array(); foreach ($this->_data as $details) { $pattern = '/(\s+)([0-9a-z]*)(\s+)(100\/1000T|10|1000SX|\s+)(\s*)(\|)(\s+)(\w+)(\s+)(\w+)(\s+)(\w+)(\s+)(1000FDx|10HDx|100HDx|10FDx|100FDx|\s+)(\s*)(\w+)(\s*)(\w+|\s+)(\s*)(0)/i'; if (preg_match($pattern, $details, $matches)) { array_push($detailsArray, array( 'Port' => $matches[2], 'Type' => $matches[4], 'Alert' => $matches[8], 'Enabled' => $matches[10], 'Status' => $matches[12], 'Mode' => $matches[14], 'MDIMode' => $matches[16], 'FlowCtrl' => $matches[18], 'BcastLimit' => $matches[20])); }//end if }//end for $this->_data = $detailsArray; Just wondering if you think there's a way to make it more efficient. Thanks.

    Read the article

  • ??OPEN CURSOR?BULK COLLECT

    - by Liu Maclean(???)
    ????T.askmaclean.com?????bulk collect?open cursor???, ?????????  ??????: ???? OPEN_CURSOR ????SQL?? ???????. ?????? ????? ???????????????? ????? test_soruce create table zengfankun_temp01 as select * from dba_objects;select count(*) from zengfankun_temp01;–12,6826analyze table zengfankun_temp01 compute statistics; create or replace procedure test_open_cursor istype type_owner is table of zengfankun_temp01.owner%type index by binary_integer;type type_object_name is table of zengfankun_temp01.object_name%type index by binary_integer;type type_object_id is table of zengfankun_temp01.object_id%type index by binary_integer;type type_object_type is table of zengfankun_temp01.object_type%type index by binary_integer;type type_last_ddl_time is table of zengfankun_temp01.last_ddl_time%type index by binary_integer; l_ary_owner type_owner;l_ary_object_name type_object_name;l_ary_object_id type_object_id;l_ary_object_type type_object_type;l_ary_last_ddl_time type_last_ddl_time; cursor cur_object isselect owner,object_name,object_id,object_type,last_ddl_timefrom zengfankun_temp01order by owner,object_name,object_type,last_ddl_time;OPEN_START number;OPEN_END number;FETCH_START number;FETCH_END number;beginDBMS_OUTPUT.ENABLE (buffer_size=>null) ;OPEN_START:=dbms_utility.get_time();open cur_object;OPEN_END :=dbms_utility.get_time();dbms_output.put_line(‘OPEN_TIME:’||TO_CHAR(OPEN_END-OPEN_START));loopFETCH_START:=dbms_utility.get_time();fetch cur_object bulk collect intol_ary_owner,l_ary_object_name,l_ary_object_id,l_ary_object_type,l_ary_last_ddl_timelimit 10000;FETCH_END:=dbms_utility.get_time();dbms_output.put_line(‘FETCH_TIME:’||TO_CHAR(FETCH_END-FETCH_START)||’ ROWCOUNT:’||cur_object%rowCount); exit when cur_object%notfound or cur_object%notfound is null;end loop;end test_open_cursor; OPEN_TIME:12FETCH_TIME:21 ROWCOUNT:10000FETCH_TIME:3 ROWCOUNT:20000FETCH_TIME:3 ROWCOUNT:30000FETCH_TIME:3 ROWCOUNT:40000FETCH_TIME:3 ROWCOUNT:50000FETCH_TIME:3 ROWCOUNT:60000FETCH_TIME:3 ROWCOUNT:70000FETCH_TIME:3 ROWCOUNT:80000FETCH_TIME:3 ROWCOUNT:90000FETCH_TIME:3 ROWCOUNT:100000FETCH_TIME:3 ROWCOUNT:110000FETCH_TIME:3 ROWCOUNT:120000FETCH_TIME:1 ROWCOUNT:126826 ???? OPEN_TIME:0FETCH_TIME:18 ROWCOUNT:10000FETCH_TIME:3 ROWCOUNT:20000FETCH_TIME:3 ROWCOUNT:30000FETCH_TIME:3 ROWCOUNT:40000FETCH_TIME:3 ROWCOUNT:50000FETCH_TIME:3 ROWCOUNT:60000FETCH_TIME:3 ROWCOUNT:70000FETCH_TIME:3 ROWCOUNT:80000FETCH_TIME:3 ROWCOUNT:90000FETCH_TIME:3 ROWCOUNT:100000FETCH_TIME:3 ROWCOUNT:110000FETCH_TIME:3 ROWCOUNT:120000FETCH_TIME:2 ROWCOUNT:126826 SQL?????????, ????????????.??OPEN CURSOR ????0???????????3??.??N? ??????. ???? ?N? ?????????? ??????. ??????????????? ??????????. ?????????10000??? ???????????????????clear???, ???????????: ?OPEN CURSOR ?????, PL/SQL????SQL????PARSE SQL????????, ??????OPEN CURSOR????SNAPSHOT SCN ??SCN, ??Oracle?????FETCH?????,???????????????? ????FETCH ??????????????,???????Current Block, The most recent version of block , ?????SCN >> Snapshot scn, ????UNDO???? ???SCN ???Best Block ,???Read Consistentcy;???? ???UNDO SNAPSHOT???????????????Best Block??,???????ORA-1555??? ????????, ??????????,???????????????char(2000)????, ???????????????,????bulk collect fetch??fetch 10 ???,????????OPEN CURSOR?????PARSE??SQL????????, ??????????fetch bulk collect??????????10????,??”_trace_pin_time”????Server Process?pin CR block???,??????????Fetch Bulk Collect limit 10??10?buffer?pin? [oracle@nas ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Wed Aug 1 11:36:52 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select * from global_name; GLOBAL_NAME -------------------------------------------------------------------------------- http://www.askmaclean.com SQL> create table maclean (t1 char(2000)) tablespace users pctfree 99; Table created. SQL> begin 2 for i in 1..200 loop 3 insert into maclean values('MACLEAN'); 4 commit ; 5 end loop; 6 end; 7 / PL/SQL procedure successfully completed. SQL> exec dbms_stats.gather_table_stats('','MACLEAN'); PL/SQL procedure successfully completed. SQL> select count(*) from maclean; COUNT(*) ---------- 200 SQL> select blocks,num_rows from dba_tables where table_name='MACLEAN'; BLOCKS NUM_ROWS ---------- ---------- 244 200 SQL> alter system set "_trace_pin_time"=1 scope=spfile; System altered. SQL> startup force; ORACLE instance started. Total System Global Area 3140026368 bytes Fixed Size 2232472 bytes Variable Size 1795166056 bytes Database Buffers 1325400064 bytes Redo Buffers 17227776 bytes Database mounted. Database opened. SQL> alter session set events '10046 trace name context forever,level 12'; Session altered. SQL> SQL> SQL> declare 2 cursor v_cursor is 3 select * from sys.maclean; 4 type v_type is table of sys.maclean%rowtype index by binary_integer; 5 rec_tab v_type; 6 begin 7 open v_cursor; 8 dbms_lock.sleep(30); 9 loop 10 fetch v_cursor bulk collect 11 into rec_tab limit 10; 12 dbms_lock.sleep(10); 13 exit when v_cursor%notfound; 14 end loop; 15 end; 16 / ?????10046 trace+ pin trace: PARSING IN CURSOR #47499559136872 len=337 dep=0 uid=0 oct=47 lid=0 tim=1343836146412056 hv=496860239 ad='11a11dbb0' sqlid='4zh7954ftuz2g' declare cursor v_cursor is select * from sys.maclean; type v_type is table of sys.maclean%rowtype index by binary_integer; rec_tab v_type; begin open v_cursor; dbms_lock.sleep(30); loop fetch v_cursor bulk collect into rec_tab limit 10; dbms_lock.sleep(10); exit when v_cursor%notfound; end loop; end; END OF STMT PARSE #47499559136872:c=0,e=346,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=0,tim=1343836146412051 ===================== PARSING IN CURSOR #47499559126280 len=25 dep=1 uid=0 oct=3 lid=0 tim=1343836146414939 hv=3296884535 ad='11a11d250' sqlid='2mb1493284xtr' SELECT * FROM SYS.MACLEAN END OF STMT PARSE #47499559126280:c=1999,e=2427,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=1,plh=2568761675,tim=1343836146414937 EXEC #47499559126280:c=0,e=55,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=1,plh=2568761675,tim=1343836146415104 ????? ? SELECT * FROM SYS.MACLEAN? PARSE ????? , ????FETCH???????pin ????????, ????OPEN CURSOR????? *** 2012-08-01 11:49:36.424 WAIT #47499559136872: nam='PL/SQL lock timer' ela= 30009361 duration=0 p2=0 p3=0 obj#=-1 tim=1343836176424782 ???30s pin ktewh26: kteinpscan dba 0x10a6202:4 time 1039048805 pin ktewh27: kteinmap dba 0x10a6202:4 time 1039048847 pin kdswh11: kdst_fetch dba 0x10a6203:1 time 1039048898 pin kdswh11: kdst_fetch dba 0x10a6204:1 time 1039048961 pin kdswh11: kdst_fetch dba 0x10a6205:1 time 1039049004 pin kdswh11: kdst_fetch dba 0x10a6206:1 time 1039049042 pin kdswh11: kdst_fetch dba 0x10a6207:1 time 1039049089 pin kdswh11: kdst_fetch dba 0x10a6208:1 time 1039049123 pin kdswh11: kdst_fetch dba 0x10a6209:1 time 1039049159 pin kdswh11: kdst_fetch dba 0x10a620a:1 time 1039049191 pin kdswh11: kdst_fetch dba 0x10a620b:1 time 1039049225 pin kdswh11: kdst_fetch dba 0x10a620c:1 time 1039049260 kdst_fetch???fetch??????? , ??fetch?10?? ???????FETCH FETCH #47499559126280:c=0,e=536,p=0,cr=12,cu=0,mis=0,r=10,dep=1,og=1,plh=2568761675,tim=1343836176425542 *** 2012-08-01 11:49:46.428 WAIT #47499559136872: nam='PL/SQL lock timer' ela= 10002694 duration=0 p2=0 p3=0 obj#=-1 tim=134383618642829 ????10s pin kdswh11: kdst_fetch dba 0x10a620d:1 time 1049052211 pin kdswh11: kdst_fetch dba 0x10a620e:1 time 1049052264 pin kdswh11: kdst_fetch dba 0x10a620f:1 time 1049052299 pin kdswh11: kdst_fetch dba 0x10a6211:1 time 1049052332 pin kdswh11: kdst_fetch dba 0x10a6212:1 time 1049052364 pin kdswh11: kdst_fetch dba 0x10a6213:1 time 1049052398 pin kdswh11: kdst_fetch dba 0x10a6214:1 time 1049052430 pin kdswh11: kdst_fetch dba 0x10a6215:1 time 1049052462 pin kdswh11: kdst_fetch dba 0x10a6216:1 time 1049052494 pin kdswh11: kdst_fetch dba 0x10a6217:1 time 1049052525 FETCH #47499559126280:c=0,e=371,p=0,cr=10,cu=0,mis=0,r=10,dep=1,og=1,plh=2568761675,tim=1343836186428807 ??pin 10????, ???fetch ?? WAIT #47499559136872: nam='PL/SQL lock timer' ela= 10002864 duration=0 p2=0 p3=0 obj#=-1 tim=1343836196431754 pin kdswh11: kdst_fetch dba 0x10a6218:1 time 1059055662 pin kdswh11: kdst_fetch dba 0x10a6219:1 time 1059055714 pin kdswh11: kdst_fetch dba 0x10a621a:1 time 1059055748 pin kdswh11: kdst_fetch dba 0x10a621b:1 time 1059055781 pin kdswh11: kdst_fetch dba 0x10a621c:1 time 1059055815 pin kdswh11: kdst_fetch dba 0x10a621d:1 time 1059055848 pin kdswh11: kdst_fetch dba 0x10a621e:1 time 1059055883 pin kdswh11: kdst_fetch dba 0x10a621f:1 time 1059055915 pin kdswh11: kdst_fetch dba 0x10a6221:1 time 1059055953 pin kdswh11: kdst_fetch dba 0x10a6222:1 time 1059055992 FETCH #47499559126280:c=0,e=385,p=0,cr=10,cu=0,mis=0,r=10,dep=1,og=1,plh=2568761675,tim=1343836196432274 ???? ??????? DBA????? ............................ ???? WAIT #47499559136872: nam='PL/SQL lock timer' ela= 10002933 duration=0 p2=0 p3=0 obj#=-1 tim=1343836366495589 pin kdswh11: kdst_fetch dba 0x10a62f6:1 time 1229119497 pin kdswh11: kdst_fetch dba 0x10a62f7:1 time 1229119545 pin kdswh11: kdst_fetch dba 0x10a62f8:1 time 1229119576 pin kdswh11: kdst_fetch dba 0x10a62f9:1 time 1229119610 pin kdswh11: kdst_fetch dba 0x10a62fa:1 time 1229119644 pin kdswh11: kdst_fetch dba 0x10a62fb:1 time 1229119671 pin kdswh11: kdst_fetch dba 0x10a62fc:1 time 1229119703 pin kdswh11: kdst_fetch dba 0x10a62fd:1 time 1229119730 pin kdswh11: kdst_fetch dba 0x10a62fe:1 time 1229119760 pin kdswh11: kdst_fetch dba 0x10a62ff:1 time 1229119787 FETCH #47499559126280:c=0,e=340,p=0,cr=10,cu=0,mis=0,r=10,dep=1,og=1,plh=2568761675,tim=1343836366496067 ??????DBA? 0x10a6203 , ??DBA ? 0x10a62ff ???????DBA??MACLEAN????????,???DBA???Maclean????? getbfno?????dba??????????? CREATE OR REPLACE FUNCTION getbfno (p_dba IN VARCHAR2) RETURN VARCHAR2 IS l_str VARCHAR2 (255) DEFAULT NULL; l_fno VARCHAR2 (15); l_bno VARCHAR2 (15); BEGIN l_fno := DBMS_UTILITY.data_block_address_file (TO_NUMBER (LTRIM (p_dba, '0x'), 'xxxxxxxx' ) ); l_bno := DBMS_UTILITY.data_block_address_block (TO_NUMBER (LTRIM (p_dba, '0x'), 'xxxxxxxx' ) ); l_str := 'datafile# is:' || l_fno || CHR (10) || 'datablock is:' || l_bno || CHR (10) || 'dump command:alter system dump datafile ' || l_fno || ' block ' || l_bno || ';'; RETURN l_str; END; / Function created. SQL> select getbfno('0x10a6203') from dual; GETBFNO('0X10A6203') -------------------------------------------------------------------------------- datafile# is:4 datablock is:680451 dump command:alter system dump datafile 4 block 680451; SQL> select getbfno('0x10a62ff') from dual; GETBFNO('0X10A62FF') -------------------------------------------------------------------------------- datafile# is:4 datablock is:680703 dump command:alter system dump datafile 4 block 680703; SQL> select dbms_rowid.rowid_block_number(min(rowid)),dbms_rowid.rowid_relative_fno(min(rowid)) from maclean; DBMS_ROWID.ROWID_BLOCK_NUMBER(MIN(ROWID)) ----------------------------------------- DBMS_ROWID.ROWID_RELATIVE_FNO(MIN(ROWID)) ----------------------------------------- 680451 4 SQL> select dbms_rowid.rowid_block_number(max(rowid)),dbms_rowid.rowid_relative_fno(max(rowid)) from maclean; DBMS_ROWID.ROWID_BLOCK_NUMBER(MAX(ROWID)) ----------------------------------------- DBMS_ROWID.ROWID_RELATIVE_FNO(MAX(ROWID)) ----------------------------------------- 680703 4 ???????3???: 1.?OPEN CURSOR ?????, PL/SQL????SQL????PARSE SQL????????, ??????OPEN CURSOR????SNAPSHOT SCN ??SCN, ??Oracle?????FETCH?????,???????????????? 2.????FETCH ?????????????? 3. ???open cursor+ fetch bulk collect???”?????????”

    Read the article

  • Delphi 2010 differs in Canvas transparency compared to Delphi 7?

    - by Tom1952
    I'm porting some very old code from Delph7 to Delphi2010 with a few changes as possible to the existing code base for the usual reasons. First: the good news for anyone who hasn't jumped yet: it's not as daunting as it may look! I'm actually pleased (& surprised) at how easy 1,000,000+ lines of code have moved across. And what a relief to be back on the leading edge! Delphi 2010 has so many great enhancements. However, I'm having a cosmetic problem with some TStringGrids and TDbGrids descendants. In the last century (literally!) someone wrote the two methods below. The first method is used to justify text. When run in Delphi 2010, the new text and the unjustified text to both appear in the cells written to. Of course it's a mess visually, almost illegible. Sometimes, as a result of the second method is use, the grid cells are actually semi-transparent, with text from the window below showing through. (Again, not pretty!) It appears to me that Delphi 2010's TDbGrid and TStringGrid have some differences in the way they handle transparency? I haven't much experience in this area of Delphi (in fact, I have no idea what the 2nd method is actually doing!) and was hoping someone could give me some pointers on what's going on and how to fix it. TIA! Method 1 procedure TForm1.gridDrawCell(Sender: TObject; Col, Row: Integer; Rect: TRect; State: TGridDrawState); {Used to align text in cells.} var x: integer; begin if (Row > 0) AND (Col > 0) then begin SetTextAlign(grdTotals.Canvas.Handle, TA_RIGHT); x := Rect.Right - 2; end else begin SetTextAlign(grdTotals.Canvas.Handle, TA_CENTER); x := (Rect.Left + Rect.Right) div 2; end; grdTotals.Canvas.TextRect(Rect, x, Rect.Top+2, grdTotals.Cells[Col,Row]); end; Method 2 procedure WriteText(ACanvas: TCanvas; ARect: TRect; DX, DY: Integer; const Text: string; TitleBreak: TTitleBreak; Alignment: TAlignment); const AlignFlags: array [TAlignment] of Integer = (DT_LEFT or { DT_WORDBREAK or } DT_EXPANDTABS or DT_NOPREFIX, DT_RIGHT or { DT_WORDBREAK or } DT_EXPANDTABS or DT_NOPREFIX, DT_CENTER or { DT_WORDBREAK or } DT_EXPANDTABS or DT_NOPREFIX); var ABitmap: TBitmap; AdjustBy: Integer; B, R: TRect; WordBreak: Integer; begin WordBreak := 0; if (TitleBreak = tbAlways) or ((TitleBreak = tbDetect) and (Pos(Chr(13) + Chr(10), Text) = 0)) then WordBreak := DT_WORDBREAK; ABitmap := TBitmap.Create; try ABitmap.Canvas.Lock; try AdjustBy := 1; if (Alignment = taRightJustify) then Inc(AdjustBy); with ABitmap, ARect do begin Width := Max(Width, Right - Left); Height := Max(Height, Bottom - Top); R := Rect(DX, DY, Right - Left - AdjustBy, Bottom - Top - 1); { @@@ } B := Rect(0, 0, Right - Left, Bottom - Top); end; with ABitmap.Canvas do begin Font := ACanvas.Font; Brush := ACanvas.Brush; Brush.Style := bsSolid; FillRect(B); SetBkMode(Handle, TRANSPARENT); DrawText(Handle, PChar(Text), Length(Text), R, AlignFlags[Alignment] or WordBreak); end; ACanvas.CopyRect(ARect, ABitmap.Canvas, B); finally ABitmap.Canvas.Unlock; end; finally ABitmap.Free; end; end;

    Read the article

  • Are their any suggestions for this new assembly language?

    - by Noctis Skytower
    Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, and a sample program was written with the given assembly mnemonics. Now that it is summer, a new project has begun with the objective being to rewrite the interpreter and assembler for Whitespace 0.3, with further developments coming afterwards. Since there is so much extra time than before to work on its design, you are presented here with an outline that provides a revised set of mnemonics for the assembly language. This post is marked as a wiki for their discussion. Have you ever had any experience with assembly languages in the past? Were there some instructions that you thought should have been renamed to something different? Did you find yourself thinking outside the box and with a different paradigm than in which the mnemonics were named? If you can answer yes to any of those questions, you are most welcome here. Subjective answers are appreciated! Stack Manipulation (IMP: [Space]) Stack manipulation is one of the more common operations, hence the shortness of the IMP [Space]. There are four stack instructions. hold N Push the number onto the stack copy Duplicate the top item on the stack copy N Copy the nth item on the stack (given by the argument) onto the top of the stack swap Swap the top two items on the stack drop Discard the top item on the stack drop N Slide n items off the stack, keeping the top item Arithmetic (IMP: [Tab][Space]) Arithmetic commands operate on the top two items on the stack, and replace them with the result of the operation. The first item pushed is considered to be left of the operator. add Addition sub Subtraction mul Multiplication div Integer Division mod Modulo Heap Access (IMP: [Tab][Tab]) Heap access commands look at the stack to find the address of items to be stored or retrieved. To store an item, push the address then the value and run the store command. To retrieve an item, push the address and run the retrieve command, which will place the value stored in the location at the top of the stack. save Store load Retrieve Flow Control (IMP: [LF]) Flow control operations are also common. Subroutines are marked by labels, as well as the targets of conditional and unconditional jumps, by which loops can be implemented. Programs must be ended by means of [LF][LF][LF] so that the interpreter can exit cleanly. L: Mark a location in the program call L Call a subroutine goto L Jump unconditionally to a label if=0 L Jump to a label if the top of the stack is zero if<0 L Jump to a label if the top of the stack is negative return End a subroutine and transfer control back to the caller exit End the program I/O (IMP: [Tab][LF]) Finally, we need to be able to interact with the user. There are IO instructions for reading and writing numbers and individual characters. With these, string manipulation routines can be written. The read instructions take the heap address in which to store the result from the top of the stack. print chr Output the character at the top of the stack print int Output the number at the top of the stack input chr Read a character and place it in the location given by the top of the stack input int Read a number and place it in the location given by the top of the stack Question: How would you redesign, rewrite, or rename the previous mnemonics and for what reasons?

    Read the article

  • Have suggestions for these assembly mnemonics?

    - by Noctis Skytower
    Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, and a sample program was written with the given assembly mnemonics. Now that it is summer, a new project has begun with the objective being to rewrite the interpreter and assembler for Whitespace 0.3, with further developments coming afterwards. Since there is so much extra time than before to work on its design, you are presented here with an outline that provides a revised set of mnemonics for the assembly language. This post is marked as a wiki for their discussion. Have you ever had any experience with assembly languages in the past? Were there some instructions that you thought should have been renamed to something different? Did you find yourself thinking outside the box and with a different paradigm than in which the mnemonics were named? If you can answer yes to any of those questions, you are most welcome here. Subjective answers are appreciated! Stack Manipulation (IMP: [Space]) Stack manipulation is one of the more common operations, hence the shortness of the IMP [Space]. There are four stack instructions. hold N Push the number onto the stack copy Duplicate the top item on the stack copy N Copy the nth item on the stack (given by the argument) onto the top of the stack swap Swap the top two items on the stack drop Discard the top item on the stack drop N Slide n items off the stack, keeping the top item Arithmetic (IMP: [Tab][Space]) Arithmetic commands operate on the top two items on the stack, and replace them with the result of the operation. The first item pushed is considered to be left of the operator. add Addition sub Subtraction mul Multiplication div Integer Division mod Modulo Heap Access (IMP: [Tab][Tab]) Heap access commands look at the stack to find the address of items to be stored or retrieved. To store an item, push the address then the value and run the store command. To retrieve an item, push the address and run the retrieve command, which will place the value stored in the location at the top of the stack. save Store load Retrieve Flow Control (IMP: [LF]) Flow control operations are also common. Subroutines are marked by labels, as well as the targets of conditional and unconditional jumps, by which loops can be implemented. Programs must be ended by means of [LF][LF][LF] so that the interpreter can exit cleanly. L: Mark a location in the program call L Call a subroutine goto L Jump unconditionally to a label if=0 L Jump to a label if the top of the stack is zero if<0 L Jump to a label if the top of the stack is negative return End a subroutine and transfer control back to the caller halt End the program I/O (IMP: [Tab][LF]) Finally, we need to be able to interact with the user. There are IO instructions for reading and writing numbers and individual characters. With these, string manipulation routines can be written. The read instructions take the heap address in which to store the result from the top of the stack. print chr Output the character at the top of the stack print int Output the number at the top of the stack input chr Read a character and place it in the location given by the top of the stack input int Read a number and place it in the location given by the top of the stack Question: How would you redesign, rewrite, or rename the previous mnemonics and for what reasons?

    Read the article

  • Are there any suggestions for these new assembly mnemonics?

    - by Noctis Skytower
    Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, and a sample program was written with the given assembly mnemonics. Now that it is summer, a new project has begun with the objective being to rewrite the interpreter and assembler for Whitespace 0.3, with further developments coming afterwards. Since there is so much extra time than before to work on its design, you are presented here with an outline that provides a revised set of mnemonics for the assembly language. This post is marked as a wiki for their discussion. Have you ever had any experience with assembly languages in the past? Were there some instructions that you thought should have been renamed to something different? Did you find yourself thinking outside the box and with a different paradigm than in which the mnemonics were named? If you can answer yes to any of those questions, you are most welcome here. Subjective answers are appreciated! Stack Manipulation (IMP: [Space]) Stack manipulation is one of the more common operations, hence the shortness of the IMP [Space]. There are four stack instructions. hold N Push the number onto the stack copy Duplicate the top item on the stack copy N Copy the nth item on the stack (given by the argument) onto the top of the stack swap Swap the top two items on the stack drop Discard the top item on the stack drop N Slide n items off the stack, keeping the top item Arithmetic (IMP: [Tab][Space]) Arithmetic commands operate on the top two items on the stack, and replace them with the result of the operation. The first item pushed is considered to be left of the operator. add Addition sub Subtraction mul Multiplication div Integer Division mod Modulo Heap Access (IMP: [Tab][Tab]) Heap access commands look at the stack to find the address of items to be stored or retrieved. To store an item, push the address then the value and run the store command. To retrieve an item, push the address and run the retrieve command, which will place the value stored in the location at the top of the stack. save Store load Retrieve Flow Control (IMP: [LF]) Flow control operations are also common. Subroutines are marked by labels, as well as the targets of conditional and unconditional jumps, by which loops can be implemented. Programs must be ended by means of [LF][LF][LF] so that the interpreter can exit cleanly. L: Mark a location in the program call L Call a subroutine goto L Jump unconditionally to a label if=0 L Jump to a label if the top of the stack is zero if<0 L Jump to a label if the top of the stack is negative return End a subroutine and transfer control back to the caller halt End the program I/O (IMP: [Tab][LF]) Finally, we need to be able to interact with the user. There are IO instructions for reading and writing numbers and individual characters. With these, string manipulation routines can be written. The read instructions take the heap address in which to store the result from the top of the stack. print chr Output the character at the top of the stack print int Output the number at the top of the stack input chr Read a character and place it in the location given by the top of the stack input int Read a number and place it in the location given by the top of the stack Question: How would you redesign, rewrite, or rename the previous mnemonics and for what reasons?

    Read the article

  • Do you have suggestions for these assembly mnemonics?

    - by Noctis Skytower
    Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, and a sample program was written with the given assembly mnemonics. Now that it is summer, a new project has begun with the objective being to rewrite the interpreter and assembler for Whitespace 0.3, with further developments coming afterwards. Since there is so much extra time than before to work on its design, you are presented here with an outline that provides a revised set of mnemonics for the assembly language. This post is marked as a wiki for their discussion. Have you ever had any experience with assembly languages in the past? Were there some instructions that you thought should have been renamed to something different? Did you find yourself thinking outside the box and with a different paradigm than in which the mnemonics were named? If you can answer yes to any of those questions, you are most welcome here. Subjective answers are appreciated! Stack Manipulation (IMP: [Space]) Stack manipulation is one of the more common operations, hence the shortness of the IMP [Space]. There are four stack instructions. hold N Push the number onto the stack copy Duplicate the top item on the stack copy N Copy the nth item on the stack (given by the argument) onto the top of the stack swap Swap the top two items on the stack drop Discard the top item on the stack drop N Slide n items off the stack, keeping the top item Arithmetic (IMP: [Tab][Space]) Arithmetic commands operate on the top two items on the stack, and replace them with the result of the operation. The first item pushed is considered to be left of the operator. add Addition sub Subtraction mul Multiplication div Integer Division mod Modulo Heap Access (IMP: [Tab][Tab]) Heap access commands look at the stack to find the address of items to be stored or retrieved. To store an item, push the address then the value and run the store command. To retrieve an item, push the address and run the retrieve command, which will place the value stored in the location at the top of the stack. save Store load Retrieve Flow Control (IMP: [LF]) Flow control operations are also common. Subroutines are marked by labels, as well as the targets of conditional and unconditional jumps, by which loops can be implemented. Programs must be ended by means of [LF][LF][LF] so that the interpreter can exit cleanly. L: Mark a location in the program call L Call a subroutine goto L Jump unconditionally to a label if=0 L Jump to a label if the top of the stack is zero if<0 L Jump to a label if the top of the stack is negative return End a subroutine and transfer control back to the caller halt End the program I/O (IMP: [Tab][LF]) Finally, we need to be able to interact with the user. There are IO instructions for reading and writing numbers and individual characters. With these, string manipulation routines can be written. The read instructions take the heap address in which to store the result from the top of the stack. print chr Output the character at the top of the stack print int Output the number at the top of the stack input chr Read a character and place it in the location given by the top of the stack input int Read a number and place it in the location given by the top of the stack Question: How would you redesign, rewrite, or rename the previous mnemonics and for what reasons?

    Read the article

  • mime decode pdf quoted-printable

    - by TonyVipros
    Hi, I've been building a simple ticket system and it's all done and working except for when it receives PDF files via email that have been sent using quoted-printable encoding. I've tried using quoted_printable_decode(), the quoted-printable.decode stream filter, the later just created an empty file. I've also tried using $input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input). However the PDF file is always unreadable. I've compared the original with the rebuilt version and there are a lot of 00 missing and some other characters replaced. original file rebuilt file

    Read the article

  • retreving long text (CLOB) using CFQuery

    - by CFUser
    I am using CFQuery to retrieve the CLOB field from Oracle DB. If the CLOB filed contains the Data less than ~ 8000, then I can see retrieved the value ( the o/p), however If the value in CLOB field size is more than 8000 chars, then its not retrieving the value. in <cfdump> i can see the query retrieved as 'empty String' though the value exists in Oracle DB. I am using the Oracle Driver in CFadim console enabled 'Enable long text retrieval (CLOB).' and 'Enable binary large object retrieval (BLOB). ' set 'Long Text Buffer (chr)' and 'Blob Buffer(bytes) ' values to 6400000 any suggestions to retrieve the full text?

    Read the article

  • Convert VB6 to C# use NDDE ? help

    - by tabvn
    i have a vb6 code i want to use http://ndde.codeplex.com/ , please help me convert to c# thanks Const TOPIC_SENSOR As String = "SeeLane|Sensor" Const TOPIC_GATE As String = "SeeLane|Gate" Const TOPIC_PIN As String = "SeeLane|Pin" Const ITEM_SENSOR_ACTIVATE As String = "Activate" Const ITEM_GATE_OPEN As String = "Open" Const ITEM_PIN_ON As String = "On" Const ITEM_PIN_OFF As String = "Off" Private Sub Form_Load() On Error GoTo NO_DDE_SERVER lblCar.LinkMode = vbLinkNotify lblLaneId.LinkMode = vbLinkManual lblName.LinkMode = vbLinkManual lblAuthorized.LinkMode = vbLinkManual lblFile.LinkMode = vbLinkManual lblConfidence.LinkMode = vbLinkManual lblType.LinkMode = vbLinkManual MsgBox "Ket noi voi thanh cong voi SeeLane !!!" Exit Sub NO_DDE_SERVER: MsgBox "Khong the ket noi voi SeeLane !(Xem chuong trinh co chay khong?)." Exit Sub End Sub Private Sub lblCar_LinkNotify() On Error Resume Next lblCar.LinkRequest lblLaneId.LinkRequest lblName.LinkRequest lblAuthorized.LinkRequest lblFile.LinkRequest lblConfidence.LinkRequest lblType.LinkRequest CheckAuthorized lblLaneId.Caption = lblLaneId.Caption + 1 End Sub Private Sub CheckAuthorized() Dim i As Integer i = lblAuthorized.Caption i = i + 1 If lblAuthorized.Caption = 1 Then lblPoke.LinkTopic = TOPIC_GATE lblPoke.LinkItem = ITEM_GATE_OPEN lblPoke = Chr(lblLaneId.Caption) lblPoke.LinkMode = vbLinkManual lblPoke.LinkPoke End If End Sub

    Read the article

  • How to read a csv file with python

    - by john
    Hello, I'm trying to read a csv file but it doesn't work. I can read my csv file but when I see what I read, there where white space between values. Here is my code # -*- coding: iso-8859-1 -*- import sql_db, tmpl_macros, os import security, form, common import csv class windows_dialect(csv.Dialect): """Describe the usual properties of unix-generated CSV files.""" delimiter = ',' quotechar = '"' doublequote = 1 skipinitialspace = 0 lineterminator = 'n' quoting = csv.QUOTE_MINIMAL def reco(d): cars = {210:'"', 211:'"', 213:"'", 136:'à', 143:'è', 142:'é'} for c in cars: d = d.replace(chr(c),cars[c]) return d def page_process(ctx): if ctx.req_equals('catalog_send'): if 'catalog_file' in ctx.locals.__dict__: contenu = ctx.locals.catalog_file[0].file.read() #contenu.encode('') p = csv.reader(contenu, delimiter=',') inserted = 0 modified = 0 (cr,db) = sql_db.cursor_get() for line in p: if line: logfile = open('/tmp/test.log', 'a') logfile.write(line[0]) logfile.write('\n') logfile.write('-----------------------------\n') logfile.close()

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >