Search Results

Search found 138 results on 6 pages for 'syed haider hassan'.

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

  • 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

  • Check server response in javascript.

    - by Mujtaba Hassan
    I want to check server response in javascript. For example I have a server A which will host the script. On excuting the script it will check if the server B is responding or not. If yest continue other wise redirect to server C. Is this possible with Javascript/Jquery? If not what could be a possible solution in PHP?

    Read the article

  • Problem showing selected value of combobox when it is bind to a List<T> using Linq to Entities

    - by Syed Mustehsan Ikram
    I have a combobox which is has itemtemplate applied on it and is bind to a List of entity return using linq. i m using mvvm. It is bind to it successfully but when i set the selected value of it from code at runtime to show the selected value coming from db it doesn't select it. For reference here is my combobox xaml. SelectedValue="{Binding Path=SelectedManufacturer}" Grid.Column="3" Grid.Row="2" Margin="20,9.25,68,7.75" ItemTemplate="{StaticResource ManufacturerDataTemplate}" TabIndex="6"/ Here is my part from code behind from viewModel. List currentManufacturers = new List(); tblManufacturer selectedManufacturer = null; public List CurrentManufacturers { get { return currentManufacturers; } set { currentManufacturers = value; NotifyPropertyChanged("CurrentManufacturers"); } } public tblManufacturer SelectedManufacturer { get { return selectedManufacturer; } set { selectedManufacturer = currentManufacturers.Where(mm => mm.ManufacturerID == Convert.ToInt32(selectedDevice.tblManufacturer.EntityKey.EntityKeyValues[0].Value)).First(); NotifyPropertyChanged("SelectedManufacturer"); } }

    Read the article

  • C++ iterators, default initialization and what to use as an uninitialized sentinel.

    - by Hassan Syed
    The Context I have a custom template container class put together from a map and vector. The map resolves a string to an ordinal, and the vector resolves an ordinal (only an initial string to ordinal lookup is done, future references are to the vector) to the entry. The entries are modified intrusively to contain a a bool "assigned" and an iterator_type which is a const_iterator to the container class's map. My container class will use RCF's serialization code (which models boost::serialization) to serialize my container classes to nodes in a network. Serializing iterator's is not possible, or a can of worms, and I can easily regenerate them onces the vectors and maps are serialized on the remote site. The Question I need to default initialize, and be able to test that the iterator has not been assigned to (if it is assigned it is valid, if not it is invalid). Since map iterators are not invalidated upon operations performed on it (unless of course items are removed :D) am I to assume that map<x,y>::end() is a valid sentinel (regardless of the state of the map -- i.e., it could be empty) to initialize to ? I will always have access to the parent map, I'm just unsure wheather end() is the same as the map contents change. I don't want to use another level of indirection (--i.e., boost::optional) to achieve my goal, I'd rather forego compiler checks to correct logic, but it would be nice if I didn't need to. Misc This question exists, but most of its content seems non-sense. Assigning a NULL to an iterator is invalid according to g++ and clang++. This is another similar question, but it focuses on the common use-cases of iterators, which generally tends to be using the iterator to iterate, ofcourse in this use-case the state of the container isn't meant to change whilst iteration is going on.

    Read the article

  • Endianness and C API's: Specifically OpenSSL.

    - by Hassan Syed
    I have an algorithm that uses the following OpenSSL calls: HMAC_update() / HMAC_final() // ripe160 EVP_CipherUpdate() / EVP_CipherFinal() // cbc_blowfish These algorithm take a unsigned char * into the "plain text". My input data is comes from a C++ std::string::c_str() which originate from a protocol buffer object as a encoded UTF-8 string. UTF-8 strings are meant to be endian neutrial. However I'm a bit paranoid about how OpenSSL may perform operations on the data. My understanding is that encryption algorithms work on 8-bit blocks of data, and if a unsigned char * is used for pointer arithmetic when the operations are performed the algorithms should be endian neutral and I do not need to worry about anything. My uncertainty is compounded by the fact that I am working on a little-endian machine and have never done any real cross-architecture programming. My beliefs/reasoning are/is based on the following two properties std::string (not wstring) internally uses a 8-bit ptr and a the resulting c_str() ptr will itterate the same way regardless of the CPU architecture. Encryption algorithms are either by design, or by implementation, endian neutral. I know the best way to get a definitive answer is to use QEMU and do some cross-platform unit tests (which I plan to do). My question is a request for comments on my reasoning, and perhaps will assist other programmers when faced with similar problems.

    Read the article

  • Multiple webservice calls

    - by Mujtaba Hassan
    I have a webservice (ASP.NET) deployed on a webfarm. A client application consumes it on daily basis. The problem is that some of its calls are duplicated (with difference of milliseconds). For example I have a function Foo(string a,string b). The client app calls this webmethod as Foo('test1','test2') once but my log shows that it is being called twice or sometimes 3 or 4 times randomly. Is this anything wrong with the webfarm or the code? Note that the webmethod has simple straighfarward insert and update statements.

    Read the article

  • xsl:value-of Not Working

    - by Ashar Syed
    Hi, I am having a little issue this piece of code in my Xsl. <xsl:if test="ShippingName != ''"> <tr> <td colspan="6" style="border:none;" align="right"> <strong>Shipping Via</strong> </td> <td align="right"> <xsl:value-of select="ShippingName" /> </td> </tr> </xsl:if> It passes the test condition (ShippingName != '') and assigns the style to 'td' but at the point where I am displaying the value that this element contains (), it displays nothing. Any ideas why this could be happening. Thanks.

    Read the article

  • Hiding Options of a Select with JQuery

    - by Syed Abdul Rahman
    Okay, let's start with an example. Keep in mind, this is only 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.           Another question - It's related Ok, so I found out that there is a .remove() available in JQuery. Works well. But what if I want to bring it back? if(condition)     {     $(this).remove();     } I can loops this. Shouldn't be complicated. But the thing of which I am trying to do is this: Maximum Capacity of Class: (Input field here) Select Room: (Dropdown here) What I'd like for it to do is to update is Dropdown using a function such as .change() or .keyup. I could create the dropdown only after something is typed. At a change or a keyup, execute the dropdown accordingly. But what I am doing is this: $roomarray = mysql_query("SELECT *     FROM         (         SELECT *,         CASE         WHEN type = 'Classroom' THEN 1         WHEN type = 'Computer laboratory' THEN 2         WHEN type = 'Lecture Hall' THEN 3         WHEN type = 'Auditorium' THEN 4         END AS ClassTypeValue         FROM rooms         ) t     ORDER BY ClassTypeValue, maxppl, roomID"); echo "<select id = \"room\">"; while ($rooms = mysql_fetch_array($roomarray)) { ?> <option value=<?php echo $rooms['roomID']; ?> id=<?php echo $rooms['roomID']; ?>><?php echo $rooms['type']; echo "&nbsp;"; echo $rooms['roomID']; echo "&nbsp;("; echo $rooms['maxppl']; echo ")"; ?></option> <?php } echo "</select>"; Yes, I know it is very messy. I plan to change it later on. But the issue now is this: Can I toggle the removal of the options according to what has been typed? Is it possible to do so with a dropdown made from a loop? Because I sure as hell can't keep executing SQL Queries. Or is that even an option? Because if it's possible, I still think it's a bad one.

    Read the article

  • Getting meaningful error messages from fstream's in C++

    - by Hassan Syed
    What is the best way to get meaningful file access error messages, in a portable way from std::fstreams ? The primitiveness of badbits and failbits is getting to be bit annoying. I have written my own exception hierarchies against win32 and POSIX before, and that was far more flexible than the way the STL does it. I am getting "basic::ios_clear" as an error message from the what method of a downcasted catch (std::exception) of a fstream which has exceptions enabled. This doesn't mean much to me, although I do know what the problem is I'd like my program to be a tad more informative so that when I start deployment a few months later my life will be easier. Is there anything in Boost to extract meaningful messages out of the ofstream's implementation cross platform and cross STL implementation ?

    Read the article

  • How to get comma-separated values in Linq?

    - by Mujtaba Hassan
    I have the query below: var users = (from a in dc.UserRoles join u in dc.Users on a.intUserId equals u.ID join r in dc.Roles on a.intRoleId equals r.ID where r.intClientId == clientID select new UserRoleDetail { ID = a.ID, intUserId = a.intUserId, intRoleId = a.intRoleId, Name =u.FullName, //Here I need comma separated values. intAssignedById = a.intAssignedById, RoleName = r.vchName, Function = u.vchFunction }); I require all the values of "Name =u.FullName" to be comma-separated in a single record group by intRoleId. I mean for every role I need all the usernames in a sigle record comma separated. Any suggestion?

    Read the article

  • What is the need for normalizing a vector?

    - by Rashed Hassan
    Trying to understand vectors a bit more. What is the need for normalizing a vector? If I have a vector, N = (x, y, z) What do you actually get when you normalize it - I get the idea you have to divide x/|N| y/|N| & z/|N|. My question is, why do we do this thing, I mean what do we get out of this equation? What is the meaning or 'inside' purpose of doing this. A bit of a maths question, I apologize, but I am really not clear in this topic.

    Read the article

  • I want to retrieve some information based on Caller ID

    - by Hassan Al-Jeshi
    Hello, my friend has a Real Estate company that receives a lot of phone calls everyday. He wants to have a solution such that when somebody call to his company, the operator sees all the information about the person who is calling based on the database he have right now and the caller ID. Is there a ready made software or solution that can do the job?? Since I'm a software engineer myself, I would never mind developing something from scratch or built on a ready made system (with a team of course), but I need some direction on how to start?? Notes: 1- cost is not an issue 2- the customers database is there but we never mind replacing it in a format to suit the new solution Best Regards,

    Read the article

  • In query in Entity Frame work

    - by Syed Salman Raza Zaidi
    I am working on Entity frame work, i have created a method which is returning List of my Table, I am retrieving data on base of grpID(which is foreign key, so i can have multiple records) I have saved these grpID's in an array so I want to run IN command on Entity framework so that i can get records in single List, How can i apply In command,my code is below public List<tblResource> GetResources(long[] grpid) { try { return dataContext.tblResource.Where(c => c.GroupId == grpid && c.IsActive == true).ToList();//This code is not working as i am having array of groupIds } catch (Exception ex) { return ex; } }

    Read the article

  • In the generic programming/TMP world what exactly is a model / a policy and a "concept" ?

    - by Hassan Syed
    I'd like to know the precise yet succinct definitions of these three concepts in one place. The quality of the answer should depend on the following two points. Show a simple code snippet to show how and what the concept/technique is used for. Be simple enough to understand so that a programmer without any exposure to this area can grasp it. Note: There are probably many correct answers since each concept has many different facets. If there are a lot of good answers I will eventually turn the question into CW and aggregate the answers. -- Post Accept Edit -- Boost has a nice article on generic programming concepts

    Read the article

  • How to sub with matched groups and variables in Python

    - by Syed
    Hi, new to python. This is probably simple but I haven't found an answer. rndStr = "20101215" rndStr2 = "20101216" str = "Looking at dates between 20110316 and 20110317" outstr = re.sub("(.+)([0-9]{8})(.+)([0-9]{8})",r'\1'+rndStr+r'\2'+rndStr2,str) The output I'm looking for is: Looking at dates between 20101215 and 20101216 But instead I get: P101215101216 The values of the two rndStr's doesn't really matter. Assume its random or taken from user input (I put static vals here to keep it simple). Thanks for any help.

    Read the article

  • Runtime error in C code (strange double conversion)

    - by Miro Hassan
    I have a strange runtime error in my C code. The Integers comparison here works fine. But in the Decimals comparison, I always get that the second number is larger than the first number, which is false. I am pretty new to C and programming in general, so this is a complex application to me. #include <stdio.h> #include <stdbool.h> #include <stdlib.h> int choose; long long neLimit = -1000000000; long long limit = 1000000000; bool big(a,b) { if ((a >= limit) || (b >= limit)) return true; else if ((a <= neLimit) || (b <= neLimit)) return true; return false; } void largerr(a,b) { if (a > b) printf("\nThe First Number is larger ..\n"); else if (a < b) printf("\nThe Second Number is larger ..\n"); else printf("\nThe Two Numbers are Equal .. \n"); } int main() { system("color e && title Numbers Comparison && echo off && cls"); start:{ printf("Choose a Type of Comparison :\n\t1. Integers\n\t2. Decimals \n\t\t I Choose Number : "); scanf("%i", &choose); switch(choose) { case 1: goto Integers; break; case 2: goto Decimals; break; default: system("echo Please Choose a Valid Option && pause>nul && cls"); goto start; } } Integers: { system("title Integers Comparison && cls"); long x , y; printf("\nFirst Number : \t"); scanf("%li", &x); printf("\nSecond Number : "); scanf("%li", &y); if (big(x,y)) { printf("\nOut of Limit .. Too Big Numbers ..\n"); system("pause>nul && cls") ; goto Integers; } largerr(x,y); printf("\nFirst Number : %li\nSecond Number : %li\n",x,y); goto exif; } Decimals: { system("title Decimals Comparison && cls"); double x , y; printf("\nFirst Number : \t"); scanf("%le", &x); printf("\nSecond Number : "); scanf("%le", &y); if (big(x,y)) { printf("\nOut of Limit .. Too Big Numbers ..\n"); system("pause>nul && cls") ; goto Decimals; } largerr(x,y); goto exif; } exif:{ system("pause>nul"); system("cls"); main(); } }

    Read the article

  • Search a string for certain numbers

    - by Hassan Gulzar
    Hello! I'm trying to come up with a lightning fast solution to find portions in a string. Here is a Sample string: "PostLoad successful! You transferred amount of 17.00 Rs to 03334224222. Now use PostLoad by dialing 123. PostLoad on SMS will end on 01-03-2011." Objective: Need to retrieve the bold values: Amount and Cell Number. The string contents change slightly but the cell number will always be a 11 digit. The amount is always with two decimal precision. Any suggestions using C# and RegEx?

    Read the article

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