Search Results

Search found 90 results on 4 pages for 'syed faraz haider zaidi'.

Page 3/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Parsing Wiki XML Dumps ver0.4 just got tough

    - by syed
    Hello, I am trying to parse Wikipedia XML Dump using "Parse-MediaWikiDump-1.0.4" along with "Wikiprep.pl" script. I guess this script works fine with ver0.3 Wiki XML Dumps but not with the latest ver0.4 Dumps. I get the following error. Can't locate object method "page" via package "Parse::MediaWikiDump::Pages" at wikiprep.pl line 390. Also, under the "Parse-MediaWikiDump-1.0.4" documentation @ http://search.cpan.org/~triddle/Parse-MediaWikiDump-1.0.4/lib/Parse/MediaWikiDump/Pages.pm, I read "LIMITATIONS Version 0.4 This class was updated to support version 0.4 dump files from a MediaWiki instance but it does not currently support any of the new information available in those files." Any work arounds would help me get to the next level. Note: one may wonder why cannot we directly use SAX or STAX parser instead, wikipedia dump is a 25GB plus single file, stack/memory issues are obvious. Hence, the above perl script resolves this issue but currently I am stuck with this version problem.

    Read the article

  • Boost Thread Specific Storage Question (boost/thread/tss.hpp)

    - by Hassan Syed
    The boost threading library has an abstraction for thread specific (local) storage. I have skimmed over the source code and it seems that the TSS functionality can be used in an application with any existing thread regardless of weather it was created from boost::thread --i.e., this implies that certain callbacks are registered with the kernel to hook in a callback function that may call the destructor of any TSS objects when the thread or process is going out of scope. I have found these callbacks. I need to cache HMAC_CTX's from OpenSSL inside the worker threads of various web-servers (see this, detailed, question for what I am trying to do), and as such I do not controll the life-time of the thread -- the web-server does. Therefore I will use the TSS functionality on threads not created by boost::thread. I just wanted to validate my assumptions before I started implementing the caching logic, are there any flaws in my logic ?

    Read the article

  • Thread Local Memory, Using std::string's internal buffer for c-style Scratch Memory.

    - by Hassan Syed
    I am using Protocol Buffers and OpensSSL to generate, HMACs and then CBC encrypt the two fields to obfuscate the session cookies -- similar Kerberos tokens. Protocol Buffers' API communicates with std::strings and has a buffer caching mechanism; I exploit the caching mechanism, for successive calls in the the same thread, by placing it in thread local memory; additionally the OpenSSL HMAC and EVP CTX's are also placed in the same thread local memory structure ( see this question for some detail on why I use thread local memory and the massive amount of speedup it enables even with a single thread). The generation and deserialization, "my algorithms", of these cookie strings uses intermediary void *s and std::strings and since Protocol Buffers has an internal memory retention mechanism I want these characteristics for "my algorithms". So how do I implement a common scratch memory ? I don't know much about the rdbuf(streambuf - strinbuf ??) of the std::string object. I would presumeably need to grow it to the lowest common size ever encountered during the execution of "my algorithms". Thoughts ? My question I guess would be: " is the internal buffer of a string re-usable, and if so, how ?" Edit: See comments to Vlad's answer please.

    Read the article

  • boost::Spirit Grammar for unsorted schema

    - by Hassan Syed
    I have a section of a schema for a model that I need to parse. Lets say it looks like the following. { type = "Standard"; hostname="x.y.z"; port="123"; } The properties are: The elements may appear unordered. All elements that are part of the schema must appear, and no other. All of the elements' synthesised attributes go into a struct. (optional) The schema might in the future depend on the type field -- i.e., different fields based on type -- however I am not concerned about this at the moment.

    Read the article

  • Loading and storing encryption keys from a config source

    - by Hassan Syed
    I am writing an application which has an authenticity mechanism, using HMAC-sha1, plus a CBC-blowfish pass over the data for good measure. This requires 2 keys and one ivec. I have looked at Crypto++ but the documentation is very poor (for example the HMAC documentation). So I am going oldschool and use Openssl. Whats the best way to generate and load these keys using library functions and tools ? I don't require a secure-socket therefore a x.509 certificate probably does not make sense, unless, of-course, I am missing something. So, do I need to write my own config file, or is there any infrastructure in openssl for this ? If so, could you direct me to some documentation or examples for this.

    Read the article

  • Auto populate a text field based on another text field

    - by Syed Aslam
    I am trying to auto-populate a text field based on the value of another input field. Currently trying to do this using observe_field helper like this: <%= observe_field( :account_name, :function => "alert('Name changed!')", :on => 'keyup' ) %> <% form_for(@account, :html => { :id => 'theform' }) do |f| %> <label for="accountname"> Account name </label> <%= form.text_field :name, :tabindex => '1' %> <label for="subdomain"> Subdomain </label> <%= form.text_field :subdomain, :tabindex => '2' %> <% end %> When the user enters text in the account_name text_field, I want to copy that convert into a subdomain (downcase and join by '-') and populate to subdomain text_field. But, in the process getting this error: element is null var method = element.tagName.toLowerCase(); protot...9227640 (line 3588) Where exactly am I going wrong here? Or is there a better way to do this?

    Read the article

  • Function-Local Static Const variable Initialization semantics.

    - by Hassan Syed
    The questions are in bold, for those that cannot be bothered reading a question in depth. This is a followup to this question. It is to do with the initialization semantics of static variables in functions. Static variables should be initialized once, and their internal state might be altered later - as I (currently) do in the linked question. However, the code in question does not require the feature to change the state of the variable later. Let me clarrify my position, since I don't require the string object's internal state to change. The code is for a trait class for meta programming, and as such would would benifit from a const char * const ptr -- thus Ideally a local cost static const variable is needed. My educated guess is that in this case the string in question will be optimally placed in memory by the link-loader, and that the code is more secure and maps to the intended semantics. This leads to the semantics of such a variable "The C++ Programming language Third Edition -- Stroustrup" does not have anything (that I could find) to say about this matter. All that is said is that the variable is initialized once when the flow of control of the thread first reaches the code. This leads me to ponder if the following code would be sensible, and if not what are the intended semantics ?. #include <iostream> const char * const GetString(const char * x_in) { static const char * const x = x_in; return x; } int main() { const char * const temp = GetString("yahoo"); std::cout << temp << std::endl; const char * const temp2 = GetString("yahoo2"); std::cout << temp2 << std::endl; } The following compiles on GCC and prints "yahoo" twice. Which is what I want -- However it might not be standards compliant (which is why I post this question). It might be more elegant to have two functions, "SetString" and "String" where the latter forwards to the first. If it is standards compliant does someone know of a templates implementation in boost (or elsewhere) ?

    Read the article

  • Using Session in Silverlight using simple WebServices (NOT WCF)

    - by Syed
    Hi, I need to use Session variables in my Silverlight application ( Using Visual Studio 2008, and Silverlight 3). I am already using a webservice (not WCF service) and would like to know if I can add two methods say GetSessionVariable and SetSessionVariable in my existing WebService Class? Any assistance with sample code would be great! Regards and Thanks in advance, Nadeem.

    Read the article

  • How does a portable Thread Specific Storage Mechanism's Naming Scheme Generate Thread Relative Uniqu

    - by Hassan Syed
    A portable thread specific storage reference/identity mechanism, of which boost/thread/tss.hpp is an instance, needs a way to generate a unique keys for itself. This key is unique in the scope of a thread, and is subsequently used to retrieve the object it references. This mechanism is used in code written in a thread neutral manner. Since boost is a portable example of this concept, how specifically does such a mechanism work ?

    Read the article

  • Rails: link_to_remote prototype helper with :with option

    - by Syed Aslam
    I am trying to grab the current value of a drop down list with Prototype and passing it along using :with like this <%= link_to_remote "today", :update => "choices", :url => { :action => "check_availability" } , :with => "'practitioner='+$F('practitioner')&'clinic='+$F('clinic')&'when=today'", :loading => "spinner.show(); $('submit').disable();", :complete => "spinner.hide(); $('submit').enable();" %> However, this is not working as expected. I am unable to access parameters in the controller as the link_to_remote helper is sending parameters like this: Parameters: {"succ"=>"function () {\n return this + 1;\n}", "action"=>"check_availability", "round"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "ceil"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "floor"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "times"=>"function (iterator, context) {\n $R(0, this, true).each(iterator, context);\n return this;\n}", "toPaddedString"=>"function (length, radix) {\n var string = this.toString(radix || 10);\n return \"0\".times(length - string.length) + string;\n}", "toColorPart"=>"function () {\n return this.toPaddedString(2, 16);\n}", "abs"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "controller"=>"main"} Where am I going wrong? Is there a better way to do this?

    Read the article

  • Accidental Complexity in OpenSSL HMAC functions

    - by Hassan Syed
    SSL Documentation Analaysis This question is pertaining the usage of the HMAC routines in OpenSSL. Since Openssl documentation is a tad on the weak side in certain areas, profiling has revealed that using the: unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, const unsigned char *d, int n, unsigned char *md, unsigned int *md_len); From here, shows 40% of my library runtime is devoted to creating and taking down **HMAC_CTX's behind the scenes. There are also two additional function to create and destroy a HMAC_CTX explicetly: HMAC_CTX_init() initialises a HMAC_CTX before first use. It must be called. HMAC_CTX_cleanup() erases the key and other data from the HMAC_CTX and releases any associated resources. It must be called when an HMAC_CTX is no longer required. These two function calls are prefixed with: The following functions may be used if the message is not completely stored in memory My data fits entirely in memory, so I choose the HMAC function -- the one whose signature is shown above. The context, as described by the man page, is made use of by using the following two functions: HMAC_Update() can be called repeatedly with chunks of the message to be authenticated (len bytes at data). HMAC_Final() places the message authentication code in md, which must have space for the hash function output. The Scope of the Application My application generates a authentic (HMAC, which is also used a nonce), CBC-BF encrypted protocol buffer string. The code will be interfaced with various web-servers and frameworks Windows / Linux as OS, nginx, Apache and IIS as webservers and Python / .NET and C++ web-server filters. The description above should clarify that the library needs to be thread safe, and potentially have resumeable processing state -- i.e., lightweight threads sharing a OS thread (which might leave thread local memory out of the picture). The Question How do I get rid of the 40% overhead on each invocation in a (1) thread-safe / (2) resume-able state way ? (2) is optional since I have all of the source-data present in one go, and can make sure a digest is created in place without relinquishing control of the thread mid-digest-creation. So, (1) can probably be done using thread local memory -- but how do I resuse the CTX's ? does the HMAC_final() call make the CTX reusable ?. (2) optional: in this case I would have to create a pool of CTX's. (3) how does the HMAC function do this ? does it create a CTX in the scope of the function call and destroy it ? Psuedocode and commentary will be useful.

    Read the article

  • How To use Simple Html Video Player Also Have Rewind Forward Capability For The Next Video ?? PHP HTML

    - by Syed Raza
    i am trying to use this code for video in html but fistle it is for flash videos and second thing is that it do not have rewind forward capability for the next video clip my code is, <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="250" height="250" align="middle"> <param name="allowScriptAccess" value="sameDomain"/> <param name="movie" value="Pro Tools Tutorials.swf"/> <param name="quality" value="high"/> <param name="bgcolor" value="#000000"/> <param name="allowFullScreen" value="true"/> <embed src="/unknittingmouse1.swf" quality="high" align="middle" bgcolor="#ffffff" width="250" height="230" allowFullScreen="true" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed> </object> we have to also be carefull that that video code will run on internet explorer Hopes to listen from you soon, thanks in advance

    Read the article

  • Reverse rendering of Urdu fonts

    - by Syed Muhammad Umair
    I am working on a project that is based on Urdu language in Ubuntu platform. I'm using Python language and have almost achieved my task. The problem is that, the Urdu text is rendered in reverse order. For example, consider the word ??? (which means work) consisting of the three letters: ? , ? , and ? The output is rendered in reverse order as ??? consisting of the three letters: ?, ?, and ? When copying this text to Open Office or opening the generated XML file in Firefox, the generated result is absolutely desired. I Am using Python 2.6 IDLE, its working perfect with Windows platform, which clearly shows its not the problem of IDLE. Am working on TKINTER GUI library. How can this problem be solved?

    Read the article

  • Hiding Opetions of a Selection with JQuery

    - by Syed Abdul Rahman
    Okay, let's start with an example. <select id = "selection1">     <option value = "1" id = "1">Number 1</option>     <option value = "2" id = "2">Number 2</option>     <option value = "3" id = "3">Number 3</option> </select> Now from here, we have a dropdown with 3 options. What I want to do now is to hide an option. Adding style = "display:none" will not help. The option would not appear in the dropdownlist, but using the arrow keys, you can still select it. Essentially, it does exactly what the code says. It isn't displayed, and it stops there. A JQuery function of $("1").hide() will not work. Plus, I don't only want to hide the option, I want to completely remove it. Any possibility on doing so? Do I have to use parent/sibling/child elements? If so, I'm still not sure how. Any help on this would be greatly appreciated. Thanks.

    Read the article

  • Conventions for modelling c programs.

    - by Hassan Syed
    I'm working with a source base written almost entirely in straight-c (nginx). It does, however, make use of rich high level programming techniques such as compile-time metaprogramming, and OOP - including run-time dispatch. I want to draw ER diagrams, UML class diagrams and UML sequence diagrams. However to have a clean mapping between the two, consistent conventions must be applied. So, I am hopping someone has some references to material that establishes or applies such conventions to similar style c-code.

    Read the article

  • postgres store with composite value type, or a better way of attributing an inverted index

    - by Hassan Syed
    can't seem to figure out the syntax for populating a hstore with a value of composite type -- note: I do not want to convert a record to a hstore. select hstore('hello => ROW(1,2)'); I know it's something simple; However, google is not my friend today. use case : custom inverted index. The data is modelling an inverted index of lexemes, the composite data types are various probabilities related to the lexemes which I will use to implement document clustering. Does anyone know a better way of doing this ? I'm open to using an external system if it allows attaching attributes to key-posting pairs in the inverted index. I'd use something external if it had solid support for what I am trying to do, I suspect that sticking 3-10k lexemes per tuple and then doing batch processing on them is gonna be nasty as the whole hstore will have to be parsed and converted .

    Read the article

  • openssl crypto library - base64 conversion

    - by Hassan Syed
    I'm using openssl BIO objects to convert a binary string into a base64 string. The code is as follows: void ToBase64(std::string & s_in) { BIO * b_s = BIO_new( BIO_s_mem() ); BIO * b64_f = BIO_new( BIO_f_base64() ); b_s = BIO_push( b64_f , b_s); std::cout << "IN::" << s_in.length(); BIO_write(b_s, s_in.c_str(), s_in.length()); char * pp; int sz = BIO_get_mem_data(b_s, &pp); std::cout << "OUT::" << sz << endl; s_in.assign(pp,sz); //std::cout << sz << " " << std::string(pp,sz) << std::endl; BIO_free (b64_f); // TODO ret error potential BIO_free (b_s); // } The in length is either 64 or 72. However the output is always 65, which is incorrect it should be much larger than that. The documentation isn't the best in the world, AFAIK the bio_s_mem object is supposed to grow dynamically. What am I doing wrong ?

    Read the article

  • Enable Datepicker only when first field has a value

    - by Syed Abdul Rahman
    Right now, the End Date selection is disabled. I want to only enable this when a Start Date is selected. if( $('#datepicker1').val().length === 0) { $('#datepicker2').datepicker("disable"); } else { $('#datepicker2').datepicker("enable"); } This clearly does not work. If I insert value = 'random date' into my first input field, it works fine. I'm not too sure on how do this. Clearly not as easy as I had hoped. My other problem, or hope, is to disable the dates including and before the first selection. You know, pick Start Date, and every date before and said date for the next picker would be disabled. But that is a whole other problem.

    Read the article

  • Vim: yank and replace -- the same yanked input -- multiple times, and two other questions

    - by Hassan Syed
    Now that I am using vim for everything I type, rather then just for configuring servers, I wan't to sort out the following trivialities. I tried to formulate Google search queries but the results didn't address my questions :D. Question one: How do I yank and replace multiple times ? Once I have something in the yank history (if that is what its called) and then highlight and use the 'p' char in command mode the replaced text is put at the front of the yank history; therefore subsequent replace operations do not use the the text I intended. I imagine this to be a usefull feature under certain circumstances but I do not have a need for it in my workflow. Question two: How do I type text without causing the line to ripple forward ? I use hard-tab stops to allign my code in a certain way -- e.g., FunctionNameX ( lala * land ); FunctionNameProto ( ); When I figure out what needs to go into the second function, how do I insert it without move the text up ? Question three Is there a way of having a uniform yank history across gvim instances on the same machine ? I have 1 monitors. Just wondering, atm I am using highlight + mouse middle click.

    Read the article

  • Adding List Array item In A Data Table Using Loop Results Error .. .

    - by Syed Raza
    I am trying to put the list array(res) item in to the Data Table(_Hdt) using for Loop I have put the values in "res" list erray using loop...but this loop results in an error: "variable use asd a method ?" Here _Hdt and dt are data table and res is list array, for (int r = 0; r < _Hdt.Rows.Count; r++) { foreach (DataRow row in dt.Select("DATE='" + _Hdt.Rows[r]["DATE"].ToString().Trim() + "'")) { DateTime date = Convert.ToDateTime(_Hdt.Rows[r]["DATE"].ToString().Trim()); string dateformat = String.Format("{0:dddd MMM d}", date); _Hdt.Rows[r]["DATE"] = dateformat; _Hdt.Rows[r]["MTU"] = row["MTU"].ToString().Trim(); _Hdt.Rows[r]["POWER"] = (Convert.ToDecimal(row["POWER"].ToString().Trim()) / 1000).ToString(); _Hdt.Rows[r]["COST"] = row["COST"].ToString().Trim(); _Hdt.Rows[r]["VOLTAGE"] = row["VOLTAGE"].ToString().Trim(); _Hdt.Rows[r]["KW"] = res(r); } }

    Read the article

  • Thread Local Memory for Scratch Memory.

    - by Hassan Syed
    I am using Protocol Buffers and OpensSSL to generate, HMACs and then CBC encrypt the two fields to obfuscate the session cookies -- similar Kerberos tokens. Protocol Buffers' API communicates with std::strings and has a buffer caching mechanism; I exploit the caching mechanism, for successive calls in the the same thread, by placing it in thread local memory; additionally the OpenSSL HMAC and EVP CTX's are also placed in the same thread local memory structure ( see this question for some detail on why I use thread local memory and the massive amount of speedup it enables even with a single thread). The generation and deserialization, "my algorithms", of these cookie strings uses intermediary void *s and std::strings and since Protocol Buffers has an internal memory retention mechanism I want these characteristics for "my algorithms". So how do I implement a common scratch memory ? I don't know much about the rdbuf of the std::string object. I would presumeably need to grow it to the lowest common size ever encountered during the execution of "my algorithms". Thoughts ?

    Read the article

  • Postgres : Post statement (or insert) asynchronous, non-blocking processing.

    - by Hassan Syed
    I'm wondering if it is possible, that after a collection of rows is inserted, to initiate an operation that is executed asynchronously, is non-blocking, and doesn't need to inform the originator of the request - of the result. I am working with large amounts of events and I can guarantee that the post-insert logic will not fail -- I just want to have a single insert thread in my event-sources, and I want this thread to keep flying without blocking, and without being responsible for any post-delivery book-keeping. I can tell you that I would potentially have a 100 of these jobs executing concurrently and each job might operate on 5 tables with anywhere between 200-1000 inserts on each of these tables. A hint in the right direction should be enough.

    Read the article

< Previous Page | 1 2 3 4  | Next Page >