Thursday, 3 October 2013

What would be the best approach to implement a multi-select combo in SWT/JFace?

What would be the best approach to implement a multi-select combo in
SWT/JFace?

I need to implement a multi-select combobox using SWT/JFace, What would be
the best approach?

Wednesday, 2 October 2013

Getting the height of the image to set modal window size

Getting the height of the image to set modal window size

I am creating a photo gallery with thumbnails and loads the resized image
into the modal window.
The problem is I want to get the height and width of the image to set the
height of the modal window, however the height is not being set on the
modal window or my container for my image.
The src of the image is not in my markup originally but I add it to the
markup by appending it on the fly.
Original Thumbnail Image
<img src="\images\picture1.jpg" height="150" width="150" id="thumbnail">
Jquery code:
var tImageID = $(this).find('img').attr( 'id', 'thumbnail' );
var fullURL = $(tImageID).attr('src');
var dFigure = $('#dialog-media figure .media');
// fullSrcURL = "\images\picture_resized.jpg"
var fullSrcURL = fullURL.replace(".jpg", "_resized.jpg");
// Add html to the div tag
$(dFigure).append('<img id="resized-pic" src="' + fullSrcURL + '"
alt="' + $(tImage).attr('alt') + '" />');
var objHeight = $("#resized-pic").height();
var objWidth = $("#resized-pic").width();
// Perform some other code here
// Some more logic
//Set the positioning of the modal window with theses CSS properties
$('.ui-dialog').css('left', '0');
$('.ui-dialog').css('right', '0');
$('.ui-dialog').css('margin', '0 auto');
$('.ui-dialog').css('width', objWidth);
$('.ui-dialog').css('height', ObjHeight);
$('.ui-dialog').css('top', '5%');
The picture loads up, but the objWidth and objHeight show up as zero when
looking at firebug.
I refresh my page, click on the same thumbail and the picture loads up
with the image within the modal and the height of the modal is set
properly.
Is it because the picture hasn't completely loaded and that is why it is
zero? Or is it because it is cached?
Thanks
Cheers

Detect presence of a specific String in Javascript String

Detect presence of a specific String in Javascript String

How can i do to search if a Javascript String contains the following
pattern :
"@someting.temp"
I would like to know if the String contains @ character and then someting
and then ".temp" string.
Thanks

Receive an EnumSet from a spring form checkbox element?

Receive an EnumSet from a spring form checkbox element?

I've seen a few related questions on this topic but none that seem to
exactly match what I'm after.
I have a form where I'd like the user to be able to select a number of
items from a checkbox list (backed by an enum), and to receive that as a
Set. I have the following (using days as an example)
My enum:
public enum Day {
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY,
SUNDAY
}
Sending the enum values to the page in the controller to be displayed as
the options:
model.addAttribute("allDays", Day.values());
Writing the options as checkboxes and mapping to correct form field:
<form:form method="get" modelAttribute="filterForm" commandName="filterForm">
<c:forEach items="${allDays}" var="item">
<form:checkbox path="days" value="${item.ordinal()}"
label="${item.name()}"/>
</c:forEach>
</form:form>
The form object backing the form:
public class FilterForm {
private EnumSet<Day> days;
public EnumSet<Day> getDays() {
return days;
}
public void setDays(EnumSet<Day> days) {
this.days = days;
}
}
This works as far as showing the options correctly, but when I try to
submit, I get an error:
org.springframework.validation.BindException:
org.springframework.validation.BeanPropertyBindingResult: 1 errors Field
error in object 'filterForm' on field 'days': rejected value [0,1]; codes
[typeMismatch.filterForm.days,typeMismatch.days,typeMismatch.java.util.EnumSet,typeMismatch];
arguments
[org.springframework.context.support.DefaultMessageSourceResolvable: codes
[filterForm.days,days]; arguments []; default message [days]]; default
message [Failed to convert property value of type 'java.lang.String[]' to
required type 'java.util.EnumSet' for property 'days'; nested exception is
org.springframework.core.convert.ConversionFailedException: Failed to
convert from type java.lang.String[] to type java.util.EnumSet for value
'{0, 1}'; nested exception is java.lang.IllegalArgumentException: Could
not instantiate Collection type: java.util.EnumSet]
org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:111)
org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:75)
org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:156)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:117)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Any idea what the problem is or if there is a better way to achieve this?
Thanks

Tuesday, 1 October 2013

What is the best way to deserialize the Byte Array in C++ which is in Big Endiaan format?

What is the best way to deserialize the Byte Array in C++ which is in Big
Endiaan format?

I am writing Byte Array value into a file using Java with Big Endian Byte
Order format.. Now I need to read that file from C++ program...
That Byte Array which I am writing into a file is made up of three Byte
Arrays as described below-
short employeeId = 32767;
long lastModifiedDate = "1379811105109L";
byte[] attributeValue = os.toByteArray();
I am writing employeeId , lastModifiedDate and attributeValue together
into a single Byte Array and that resulting Byte Array I am writing into a
file and then I will be having my C++ program which will retrieve that
Byte Array data from file and then deserialize it to extract employeeId ,
lastModifiedDate and attributeValue from it.
Below is my Java code which is writing Byte Array value into a file with
Big Endian format and it is working fine...
public class ByteBufferTest {
public static void main(String[] args) {
String text = "Byte Array Test For Big Endian";
byte[] attributeValue = text.getBytes();
long lastModifiedDate = 1289811105109L;
short employeeId = 32767;
int size = 2 + 8 + 4 + attributeValue.length; // short is 2 bytes,
long 8 and int 4
ByteBuffer bbuf = ByteBuffer.allocate(size);
bbuf.order(ByteOrder.BIG_ENDIAN);
bbuf.putShort(employeeId);
bbuf.putLong(lastModifiedDate);
bbuf.putInt(attributeValue.length);
bbuf.put(attributeValue);
bbuf.rewind();
// best approach is copy the internal buffer
byte[] bytesToStore = new byte[size];
bbuf.get(bytesToStore);
writeFile(bytesToStore);
}
/**
* Write the file in Java
* @param byteArray
*/
public static void writeFile(byte[] byteArray) {
try{
File file = new File("bytebuffertest");
FileOutputStream output = new FileOutputStream(file);
IOUtils.write(byteArray, output);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Now I need to retrieve Byte Array from that same file using the below C++
program and deserialize it to extract employeeId , lastModifiedDate and
attributeValue from it. I am not sure what is the best way on the C++
side. Below is the code I have got so far on C++ side-
int main() {
string line;
std::ifstream myfile("bytebuffertest", std::ios::binary);
if (myfile.is_open()) {
uint16_t employeeId;
uint64_t lastModifiedDate;
uint32_t attributeLength;
char buffer[8]; // sized for the biggest read we want to do
// read two bytes (will be in the wrong order)
myfile.read(buffer, 2);
// swap the bytes
std::swap(buffer[0], buffer[1]);
// only now convert bytes to an integer
employeeId = *reinterpret_cast<uint16_t*>(buffer);
cout<< employeeId <<endl;
// read eight bytes (will be in the wrong order)
myfile.read(buffer, 8);
// swap the bytes
std::swap(buffer[0], buffer[7]);
std::swap(buffer[1], buffer[6]);
std::swap(buffer[2], buffer[5]);
std::swap(buffer[3], buffer[4]);
// only now convert bytes to an integer
lastModifiedDate = *reinterpret_cast<uint64_t*>(buffer);
cout<< lastModifiedDate <<endl;
// read 4 bytes (will be in the wrong order)
myfile.read(buffer, 4);
// swap the bytes
std::swap(buffer[0], buffer[3]);
std::swap(buffer[1], buffer[2]);
// only now convert bytes to an integer
attributeLength = *reinterpret_cast<uint32_t*>(buffer);
cout<< attributeLength <<endl;
myfile.read(buffer, attributeLength);
// now I am not sure how should I get the actual attribute value
here?
//close the stream:
myfile.close();
}
else
cout << "Unable to open file";
return 0;
}
Can anybody take a look on C++ code and see what I can do to improve it as
I don't think so it is looking much efficient? Any better way to
deserialize the Byte Array and extract relevant information on the C++
side?
Thanks for the help..

Uncaught SyntaxError: Unexpected identifier Readability.js:108

Uncaught SyntaxError: Unexpected identifier Readability.js:108

I want to investigate the functionality of reader mode in Firefox for
Android. To do that I took Readability.js from Firefox sources and created
a simple HTML file:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<script src="Readability.js"></script>
</body> </html>
If I load the above page in Chrome and open JavaScript Console I see
Uncaught SyntaxError: Unexpected identifier Readability.js:108
If I do the same in Firefox, the result is similar:
SyntaxError: missing ; before statement @ file:///XXX/Readability.js:108
Why does Readability.js work in Firefox for Android and does not when used
as shown above in desktop browsers?

nginx - show different page when ip address is given instead of domain name

nginx - show different page when ip address is given instead of domain name

I have installed on my vps nginx with ISPConfig3. I created a domain
mydomain.com through ispconfig and everything works just fine except two
things.
When i go to the ip address of my vps, my website is shown. I want a
different page ex. /var/www/index.html to be shown
I want to redirect from www.mydomain.com to mydomain.com.
Here is the virtual hosts in sites-enabled:
000-apps.vhost
server {
listen 8081;
server_name _;
root /var/www/apps;
client_max_body_size 20M;
location / {
index index.php index.html;
}
# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
# PHP only, required if PHP was built with
--enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_pass unix:/var/lib/php5-fpm/apps.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location ~ /\. {
deny all;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD
$request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH
$content_length;
fastcgi_param SCRIPT_FILENAME
$request_filename;
fastcgi_param SCRIPT_NAME
$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT
$document_root;
fastcgi_param SERVER_PROTOCOL
$server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE
nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
# PHP only, required if PHP was built with
--enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
# To access phpMyAdmin, the default user (like
www-data on Debian/Ubuntu) must be used
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_read_timeout 240;
}
location ~*
^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$
{
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
location /squirrelmail {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/squirrelmail/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD
$request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH
$content_length;
fastcgi_param SCRIPT_FILENAME
$request_filename;
fastcgi_param SCRIPT_NAME
$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT
$document_root;
fastcgi_param SERVER_PROTOCOL
$server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE
nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
# PHP only, required if PHP was built with
--enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
# To access SquirrelMail, the default user (like
www-data on Debian/Ubuntu) must be used
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location ~*
^/squirrelmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$
{
root /usr/share/;
}
}
location /webmail {
rewrite ^/* /squirrelmail last;
}
location /cgi-bin/mailman {
root /usr/lib/;
fastcgi_split_path_info (^/cgi-bin/mailman/[^/]*)(.*)$;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
# PHP only, required if PHP was built with
--enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED
$document_root$fastcgi_path_info;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /images/mailman {
alias /usr/share/images/mailman;
}
location /pipermail {
alias /var/lib/mailman/archives/public;
autoindex on;
}
}
000-ispconfig.vhost
server {
listen 8080;
ssl on;
ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt;
ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
# redirect to https if accessed with http
error_page 497 https://$host:8080$request_uri;
server_name _;
root /usr/local/ispconfig/interface/web/;
client_max_body_size 20M;
location / {
index index.php index.html;
}
# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location ~ /\. {
deny all;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
location ~*
^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$
{
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
location /squirrelmail {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/squirrelmail/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
location ~*
^/squirrelmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$
{
root /usr/share/;
}
}
location /webmail {
rewrite ^/* /squirrelmail last;
}
}
100-mydomain.com.vhost
server {
listen *:80;
server_name mydomain.com www.mydomain.com;
root /var/www/mydomain.com/web;
index index.html index.htm index.php index.cgi index.pl index.xhtml;
error_log /var/log/ispconfig/httpd/mydomain.com/error.log;
access_log /var/log/ispconfig/httpd/mydomain.com/access.log combined;
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location /stats {
index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file
/var/www/clients/client1/web1/web/stats/.htpasswd_stats;
}
location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}
location ~ \.php$ {
try_files /b4c43b69af764469f45973ffea6ff69d.htm @php;
}
location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9010;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
Edit: So i want when i type the ip of the vps ex. 5.55.33.7 to show a
certain page and not the website that is hosted in this ip.

ubuntu in a virtual box

ubuntu in a virtual box

I need to run ubuntu through Oracle vm virtual box. Can someone please
walk me through it? do I download ubuntu first then open the vm and
install it there? or do I need an image? very new to this please help!

Monday, 30 September 2013

Wirelss problem with RT3290 in ubuntu 13.04

Wirelss problem with RT3290 in ubuntu 13.04

I have a hp pavilion laptop with rt3290 wifi device. The original driver
provided by ralink corporation compiles in 12.04 but fails to compile in
13.04 (I guess this is a problem with kernel..). Also the inbuilt driver
rt2800 works fine at some places, but can not connect at others.It shows
the available networks but does not connect....Any Help???

Showing the sequence is monotone, bounded, and finding the limit

Showing the sequence is monotone, bounded, and finding the limit

The problem I am having is figuring out the way show the following
sequence is monotone:
let $x_1 = \frac{3}{2}$ and $x_{n+1} = {x_n}^2-2x_n+2$, show that the
sequence $x_n$ is monotone and bounded and find the limit.
I have found the first three terms, and found that the sequence is
decreasing, I have followed an example in my text that is the opposite
however my text is vague and I'm not sure how they found where the
sequence is bounded I am led to believe by math that it is bounded by 1.
any hints or suggestions on how to approach the problem would bennefit me
greatly
thanks

array_shift but preserve keys

array_shift but preserve keys

My array looks like this:
$arValues = array( 345 => "jhdrfr", 534 => "jhdrffr", 673 => "jhrffr", 234
=> "jfrhfr" );
How can I remove the first element of an array, but preserve the numeric
keys? Since array_shift changes my integer key values to 0, 1, 2, ....
I tried using unset( $arValues[ $first ] ); reset( $arValues ); to
continue using the second element (now first), but it returns false.
How can I achieve this?

Build FFmpeg with xCode 5

Build FFmpeg with xCode 5

Does anyone know how to compile FFmpeg with xCode 5?
My configure part:
./configure --disable-doc --disable-ffmpeg --disable-ffplay
--disable-ffserver --enable cross-compile --arch=arm --target-os=darwin
--enable-neon --disable-avfilter \ --disable-bsfs \ --enable-avresample
--enable-swresample --disable-iconv --enable-gpl \ --disable-demuxers
--enable-demuxer=rtsp --enable-demuxer=rtp --enable-demuxer=mpegts \
--disable-decoders --enable-decoder=mp2 --enable-decoder=mp3
--enable-decoder=mpeg2video --enable-decoder=ac3 - enable-decoder=dvbsub
--enable-decoder=h264 \ --disable-parsers --enable-parser=mpegvideo -
enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=dvbsub\
--disable-muxers --disable-encoders --disable-filters \
--disable-protocols --enable-protocol=http --enable-protocol=rtp
--enable-protocol=udp --enable-protocol=tcp \ --disable-swscale-alpha \
--disable-armv5te \ --disable-armv6 \ --disable-armv6t2 \
--cc=/Applications/Xcode.app/Contents/Developer/usr/bin
--as='/usr/local/bin/gas preprocessor/gas-preprocessor.pl
/Applications/Xcode.app/Contents/Developer/usr/bin'
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
--cpu=cortex-a8 --extra-cflags='-arch armv7 -mfpu=neon -mfloat-abi=softfp'
--extra-ldflags='-arch armv7 -mfpu=neon -mfloat-abi=softfp -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk'
--enable-pic --disable-bzlib
It works with xCode 4 (different Compiler-Path)
Error-Message:
./configure: line 3763: nm: command not found

Sunday, 29 September 2013

semicolon as character in c++ char array

semicolon as character in c++ char array

I'm trying to create a character array which holds a single symbol per
array index with the following code:
#ifndef TABLEDEFS_H
#define TABLEDEFS_H
#include <string>
using namespace std;
char symbolTable[] = {'_', '=', '<', '>', '!', '+', '-', '*', '/', '%', '.',
'(', ')', ',', '{', '}', ';', '[', ']', ':'};
string tokenTable[] = {"IDtk", "NUMtk", "==", "=<=", "=>=", "=", "<", ">",
"!",
"+", "-",
"*", "/", "%", ".", "(", ")", ",", "{", "}", ";", "[", "]", ":", "EOFtk"};
string keywordTable[] = {"Start", "Stop", "Then", "If", "Iff", "While",
"Var", "
Int", "Float", "Do",
"Read", "Write", "Void", "Return", "Dummy", "Program"};

How to Change Button Foreground and Background When Pressed and Released

How to Change Button Foreground and Background When Pressed and Released

Currently I have a need to place a 'back' button within my application.
This is not to replace the hardware back button, but to go back to a
previous state of an item if the user does not wish to continue with his
or her change of an item. Currently I have the following xaml for my
MainPage, which binds an image as well as places the 'back' button on the
view as well.
MainPage.xaml
<Grid x:Name="MainPageGrid" Margin="{Binding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".2*"/>
<ColumnDefinition Width=".2*"/>
<ColumnDefinition Width=".2*"/>
<ColumnDefinition Width=".2*"/>
<ColumnDefinition Width=".2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height=".2*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Image x:Name="currentPhoto" Grid.ColumnSpan="5"
Grid.RowSpan="2"
Source="{Binding Source}" Margin="12,0,12,12"
HorizontalAlignment="Center"
VerticalAlignment="Center"
toolkit:TiltEffect.IsTiltEnabled="True"/>
<Button x:Name="photoRefreshButton" Grid.Row="0"
Grid.Column="5"
BorderBrush="Transparent"
Click="photoRefreshButton_Click"
toolkit:TiltEffect.IsTiltEnabled="True">
<Image Source="Assets/Buttons/back.png"/>
</Button>
</Grid>
I would like to be able to toggle the foreground and background when the
button is pressed and released, but I am unsure of how to change the
button template style for this. I would like to use the following setup:
Not Pressed
Foreground = #FF1BA1E2 (ARGB: 255, 27, 161, 226)
background = transparent
Pressed
Foreground = Current theme foreground brush
background = transparent

Automatic form submission using JS

Automatic form submission using JS

I am developing a code, which takes a value as input and the form when
submitted, displays the result and the code is as follows:
<script>
function submitme()
{
document.forms["myform"].submit();
}
</script>
<body onload="submitme()">
<FORM name="performance" id="myform" method="post"
action="http://www.pvpsiddhartha.ac.in/index.sit" >
<INPUT type="hidden" name="service"
value="STU_PERFORMANCE_MARKS_DISPLAY">
<TABLE border="0" width="100%" cellspacing="0" cellpadding="0">
<TR>
<TD colspan="2" align="center"><STRONG><U>Student Marks
Performance Display Form</U></STRONG></TD>
</TR>
<TR><TD>&nbsp;</TD></TR>
<TR>
<TD align="right" width="40%">Regd. No:</TD>
<TD><INPUT type="text" name="stid" value="<?php echo
$_GET['x']; ?>"></TD>
</TR>
<TR><TD>&nbsp;</TD></TR>
<TR>
<TD align="right"><INPUT type="submit" name="submit"
value="Submit"></TD>
<TD align="center"><INPUT type="reset" value="Clear"></TD>
</TR>
</TABLE>
</FORM>
</body>
The problem is, when the page is loaded completely, the form should be
submitted , but the form cannot be submitted. What is the problem , Help
me!! Thanks in advance

Saturday, 28 September 2013

CSS Code working on Mac browsers but not on Windows browsers?

CSS Code working on Mac browsers but not on Windows browsers?

I have the following CSS:
font-family: 'HelveticaNeue-UltraLight', 'Helvetica Neue UltraLight',
'Helvetica Neue', Arial, Helvetica, sans-serif; font-weight: 100;
letter-spacing: 1px; }
It works on all Mac browsers (Chrome, Safari) But I opened my project on
Chrome and Internet explorer on Windows, it displays the font as bold
rather than light. I'm not sure how to fix this but I need the design to
work cross platform with the design that appears on mac.
Thanks in advance.

How to input values to HashMap in bean using Primefaces?

How to input values to HashMap in bean using Primefaces?

I have a page where I have to associate two fields using key-value pair
and save. For example, I have a number of participants who has prices. If
I use two p:inputText fields to enter their values, how should the backing
bean look like?
Also, I want to display the number of such pairs of p:inputText fields
according to the number of participants I enter. I have a similar question
answered here How to insert a primefaces input text dynamically?. But I
want to be able to submit the values to a key-value pair.

Ubuntu boot-repair problems

Ubuntu boot-repair problems

I used Gparted to decrease my Windows-partition and to increase my Ubuntu
13.04 partition. After restarting my pc, ubuntu doesn't start and I used
Boot-repair to reinstall GRUB2. Now I can only boot with Ubuntu-Live-CD or
get to the grub-terminal.
I hope this helps: Ubuntu Boot-repair info
Thanks!

PHP - Username must only contain letters, numbers and underscores

PHP - Username must only contain letters, numbers and underscores

I am making a registration form for a website and want to check that the
username must only contain letters, numbers and underscores. it cant
contain spaces, commas, dots,slashes or any other symbol. I want to do it
with the function preg_match. can you please help me writing a good
validation code?thanks in advance.

Friday, 27 September 2013

What is a better way in php for variables

What is a better way in php for variables

This:
$var = true
if(1 > 0){
$var = false
}
or this:
if(1 > 0){
$var = false
} else {
$var = true
}