Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on April 29, 2013 09:00:48
Last update: April 29, 2013 09:00:48
In the case proposed by Diony , signing multiple elements by id, simply change the newSignedInfo to:
// Create the SignedInfo
final List transforms0...
I must admit that I don't understand transformations, so take my example code with a grain of salt.
Also, signing a doc fragment by PATH does not work, simply because there's no way to identify the fragment with a URI without referring to it by id. Reference ode from org.jcp.xml.dsig.internal.dom.DOMURIDereferencer :
// Check if same-document URI and register...
Created by voodoo on March 24, 2013 13:44:47
Last update: March 29, 2013 13:08:31
Use getpwnam group of functions. Example code:
#include <sys/types.h>
#include <pwd.h>
#inc...
For gid, use getgrnam
Created by freyo on February 06, 2013 21:10:47
Last update: February 06, 2013 21:12:18
I have an old Samung phone to be used as a toy. After restoring back to factory image and power on, I was stuck at the activate service screen. Unfortunately, the four corner magic touch did not work. So I did quite a bit of digging and this is what worked on my Samsung Continuum: Press emergency call button, then at the dialer, press * # 8 3 7 8 6 6 3 3 , press the Home key From the home screen, tap phone icon, Dial * # 2 2 7 4 5 9 2 7 Enter SPC code: ______ displays tap in white box to show virtual keyboard, enter 6 digit code (default: 000000), tap OK Select “Hidden menu Enable”, tap OK From...
Created by magnum on December 25, 2012 15:14:42
Last update: December 25, 2012 15:14:42
The C function strtok tokenizes a string when you call it repeated with a NULL pointer. It should be mentioned that it destroys (alters) the original string.
#include <stdio.h>
#include <stdlib.h>
#incl...
Created by magnum on October 22, 2012 20:03:05
Last update: October 22, 2012 20:03:05
First, the test command that sleeps random number of seconds ( sleeper.sh ):
#!/bin/bash
stime=$[$RANDOM % 20]
sleep $sti...
As comparison, synchronous pipe code:
#include <sys/wait.h>
#include <stdio.h>
#in...
Asynchronous pipe code:
#include <sys/wait.h>
#include <stdio.h>
#in...
Created by magnum on October 22, 2012 19:54:43
Last update: October 22, 2012 19:54:43
Example 1, from the pipe man page. The parent then writes the string contained in the program's command-line argument to the pipe, and the child reads this string a byte at a time from the pipe and echoes it on standard output.
#include <sys/wait.h>
#include <stdio.h>
#in...
Example 2, child execs command given at the command line, then writes to stdout (of child), which is piped to parent. Parent reads from pipe and writes to stdout (of parent).
#include <sys/wait.h>
#include <stdio.h>
#in...
Created by magnum on October 22, 2012 19:48:03
Last update: October 22, 2012 19:48:03
execl takes the full path name of the command and variable length of arguments terminated by NULL:
execl("/bin/ls", "/bin/ls", "-r", "-t", "-l", NULL...
where the second argument is argv[0] , but can be any string!
execlp will try to find the command from $PATH , so full path to command is not needed:
execl("ls", "ls", "-r", "-t", "-l", NULL);
execv is the equivalent of execl , except that the arguments are passed in as a NULL terminated array:
char *args[] = {"/bin/ls", "-r", "-t", "-l", NULL ...
execvp is the equivalent of execvl , excep that the arguments are passed in as a NULL terminated array:
char *args[] = {"ls", "-r", "-t", "-l", NULL };
...
Created by magnum on October 22, 2012 15:46:44
Last update: October 22, 2012 15:46:44
Example code from the Linux Programmer's Manual:
#include <stdio.h>
#include <stdlib.h>
#incl...
Created by James on September 20, 2012 15:08:15
Last update: September 21, 2012 11:55:58
The idea is simple: duplicate the input field and position one on top of the other. The top one will take the input, while the bottom one will serve the placeholder. The top one will have a transparent background so the value of the placeholder field will show through. The placeholder field is disabled so that it's value is not submitted with the form. Here's the code:
(function($) { $.fn.placeholder = function(... But in practice, it's tricky. Notice that I used 'background-color': 'rgba(255, 255, 255, 0)' for the background transparency. This is because 'background-color': 'transparent' does not work for IE9. Even though the input is on top of the placeholder, the placeholder always gets the event when you click on the field. That might be...
Created by James on September 18, 2012 20:46:12
Last update: September 18, 2012 20:46:12
There's no easy way in jQuery (like one or two lines) to copy all CSS properties (inline, inherited, native, etc.) from one element to another. Such as, create a <p> element that has the same CSS as an existing <div> element.
Upshots provides a simple jQuery plugin that seemed to work. I copy the code below.
$.fn.copyCSS = function(source){
var dom = ...