Search Results

Search found 43 results on 2 pages for 'alaa gamal'.

Page 2/2 | < Previous Page | 1 2 

  • Java JList model

    - by Alaa
    How can I make a list model from a JList in order to be able to insert an item into it. I want to use this method: addElement(java.lang.Object item) I found an explanation here, but the problem is that ListModel is an interface and even if I write an implementation and override its method, I can't use the addElement() method

    Read the article

  • Reflection, invoke

    - by Alaa'
    Hi, I have a dll file, and i took an object from it and called the functions inside this dll by the object, like this way: Command testClass = (Command)assembly.CreateInstance(creatObject); testClass.Execute(); anyway, the i used reflection from some reason. so i need to use invoke function & set values for variables, then calling the basic function Execute. Before: i wrote the following: object returnValue = objectType.GetMethod("setValues").Invoke(classObject, arguments); testClass.Execute(); but it wasnt useful for me. i used the following: object returnValue = objectType.GetMethod("setValues").Invoke(classObject, arguments); object returnValue1 = objectType.GetMethod("Execute").Invoke(classObject, null); i just want to ask if this is right, to calling the execute in this way, and by the way it works! Thank you.

    Read the article

  • how can I convert String to SecretKey

    - by Alaa
    I want to convert String to secretKey public void generateCode(String keyStr){ KeyGenerator kgen = KeyGenerator.getInstance("AES"); kgen.init(128); // 192 and 256 bits may not be available // Generate the secret key specs. secretKey skey=keyStr; //How can I make the casting here //SecretKey skey = kgen.generateKey(); byte[] raw = skey.getEncoded(); } I try to use BASE64Decoder instead of secretKey, but I face a porblem which is I cannot specify key length. EDIT: I want to call this function from another place static public String encrypt(String message , String key , int keyLength) throws Exception { // Get the KeyGenerator KeyGenerator kgen = KeyGenerator.getInstance("AES"); kgen.init(keyLength); // 192 and 256 bits may not be available // Generate the secret key specs. //decode the BASE64 coded message SecretKey skey = key; //here is the error raw = skey.getEncoded(); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); // Instantiate the cipher Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); System.out.println("msg is" + message + "\n raw is" + raw); byte[] encrypted = cipher.doFinal(message.getBytes()); String cryptedValue = new String(encrypted); System.out.println("encrypted string: " + cryptedValue); return cryptedValue; } Any one can help, i'll be very thankful.

    Read the article

  • php script return specific xml tag value

    - by Alaa
    i need php script to extract the ip address from the following xml page www.ip-address.com/test.xml <dnstools> <service_provider>Domain Tools</service_provider> <provider_url>http://www.domaintools.com/</provider_url> <date>Wed, 12 May 2010 00:43:07 GMT</date> <unix_time>1273624987</unix_time> <ip_address>94.252.157.241</ip_address> <hostname>94.252.157.241</hostname> <blacklist_status>Clear</blacklist_status> <remote_port>43577</remote_port> <protocol>HTTP/1.0</protocol> <connection>keep-alive</connection> <keep_alive/>

    Read the article

  • How to request Transponder list from a TV satellite

    - by Muhammad alaa
    I have a DTV-DVB Mantis BDA satellite card and I was wondering if i can use it programmatically to request a satellite transponder list throw some library or if i should create one Where should i start? I saw applications do that such as ProgDVB, but i didn't know what is the idea behind that. Another question: is there any standard that define how to communicate with Satellite TV, and if there is where i can get/read it. thank you

    Read the article

  • SoundPool repeating issue for Samsung Galaxy S3

    - by Alaa Eldin
    I'm trying to play a background sound for my application, I use SoundPool class, my problem is that, sound plays well only when I set the loop parameter with zero value, but it doesn't work for any other value. My code for initialization is: soundpool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0); soundsMap = new HashMap<Integer, Integer>(); soundsMap.put(1, soundpool.load(this, R.raw.soundfile_1, 1)); soundsMap.put(2, soundpool.load(this, R.raw.soundfile_2, 1)); my code for playing is soundpool.play(1, 0.9f, 0.9f, 1, -1, 1f); as I mentioned sound works when I put (0) instead of (-1) for the loop value, anyone has any idea why (-1) or any value other than (0) doesn't work (there is no output sound) ?

    Read the article

  • Calling function dynamically by using Reflection

    - by Alaa'
    Hi, I'm generating dll files contain code like the following example : // using System; using System.Collections; using System.Xml; using System.IO; using System.Windows.Forms; namespace CSharpScripter { public class TestClass : CSharpScripter.Command { private int i=1; private int j=2; public int k=3; public TestClass6() { } public void display (int i,int j,int k) { string a = null; a= k.ToString(); string a1 = null; a1= this.i.ToString(); string a2 = null; a2= j.ToString(); MessageBox.Show(" working! "+ "k="+ a +" i="+a1 + " j="+ a2); } public void setValues(int i,int j,int k1) { this.i=i; this.j=j; k=k1; } // I'm compiling the pervious code, then I execute an object from the dll file. So, in the second part of the code ( Executing part), I'm just calling the execute function, It contains a call for a function, I named here: display. For that I need to set values in the declaration by a setValue function. I want it to been called dynamically (setValues ), which has declaration like : public void(Parameter[] parameters) { //some code block here } For this situation I used Reflection. // Type objectType = testClass.GetType(); MethodInfo members = objectType.GetMethod("setValues"); ParameterInfo[] parameters = members.GetParameters(); For) int t = 0; t < parameters.Length; t++) { If (parameters[t]. ParameterType == typeof()) { object value = this.textBox2.Text; parameters.SetValue)Convert.ChangeType(value,parameters[t].ParameterType), t); } } // But it throws an casting error" Object cannot be stored in an array of this type." at last line, in first parameter for (setValue) methode. What is the problem here? And How I can call the method Dynamically after the previous code, by( Invoke) or is there a better way? Thanks.

    Read the article

  • const object and const constructor

    - by Muhammad alaa
    Is there any way to know if an object is a const object or regular object, for instance consider the following class class String { String(const char* str); }; if user create a const object from String then there is no reason to copy the passed native string and that because he will not make any manipulation on it, the only thing he will do is get string size, string search and other functions that will not change the string.

    Read the article

  • php script request frequently specific web page

    - by Alaa
    i need php script running on my server frequently request a web page i thought of php header, with meta tag (refresh) but that's will not success, because header will redirect me once to the url then the refresh will stop. <?php header('Location: http://www.example.com/'); ?> <html> <META HTTP-EQUIV=Refresh CONTENT="60"> </html> any suggestion please;

    Read the article

  • node_load in drupal gets incorrect node when you are NOT logged in

    - by Alaa
    Hi All, i have a module and i am using node_load(array('nid' = arg(1))); now the problem is that this function keep getting its data for node_load from DB cache. how can i force this function to not use DB cache or static value? Example my link is http://mydomain.com/node/344983 now: $node=node_load(array('nid'=arg(1)),null,true); echo $node-nid; output: 435632 which is a randomly node id (available in the database) and everytime i ctrl+F5 my browser, i get new nid!! Note: if i am logged in, it gives the result correctly, but this problem happens only when i am browsing the website as an anonymous user i really appreciate any idea!! Thanks

    Read the article

  • mysql join on two indexes takes long time!!

    - by Alaa
    Hi All I have a custom query in dripal, this query is: select count(distinct B.src) from node A, url_alias B where concat('node/',A.nid)= B.src; now, nid in node is primary key and i have made src as an index in url_alias table. after waiting for more than a minute i got this: +-----------------------+ | count(distinct B.src) | +-----------------------+ | 325715 | +-----------------------+ 1 row in set (1 min 24.37 sec) now my question is: why did this query take this long, and how to optimize it?? Thanks for your help

    Read the article

  • what is the difference between MVC1 and MVC2

    - by Alaa
    I am using MVC design pattern in jsp-servlet web application, and want to what is the exact difference between MVC1 and MVC2 , can someone help? EDIT newly I hear that there is 2 versions of using MVC in servlet programming, I hear that in MVC1 there is kind of coupling between controller and view , but in MVC2 they overtake it, if someone know whether this is right or wrong I'll be very thankful.

    Read the article

  • how to force drupal function to not use DB cache?

    - by Alaa
    Hi All, i have a module and i am using node_load(array('nid' = arg(1))); now the problem is that this function keep getting its data for node_load from DB cache. how can i force this function to not use DB cache? Example my link is http://mydomain.com/node/344983 now: $node=node_load(array('nid'=arg(1)),null,true); echo $node-nid; output 435632 which is a randomly node id (available on the system) and everytime i ctrl+F5 my browser i get new nid!! Thanks for your help

    Read the article

  • Persistent "held broken packages" error

    - by stoplan
    sudo apt-get update && sudo apt-get install netflix-desktop gives the error The following packages have unmet dependencies: netflix-desktop : Depends: wine-browser-installer but it is not going to be installed E: Unable to correct problems, you have held broken packages. but dpkg --get-selections | grep hold shows nothing. I'm running 12.04 64-bit. I've followed the directions in How do I resolve unmet dependencies?: Confirmed that main, universe, restricted and multiverse software sources are enabled sudo apt-get clean sudo apt-get -f install (returning '0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.') sudo dpkg --configure -a sudo apt-get -f install (again '0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.) sudo apt-get -u dist-upgrade (0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.) used Y PPA Manager to check for duplicate ppas (none found) [Edit] I have had the same error with other packages. Here's the output requested by Alaa: sudo apt-get install wine-browser-installer Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: wine-browser-installer : Depends: wine-compholio (= 1.5.19~precise1) E: Unable to correct problems, you have held broken packages.

    Read the article

  • Connected to wireless, but no internet access

    - by boogaloo
    After installing Ubuntu 12.04 a week ago wireless internet had been working fine. It stopped working yesterday, however, and I'm at a loss for what to do even after scouring replies to similar posted problems. I have tried using Google's public DNS and turning off proxy settings on Firefox. I have used nm-tool and lshw to make sure my wireless device and driver are connected. If anyone can help me resolve this issue I would be extremely grateful! @kregerjd $ ping -c3 www.google.com ping: unknown host www.google.com @Alaa: $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0 192.168.1.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0 $ ping -c4 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data From 192.168.1.104 icmp_seq=1 Destination Host Unavailable From 192.168.1.104 icmp_seq=2 Destination Host Unavailable --- 192.168.1.1 ping statistics --- 4 packets transmitted, 0 received, +2 errors, 100% packet loss, time 2998ms pipe 4

    Read the article

  • Why doesn't my implementation of ElGamal work for long text strings?

    - by angstrom91
    I'm playing with the El Gamal cryptosystem, and my goal is to be able to encipher and decipher long sequences of text. I have come up with a method that works for short sequences, but does not work for long sequences, and I cannot figure out why. El Gamal requires the plaintext to be an integer. I have turned my string into a byte[] using the .getBytes() method for Strings, and then created a BigInteger out of the byte[]. After encryption/decryption, I turn the BigInteger into a byte[] using the .toByteArray() method for BigIntegers, and then create a new String object from the byte[]. This works perfectly when i call ElGamalEncipher with strings up to 129 characters. With 130 or more characters, the output produced from ElGamalDecipher is garbled. Can someone suggest how to solve this issue? Is this an issue with my method of turning the string into a BigInteger? If so, is there a better way to turn my string of text into a BigInteger and back? Below is my encipher/decipher code with a program to demonstrate the problem. import java.math.BigInteger; public class Main { static BigInteger P = new BigInteger("15893293927989454301918026303382412" + "2586402937727056707057089173871237566896685250125642378268385842" + "6917261652781627945428519810052550093673226849059197769795219973" + "9423619267147615314847625134014485225178547696778149706043781174" + "2873134844164791938367765407368476144402513720666965545242487520" + "288928241768306844169"); static BigInteger G = new BigInteger("33234037774370419907086775226926852" + "1714093595439329931523707339920987838600777935381196897157489391" + "8360683761941170467795379762509619438720072694104701372808513985" + "2267495266642743136795903226571831274837537691982486936010899433" + "1742996138863988537349011363534657200181054004755211807985189183" + "22832092343085067869"); static BigInteger R = new BigInteger("72294619754760174015019300613282868" + "7219874058383991405961870844510501809885568825032608592198728334" + "7842806755320938980653857292210955880919036195738252708294945320" + "3969657021169134916999794791553544054426668823852291733234236693" + "4178738081619274342922698767296233937873073756955509269717272907" + "8566607940937442517"); static BigInteger A = new BigInteger("32189274574111378750865973746687106" + "3695160924347574569923113893643975328118502246784387874381928804" + "6865920942258286938666201264395694101012858796521485171319748255" + "4630425677084511454641229993833255506759834486100188932905136959" + "7287419551379203001848457730376230681693887924162381650252270090" + "28296990388507680954"); public static void main(String[] args) { FewChars(); System.out.println(); ManyChars(); } public static void FewChars() { //ElGamalEncipher(String plaintext, BigInteger p, BigInteger g, BigInteger r) BigInteger[] cipherText = ElGamal.ElGamalEncipher("This is a string " + "of 129 characters which works just fine . This is a string " + "of 129 characters which works just fine . This is a s", P, G, R); System.out.println("This is a string of 129 characters which works " + "just fine . This is a string of 129 characters which works " + "just fine . This is a s"); //ElGamalDecipher(BigInteger c, BigInteger d, BigInteger a, BigInteger p) System.out.println("The decrypted text is: " + ElGamal.ElGamalDecipher(cipherText[0], cipherText[1], A, P)); } public static void ManyChars() { //ElGamalEncipher(String plaintext, BigInteger p, BigInteger g, BigInteger r) BigInteger[] cipherText = ElGamal.ElGamalEncipher("This is a string " + "of 130 characters which doesn’t work! This is a string of " + "130 characters which doesn’t work! This is a string of ", P, G, R); System.out.println("This is a string of 130 characters which doesn’t " + "work! This is a string of 130 characters which doesn’t work!" + " This is a string of "); //ElGamalDecipher(BigInteger c, BigInteger d, BigInteger a, BigInteger p) System.out.println("The decrypted text is: " + ElGamal.ElGamalDecipher(cipherText[0], cipherText[1], A, P)); } } import java.math.BigInteger; import java.security.SecureRandom; public class ElGamal { public static BigInteger[] ElGamalEncipher(String plaintext, BigInteger p, BigInteger g, BigInteger r) { // returns a BigInteger[] cipherText // cipherText[0] is c // cipherText[1] is d SecureRandom sr = new SecureRandom(); BigInteger[] cipherText = new BigInteger[2]; BigInteger pText = new BigInteger(plaintext.getBytes()); // 1: select a random integer k such that 1 <= k <= p-2 BigInteger k = new BigInteger(p.bitLength() - 2, sr); // 2: Compute c = g^k(mod p) BigInteger c = g.modPow(k, p); // 3: Compute d= P*r^k = P(g^a)^k(mod p) BigInteger d = pText.multiply(r.modPow(k, p)).mod(p); // C =(c,d) is the ciphertext cipherText[0] = c; cipherText[1] = d; return cipherText; } public static String ElGamalDecipher(BigInteger c, BigInteger d, BigInteger a, BigInteger p) { //returns the plaintext enciphered as (c,d) // 1: use the private key a to compute the least non-negative residue // of an inverse of (c^a)' (mod p) BigInteger z = c.modPow(a, p).modInverse(p); BigInteger P = z.multiply(d).mod(p); byte[] plainTextArray = P.toByteArray(); return new String(plainTextArray); } }

    Read the article

  • Not enough free disk space

    - by carmatt95
    I'm new to Ubuntu and I'm getting an error in software updater. When I try and do my daily updates, it says: The upgrade needs a total of 25.3 M free space on disk /boot. Please free at least an additional 25.3 M of disk space on /boot. Empty your trash and remove temporary packages of former installations using sudo apt-get clean. I tried typing in sudo apt-get clean into the terminal but I still get the message. All of the pages I read seem to be for experianced Ubuntuers. Any help would be appreciated. I'm running Ubuntu 12.10. I want to upgrade to 13.04 but understand I have to finish these first. EDIT: @Alaa, This is the output from typing in cat /etc/fstab into the terminal: # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> /dev/mapper/ubuntu-root / ext4 errors=remount-ro 0 1 # /boot was on /dev/sda1 during installation UUID=fa55c082-112d-4b10-bcf3-e7ffec6cebbc /boot ext2 defaults 0 2 /dev/mapper/ubuntu-swap_1 none swap sw 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0 matty@matty-G41M-ES2L:~$ df -h: Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu-root 915G 27G 842G 4% / udev 984M 4.0K 984M 1% /dev tmpfs 397M 1.1M 396M 1% /run none 5.0M 0 5.0M 0% /run/lock none 992M 1.8M 990M 1% /run/shm none 100M 52K 100M 1% /run/user /dev/sda1 228M 222M 0 100% /boot matty@matty-G41M-ES2L:~$ dpkg -l | grep linux-image: ii linux-image-3.5.0-17-generic 3.5.0-17.28 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-18-generic 3.5.0-18.29 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-19-generic 3.5.0-19.30 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-21-generic 3.5.0-21.32 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-22-generic 3.5.0-22.34 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-23-generic 3.5.0-23.35 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-24-generic 3.5.0-24.37 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-25-generic 3.5.0-25.39 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP ii linux-image-3.5.0-26-generic 3.5.0-26.42 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP iF linux-image-3.5.0-28-generic 3.5.0-28.48 i386 Linux kernel image for version 3.5.0 on 32 bit x86 SMP

    Read the article

  • Bouncycastle encryption algorithms not provided

    - by David Read
    I'm trying to use BouncyCastle with android to implement ECDH and EL Gamal. I've added the bouncycastle jar file (bcprov-jdk16-144.jar) and written some code that works with my computers jvm however when I try and port it to my android application it throws: java.security.NoSuchAlgorithmException: KeyPairGenerator ECDH implementation not found A sample of the code is: Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); java.security.KeyPairGenerator keyGen = org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator.getInstance("ECDH", "BC"); ECGenParameterSpec ecSpec = new ECGenParameterSpec("prime192v1"); keyGen.initialize(ecSpec, SecureRandom.getInstance("SHA1PRNG")); KeyPair pair = keyGen.generateKeyPair(); PublicKey pubk = pair.getPublic(); PrivateKey prik = pair.getPrivate(); I then wrote a simple program to see what encryption algorithms are available and ran it on my android emulator and on my computers jvm the code was: Set<Provider.Service> rar = new org.bouncycastle.jce.provider.BouncyCastleProvider().getServices(); Iterator<Provider.Service> ir = rar.iterator(); while(ir.hasNext()) System.out.println(ir.next().getAlgorithm()); On android I do not get any of the EC algorithms while ran normally on my computer it's fine. I'm also getting the following two errors when compiling for a lot of the bouncy castle classes: 01-07 17:17:42.548: INFO/dalvikvm(1054): DexOpt: not resolving ambiguous class 'Lorg/bouncycastle/asn1/ASN1Encodable;' 01-07 17:17:42.548: DEBUG/dalvikvm(1054): DexOpt: not verifying 'Lorg/bouncycastle/asn1/ess/OtherSigningCertificate;': multiple definitions What am I doing wrong?

    Read the article

< Previous Page | 1 2