Search Results

Search found 664 results on 27 pages for 'sid sri'.

Page 10/27 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • How to escape simple SQL queries in C# for SqlServer

    - by sri
    I use an API that expects a SQL string. I take a user input, escape it and pass it along to the API. The user input is quiet simple. It asks for column values. Like so: string name = userInput.Value; Then I construct a SQL query: string sql = string.Format("SELECT * FROM SOME_TABLE WHERE Name = '{0}'", name.replace("'", "''")); Is this safe enough? If it isn't, is there a simple library function that make column values safe: string sql = string.Format("SELECT * FROM SOME_TABLE WHERE Name = '{0}'", SqlSafeColumnValue(name)); The API uses SQLServer as the database. Thanks.

    Read the article

  • Installing PHP APC in Fedora - Unable to initialize module ?

    - by sri
    I have been trying to install APC on my Fedora Apache Server for showing progress bar while uploading files. But I am getting the following PHP Warning while starting XAMPP. Starting XAMPP for Linux 1.7.1... PHP Warning: PHP Startup: apc: Unable to initialize module Module compiled with module API=20090626, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to matchin Unknown on line 0 XAMPP: Starting Apache with SSL (and PHP5)... XAMPP: Starting MySQL... XAMPP: Another FTP daemon is already running. XAMPP for Linux started. My Server Details : OS : Fedora-12 XAMPP version : 1.7.1 PHP Version : 5.2.9 APC Version : 3.1.9 I have tried the process as is mentioned in here : 1)http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html 2)http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/

    Read the article

  • Efficiency of purely functional programming

    - by Sid
    Does anyone know what is the worst possible asymptotic slowdown that can happen when programming purely functionally as opposed to imperatively (i.e. allowing side-effects)? Clarification from comment by itowlson: is there any problem for which the best known non-destructive algorithm is asymptotically worse than the best known destructive algorithm, and if so by how much?

    Read the article

  • XMPP4R Callbacks dont seem to work

    - by Sid
    Im using xmpp4r and trying to get the hang of a basic chat feature that I wish to implement later in my Rails app. My fundamentals on Ruby Threads is still a bit shaky so I would appreciate any help on this. Though I register the callback i dont get a response from my gmail account. I am able to send a message but my ruby program terminates. In order to prevent it from terminating I tried to stop on of the threads in the program but I cant seem to get it working. require 'rubygems' require "xmpp4r/client" require "xmpp4r/roster" include Jabber def connect client = Client.new(JID::new("[email protected]")) client.connect client.auth("test") client.send(Presence.new.set_type(:available)) client end def create_message(message, to_email) msg = Jabber::Message::new(to_email, message) msg.type = :chat msg end def subscribe(email_id) pres = Presence.new.set_type(:subscribe).set_to(email_id) pres end client = connect roster = Roster::Helper.new(client) roster.add_subscription_request_callback do |item,pres| roster.accept_subscription(pres.from) end def create_callback(client) $t4= Thread.new do client.add_message_callback do |m| puts m.body puts "................................Callback working" end end end puts "Client has connected" msg = create_message("Welcome to the winter of my discontent", "[email protected]") client.send(msg) create_callback(client) def check(client) $t3 = Thread.new do loop do puts "t3 still running........." Thread.current.stop $t4.join end end end check(client)

    Read the article

  • AdvancedDataGrid dynamic text Value Coloring - ItemRenderer problem

    - by sri
    In my AdvancedDataGrid, I am adding dynamic values to cells by dragging a cell value to other cells. While copying, I am setting the value to listData and setting the Red color to the value in ItemRenderer. Everything is working fine, but when I scroll down/up, the values remains in the cells where thay are supposed to be(as I am setting to listData) but the coloring behaves wierd(as I am trying to set the color in ItemRenderer). I don't want to store the color of the value, but I should be able to see the dynamically created values in Red color. Is there a way, I can do this? Do I need to set the color to actual dataprovider object and then check in ItemRenderer? Can anyone help me with this? public class CustomItemRenderer extends AdvancedDataGridItemRenderer { private var _isDynamicValue:Boolean; .... .... //_isDynamicValue is set to true if the value is dynamic if(_isDynamicValue && listData.label) { setStyle("color", 0xFF0000); setStyle("fontWeight", "bold"); } else { setStyle("color", 0x000000); }

    Read the article

  • VB.NET Dock problem

    - by Sid
    Whenever I am adding New TableLayoutPanel programmatically in a Panel by setting DockStyle.Top, the last added TableLayoutPanel goes at the top most position of the Panel and the TableLayoutPanel added first comes down. Example: If I add like 1 2 3 4 5 It adds as 5 4 3 2 1 Please help me to fix the problem. The TableLayoutPanels should maintain the order as I am adding. Thanx.

    Read the article

  • Interchange xsd and xsi - XmlSerializer in c#

    - by Sri Kumar
    Hello All, XmlSerializer serializer = new XmlSerializer(typeof(IxComment)); System.IO.StringWriter aStream = new System.IO.StringWriter(); serializer.Serialize(aStream,Comments); commentsString = aStream.ToString(); Here the commentsString has the the following element in it <IxComment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Is there any possibility to interchange the xsi and xsd attribute and get the element as shown below <IxComment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > Will this cause any other issue?

    Read the article

  • Java Conversion of byte[] into a srting and then back to a byte[]

    - by Sid
    I am working on a proxy server. I am getting data in byte[] which i convert into a string to perform certain operations. Now when i convert this new string back into a byte [] it causes unkonw problems. So mainly its like i need to know how to correctly convert a byte[] into a string and then back into a byte[] again. I tried to just convert the byte[] to string and then back to byte[] again (to make sure thats its not my operations that are causing problems). So its like: // where reply is a byte[] String str= new String(reply,0, bytesRead); streamToClient.write(str.getBytes(), 0, bytesRead); is not equivalent to streamToClient.write(reply, 0, bytesRead); my proxy works fine when i just send the byte[] without any conversion but when i convert it from byte[] to a string and then back to a byte[] its causes problems. can some one please help? =]

    Read the article

  • verifying the signature of x509

    - by sid
    Hi All, While verifying the certificate I am getting EVP_F_EVP_PKEY_GET1_DH My Aim - Verify the certificate signature. I am having 2 certificates : 1. a CA certificate 2. certificate issued by CA. I extracted the 'RSA Public Key (key)' Modulus From CA Certificate using, pPublicKey = X509_get_pubkey(x509); buf_len = (size_t) BN_num_bytes (bn); key = (unsigned char *)malloc (buf_len); n = BN_bn2bin (bn, (unsigned char *) key); if (n != buf_len) LOG(ERROR," : key error\n"); if (key[0] & 0x80) LOG(DEBUG, "00\n"); Now, I have CA public key & CA key length and also having certificate issued by CA in buffer, buffer length & public key. To verify the signature, I have following code int iRet1, iRet2, iRet3, iReason; iRet1 = EVP_VerifyInit(&md_ctx, EVP_sha1()); iRet2 = EVP_VerifyUpdate(&md_ctx, buf, buflen); iRet3 = EVP_VerifyFinal(&md_ctx, (const unsigned char *)CAkey, CAkeyLen, pubkey); iReason = ERR_get_error(); if(ERR_GET_REASON(iReason) == EVP_F_EVP_PKEY_GET1_DH) { LOG(ERROR, "EVP_F_EVP_PKEY_GET1_DH\n"); } LOG(INFO,"EVP_VerifyInit returned %d : EVP_VerifyUpdate returned %d : EVP_VerifyFinal = %d \n", iRet1, iRet2, iRet3); EVP_MD_CTX_cleanup(&md_ctx); EVP_PKEY_free(pubkey); if (iRet3 != 1) { LOG(ERROR,"EVP_VerifyFinal() failed\n"); ret = -1; } LOG(INFO,"signature is valid\n"); I am unable to figure out What might went wrong??? Please if anybody faced same issues? What EVP_F_EVP_PKEY_GET1_DH Error means? Thanks in Advance - opensid

    Read the article

  • asp.net ajax + http module fails

    - by Sri Kumar
    Hi, I am trying my hands on asp.net+ajax+httpmodule. My Form <form id="LoginForm" runat="server"> <asp:ScriptManager ID="LoginScriptMgr" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="LoginPanel" runat="server"> <ContentTemplate> <asp:Label ID="lblLoginHeader" Text="Login" runat="server"></asp:Label> <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> <asp:Button ID="btnLogin" Text="Login" runat="server" OnClick="Login" /> <asp:Label ID="lblLoginStatus" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </form> C# Code protected void Login(object sender, EventArgs e) { lblLoginStatus.Text = "Login Successful"; } Web.config <httpModules> <add name="TimeModule" type="MyWebPortal.App_Code.TimeModule,App_Code"/> </httpModules> HTTP Module public class TimeModule : IHttpModule { private HttpApplication oApps = null; public void Dispose() { } public void Init(System.Web.HttpApplication context) { oApps = context; context.PreSendRequestContent += new EventHandler (context_PreSendRequestContent); } void context_PreSendRequestContent(object sender, EventArgs e) { string message = "&lt;!-- This page is being processed at " + System.DateTime.Now.ToString() + " -->"; oApps.Context.Response.Output.Write(message); } } When i remove the TimeModule from Web.config my ajax works. If add the TimeModule then the label doesn't show the message "Login Successful". Removing the ajax panel and with httpmodule available the label shows the message. So, how ajax panel was related to httpmodules?

    Read the article

  • x509 certificate verification in C

    - by sid
    Hi All, I do have certificates in DER and PEM format, My goal is to retrieve the fields of Issuer and Subject And verify the Certificate with the CA public key and simultaneously verify CA certificate with the Root public key. I am able to retrieve all the details of issuer and subject But unable to verify the certificate. Please help. The API's used, x509 = d2i_X509_fp (fp, &x509); //READING DER Format x509 = PEM_read_X509 (fp, &x509, NULL, NULL); //READING PEM Format X509_NAME_oneline(X509_get_subject_name(x509), subject, sizeof (subject)); //to retrive the Subject X509_NAME_oneline(X509_get_issuer_name(x509), issuer, sizeof (issuer)); //to retrive the Issuer // to store the CA public key (in unsigned char *key)that will be used to verify the certificate (My case Always sha1WithRSAEncryption) RSA *x = X509_get_pubkey(x509)->pkey.rsa; bn = x->n; //extracts the bytes from public key & convert into unsigned char buffer buf_len = (size_t) BN_num_bytes (bn); stored_CA_pubKey = (unsigned char *)malloc (buf_len); i_n = BN_bn2bin (bn, (unsigned char *)stored_CA_pubKey); if (i_n != buf_len) LOG(ERROR," : key error\n"); if (key[0] & 0x80) LOG(DEBUG, "00\n"); stored_CA_pubKeyLen = EVP_PKEY_size(X509_get_pubkey(x509)); For Verification I went through different approaches but unable to verify a) i_x509_verify = X509_verify(cert_x509, ca_pubkey); b) /* verify the signature */ int iRet1, iRet2, iReason; iRet1 = EVP_VerifyInit(&md_ctx, EVP_sha1()); iRet2 = EVP_VerifyUpdate(&md_ctx, cert_code, cert_code_len); rv = EVP_VerifyFinal(&md_ctx, (const unsigned char *)stored_CA_pubKey, stored_CA_pubKeyLen, cert_pubkey); NOTE : cert_code & stored_CA_pubKey is unsigned char buffer. Thanks in Advance

    Read the article

  • Using SQL dB column as a lock for concurrent operations in Entity Framework

    - by Sid
    We have a long running user operation that is handled by a pool of worker processes. Data input and output is from Azure SQL. The master Azure SQL table structure columns are approximated to [UserId, col1, col2, ... , col N, beingProcessed, lastTimeProcessed ] beingProcessed is boolean and lastTimeProcessed is DateTime. The logic in every worker role is: public void WorkerRoleMain() { while(true) { try { dbContext db = new dbContext(); // Read foreach (UserProfile user in db.UserProfile .Where(u => DateTime.UtcNow.Subtract(u.lastTimeProcessed) > TimeSpan.FromHours(24) & u.beingProcessed == false)) { user.beingProcessed = true; // Modify db.SaveChanges(); // Write // Do some long drawn processing here ... ... ... user.lastTimeProcessed = DateTime.UtcNow; user.beingProcessed = false; db.SaveChanges(); } } catch(Exception ex) { LogException(ex); Sleep(TimeSpan.FromMinutes(5)); } } // while () } With multiple workers processing as above (each with their own Entity Framework layer), in essence beingProcessed is being used a lock for MutEx purposes Question: How can I deal with concurrency issues on the beingProcessed "lock" itself based on the above load? I think read-modify-write operation on the beingProcessed needs to be atomic but I'm open to other strategies. Open to other code refinements too.

    Read the article

  • Convert Byte [] to PDF

    - by Sri Kumar
    Hello All, With help of this question C# 4.0: Convert pdf to byte[] and vice versa i was able to convert byte[] to PDF. But the problem here is not all the contents were written in PDF. Byte array length is 25990 approx. Only 21 to 26 KB size PDF file was created. When i try to open the PDF it says file is corrupted. What could be the reason? I tried the BinaryWriter but it creates PDF of 0 KB.

    Read the article

  • How does the proc in the caches_action if clause get execute

    - by Sid
    I have a newbie kind of question which I cant get my head around. How does the Proc in the if condition of the caches_action get executed for the caches_action method. for example caches_action :show, :if=Proc.new{|x| something} what i dont get its how does this get called. I know i can execute a proc defined as proc= Proc.new by proc.call so i dont understand how this gets called. Second how do I pass conditions like if logged_in? I'd appreciate any help on this

    Read the article

  • How do I read user input in python thread?

    - by Sid H
    I'm trying to read from a thread in python as follows import threading, time, random var = True class MyThread(threading.Thread): def set_name(self, name): self.name = name def run(self): global var while var == True: print "In mythread " + self.name time.sleep(random.randint(2,5)) class MyReader(threading.Thread): def run(self): global var while var == True: input = raw_input("Quit?") if input == "q": var = False t1 = MyThread() t1.set_name("One") t2 = MyReader() t1.start() t2.start() However, if I enter 'q', I see the following error. In mythread One Quit?q Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 522, in __bootstrap_inner self.run() File "test.py", line 20, in run input = raw_input("Quit?") EOFError In mythread One In mythread One How does on get user input from a thread?

    Read the article

  • Interchange xsd and xsi in the output of XmlSerializer

    - by Sri Kumar
    XmlSerializer serializer = new XmlSerializer(typeof(IxComment)); System.IO.StringWriter aStream = new System.IO.StringWriter(); serializer.Serialize(aStream,Comments); commentsString = aStream.ToString(); Here the commentsString has the the following element in it <IxComment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Is there any possibility to interchange the xsi and xsd attribute and get the element as shown below <IxComment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > Will this cause any other issue? EDIT: Why do i need to do this? We are migrating an existing application from 1.1 to 3.0 and in the code there is a if loop int iStartTagIndex = strXMLString.IndexOf("<IxComment xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"); that check for the index of the IxComment. Here the o/p of the serializer and the condition differ in the position of xsd and xsi. So i am trying to know whether we can instruct the serializer to provided the o/p as required. I have another question here as this was an existing application does the serializer O/P differs with versions?

    Read the article

  • DOM - More than 5 'window' objects on one page

    - by Sid
    Hi, I'm trying to extract data from one of my websites using Greasemonkey. Problem is, the script runs 6 times because apparently the page loads content from 6 different servers. So if I put in an alert ("Hey"); the code runs 6 times and I get 6 alerts. How can I wait for the entire page to load and then start playing with the DOM. Also, I'm using jQuery. Thanks

    Read the article

  • Greasemonkey - jQuery not loading

    - by Sid
    Hi, I tried to load a copy of jQuery 1.3.2 from jquery.com (because it seems 1.4.0+ aren't treated too well by GM) using @require. Even after I uninstall and reinstall the script, GM does not copy jquery-1.3.2.js to my gm_scripts folder like it should. Tried this almost 10 times today. Also, when I click on "Manage Scripts", it shows my script as running on * even though I've added @include for http://www.catholicon.in/* I'm using the latest updates on both FF 3.6 and GM 0.8 Thanks

    Read the article

  • x509 certificate Information

    - by sid
    Certificate: Data: Version: 3 (0x2) Serial Number: 95 (0x5f) Signature Algorithm: sha1WithRSAEncryption Issuer: C=, O=, CN= Validity Not Before: Apr 22 16:42:11 2008 GMT Not After : Apr 22 16:42:11 2009 GMT Subject: C=, O=, CN=, L=, ST= Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (1024 bit) Modulus (1024 bit): ... ... ... Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Extended Key Usage: critical Code Signing X509v3 Authority Key Identifier: keyid: ... Signature Algorithm: sha1WithRSAEncryption a9:55:56:9b:9e:60:7a:57:fd:7:6b:1e:c0:79:1c:50:62:8f: ... ... -----BEGIN CERTIFICATE----- ... ... ... -----END CERTIFICATE----- In This Certificate, Which is the public key? is Modulus? what does the Signature Algorithm, a9:55:56:... represent (is it message digest)? And what is between -----BEGIN CERTIFICATE----- & -----END CERTIFICATE-----, is That the whole certificate? As I am novice, little bit confusing between the message digest and public key? Thanks in Advance-opensid

    Read the article

  • Orbited exception Data must not be unicode.

    - by Sid
    I am working with orbited and once I switch on orbited in production mode it throws the following error on my screen -- <exception caught here> --- File "/usr/lib/python2.6/dist-packages/twisted/web/server.py", line 150, in process self.render(resrc) File "/usr/lib/python2.6/dist-packages/twisted/web/server.py", line 157, in render body = resrc.render(self) File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/transports/base.py", line 21, in render self.conn.transportOpened(self) File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/cometsession.py", line 322, in transportOpened self.cometTransport.flush() File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/transports/base.py", line 45, in flush self.write(self.packets) File "/usr/local/lib/python2.6/dist-packages/orbited-0.7.10-py2.6.egg/orbited/transports/htmlfile.py", line 42, in write self.request.write(payload); File "/usr/lib/python2.6/dist-packages/twisted/web/http.py", line 862, in write self.transport.write(data) File "/usr/lib/python2.6/dist-packages/twisted/internet/tcp.py", line 420, in write abstract.FileDescriptor.write(self, bytes) File "/usr/lib/python2.6/dist-packages/twisted/internet/abstract.py", line 170, in write raise TypeError("Data must not be unicode") exceptions.TypeError: Data must not be unicode I have absolutely no clue as to what could be the problem. Could anyone point me in the right direction.

    Read the article

  • Resize the /var directory in redhat enterprise edition 4

    - by Sri
    I am running NDB mysql. the log files fills up the /var directory. therefore i cant start the ndbd service now. as a temporary fix, i have deleted the log files and again working fine. but again the log files fill up the /var directory. i got plenty of space in other partition. therefore i would like to swap the partition from one directory to /var. here if my input from df -h Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 ext3 54G 2.9G 49G 6% / /dev/cciss/c0d0p1 ext3 99M 14M 81M 14% /boot none tmpfs 1013M 0 1013M 0% /dev/shm /dev/cciss/c0d0p2 ext3 9.7G 9.7G 0 100% /var there are plenty of space in /dev/mapper/VolGroup00-LogVol00. Therefore i will like to swap 10 G space from this directory to /var. could you please help me out to solve this problem?

    Read the article

  • Page doesn't post to the given URL

    - by Sri Kumar
    Hello All, I have the following HTML content. When i click the button, the page doesn't post to URL provided in action tag. The corresponding application is running, but still the page load of the CrossPage.aspx was not invoked. What could be the problem? <body> <form id="UploadForm" method="post" enctype="multipart/form-data" action="http://localhost:2518/Web/CrossPage.aspx"> <div> <input type="file" id="BtnUpload" /> <input type="button" id="BtnSubmit" value="Submit" /> </div> </form> </body>

    Read the article

  • Was delegates static by default?

    - by Sri Kumar
    Hello All, I was just trying to understand delegates using the following code. public class delegatesEx { public delegate int Mydelegate(int first, int second); public int add(int first, int second) { return first + second; } public int sub(int first, int second) { return first - second; } } Here is my main method Console.WriteLine("******** Delegates ************"); delegatesEx.Mydelegate myAddDelegates = new delegatesEx.Mydelegate(new delegatesEx().add); int addRes = myAddDelegates(3, 2); Console.WriteLine("Add :" + addRes); delegatesEx.Mydelegate mySubDelegates = new delegatesEx.Mydelegate(new delegatesEx().sub); int subRes = mySubDelegates(3, 2); Console.WriteLine("Sub :" + subRes); I didn't declare delegate to be static but i was able to access it using the Class name. How is it possible?

    Read the article

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