Search Results

Search found 2312 results on 93 pages for 'whats your favourite'.

Page 73/93 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • Maven Eclipse plugin and classpath issues in Eclipse

    - by subferno
    I am using Eclipse 3.51, Maven 2.0.9, Java 1.4, with the Maven Eclipse plugin 2.7 with WTP 2.0 (not m2Eclipse). I have a flat multi module project that is set up as follows (module Parent with the parent pom, module A and B is dependent on C). Importing the four modules in for the first time will show compile errors as expected since I have not ran the eclipse plugin. With my local repository empty, running eclipse clean will resolve all compile errors and dependencies within the my local workspace. If I were to make some minor code changes to module B and run the eclipse plugin again, compile errors would show up in module A and B. Compile errors about classes that cannot be found. Its like module C is no longer in the classpath for A and B to see. I look at the .classpath file and its definitely looking at the right modules in the Eclipse workspace. If I delete the maven repository and do the eclipse clean again, the compile errors about unresolved classes are fixed. Also, if I run the eclpse clean command with the useProjectReferences flag to false and then rerun it with true, Eclipse would rebuild my workspace and the errors will go away. Whats going on?

    Read the article

  • Ruby metaclass madness

    - by t6d
    I'm stuck. I'm trying to dynamically define a class method and I can't wrap my head around the ruby metaclass model. Consider the following class: class Example def self.meta; (class << self; self; end); end def self.class_instance; self; end end Example.class_instance.class # => Class Example.meta.class # => Class Example.class_instance == Example # => true Example.class_instance == Example.meta # => false Obviously both methods return an instance of Class. But these two instances are not the same. They also have different ancestors: Example.meta.ancestors # => [Class, Module, Object, Kernel] Example.class_instance.ancestors # => [Example, Object, Kernel] Whats the point in making a difference between the metaclass and the class instance? I figured out, that I can send :define_method to the metaclass to dynamically define a method, but if I try to send it to the class instance it won't work. At least I could solve my problem, but I still want to understand why it is working this way.

    Read the article

  • Custom ASPNetMembership FailureInformation always null, OnValidatingPassword issue

    - by bigb
    As stated here http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.onvalidatingpassword.aspx "When the ValidatingPassword event has completed, the properties of the ValidatePasswordEventArgs object supplied as the e parameter can be examined to determine whether the current action should be canceled and if a particular Exception, stored in the FailureInformation property, should be thrown." Here is some details/code which really shows why FailureInformation shouldn't be always null http://forums.asp.net/t/991002.aspx if any password security conditions not matched. According with my Membership settings i should get an exception that password does not match password security conditions, but it is not happened. Then i did try to debug System.Web.ApplicationServices.dll(in .NET 4.0 System.Web.Security located here) Framework Code to see whats really happens there, but i cant step into this assembly, may be because of this [TypeForwardedFrom("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] public abstract class MembershipProvider : ProviderBase Easily i may step into any another .NET 4.0 assembly, but in this one not. I did check, symbols for System.Web.ApplicationServices.dll loaded. Now i have only one idea how ti fix it - to override method OnValidatingPassword(ValidatePasswordEventArgs e). Thats my story. May be some one may help: 1) Any ideas why OnValidatingPassword not working? 2) Any ideas how to step into it?

    Read the article

  • Mysql german accents not-sensitive search in full-text searches

    - by lukaszsadowski
    Let`s have a example hotels table: CREATE TABLE `hotels` ( `HotelNo` varchar(4) character set latin1 NOT NULL default '0000', `Hotel` varchar(80) character set latin1 NOT NULL default '', `City` varchar(100) character set latin1 default NULL, `CityFR` varchar(100) character set latin1 default NULL, `Region` varchar(50) character set latin1 default NULL, `RegionFR` varchar(100) character set latin1 default NULL, `Country` varchar(50) character set latin1 default NULL, `CountryFR` varchar(50) character set latin1 default NULL, `HotelText` text character set latin1, `HotelTextFR` text character set latin1, `tagsforsearch` text character set latin1, `tagsforsearchFR` text character set latin1, PRIMARY KEY (`HotelNo`), FULLTEXT KEY `fulltextHotelSearch` (`HotelNo`,`Hotel`,`City`,`CityFR`,`Region`,`RegionFR`,`Country`,`CountryFR`,`HotelText`,`HotelTextFR`,`tagsforsearch`,`tagsforsearchFR`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci; In this table for example we have only one hotel with Region name = "Graubünden" (please note umlaut ü character) And now I want to achieve same search match for phrases: 'graubunden' and 'graubünden' This is simple with use of MySql built in collations in regular searches as follows: SELECT * FROM `hotels` WHERE `Region` LIKE CONVERT(_utf8 '%graubunden%' USING latin1) COLLATE latin1_german1_ci This works fine for 'graubunden' and 'graubünden' and as a result I receive proper result, but problem is when we make MySQL full text search Whats wrong with this SQL statement?: SELECT * FROM hotels WHERE MATCH (`HotelNo`,`Hotel`,`Address`,`City`,`CityFR`,`Region`,`RegionFR`,`Country`,`CountryFR`, `HotelText`, `HotelTextFR`, `tagsforsearch`, `tagsforsearchFR`) AGAINST( CONVERT('+graubunden' USING latin1) COLLATE latin1_german1_ci IN BOOLEAN MODE) ORDER BY Country ASC, Region ASC, City ASC This doesn`t return any result. Any ideas where the dog is buried ?

    Read the article

  • how does hash element make a secure login on zend framework?

    - by ulduz114
    hello all i saw a example for login form same blow code class Form_Login extends Zend_Form { //put your code here public function init($timeout=360){ $this->addElement('hash', 'token', array( 'timeout' => $timeout )); $this->setName('Login'); $username = $this->createElement ( 'text', 'username' ); $username->setLabel('user name:') ->setRequired(); $this->addElement($username); $password=$this->createElement('password','password'); $password->setLabel('password:'); $password->setRequired(); $this->addElement($password); $login=$this->createElement('submit','login'); $login->setLabel('Login'); $this->addElement($login); $this->setMethod('post'); $this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl().'/authentication/login'); } } and in submitAction a part code same below if (!$form->isValid($request->getPost())) { if (count($form->getErrors('token')) > 0) { return $this->_forward('csrf-forbidden', 'error'); } $this->view->form = $form; return $this->render('login'); } now , my question, whats the reason for use of hash element? how this hash element make secure login? anybody may help explain these? thanks

    Read the article

  • ABAddressBookGetPersonCount(ab) problem

    - by prathumca
    Why the call to ABAddressBookGetPersonCount(ab); is giving the problem? I have around 2000 contacts in my address book. When my app gets started I'm trying to read the entire address book. This works perfectly on simulator but causing crash on IPhone. The crash report is pointing to 9 AppSupport 0x31fbca1e 0x31fb6000 + 27166 // CPRecordStoreGetCountOfInstancesOfClassWhere + 0x7e 10 AddressBook 0x318df668 0x318d5000 + 42600 // ABCGetPersonCountInStore + 0x88 11 AddressBook 0x318ea450 0x318d5000 + 87120 // ABAddressBookGetPersonCount + 0x8 12 MyAddressBook 0x0000ad30 0x1000 + 40240 // -[MyAddressBookController readAB] + 0x2c0 13 MyAddressBook 0x0000a8ce 0x1000 + 39118 // -[MyAddressBookController start] + 0x4a What I'm doing in "readAB"? - (void) readAB { ABAddressBookRef ab = ABAddressBookCreate(); CFArrayRef contacts = ABAddressBookCopyArrayOfAllPeople(ab); CFIndex count = ABAddressBookGetPersonCount(ab); for(int i = 0; i < count; i++) { //doing some thing... } } If you observe the above crash report, it is clearly pointing to CFIndex count = ABAddressBookGetPersonCount(ab);. Whats wrong with this code? I'm sure that this code works perfectly on firmware 3.1.2. But now I upgraded firmware to 3.1.3. Is this upgrade is causing any trouble? Regards, prathumca.

    Read the article

  • Credit card system implementation?

    - by Mark
    My site is going to have a credit system that basically works a lot like a credit card. Each user has an unlimited credit limit, but at the end of each week, they have to pay it off. For example, a user might make several purchases between March 1st and 7th, and then at the end of March 7th, they would be emailed an invoice that lists all their purchases during the week and a total that is due by the 14th. If they don't pay it off, their account is simply deactivated until they do. I'm just trying to wrap my head around how to implement this. I have a list of all their purchases, that's not a problem, but I'm just trying to figure out what to do with it. On the end of the 7th day, I could set up a cronjob to generate an invoice, which would basically have an id, and due date, and then I would need another many-to-many table to link all the purchases to the invoice. Then when a user adds money to their account, I guess it's applied against their current outstanding invoice? And what if they don't pay off their invoice by the time a new invoice rolls around, so now they have 2 outstanding ones, how do I know which to apply it against? Or do I make the cronjob check for any previous outstanding invoices, cancel them, and add a new item to the new invoice as "balance forward (+interest)"? How would you apply the money against an invoice? Would each payment have to be linked to an invoice, or could I just deposit it to their account credit, and then somehow figure out whats been paid and what hasn't? What if they pay in advance, before their invoice has been generated? Do I deduct it from their credit from the invoice upon generation, or at the end of the week when its due? There are so many ways to do this... Can anyone describe what approach they would take?

    Read the article

  • IIS7 GrantByDefault

    - by jonot
    I have an application (written in c#) that allow me to set IIS to allow or deny access to a website from all ip addresses. The application works fine for IIS6 however it does not work with IIS 7 (even with IIS 6 WMI Compatibility installed). heres the code (basically) Type typ = this.Entry.Properties[IIsWebDirectoryProperty.IPSecurity][0].GetType(); var securityProp = this.Entry.Properties[IIsWebDirectoryProperty.IPSecurity][0]; typ.InvokeMember("GrantByDefault", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, securityProp, new object[] { IPSecurity.GrantByDefault }); this.Entry.CommitChanges(); I have checked the metabase for both IIS6 and IIS7 using the metabase explorer and the only diffecnce I can see is that the "IPSecurity" property does not appear in IIS7 until you also add a an allow or deny IP address, through IIS Manager. Whats really got me stumped is that even when I edit the feature setting to Deny access in the IIS Manager there is no change to the metabase or to the web.config in the site root! So how/where is this property being set and read from? And how can I set and read value of this property programmatically?

    Read the article

  • Perl program - Dynamic Bootstrapping code

    - by mgj
    Hi.. I need to understand the working of this particular program, It seems to be quite complicated, could you please see if you could help me understanding what this program in Perl does, I am a beginner so I hardly can understand whats happening in the code given on the following link below, Any kind of guidance or insights wrt this program is highly appreciated. Thank you...:) This program is called premove.pl.c Its associated with one more program premove.pl, Its code looks like this: #!perl open (newdata,">newdata.txt") || die("cant create new file\n");#create passwd file $linedata = ""; while($line=<>){ chomp($line); #chop($line); print newdata $line."\n"; } close(newdata); close(olddata); __END__ I am even not sure how to run the two programs mentioned here. I wonder also what does the extension of the first program signify as it has "pl.c" extension, please let me know if you know what it could mean. I need to understand it asap thats why I am posting this question, I am kind of short of time else I would try to figure it out myself, This seems to be a complex program for a beginner like me, hope you understand. Thank you again for your time.

    Read the article

  • Using PHP to store results of a post request

    - by Paul M
    Im currently working with an API which requires we send our collection details in xml to their server using a post request. Nothing major there but its not working, so I want to output the sent xml to a txt file so I can look at actually whats being sent!! Instead of posting to the API im posting to a document called target, but the xml its outputting its recording seems to be really wrong. Here is my target script, note that the posting script posts 3 items, so the file being written should have details of each post request one after the other. <?php error_reporting(E_ALL); ini_set('display_errors', 1); // get the request data... $payload = ''; $fp = fopen('php://input','r'); $output_file = fopen('output.txt', 'w'); while (!feof($fp)) { $payload .= fgets($fp); fwrite($output_file, $payload); } fclose($fp); fclose($output_file); ?> I also tried the following, but this just recorded the last post request so only 1 collection item was recorded in the txt file, instead of all 3 output_file = fopen('output.txt', 'w'); while (!feof($fp)) { $payload .= fgets($fp); } fwrite($output_file, $payload); fclose($fp); fclose($output_file); I know im missing something really obvious, but ive been looking at this all morning!

    Read the article

  • jQuery1.4.2 $.ajax crashes IE6/7

    - by Kenny Eliasson
    Hello there! I'm having a really hard time debugging one of our latest reported bugs. The problem occurs "randomly", not on every page load, sometimes I can "click" around for a minute or two before IE6/7 crashes. By crash I mean that the IE-window shuts down and I get the option to send the crash info to Microsoft. In FF, Chrome, Safari, IE8 everything is working perfectly. What the page does is issuing 2 AJAX Jsonp calls and building some menus with the data returned. The data brought back can be from ~500b to approx. 35kb. The JSON is valid (else it wouldn't have loaded at all in FF etc), and as i told previous, it works for when navigating around the site soemtimes in IE6/7. I've tested to comment out the callbacks, still crashes. If I remove the $.ajax calls the page will work again. Whats strange is that if I downgrade to jQuery 1.3.2 everything works in all browsers including IE6/7. I've taken the crash-logs and looked at them in WinDbg and what happens seems to be a NULL POINTER reference. The last entries of the stack trace is as follows mshtml!CTreePos::SourceIndex+0x9 mshtml!CMarkup::InsertElementInternal+0x3a8 mshtml!CDoc::InsertElement+0x98 mshtml!CDocument::get_implementation+0x144 Anyone having a clue what could cause this?

    Read the article

  • BizTalk SMTP Message Part Getting XML Encoding

    - by alram
    I have a email multi-part message which I am using to send failed message routing from the messagebox to a business users mailbox. Email{ Body - RawString; OriginalMessage - string}; The original message gets set from the received message that activates the orchestration. For example assume the original failed message is from a Flat file that failed disassembly with the contents: Order,1,2,3,4,5,<6>, I set the message using: Email.OriginalMessage = MyUtil.XlangMsgToStringMethod(FailedMessage);// XmlDocument type, this can be malformed xml, valid xml, or flat file that fails in disassembler. I can then write to the event log to test whats in Email.OriginalMessage: System.Diagnostics.EventLog.WriteEntry("BizTalk Server 2006", Email.OriginalMessage, Information); // This displays the correct original message "Order, 1,2,3,4,5,<6," When the email is delivered using a SMTP server and a dynamic send port, with the attachment set to text/plain mime type, the original message gets xml encoding escaped and wrapped in xml: <?xml version="1.0"?> <string>Order, 1,2,3,4,5,&lt;6&gt;,</string> Any ideas why? The SMTP port has passthrutransmit as pipeline. Thanks.

    Read the article

  • Compute the Length of Largest substring that starts and ends with the same substring

    - by Deepak
    Hi People, Below is the Problem Statement: PS: Given a string and a non-empty substring sub, compute recursively the largest substring which starts and ends with sub and return its length. Examples: strDist("catcowcat", "cat") ? 9 strDist("catcowcat", "cow") ? 3 strDist("cccatcowcatxx", "cat") ? 9 Below is my Code: (Without recursion)//since i found it hard to implement with recursion. public int strDist(String str, String sub){ int idx = 0; int max; if (str.isEmpty()) max = 0; else max=1; while ((idx = str.indexOf(sub, idx)) != -1){ int previous=str.indexOf(sub, idx); max = Math.max(max,previous); idx++; } return max; } Its working for few as shown below but returns FAIL for others. Expected This Run strDist("catcowcat", "cat") ? 9 6 FAIL strDist("catcowcat", "cow") ? 3 3 OK strDist("cccatcowcatxx", "cat") ? 9 8 FAIL strDist("abccatcowcatcatxyz", "cat") ? 12 12 OK strDist("xyx", "x") ? 3 2 FAIL strDist("xyx", "y") ? 1 1 OK strDist("xyx", "z") ? 0 1 FAIL strDist("z", "z") ? 1 1 OK strDist("x", "z") ? 0 1 FAIL strDist("", "z") ? 0 0 OK strDist("hiHellohihihi", "hi") ? 13 11 FAIL strDist("hiHellohihihi", "hih") ? 5 9 FAIL strDist("hiHellohihihi", "o") ? 1 6 FAIL strDist("hiHellohihihi", "ll") ? 2 4 FAIL Could you let me whats wrong with the code and how to return the largest substring that begins and ends with sub with its respective length.

    Read the article

  • How can one setup a version control system on a local network, without a server?

    - by Andrew
    Edit: Ok so I learned that I guess I need an distributed source control, however are there any UI based ones, and do they allow you to merge with other users on the network? This is kind of a two part question, so here it goes. I want to start developing a web application at home (with multiple developers). However, I don't have a dedicated server nor want to pay for on. So first, I don't know which version control system to use for this case, as at work we mostly have TFS setup, so I am not to familiar with whats out there. What are the best free CVS/SVN tools out there? Second, is it possible to somehow setup the CVS/SVN where there is no dedicated server and both clients store up to one week of the source code from the last check-in? Also, it would be helpful if it could integrate with visual studio, again this isn't that important at all. Problem: There are Five users, one is a Server. Server Connected: All Ok Server Disconnected: No one can share. What I am looking for: No Server: Users still have versioning based on version id of last check-in. Users must check all version on network to make sure they aren't outdated based on their last version id. If not check-in, otherwise merge/get latest. If they are update checkin, and set current version id +1.

    Read the article

  • How to use bll, dal and model?

    - by bruno
    Dear all, In my company I must use a Bll, Dal and model layer for creating applications with a database. I've learned at school that every databasetable should be an object in my model. so I create the whole model of my database. Also I've learned that for every table (or model object) there should be a DAO created into the DAL. So I do this to. Now i'm stuck with the BLL classes. I can write a BLLclass for each DAO/ModelObject or I can write a BLLclass that combine some (logic) DAO's... Or i can write just one Bllclass that will manage everything. (this last one I'm sure it aint the best way..) What is the best practice to handle this Bll 'problem'? And a second question. If a bll is in need of tablecontent from an other table where it aint responsible for, whats the best way to get the content? Go ask on the responsible BLL or go directly to the DAO? I'm struggling with these questions the last 2 months, and i don't know what is the best way to handle it.

    Read the article

  • Java: Cleaning up what causes a connection reset

    - by Zombies
    There seems to be some confusion as well contradicting statements on various SO answers: http://stackoverflow.com/questions/585599/whats-causing-my-java-net-socketexception-connection-reset . You can see here that the accepted answer states that the connection was closed by other side. But this is not true, closing a connection doesn't cause a connection reset. It is cauesed by "an underlying TCP/IP error." What I want to know is if a SocketException: Connection reset means really besides "unerlying TCP/IP Error." What really causes this? As I doubt it has anything to do with the connection being closed (since closing a connection isn't an exception worthy flag, and reading from a closed connection is, but that isn't an "underlying TCP/IP error." My hypothesis is this Connection reset is caused from a server's failure to acknowledge an ACK packet (either wholly or just improperly as per TCP/IP). And that a SocketTimeoutException is generated only when no data is generated to be read (since this is thrown during a read after a certain duration, and read is waiting for data, but is not concerned with ACK packets). In other words, read() throws SocketTimeoutException if it didn't read any bytes of actual data (DATA LAYER) in its allotted time.

    Read the article

  • going reverse in a for loop?

    - by sil3nt
    Hello there, Basically i got this for loop and i want the number inputed (eg. 123) to be printed out in reverse, so "321". so far it works fine and prints out the correct order when the for loop is for(i = 0; i<len ; i++) but i get an error when i try to print it in reverse?. Whats going wrong? #include <stdio.h> #include <string.h> void cnvrter(char *number); int main(){ char number[80]; printf("enter a number "); gets(number); cnvrter(number); return 0; } void cnvrter(char *number){ char tmp[80]; int i = 0,len = 0; int cnvrtd_digit = 0; len = strlen(number); printf("\nsize of input %d\n",len); for(i = len; i>len ; i--){ if ( ( number[i] >= '0' ) && ( number[i]<='9' ) ){ tmp[0] = number[i]; sscanf(tmp,"%d",&cnvrtd_digit); } printf("%d\n",cnvrtd_digit); } }

    Read the article

  • How to retrieve an array from Multidimensional Array.

    - by Mike Smith
    So I have a multi-dimensional array looks like this. $config = array( "First Name" => array( "user" => $_POST['firstname'], "limit" => 35, ), "Last Name" => array( "user" => $_POST['lastname'], "limit" => 40, ), ); I want use the array that's within the config array, so my approach is to use a foreach loop. foreach($config as $field => $data) { } Now I know that $data will be my array, but it seems I can't use it outside of the foreach statement because I only get half of whats already there. Using print_r you can see what it shows outside the loop: Array ( [user] => lastname [limit] => 40 ) But when inside the loop and I use print_r here is my result: Array ( [user] => firstname [limit] => 35 ) Array ( [user] => lastname [limit] => 40 ) I imagine it has to do something with it being with the foreach loop. I've tried to run a foreach on the $data array to populate another array, but that didn't work as well. Is there a way to use this outside of a foreach loop? Sorry if this a dumb question, I'm sure there is a quite a simple answer to this, but I'm just stumped, and can't think of a way to do this. Thanks.

    Read the article

  • Java Error beeping

    - by user1281385
    Im working on a Chat client that i didnt write the bulk of the code for. It works fine however when someone sends a message it beeps (system error beep) when using Java 7. Java 6 and below doesn't have this beep. I cant seem to find whats causing the beep is there any way to find it ? I dont think its calling beep as i have public class nobeep extends sun.awt.windows.WToolkit { @Override public void beep() { System.out.println("tried to beep"); new Exception().printStackTrace(); } } and then called System.setProperty("awt.toolkit", "nobeep"); in the main method. Using the method to send a beep doesnt make it beep. Its only when sent normally. Is there a quick way to track down the cause of the beep ? Edit: After looking in the bugs database - its confirmed. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7194469 I know it says no work around but is there one (java not c++) or just wait until update 8 ?

    Read the article

  • Powershell Regex help in extracting text between strings

    - by vivekeviv
    i Have an arguments like the one below which i pass to powershell script -arg1 -abc -def -arg2 -ghi -jkl -arg3 -123 -234 Now i need to extract three strings without any whitespace string 1: "-abc -def" string 2: "-ghi -jkl" string 3: "-123 -234" i figured this expression could do it. But this doesnt seem to work. $args -match '-arg1(?'arg1'.*?) -arg3(?'arg3'.*?) -arg3(?'arg3'.*)'. THis should return $matches['arg1'] etc. So whats wrong in above expression. Why do i get an error as shown below runScript.ps1 -arg1 -abc -def -arg2 -ghi -jkl -arg3 -123 -234 Unexpected token 'arg1'.?) -arg2 (?'arg2'.?) -arg3 (?'arg3'.)'' in expression or statement. At G:\powershell\tools\powershell\runTest.ps1:1 char:71 + $args -match '-arg1 (?'arg1'.?) -arg2 (?'arg2'.?) -arg3 (?'arg3'.)' <<<< + CategoryInfo : ParserError: (arg1'.?) -arg2...g3 (?'arg3'.)':String) [], ParseException + FullyQualifiedErrorId : UnexpectedToken and also the second question is how do i make arg1 or arg2 or arg3 optional? The argument to script can be -arg2 -def -ghi. I'll take some default values for arg(1|2|3) that is not mentioned. Thanks

    Read the article

  • what is wrong in java AES decrypt function?

    - by rohit
    hi, i modified the code available on http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html and made encrypt and decrypt methods in program. but i am getting BadpaddingException.. also the function is returning null.. why it is happing?? whats going wrong? please help me.. these are variables i am using: kgen = KeyGenerator.getInstance("AES"); kgen.init(128); raw = new byte[]{(byte)0x00,(byte)0x11,(byte)0x22,(byte)0x33,(byte)0x44,(byte)0x55,(byte)0x66,(byte)0x77,(byte)0x88,(byte)0x99,(byte)0xaa,(byte)0xbb,(byte)0xcc,(byte)0xdd,(byte)0xee,(byte)0xff}; skeySpec = new SecretKeySpec(raw, "AES"); cipher = Cipher.getInstance("AES"); plainText=null; cipherText=null; following is decrypt function.. public String decrypt(String cipherText) { try { cipher.init(Cipher.DECRYPT_MODE, skeySpec); byte[] original = cipher.doFinal(cipherText.getBytes()); plainText = new String(original); } catch(BadPaddingException e) { } return plainText; }

    Read the article

  • submit remote form with prototype

    - by badnaam
    I have a remote form like this and a checkbox in it. When I select or deselect the checkbox I would like to 1 - set the value of a hidden field 2 - ajax submit this form to its designated url. I tried $('search_form').onsubmit(), but I get an error saying onsubmit is not a function. Using prototype. Whats the best way to do this? <form onsubmit="new Ajax.Request('/searches/search_set?stype=1', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" method="post" id="new_search" class="new_search" action="/searches/search_set?stype=1"><div style="margin: 0pt; padding: 0pt; display: inline;"><input type="hidden" value="3TWSyMsZXI0nltz7zHAxuj1KX=" name="authenticity_token"></div> <a onclick="setSubmit(this);" href="#" class="submit-link-button fg-button ui-state-default fg-button-icon-left ui-corner-all" id="search_submit"><span class="ui-icon ui-icon-search"></span>'Search'</a> </div> <input type="checkbox" value="Energy" onclick="refreshResults(this);" name="search[conditions][article_tag][0]" id="search_conditions_article_tag_0">

    Read the article

  • Essential AIML responses?

    - by user335932
    What do you think are important pattern/temples to program. Like in a chatbot what does EVERY chatbot need a response for? Im just starting out making the aiml file and need some help... Heres the file now. <aiml> <category> <pattern>Hey</pattern> <template>Whats up?</template> <category> <category> <pattern>WHAT ARE YOU?</pattern> <template>I am a chatbot.</template> <category> <category> <pattern>DO YOU LIKE*</pattern> <template>Yes, I love <star/></template> <category> <category> <pattern>WHAT IS*</pattern> <template><star/>? is that what humans call what I did to your mom last night?</template> <category> <category> <pattern>WHEN WERE YOUR BORN*</pattern> <template>I was created in 2010.</template> <category>

    Read the article

  • Delphi - Populate an imagelist with icons at runtime 'destroys' transparency

    - by ben
    Hi again, I've spended hours for this (simple) one and don't find a solution :/ I'm using D7 and the TImageList. The ImageList is assigned to a toolbar. When I populate the ImageList at designtime, the icons (with partial transparency) are looking fine. But I need to populate it at runtime, and when I do this the icons are looking pretty shitty - complete loose of the partial transparency. I just tried to load the icons from a .res file - with the same result. I've tried third party image lists also without success. I have no clue what I could do :/ Thanks 2 all ;) edit: To be honest I dont know exactly whats going on. Alpha blending is the correkt term... Here are 2 screenies: Icon added at designtime: Icon added at runtime: Your comment that alpha blending is not supported just brought the solution: I've edited the image in an editor and removed the "alpha blended" pixels - and now it looks fine. But its still strange that the icons look other when added at runtime instead of designtime. If you (or somebody else ;) can explain it, I would be happy ;) thanks for you support!

    Read the article

  • Android AlertDialog wait for result in calling activity

    - by insanesam
    I am trying to use an AlertDialog in my app to select the quantity of an item. The problem is that the activity that calls the AlertDialog doesn't wait for it to update the item before it adds it to the SQLite Database and change intents. At the moment, the QuantitySelector (AlertDialog) appears, then disappears straight away and changes the MealActivity class (which is just a ListView that reads from the database) through the intent change with an update to the database with quantity 0. I need the Activity to wait for the AlertDialog to close before it updates the database. What would be the correct way of implementing this? Here is some code for you: QuantitySelector (which runs the alertdialog): public class QuantitySelector{ protected static final int RESULT_OK = 0; private Context _context; private DatabaseHandler db; private HashMap<String, Double> measures; private Item item; private View v; private EditText quan; private NumberPicker pick; private int value; private Quantity quantity; /** * Function calls the quantity selector AlertDialog * @param _c: The application context * @param item: The item to be added to consumption * @return The quantity that is consumed */ public void select(Context _c, Item item, Quantity quantity){ this._context = _c; this.item = item; this.quantity = quantity; db = new DatabaseHandler(_context); //Get the measures to display createData(); //Set up the custom view LayoutInflater inflater = LayoutInflater.from(_context); v = inflater.inflate(R.layout.quantity_selector, null); //Set up the input fields quan = (EditText) v.findViewById(R.id.quantityNumber); pick = (NumberPicker) v.findViewById(R.id.numberPicker1); //Set up the custom measures into pick pick.setMaxValue(measures.size()-1); pick.setDisplayedValues(measures.keySet().toArray(new String[0])); //Start the alert dialog runDialog(); } public void createData(){ measures = new HashMap<String, Double>(); //Get the measurements from the database if(item!=null){ measures.putAll(db.getMeasures(item)); } //Add grams as the default measurement if(!measures.keySet().contains("grams")){ //Add grams as a standard measure measures.put("grams", 1.0); } } public void runDialog(){ AlertDialog dialog = new AlertDialog.Builder(_context).setTitle("Select Quantity") .setView(v) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //Change the consumption to the new quantity if(!quan.getText().toString().matches("")){ value = Integer.parseInt(quan.getText().toString()); //Check if conversion from other units is needed String s[] = pick.getDisplayedValues(); String a = s[pick.getValue()]; //Convert the chosen measure back to grams if(!a.equals("grams")){ for(String m : measures.keySet()){ if(m==a){ value = (int) (value * measures.get(m)); } } } } quantity.setQuantity(value); dialog.dismiss(); } }) .setNegativeButton("Cancel", null).create(); dialog.show(); } } The method from favouritesAdapter (which calls the alertdialog): add.setOnClickListener(new OnClickListener(){ public void onClick(View arg0) { QuantitySelector q = new QuantitySelector(); Quantity quan = new Quantity(); q.select(_context, db.getItem(p.getID()), quan); db.addConsumption(p.getID(), p.getFavouriteShortName(), quan.getQuantity(), "FAVOURITE"); Intent intent = new Intent(_context,MealActivity.class); _context.startActivity(intent); } }); All help is appreciated :)

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >