Wednesday, May 23, 2012

android copy folders from assets to internal device app data folder

I created two folders inside assets ("images" and "files") both containing some files. I need to copy it when first launch to data/data/com.relatedPackage.myApp keeping same name and same file contents. I am an iOS programmer and that os does not allow to copy whole folders so, in android, which is the proper method to do it?

Possible to copy whole folder "images" (including its files) from assets to data/...? That would be great.
If not, should I create first empty folders using same names at data/... and then copy files from assets to current? In this case would be necessary to list all files inside folders in order to copy to data/...? Thank you.

Make text height 100% of div?

I'm trying to make the text 100% height of a div but it doesn't work. It just becomes 100% of the body { font-size:?; }. Is there any way to make it follow the div height?
The div height is 4% of the whole page and I wan't the text to follow it when you rezise/change resolution.

best regards,

Serving different XML content on the same web

I don't know if this is the suitable place to ask this question, so I am sorry if I am doing it wrong. I think this is not a duplicate question. If it is, I am sorry too.

Currently, I have a web app which takes its content from a unique XML document. The URL is ""

The problem is that now I have to create a second version of the web which uses a new different XML document, so I have to put them different URLs, something like the following:

How can I have all my sources on just one directory on server-side (I suppose it's better to maintain, the resources are cached better, etc...) but with these 2 URLs pointing to the folder and making the PHP loades the XML depending on the URL?

I suppose I have to change the .htaccess file to redirect to that folder, but how can I tell what XML I must load? And the user must see on the search bar the URL he used, for example ""

Can anybody help me please?
Thanks for all

How to press back button in android programatically?

I my app i have a logout functionality. If user clicks logout it goes to home screen.Now i am exiting my app by pressing back button. But what i want is i need to exit automatically(i.e Programatically) as same like as back button functionality. I know by calling finish() will do the functionality. But the thing is it goes to the previous activity.

Thanks for your help guys

Spring @Transactional does not work in JUnit test?

I am using Spring 3.2 and JUnit 4.

My Dao class is as follows:

@Transactional public class SomeDaoImpl implements SomeDao {

The update operations on this work if executed directly from web application. However, I am seeing that junit integration tests that exercise the update methods do not actually persist the changes. Is something rolling the transactions back when junit methods are executed?

Best practices for API backwards compatibility

I'm working on an iPhone/iPad/Android app which communicates with a JSON API.

The first release of the version of the app is complete, and now additional phases of development are taking place. In the additional phases, the app needs to integrate with a new version of the API and allow the user access to additional features such as new screens or modified behaviour within existing screens. The app does however need to be backwards with previous versions of the API.

What is the best practice for tackling such a requirement?
I could of could do checks throughout the code:

if (APIVersion == 1) {

} else if (APIVersion == 2) {

} else if (APIVersion == ....) {


But I'm concerned about the scalability of this approach.
The factory method comes to mind but I'm not sure how far this would get me.


array variable in awk

A=(aaa bbb ccc)    
cat abc.txt | awk '{ print $1, ${A[$1]} }'

I want to index an array element based on the $1, but the code above is not correct in awk syntax. Could someone help? Thanks!

Extension method in where clause in linq to Entities

In linq to Entities we needed a method that works like "sql like". We have implemented our own extension method to IQueryable, because contains method not work for us because doesn't accept patterns like '%a%b%'

The created code is:

private const char WildcardCharacter = '%';

public static IQueryable<TSource> WhereLike<TSource>(this IQueryable<TSource> _source, Expression<Func<TSource, string>> _valueSelector, string _textSearch)
if (_valueSelector == null)
throw new ArgumentNullException("valueSelector");

return _source.Where(BuildLikeExpressionWithWildcards(_valueSelector, _textSearch));

private static Expression<Func<TSource, bool>> BuildLikeExpressionWithWildcards<TSource>(Expression<Func<TSource, string>> _valueSelector, string _textToSearch)
var method = GetPatIndexMethod();

var body = Expression.Call(method, Expression.Constant(WildcardCharacter + _textToSearch + WildcardCharacter), _valueSelector.Body);

var parameter = _valueSelector.Parameters.Single();
UnaryExpression expressionConvert = Expression.Convert(Expression.Constant(0), typeof(int?));
return Expression.Lambda<Func<TSource, bool>> (Expression.GreaterThan(body, expressionConvert), parameter);

private static MethodInfo GetPatIndexMethod()
var methodName = "PatIndex";

Type stringType = typeof(SqlFunctions);
return stringType.GetMethod(methodName);

This works correctly and the code is executed entirely in SqlServer, but now we would use this extension method inside where clause as:

myDBContext.MyObject.Where(o => o.Description.Like(patternToSearch) || o.Title.Like(patterToSerch));

The problem is that the methods used in the where clause have to return a bool result if is it used with operators like '||' , and I don't know how to make that the code I have created returns a bool and keep the code executed in sqlserver. I suppose that I have to convert the returned Expression by BuildLinqExpression method to bool, but I don't know how to do it

To sum up! First of all it's possible to create our own extensiond methods in Linq to Entities that execute the code in SqlServer? if this is possible how I have to do it?

Thanks for your help.

Post JSON to Python CGI

I am looking to post JSON sent by any standard library such as 'JQUERY' using the standard.

$.ajax() post routine with my JSON.

can you tell me if on the page I post to ("") this code is correct that will get the resultant json and then return the response as successful.

cheers, I've only ever worked with Django and now raw cgi so im slightly confused.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
import json

def get():
result = {'success':'true','message':'The Command Completed Successfully'}
data =
myjson = json.loads(data)


show 1 insted of 01 with PHP pack for Persian numbers

there is a function for converting English standard nums to Persian (Farsi) or Arabic nums:

function farsinum($str){ if (strlen($str) == 1){
$str = "0".$str; $out = ""; for ($i = 0; $i < strlen($str); ++$i) {
$c = substr($str, $i, 1);
$out .= pack("C*", 0xDB, 0xB0 + $c); } } return $out; }

but this function produce 01 02 03 ... insted of 1 2 3 ...
i think something must be change here:

$out .= pack("C*", 0xDB, 0xB0 + $c);

any help appreciated.

Confusion in int conversion of a string in PHP

I am unable to get the exact value of $data, which I converted into integer from this,


$data = '9999999999';
echo $datan = (int) $data;


How can I get the exact value of $data from $datan?

Unable to use ActionBarSherlock library

I have Created a new android project from existing source(ActionBarSherlock library) with API 15. I added this library to my project(Project properties -> android -> library-> add ->com_actionbarsherlock ->apply ->ok).But When I again see (Project properties -> android -> library->) com_actionbarsherlock is showing red color cross.So, I am unable to import the library classes.I am really struggling with this.
Any help would be appreciate.Screen Shot When I add library
Screen Shot After library is added

Python script - How to set the right server, when I perform request/open of application

Python 3.2.2, I want to check HTTP status code (eg. 200 or 404) on some www application.

There are five servers and each server have a copy of this www application

(The user is automatically redirected to the application on the server with low traffic/sometimes on random server).

Suppose that the name of servers is: 0,1,2,3,4

I tried various options i have tried, three of them I pasted below (they works -always return 200, but choose not this server what I want):


import urllib.request,urllib.parse, http.cookiejar
values2= {"server":"2"}
data2 = urllib.parse.urlencode(values2)
data2 = data2.encode("utf-8")
request2 = urllib.request.Request(url,data2)
cj2 = http.cookiejar.CookieJar()
urlOpener2 = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj2))
url2 =
x2 = url2.getcode()


import urllib.request
headers1 = {"Set-Cookie":"server=2"}
req1 = urllib.request.Request(url, None, headers1)
t1 = urllib.request.urlopen(req1)
coderesp1 = t1.getcode()


import urllib.request
urlOpener3 = urllib.request.build_opener()
urlOpener3.addheaders.append(("Set-Cookie", "server=2"))
url3 =
x3 = url3.getcode()

If you have some questions about my problem, please write, I will immediately reply to what you want to know.

Android bitmap out of memory error

I get the famous out of memory error. But i have tried many of the suggested solutions on this problem without any luck. I understand that to prevent a bitmap to exceed the memory, you make a static variable of the drawable (Android docs). But that isn't working in my app because i have so many markers as you can see..

Does anyone have a suggestion to a solution?

for(Poi p : poiarray){

WeakReference<Bitmap> bitmap = new WeakReference<Bitmap>(p.get_poiIcon());

Drawable marker = new BitmapDrawable(Bitmap.createScaledBitmap(bitmap.get(), 60, 60, true));
annotationOverLays.add(new CustomAnnotation(marker,p,this,mapView));
//mapView.getOverlays().add(new CustomAnnotation(marker,p,this,mapView));


05-23 13:08:31.436: E/dalvikvm-heap(22310): 20736-byte external allocation too large for this process.
05-23 13:08:31.436: E/dalvikvm(22310): Out of memory: Heap Size=23111KB, Allocated=22474KB, Bitmap Size=1505KB
05-23 13:08:31.436: E/GraphicsJNI(22310): VM won't let us allocate 20736 bytes

Sending JSON through GET Method in Objective-C

I have a seemingly easy question. I'm trying to send data from my iPad device to a server using JSON. The thing is, all tutorials I see about sending JSON to the server uses the POST method. My question is, is it possible to send JSON using the GET method? It will be really helpful if you can give me some pointers on how to do it. Thanks.

Defining JQuery Function

The two below functions work as scripted except for when i add the Function next () {;} and function prev () {'} around it to define the custom function.

What am I doing wrong here?

function next() {

$('#up').click(function() {
$("#two").prev().animate({height:'80%'}, 500);

function prev() {
$('#down').click(function() {
$("#two").next().animate({height:'80%'}, 500);

Regarding Map pin points that should display dynamically in iphone

hi everyone i have a mapview where i have to drop pins on the map based on latitude and longitude where i used to get that from a webservice can any one help me out how to get and plot it on the map

move the focus from textbox to ajax combobox on enter key

I want to move the focus from the textbox to an ajax combobox on enter key

 <script type="text/javascript">
$(document).ready(function () {
function checkForEnter(event) {

if (event.keyCode == 13) {
return false;

txtGroupSname is my textbox and cmbUnder is the ajax combobox.

Any ideas or suggestions please.

Is it possible to generate XML file in gef

Is it possible to generate XML file from Shape example in GEF,Same as its getting generated in GMF?
Like in GMF if we select GMF Design page and open it with XML file,it provides all external information about model figures,same like i want to generate with GEF.

How to change the comment link text "Login or register to post comment" to be shorter eg " comment" in drupal

  1. I have created a Q&A type using
    Create Content in drupal.

  2. I have created a new content name
    Ask and Answer.

  3. Until this i don't have any issues.
    Now problem is i have enabled
    comments in content type.

  4. In this case i need to change the
    "Add new comment" or similar links
    related to comments as "Answer"
    without changing the core comment

  5. How can i do this?

Thanks in advance.

How to express more OOP in the Mars Rovers Program test

It's a interview problem, i was told to solve the problem Mars Rover.

The rover runs in a plane. As from (0,0) to (5,5).

The rover could proceed 3 movement which are Turn Left, Turn Right, and Move Forward.

The input of the program is a coordinate in the plane such as (1,1) and a sequence of the movement such as LMRMLMLM (L/R means turn left/right, M means move),
the output is the result coordinate of the rover in the end.

What I already done is I program the rover as a object, it has some method like turn left/right and move, and some attribute like the coordinate of the rover. And the whole map is also as a object.

BUT, the technical HR told me that is not good enough to express the OOP, SO, what I want to know is what can I should do in this small program test?

Thanks everyone in this Questions.

flickr api grab url php

In my local webserver, I'm trying to generate the text for pasting to my blog, followed by below question:
How to get static image url from flickr URL?

<a href="" title="Chou fleurs by Nicolas de Fontenay, on Flickr"><img src="" width="500" height="375" alt="Chou fleurs"></a>

I think it's good to use some API function and to designate $variables to:

  • 53067560@N00

  • 2658147888

  • "Chou fleurs by Nicolas de Fontenay, on Flickr"

  • ""

  • "500"

  • "375"

  • "Chou fleurs"

, but don't know how to code in detail. Ideally, a function

getFlickrImageURLforGrab(name of Set, # of photos)

ex.) getFlickrImageURLforGrab(myset1, 10) returns first 10 photo's URLs in the Set myset1 are displayed. Would you please show a simple php example?

what is wrong with this assignment?

I have defined a class XX like this:

   public class XX extends RelativeLayout {
protected static final boolean DEBUG = true;

public XX(Context context) {
// TODO Auto-generated constructor stub

public XX(Context context, AttributeSet attrs) {
super(context, attrs);
if (DEBUG)
Log.i(this.getClass().getSimpleName(), " ->2"
+ Thread.currentThread().getStackTrace()[2].getMethodName());
//getAttributes(context, attrs);


public XX(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (DEBUG)
Log.i(this.getClass().getSimpleName(), " ->3"
+ Thread.currentThread().getStackTrace()[2].getMethodName());
//getAttributes(context, attrs);



and in my code I write:

RelativeLayout v = (RelativeLayout) this.findViewById(;
XX x = (XX) v; //<----- crashes here

but it crashes with the assignment. I assume the because XX extends View I can just assign the view (RelativeLayout) to an XX object.

But it crashes. What is wrong with the assignment?


I changed extends View to extends RelativeLayout. Also changed View v to RelativeLayout v.
But I still get a classCastException..???? Why?


RelativeLayout r = (RelativeLayout) v; 

certainly works fine.

Grid Border / Gap between cells

I've created a ControlTemplate that contains a Grid with two rows.

Sadly, there appears to be a single pixel gap between the cells.

How do I remove the gap?

Here's a screenshot showing the gap:

Gap between cells

...and here's the XAML:

<Window x:Class="MAQButtonTest.MainWindow"
Title="MainWindow" Height="695" Width="996">
<Style TargetType="TextBlock">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<ControlTemplate TargetType="Button" x:Key="ButtonTemplate">
<Grid Width="444" Margin="0" ShowGridLines="False">
<RowDefinition Height="51" />
<RowDefinition Height="36" />
<Grid Grid.Row="0" Background="#286c97">
<TextBlock>This is the first piece of text</TextBlock>
<Grid Grid.Row="1" Background="#5898c0">
<ContentPresenter Grid.Row="0" />

<ColumnDefinition Width="300" />
<ColumnDefinition />
<Grid Grid.Column="0" Background="#e9f1f6"></Grid>
<Grid Grid.Column="1" Background="#d2e3ed">
<TextBlock FontFamily="Segoe UI" FontSize="22" FontWeight="Medium" Margin="52,58,0,0" Foreground="#0c3d5d">Your Quizzes <TextBlock FontFamily="Segoe UI" FontSize="18" FontWeight="Medium" Foreground="#0c3d5d">(7)</TextBlock></TextBlock>
<Grid Margin="0,20,0,0">
<Button Width="444" Background="{x:Null}" BorderThickness="0" Template="{StaticResource ButtonTemplate}" Click="DoSomething" BorderBrush="#032135">
<TextBlock Margin="6,2.8,0,0" FontFamily="Segoe UI" FontSize="19" Foreground="#032135" FontWeight="Medium">This is a second piece of text</TextBlock>


C# Get true path of current directory

I have a project, built with Visual Web Developer 2008. I want to be able to extract (with C#), the current folder the project is in now. Until now I had to hard code the true path.

This project is hosted on my computer.

For example, the path I would like to generate:


Thanks! Guy

Multiple connections on the same port socket C++

I need to accept multiple connections to the same port.
I'm using socket in C++, i want to do something like the SSH do.
I can do an ssh user@machine "ls -lathrR /" and run another command to the same machine, even if the first one still running.

How can i do that?


How can I make bash tab completion behave like vim tab completion?

I've been meaning to find a solution for this for YEARS.

I am sooo much more productive in vim when manipulating files than bash for this reason.

if I have


In bash and type file_1->tab , it obviously lists:

file_12390983421 file_12391983421 file_12340983421 file_12390986421

And this is a horrible boar and painful to work with.

The same sequence in vim will loop through the files one at a time.

Please someone tell me how to do this in bash, or if there is another shell that can do this, I'll switch tomorrow.

What is the best position to sit and to place your hands while you program?

Recently I've been more concerned about the way I sit while I code, I don't think I have any kind of injury yet but one of my coworkers had to take a couple of days off because of his column and I began to worry about this.
So, how do you sit? how do you place your hands? Do you recommend any keyboard in special? any chair? I have been looking into a new keyboard and maybe I' ll ask for it at work. Also my chair isn't top-notch so any budget oriented option?
Thanks, Joaquin.

related: keyboard for programmers , what is the best keyboard mouse for ergonomics or to prevent wrist pain? , What is the best physical operating environment for a developer?

dlls in SysWOW64 not found by application

I'm developing a C#/WPF app that talks to a USB device using some custom 32 bit dlls. It's developed as an x86 app, and installed with WIX. When I install the package on a 64-bit machine, the program files get installed to Program Files (x86) as I expect.

The dlls are installed to the SystemFolder using WIX. On 32-bit machines, this means C:\Windows\System32. On 64-bit, they end up in C:\Windows\SysWOW64. This is ok, but when I run my app, it is unable to find the dlls (it uses them via [DllImport...]).

So, what is the right way to make my app find the dlls, whether they are in System32 or SysWOW64?


jQuery how to reverse a remove() event

I have this code:

$(window).resize(function() {
if($(window).height() < 768) {
$('div#navigation ul li br').remove()
} else {

Is it possible to reverse the remove event on else? I need to have those
tags in the same place as before the action.

Update with a LIMIT in zend framework

I would like to do a update and place LIMIT 1 as precaution.
Here is my code:

$vals = array();
$vals['status'] = 'closed';
$where = $write->quoteInto('id =?', $orderID);

$write->update("order", $vals ,$where);

Where can i add a LIMIT into this query?

(looks like has been asked in the past but i hope someone out there has the answer)

Sybase Check Constraint Evaluation

I'm trying to formulate some check constraints in SQL Anywhere 9.0.

Basically I have schema like this:


user INT,
limit INT,
my_number INT NOT NULL CHECK(my_number > 0),
PRIMARY KEY (user, limit)

I'm trying to force a constraint my_number for each limit to be at most count in table.

I've tried

CHECK ((SELECT sum(my_number) FROM sum WHERE limit = limit) <= (SELECT count FROM limits WHERE id = limit))


CHECK (((SELECT sum(my_number) FROM sum WHERE limit = limit) + my_number) <= (SELECT count FROM limits WHERE id = limit))

and they both seem not to do the correct thing. They are both off by one (meaning once you get a negative number, then insertion will fail, but not before that.

So my question is, with what version of the table are these subqueries being executed against? Is it the table before the insertion happens, or does the subquery check for consistency after the insert happens, and rolls back if it finds it invalid?

Some starting pointer how to build a server application

I'm evaluating a project where we will have to implmenent a server application that allows client applications (not a browser) to transmit data to an database and download digital audio files.

Clients will be a custom application not a web browser.

We will have about 11 Downloads/minute with about 40MB per download.

I have written client-sever database applications, but without server side processing.

I'm experienced with C# and C++, so it would ne nice if I could realize the project without learning JAVA.

What are the topics I should look at?


Storyboarding for Android

I was wondering if there are any storyboarding applications which can be used for Android development?

I've looked for something which can be used, but came up short in the end. Any help/suggestions would be most welcome.

EDIT -: It seems that there are no plans for Storyboarding - Source

Recommended approach for loading CouchDB design documents in Python?

I'm very new to couch, but I'm trying to use it on a new Python project, and I'd like to use python to write the design documents (views), also. I've already configured Couch to use the couchpy view server, and I can confirm this works by entering some simple map/reduce functions into Futon.

Are there any official recommendations on how to load/synchronize design documents when using Python's couchdb module?

I understand that I can post design documents to "install" them into Couch, but my question is really around best practices. I need some kind of strategy for deploying, both in development environments and in production environments. My intuition is to create a directory and store all of my design documents there, then write some kind of sync script that will upload each one into couch (probably just blindly overwriting what's already there). Is this a good idea?

The documentation for "Writing views in Python" is 5 sentences, and really just explains how to install couchpy. On the project's google code site, there is mention of a module that sounds like it might help, but there's no documentation (that I can find). The source code for that module indicates that it does most of what I'm interested in, but it stops short of actually loading files. I think I should do some kind of module discovery, but I've heard that's non-Pythonic. Advice?


In particular, the idea of storing my map/reduce functions inside string literals seems completely hacky. I'd like to write real python code, in a real module, in a real package, with real unit tests. Periodically, I'd like to synchronize my "couch views" package with a couchdb instance.

How to set scheduled task?

Before this I asked a question. My service conifg is :

<proxy xmlns="" name="UnpayBilling_Task" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<class name="com.coship.mediator.UnpayBillingMediator"></class>
<log level="full" />
<log level="full" />
<send />
<address uri="" />

I write a extension mediator UnpayBillingMediator deal files. The class returns file name and send request to service The service no input message. I want service running every day at 13:30. I tried add New Scheduled Task.
soapAction:urn:mediate,to:http://localhost:8280/services/UnpayBilling?wsdl, Cron: 30 13 * * *. But it can not work? Anyone can tell me how to set this Scheduled Task?

SimpleQuartz Server name not in pinned servers list. Not starting Task

I also do not know how to set "pinned servers".

HttpWebRequest and connection lost

I'm using HttpWebRequest.BeginGetRequestStream to make POST requests to the remote server. Let's presume that the network connection is lost during this process and response was not received. Is there any way to detect whether the request was sent to the remote server or not? Thank you!

Google Maps API v3 repeats markers on custom map

I have this problem for a while now, I have searched the web for answers, but I could not find a good answer related to my problem.

screenshot of my problem

You can see that I render my own set of tiles. The problem is that the markers are repeated horizontally, because of the wrapped map. I can't use the zoom in trick to avoid this problem, because the map has to be dynamic so it supports multiple resolutions.

I hope someone knows how to deal with this problem! I would really appreciate it.

I use Google Maps API v3.


Here is another screenshot:

another screenshot

Calling constexpr in default template argument

In C++11 I am using a constexpr function as a default value for a template parameter - it looks like this:

template <int value>
struct bar
static constexpr int get()
return value;

template <typename A, int value = A::get()>
struct foo

int main()
typedef foo<bar<0>> type;

return 0;

G++ 4.5 and 4.7 compiles this, but Clang++ 3.1 does not. The error message from clang is:

clang_test.cpp:10:35: error: non-type template argument is not a constant expression
template <typename A, int value = A::get()>
clang_test.cpp:17:19: note: while checking a default template argument used here
typedef foo<bar<3>> type;
clang_test.cpp:10:35: note: undefined function 'get' cannot be used in a constant expression
template <typename A, int value = A::get()>
clang_test.cpp:4:23: note: declared here
static constexpr int get()
1 error generated.

Which one is correct?

How to get rid of 'Content-type: text/html' in PHP script output?

I am running a PHP script as a cron job. An email is fired iff the script generates an output. Unfortunately, even if it does not output anything, an email is fired with:

Content-type: text/html

How can I get rid of this automatic Content-type: text/html generation triggering an email?

Preventing spam submission via form using a hidden field

My boss hates captcha's and well, so do I even if they work. She instead suggests using a hidden field so that if it is filled out [by robots] that the form should not be submitted. Are there downsides to this method? Any specific ways to tie into this using jQuery validate which is already implemented for the user validation?

How to retrieve a GUID and value from a string in ruby

I have a string like this in Ruby

word=0 id=891efc9a-2210-4beb-a19a-5e86b2f8a49f

How can I get both the word and id values from that string?

How do i change image in UIImageView in iOS?

I have a lot of image to show in UIImageView in iOS.

I have two buttons in my app.

When i clicked Next button , next image will appear in UIImageView with Slide.

When i clicked Previous button , previous image will appear in UIImageView with Slide.

It's like photos app in built-in iOS.

How can i do that?

Thanks you for reading my question and hoping to answers.

ignore case in php

i am searching a text using in_array() function from the array which is fetching database value

$value is the array value.

How can i ignore case in this.


How to use the "Masked Input" module in Drupal 7

I am trying to build a form in Drupal 7, one of the fields needs to have an input mask. I found the plugin masked input it seems like what I am searching for . Only there is no documentation on how to implement it (I read about currency and this plugin, yet here it is only about getting it to work).

I am new to Drupal, but searching on forums I came up with the following code:

function report_expenses_form($form, &$form_submit) {
libraries_get_path('maskedinput') . '/misc/ui/jquery.maskedinput-1.3.js';
$form['cash_advance']['amount'] = array(
'#title' => t('Cash Advance : '),
'#type' => 'textfield',
'#default_value' => t('$ 00,00'),
'#required' => TRUE,
'#mask' => '$?999.999.999,99',

I installed the "Libraries" and "Masked Input" plugins in Drupal and flushed my caches.

I downloaded the jquery.maskedinput-1.3.js and put it in my {DRUPAL_HOME}/misc/ui/

any Ideas?

thank you in advance

ListView owner drawing and column auto-resizing

I have a ListView which is using owner drawing to draw additional content for some sub-items.

I've found that because this additional content takes up some additional space the list view now incorrectly calculates the column "auto resize" width, and so when someone auto-resizes some columns (e.g. by double clicking on the column resize handle) the column is resized so that it is too small, and the text in that list view is rendered with parenthases (...) at the end.

Is there a way that I can prompt the list view to ask me what size the columns should be during an auto-resize?

need to create array which prints maximum+location after taking 5 inputs

import java.util.Scanner;

public class Arraymaxloc {
public static void main(String args[]) {
Scanner s = new Scanner(;
int[] a = new int[5];
int c = 1;
while (c < a.length) {
c = s.nextInt();
int max = a[0];
int loc = -1;
while (c < a.length) {
if (a[c] > max == true) {
max = a[c];
loc = c;
} else {
System.out.println("max found at" + loc);

Classic ASP suddenly giving me permissions (401.3) error

Background: I support a classic ASP environment. I have a development setup locally on my machine as part of that support. I am running IIS7.

To access my environment, I use "http://localhost:99999/" (port # faked for privacy purposes). I have not had a problem with this -- until today.

I built an application that is intended to run in this environment. The app is ASP.NET v.4.0 (for sake of example, I'll say it's called "http://localhost:99999/DotNetApp/"). Of course, in order to run this, I had to set up my environment application pool to support it (which it now does).

Problem: after configuring this, I am now getting:

Server Error in '/' Application.

Access is denied.
Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.

Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to '[filepath]\SourceFiles'.

I did NOT get this before I set my IIS configuration. Why am I getting this now?

Note: this ONLY happens with "http://localhost:99999/"; this does NOT happen if I try "http://localhost:99999/default.asp" (the page comes up with no problem).

Anyone have any insight?

Thanks in advance . . .

Edit: Additional symptoms: I tried playing with the application pool settings. The problem goes away if I change the .NET Framework version to either 2.0.50727 or to "No Managed Code." Changing it to 4.0.31319 breaks it. Of course, if I use any of the other two versions, my ASP.NET app won't run.

Edit #2: This problem occurs on ALL links that go to a folder or directory (e.g. "http://localhost:99999/somefolder/"), not just the web root.

Why can't one set an alias to a document.getElementById()?

My code would be more efficient if I could write

var min = window.document.getElementById;

and then call document.getElementById() using min().

I'm not trying to write minified code but in this particular case I can reduce scope lookup and shorten some lines.

Perhaps I'm using the wrong syntax?

uddi v2 client access to uddi v3

We have been asked to set-up a uddi v3 in our SOA governance infrastructure, but all the tools we have are only v2 compliant, and most of them are propietary.

I would like to know if anyone has come to this problem, and if there is some kind of gateway to map from v2 to v3 and back.

I know than manually we can get this, but it will be probably a reason for the dev teams to avoid using the uddi and ask directly to the people that are managing the governance.

Thanks in advance.


Monday, May 21, 2012

3n+1 challenge at UVa

I'm having trouble running the "3n+1 Problem" from the "Programming Challenges" book.

I've tried every solution in Java I could find on google (even the ones on Stack Overflow), and not a single one works, they all report a "Wrong answer". I also found a working C++ solution, translated it to Java, and same thing: "Wrong answer".

I'm using the template from Programming Challenges for Java submissions, and I could swear my algorithm is right, the only possible problem I can think of is in the code for reading the input or writing the output, but I can't figure it out. Here's my code, any help would be greatly appreciated:

class myStuff implements Runnable {

public void run() {
String line = Main.ReadLn(128);
while (line != null) {
line = Main.ReadLn(128);

private void process(String line) {

String[] data = line.split("\\s+");

if (data.length == 2) {
int low = Integer.parseInt(data[0]);
int high = Integer.parseInt(data[1]);
int max = low < high ? findMax(low, high) : findMax(high, low);
System.out.println(low + " " + high + " " + max);


private int findMax(int low, int high) {
int max = Integer.MIN_VALUE;
for (int i = low; i <= high; i++) {
int length = cycleLength(i);
if (length > max)
max = length;
return max;

private int cycleLength(int i) {

long n = i;
int length = 1;

while (n > 1) {
n = ((n & 1) == 0) ? n >> 1 : 3*n + 1;

return length;



// java program model from
class Main implements Runnable {
static String ReadLn(int maxLength) { // utility function to read from
// stdin, Provided by Programming-challenges, edit for style only
byte line[] = new byte[maxLength];
int length = 0;
int input = -1;
try {
while (length < maxLength) { // Read untill maxlength
input =;
if ((input < 0) || (input == '\n'))
break; // or untill end of line ninput
line[length++] += input;

if ((input < 0) && (length == 0))
return null; // eof
return new String(line, 0, length);
} catch ( e) {
return null;

public static void main(String args[]) { // entry point from OS
Main myWork = new Main(); // Construct the bootloader; // execute

public void run() {
new myStuff().run();


How to set WindowsClientCredential.AllowedImpersonationLevel under WinRT?

I try to request a Sharepoint webservice from an MetroStyleApp. The Sharepoint returns an error (Exception from HRESULT: 0x80131904). After some googleing I found, that the problem is, that the credentials don't get passed to the SQL-Server. In an normal (Win32) Application I would set WindowsClientCredential.AllowedImpersonationLevel to Delegation. But there is no property like this under WinRT. How to solve this problem?

Cannot read remote private queue

I'm trying to get MSMQ 5 working on my two Windows Server 2008 R2 virtual machines.
I can send to local and remote private queues, and I can read from local private queues.
I can't read from remote private queues.

I've read a number of suggestions, especially the ones summarised by John Breakwell at MSMQ Issue reading remote private queues (again).

Things I've already done:

  • Turned off firewalls on both machines.

  • Ensured that Everyone and AnonymousLogon have full control of the queues. (If I take away AnonymousLogon access, then I can't remotely send to the queue, and the message ends up with "Access is denied" on the receiving machine.)

  • Allowed Nonauthenticated Rpc on both machines.

  • Allowed NewRemoteReadServerAllowNoneSecurityClient on both machines.

the sending code fragment is:

        MessageQueue queue = new MessageQueue(queueName, false, false, QueueAccessMode.Send);
Message msg = new Message("Blah");
msg.UseDeadLetterQueue = true;
msg.UseJournalQueue = true;
queue.Send(msg, MessageQueueTransactionType.Automatic);

The receiving code fragment is:

   queueName = String.Format("FormatName:DIRECT=OS:{0}\\private$\\{1}",host,id);
queue = new MessageQueue(queueName, QueueAccessMode.Receive);
queue.ReceiveCompleted += new ReceiveCompletedEventHandler(receive);


    public void receive(object sender, ReceiveCompletedEventArgs e)
Console.WriteLine("Message received");

My queueName ends up as FormatName:DIRECT=OS:server2\private$\TestQueue

When I call beginReceive() on the queue, I get

Exception: System.Messaging.MessageQueueException (0x80004005)
at System.Messaging.MessageQueue.MQCacheableInfo.get_ReadHandle()
at System.Messaging.MessageQueue.ReceiveAsync(TimeSpan timeout, CursorHandle cursorHandle, Int32 action, AsyncCallback callback, Object stateObject)
at System.Messaging.MessageQueue.BeginReceive()

I've used Wireshark on Server1 to look at the network traffic. Without posting all the detail, it seems to go through the following stages. (Server1 is trying to read from a queue on Server2.)

  • Server1 contacts Server2, and there is an NTLMSSP challenge/response negotiation. A couple of the responses mention "Unknown result (3), reason: Local limit exceeded".

  • Server1 sends Server2 an rpc__mgmt_inq_princ_name request, and Server2 replies with a corresponding response.

  • There's some ldap exchanges looking up the domain, then a referral to ldap://domain/cn=msmq,CN=Server2,CN=Computers,DC=domain which returns a "no such object" response.

  • Then there's some SASL GSS-API encrypted exchange with the LDAP server

  • Then connections to the ldap server and Server2 are closed.

I've tried enabling Event Viewer > Applications and Services Logs > Microsoft > Windows > MSMQ > End2End. It shows messages being sent, but no indication of why trying to receive is failing.
How can I debug this further?

How to catch touch event of an dialog when it is clicked outside

Actually i have Dialog in my activity, what i want is suppose the dialog is open, then on Touch of outside dialog i want to dismiss the dialog and at the same time i want to call a function which do some update in my activity.

Initially i used MyDialog.setCanceledOnTouchOutside(true); But these will only dismiss and in my case, at the same time i want to call some functions whenever user click outside of dialog. So what should i do, I know that if i can extend the Dialog class and override its onTouchEvent method then it will be solved but in my case my class already extends Activity class and in java we can't extend more then one class..

So what will be the best solution for that. Please help me to solve this out

What's the difference between calloc & malloc followed by a memset?

What's the difference between calloc & malloc followed by a memset? If I replace all calls to calloc with a malloc followed by a memset, will it be the same?

If that is the case, then why are two functions malloc & calloc seperately provided?

An empty DataTable with column names from SharePoint 2010 List

I am developing a project in SharePoint 2010.

My requirement is to get an empty DataTable but with column names in it from SharePoint List.

The .GetDataTable() method returns only if it has a value.

So basically I need a structure of the list in a DataTable.

In Eclipse m2e, how to reference workspace project?

How can I reference another workspace project using Eclipse m2e?

Do I have to add a project dependency in the project setting? But in that case the dependency is not shown in the pom.

If I set them in the pom, it will not reference the project in workspace but reference the jar in the local repository. Quite annoying, anyone can help?

Get total time difference between two dates using php

Here i mention two times with its date

2008-12-13 10:42:00

2010-10-20 08:10:00

I want to get total time difference in (h:m:s) format

SQL Query - How to remove null and replace with blank

Here is my query:

SELECT ename, sal, comm

I would like to replace the NULL result in the comm column with a blank space. I have been told to under SELECT, write NULL(comm,' '), however this comes up with an error, saying invalid number. The query works if I have NULL(comm, 0), returning with 0 in the column.

From my understanding this means I can only have a number value in this column, however I want the blank space. Is someone able to please give me some guidance?

Node.js: Using multiple moustache templates

I'm trying to break a moustache template up into various components so I can reuse them, and get the assembled text returned through node.js. I cannot find anyone that has done this.

I can return must ache pages imply with:

function index(request, response, next) {
var stream = mu.compileAndRender('',
{name: "Me"}
util.pump(stream, response);

I just cannot figure out how to render a template and use it in another template. I've tried rendering it separately like this:

function index(request, response, next) {
var headerStream = mu.compileAndRender('', {title:'Home page'});
var headerText;

headerStream.on('data', function(data) {
headerText = headerText + data.toString();

var stream = mu.compileAndRender('',
heading: 'Home Page',
content: 'hello this is the home page',
header: headerText
util.pump(stream, response);

But the problem is that the header is not rendered before the page and even if I get that to happen. The header is seen as display text rather than html.

Any help appreciated.

dispatcherservlet does not wire model to view

I made a model from a controller and return to dispatcherservlet. It looks like there is no problem

in model since I double checked output by system.out.println. for viewname string, I double checked

an actual directory name which is "WEB-INF/views/hello.jsp".

but I believe dispatcher servlet does not adapt model to a view since browser does not displayed

a model value which should be displayed. It would be easier to understand what I am going through

if I put my code here. so... here is my code.




<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
<bean name="/hello" class="com.spring.toby.HelloController"/>
<bean id="HelloSpring" class="com.spring.toby.HelloSpring"></bean>

and controller java file

public class HelloController implements Controller{

@Autowired HelloSpring helloSpring;
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
// TODO Auto-generated method stub
String name = request.getParameter("name");
String msg = this.helloSpring.sayHello(name);
Map<String, Object> model = new HashMap<String, Object>();
model.put("msg", msg);
return new ModelAndView("WEB-INF/views/hello.jsp", model);

and bean file

public class HelloSpring {
public String sayHello(String name){
return "Hello " + name;

can anybody tell me what am I doing wrong? thanks in advance.

Characters allowed in php array keys?

I have some php array keys that are populated with a lot of weird characters.

Is this allowed? Are there any constraints to what I cannot use?

Animate UILabel text size increase and decrease

I want to apply animation on UILabel text. I write the code to increase font size in animation block but animation is not applied.

[UIView beginAnimations:nil context:nil/*contextPoint*/];
monthsOnBoard.font=[UIFont fontWithName:@"digital-7" size:150];
daysOnBoard.font=[UIFont fontWithName:@"digital-7" size:150];
hoursOnBoard.font=[UIFont fontWithName:@"digital-7" size:100];
minutesOnBoard.font=[UIFont fontWithName:@"digital-7" size:100];
secondsOnBoard.font=[UIFont fontWithName:@"digital-7" size:100];
[UIView setAnimationDelegate:self];
[UIView setAnimationDelay:0.5];
[UIView setAnimationDuration:1];
[UIView setAnimationRepeatCount:4];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView commitAnimations];

How does the array stored in memory?

I have a simple program which initializes an array as:

int a[]={10,20,30,40,50};

char *p;


Now I want to access the value at each byte through pointer p. For that I need to know how does the array stored in memory(stack or heap)?

Is it possible to localize CalendarView or DatePicker?

My users' calendar is Persian calendar. I have an algorithm to change date and time between western and Persian calendar. I want to use CalendarView or DatePicker for my users for selecting dates. Is it possible to localize CalendarView and DatePicker for supporting my local calendar?

How to Pass Variables Into PHP Ajax Handler Script?

I have a small ajax php application, which outputs data from a mysql db into a table. The rows are links, which when clicked will call an ajax function, which in turn will call another php file, which displays a different query from the same database in a layer without reloading the page.

I would like to know how to synchronize queries between both php files. So when I click on a row in the base page, the layer will be expanded to include additional information, or indeed the whole query.

I was thinking I could do this by having the primary key in the first query for the table, however I don't want it displayed and was wondering if there was a better approach to this?

How to communicate between content script and the panel

How does the communication between a panel and a content script happen? How can we dynamically update the panel content from content script? The content script accesses the DOM of the page loaded. Now every time when there is a DOM change in the webpage that should be shown in the panel. How can we do this? Can anyone explain with an example?

Set and get Notes field in CRM 2011 Javascript

I need to set the Notes field to the Notes field value in other entity in CRM 2011 form. So, I need to know how get and set the Notes field using Javascript. And I'm not able to get the name of Notes field inside the section as you can seen in the below image.

enter image description here

GitHub Organization Repo + Jenkins (GitHub Plugin) integration

I have an organization on GitHub with private repositories. I also have Jenkins set up running on port 8080 on a server, with the GitHub plugin installed. I've created an account on GitHub for my jenkins user, which resides in the owners group.

I'm trying to trigger a job on jenkins when a change is pushed to my development branch (or master branch, neither seem to be working).

When I look at the GitHub Hook Logs in Jenkins, it says that Polling has not run yet. When I go to "Manage Jenkins", the GitHub plugin says my account is Verified when I test it.

Any insight on how to configure this? I have multiple repositories I'd like to work with, so deploy keys don't seem like the solution to me.

Load UIImage from file using grand central dispatch

I'm trying to load images in the background using gcd. My first attempt didn't work:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW,0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
// create UI Image, add to subview

commenting out the background queue code and leaving just the main queue dispatch block didn't work:

dispatch_async(dispatch_get_main_queue(), ^{
// create UI Image, add to subview

Is there some trick to doing ui stuff inside a gcd block?

In response to mattjgalloway's comment, I'm simply trying to load a big image in a background thread. Here's the full code that I tried originally:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW,0), ^{

UIImage* img = [[UIImage alloc] initWithContentsOfFile: path];

dispatch_async(dispatch_get_main_queue(), ^{

imageView = [[[UIImageView alloc] initWithImage: img] autorelease];
imageView.contentMode = UIViewContentModeScaleAspectFill;
CGRect photoFrame = self.frame;
imageView.frame = photoFrame;
[self addSubview:imageView];



I simplified it so that I was running everything inside the main queue, but even then it didn't work. I figure if I can't get the whole thing to work in the main queue, no way the background queue stuff will work.

put jpg data from xmlhttprequest into <img /> tag

here is some part of my code"GET", theUrl, true);
document.imglive.innerHTML = '<img src="data:image/jpeg,' + xmlhttp.responseText + '"/>';

that don´t seem to work.
i also tried

document.imglive.src= xmlhttp.responseText;

that neither worked

I checked some of the asked questions here but none of the answers where helping at this porblem.

Problem with Icon.png (Icon specified in the Info.plist not found under the top level app wrapper: Icon.png (-19007))

I'm putting together a universal app and I have the icons in my project, but I keep getting a warning from the compiler in regards to Icon.png.

I followed the instructions at but still get the above error.

I've tried doing the following:

Putting the icons in the Shared group and adding them according to the plist according to the tech note.
Changing the icon paths to add Shared/ to them to point to the shared folder.

Creating a Resources group (which the tech note fails to point out that XCode doesn't create a Resources Group for a universal app) and moving them into that (I removed the "Shared/" prefixes from the plist.)

Moving the icons to the top level of the project.

I've also double-checked the icon sizes and they are all correct, as well as the names of each.

Anything I might have missed?

Using hover while showing/hiding areas

Have a question about showing/toggling div

Is there a way to add a click function to this script that will allow the hover to work and show the element that has been clicked? The link to this example has a hover working. I would like to be able to click a square and have it remain selected. There is an event that fires upon lick that will show media in another area of the screen. The area's graphis should remain selected because it corresponds to the other media and let's a person know what they clicked. If there is another way this should be set up, I am completely open.

Static Virtual workaround in GSL

Hello I am trying to write a small program to simulate dynamical systems using the differential equation package from the GNU Scientific Library. The problem is not specific to the GSL but I am just giving you all the details

In the current design I want to have an abstract Experiment class, where all the complex functions will be called by the gsl library. The dynamics of the explicit system will be defined by two functions, i.e., func and jacob, that define the specific motion equations and the jacobian respectively. Thus, I want to do all the simulation in the Experiment class and only override the two virtual functions with the specific class which will be inherited by the Experiment.

The problem I have is that as virtual these methods do not compile

error: argument of type 'int (Experiment::)(double, const double*, double*, void*)' does not match 'int (*)(double, const double*, double*, void*)'

If I make these two functions static the program compiles but I am losing the functionality that I want to achieve for specific problems.

Apparently, they cannot be both static and virtual, so does anyone know any workaround to this problem? Are there any suggestions to better approach it?

Thanks in advance.

Conditionally wrapping content in Razor using

Using Razor I want to conditionally wrap some content in a <span> element based on a boolean property of my model. My guess is that I will need to use Templated Razor Delegates, but I'm finding it tricky to get them right.

My model goes something like:

public class Foo
public bool IsBar { get; set; }

and in my view I'd like to be able to use something similar to:

<a href="/baz">
@Html.WrapWith(Model.IsBar, "span", @This content may be wrapped, or not)

where it would render:

<!-- Model.IsBar == True -->
<a href="/baz">
<span>This content may be wrapped, or not</span>

<!-- Model.IsBar == False-->
<a href="/baz">
This content may be wrapped, or not

Update empty column with calculated values from SELECT statement?

I have a table, 6 columns, the 6th column is empty but the other 5 have data. I used the 4th and 5th columns to calculate a value and then I wish to insert this value into the 6th column.

How do I link my Select statement which creates the values for the 6th column to the

"UPDATE Table_Name SET Column6 = "

part of my SQL statement.

I will also have to make sure the correct rows get updated with the correct values by using the primary ket of Columns 1 to 4

how to take screen shot and that screen shot save in album

I am working on application of greeting cards in I have taken screen shot and save in gallery so give any suggestion and source code which apply in my code

Sending an array from websocket to clients

I'm having an issue sending an array from the backend js to the client side.

I've tried the following on the server side:

for (var i=0; i < clients.length; i++) {

for (var i=0; i < clients.length; i++) {

  • also using json.stringify on the client side aswell

for (var i=0; i < clients.length; i++) {

  • again I've tried this method on the client side aswell.

Unfortunately, none of the above solutions worked, The JSON.stringify method obviously didn't work on the serverside due to JSON.stringify being a browser method however the other methods returned either [object Object] or "[object Object]"

How can I send the array clients to client side, or even if I can encode it into JSON and then send it over and parse it on the client side.

Really all I need is to send the contents over to the client side, but I have no clue how to do so haha

Any ideas are appreciated :)

what's the diff among cflgs sse options of -msse, -msse2, -mssse3, -msse4 rtc..? and how to determine?

as for the GCC cflags options: -msse, -msse2, -mssse3, -msse4, -msse4.1, -msse4.2. Are they exclusive when using or could be in parallel?

My understanding is that the choosing which to set depends on whether the target arch, which the program will run on, supports or not, is this correct?

If so, how could I know what sse my target arch supports? In Linux, I cat /proc/cpuinfo, but what if mac or Windows?


What is E in floating point?

What is E+3? What exactly happens here? Can we use this approach in other data types or can we only use it in floating points?

static void Main(string[] args)
double w = 1.7E+3;

Output: 1700

Recursive Bubble Sort

I am having some trouble with this. We basically have been asked to create two versions of a program that will sort an array of 50 items then display the largest numbers in LED's. I have got it working using a basic bubble sort and it displaying. My issue is when I have to do this using recursion. Unfortunately my knowledge on recursion is very limited as I missed the lecture on it -.- He has also not put the notes online. I have had a long google however still can't get my head around it. So I ask a few things. Firstly, could someone explain recursion in relation to a bubble sort using sedo code. Secondly, am I completely wrong with my attempt.

int numbers[49];

void setup()
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);

void loop()

void resetLEDLow()
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, LOW);

void genNumbers()
for( int i = 0 ; i < 50 ; i++ )
numbers[i] = random(256);

void sortNumbers()
int sizeOfArray = sizeof(numbers)/sizeof(int);
int check = 1;
if( check != 0 )
check = 0;
for( int i = 0 ; i < sizeOfArray ; i++ )
for ( int j = 1 ; j < sizeOfArray ; j++ )
if( numbers[j-1] > numbers[j] )
int temp = numbers[j-1];
numbers[j-1] = numbers[j];
numbers[j] = temp;

void displayNumber()
int i = 12;
int a = numbers[49];
while ( a > 0 )
int num = a % 2;
a = a / 2;
if( num == 1 )
digitalWrite(i, HIGH);
digitalWrite(i, LOW);

I know that code does not work as when it loops round count is reset to 1 so the condition will never be true thus meaning it will loop round forever and ever. So, what do I need to change or is what I am doing not really recursion at all?

Really need some help with this, got my brain going round and around.

Compare a string from $_GET with a string from an array

This has been frustrating me, because I'm pretty new to PHP and am sure I'm missing something very basic about the nature of the language. But why oh why won't this work?

$tag = $_GET['id'];
$openfile = fopen($files[$i], "r");
$tagsraw = fgets($openfile);
$tag_array = explode(",",$tagsraw);
foreach ($tag_array as $a) {
if ($a == $tag) {
echo $a." matches ".$tag;

EDIT: The file-opening works fine, by the way; print_r() shows that $tag_array populates how it's meant to.

Tooltips (Titles) in "XUL Browser" content are not working?

I'm developing a plugin for FireFox.

I've an XUL Deck which contains an XUL Browser.

Unfortunately, whenever the page displayed in the browser has an HTML title attribute, the title will not work for any element !

PS, the title HTML attribute is used to display a tooltip for the HTML element.

How to solve this ?

How to redirect a fully encoded url htaccess?

I want to redirect


Tried many different rules, bot non worked.

Need help with this

how is absolute path of <a href="..."/> determined?

I have an html deep inside my directory structure inside c:\. one line there is this:

<link type="text/css" rel="stylesheet" href="/s/2036/21/2/_/download/superbatch/css/batch.css" media="all">

When I hover over the link, it shows file:///C:/s/2036/21/2/_/download/superbatch/css/batch.css as the link address. I want it to interpret to actual location which is file:///C:/Users/name/folder1/...some folders/s/2036/21/2/_/download/superbatch/css/batch.css

What changes are needed to make?

P.S: please change the title to something better if this one is not expressive enough.

clear contents of a jTable

I have a jTable and it's got a table model defined like this:

javax.swing.table.TableModel dataModel = 
new javax.swing.table.DefaultTableModel(data, columns);

Does anyone know how I can clear its contents? Just so it returns to an empty table?

List html and float IE

Normally I always manage to find a solution to my CSS problems, but this one is driving me crazy.

I'm trying to place my list correctly on Wordpress (sidebar widget).
(I tried divs, but that still doesn't work under IE.) So here is the HTML code and some screenshots

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans nom</title>
<style type="text/css">
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
#header_wrap {
padding:0 15px;
#header_wrap #logo {
background:url(images/logo.png) no-repeat;
margin:10px 0 0 0;
#header_menu {
#header_menu ul {
#header_menu li {
#header_menu h2 {
.clear {
.widget_text, icl_languages_selector, #lang_sel, .widget_pages, #pages, .widget_wp_shopping_cart, #sliding_cart, .widget_search {
.widget_pages, .widget_search {
<div id="header_wrap">
<div id="logo"></div>
<div id="header_menu">
<li class="widget icl_languages_selector" id="language-selector">
<div id="lang_sel">
<li><a class="lang_sel_sel icl-fr" href="#"> <img alt="fr" src="./flags/fr.png" class="iclflag"/> * </a> </li>
<li class="icl-en"> <a href="/?lang=en"> <img alt="en" src="./flags/en.png" class="iclflag"/>* </a> </li>
<li class="widget widget_text" id="text-3">
<div class="textwidget">Bienvenue sur TEST</div>
<li class="widget widget_pages" id="pages-4">
<h2 class="widgettitle">Pages</h2>
<div id="pages">
<li class="page_item page-item-201"><a title="Sign in" href="/?page_id=201">Sign in</a></li>
<li class="page_item page-item-19"><a title="Mon compte" href="/?page_id=19">Mon compte</a></li>
<li class="widget widget_wp_shopping_cart" id="shopping-cart">
<h2 class="widgettitle">Shopping Cart</h2>
<div class="shopping-cart-wrapper" id="sliding_cart"><span class="gocheckout"> <a href="/?page_id=17">Panier d'achats <span class="items"> <span class="cartcount"> (0 </span> <span class="numberitems">objet(s) dans votre panier)</span> </span> </a> </span> </div>
<li class="widget widget_search" id="search-3">
<h2 class="widgettitle">Search</h2>
<ul class="search_wrap">
<form id="searchform" enctype="application/x-www-form-urlencoded" method="get" action="#">
<input type="text" value="" class="query" id="s" name="s"/>
<input type="submit" value="Search" class="submit" id="searchsubmit"/>
<input type="hidden" name="lang" value="fr"/>


Inconsistent behaviour in CKEditor using Jquery mobile in Safari on iOS5.1 - this link contains an example of code with the bug

try typing in the editor on an iOS device, then move the cursor around by
tapping in a different place in the editor. and carry on typing, the
editor stops responding, then closing the keyboard and tapping again to
edit allows you to type.

Also the Next/Previous buttons on the iOS on screen key board ignore the
editor when "tabbing" through controls

JSTL: remove last item from array

Was wondering if it's possible to remove the last item from an array using JSTL? Currently I'm using c:url to append parameters (from an array) to a hyperlink. I want to be able to remove the last parameter as well...

Here is the code for the c:url to append parameters

 <c:url value="search" var="url">
<c:param name="q" value="${q}"/>
<c:if test="${fn:length(fq) > 0}">
<c:forEach var="field" items="${fq}">
<c:param name="fq" value="${field}"/>

GridLayout from support library does not show 2 rows on Android 2, onChildVisibilityChanged Error

Has anybody gotten the support library to render a grid layout correctly in Android 2? Instead of 2 rows and columns I get a single row on the screen and see this error in the logcat output:
Android GridLayout Could not find method

The same exact layout is working on Android4 -> ICS when I change the layout tag from to GridLayout

Could this be some issue with the setup? I have the gridlayout_v7 library project in the Android tab of my Eclipse project properties and the v.13 jar is on the build path.

The xml layout that is failing is pasted below. I added the layout rows and columns explicitly in the image button tags in an effort to work around the problem. If anybody has a working example that runs on Android 2 with the support library, please share. If you have it working, I would appreciate your help to get mine going.
Thanks and regards!

< xmlns:android=""
android:columnCount="2" android:rowCount="2"
android:layout="@drawable/bg_test_main" >

<ImageButton android:id="@+id/btnSentence"
<ImageButton android:id="@+id/btnAudio"
<ImageButton android:id="@+id/btnPickWord"
android:contentDescription="@string/def_pick_word" />

<ImageButton android:id="@+id/btnPickDef"
android:contentDescription="@string/pick_def" />


Use of LINQ on Arbitrary Tables

I love LINQ esp. LINQ to SQL. The use of LINQ for static tables (where the structure of the table is known before hand) is great.

I now have a list of tables where I only know the Table Name (as a string). I also know that each row in the table would have an ID/Primary Key(int) and a number of undetermined columns whose datatypes are varchar/string. I can get the names of the columns using SMO.

I am wondering what is the best way to query these columns e.g. run a distinct on each of them? LINQ to SQL seems to be pretty efficient by converting the query directly to SQL. I would prefer not to write the SQL by hand.

Please let me know your ideas.

Thank you,
O. O.

How do I make TWebBrowser keep running JavaScript after an error?

I'm having some troubles with javascript error handling in WebBrowser on Delphi 2010.

I'm using WebBrowser with enabled silent property. Seems OK, but there is one issue on sites with buggy scripts: it seems like part of script after error doesn't executes. Results of some script slightly differs from IE.

Do you have any idea how this issue can be solved?

Using Microsoft.Data.Services.Client.dll instead of System.Data.Services.Client.dll causes issues with Azure.StorageClient

We have a project that uses WCF 5.0 and the WindowsAzure SDK.

There are two references Microsoft.Data.Services.Client.dll and System.Data.Services.Client.dll and they are in conflict. If I remove the System DLL (as per this) I am unable to use the windowsAzure SDK. If I remove the Microsoft DLL I am unable to take advantage of the new features of WCF specifically OData version 3.0.

After I remove the System DLL reference:

cannot convert from
'System.Data.Services.Client.SaveChangesOptions [c:\Program Files
(x86)\Microsoft WCF Data
Services\5.0\bin.NETFramework\Microsoft.Data.Services.Client.dll]' to

Additional information:

The best overloaded method match for
has some invalid arguments

The type 'System.Data.Services.Client.DataServiceContext' is defined
in an assembly that is not referenced. You must add a reference to
assembly 'System.Data.Services.Client, Version=,
Culture=neutral, PublicKeyToken=b77a5c561934e089'.

If I remove the reference to Microsoft.Data.Services.Client and add reference to System.Data.Services.Client then we get no errors - we also get no WCF 5.0!

Bash declaratively defining a list to loop on

In bash I frequently make scripts where I loop over a list of strings that I define.


for a in 1 2 3 4; do echo $a; done

However I would like to define the list so that it contains spaces and with out a separate file:


read -r VAR <<HERE
list item 1
list item 2
list item 3

for a in $VAR; do echo $a; done

The expected output above (I would like):

list item 1
list item 2
list item 3

But you will get:


I could use arrays but I would have to index each array. How do others declaratively define lists in bash with out using separate files?

How to setup a 3-column layout using pisa xhtml2pdf

I have a list of items that I want to layout in three columns. The list is pretty long (using a 3-column layout might take 5 pages). The conditions are as follows:

  1. The first page has a header that is about 200px in height and 100% in width. After the heading in the first page, the page should start displaying the list in 3-columns.

  2. "Middle and last" pages dont contain any header.

  3. Last page contains an image.

I tried to give a margin-top for the second and third frames, the first page looks right but the "middle" pages don't. The margin-top gets applied to all pages.

Help will be appreciated.

How to sort a observablecollection(of String)

All I need is a simple way to sort the strings in the collection. I can't find anything online. Everybody is using lamda expressions which I don't think works for just a string collection?

   Public Property FilterCollection As New ObservableCollection(Of String)

From d In FilterCollection Order By (Function(d) d)()

IE Compatibility mode creates issues with XPages DateTimePicker

Per Hendrik suggested a fix for the strange stretched dialog problems in IE with xPage extensions.

Fixing "stretched" XPage extension library Name Picker in IE?

This worked great and fixed the problem. But it creates an issue with the DateTimePicker. With compatibility mode in place the calendar for the DateTimePicker displays but is immediately closed. I have put together a demo here:

<![CDATA[#{javascript: if (context.getUserAgent().isIE()) {
var response = facesContext.getExternalContext().getResponse();
response.setHeader("X-UA-Compatible", "IE=8");

<xp:inputText id="inputText1">
<xp:dateTimeHelper id="dateTimeHelper1"></xp:dateTimeHelper>
<xp:convertDateTime type="date"></xp:convertDateTime>

MYSQL export Value and NOT ID

I have a MYSQL database table with a field that contains information like below...

ID: 1 with a VALUE: Apple

ID: 2 with a VALUE: Orange

ID: 3 with a VALUE: BANANA

I wish to export the data VALUE, but currently can only pull out the ID.
For example, I want to export the words "APPLE", "ORANGE" etc - meaningful names, and NOT just "1", "2" etc.

My actual query line thus far....

SELECT ID,time,quote,media,pack FROM database_table_name

The issue is the 'pack' field renders the id numbers, not the real names on export. Any ideas how to access the real names instead??

Need hints on seemingly simple SQL query

I'm trying to do something like:

FROM customers c
JOIN orders ON o.customerId =

However, SQL will not allow the COUNT function. The error given at execution is that c.Id is not valid in the select list because it isn't in the group by clause or isn't aggregated.

I think I know the problem, COUNT just counts all the rows in the orders table. How can I make a count for each customer?

PHP - Proper way to extend class

I am currently working on a mini 'framework' and I am having some difficulties. I'm attempting this in order to strengthen my understanding of basic concepts utilized in most MVC's (At least from what I have seen). So yes, I do understand that using a framework may be easier and not everything that I am doing is ideal. I am just trying to learn more.

So I have 2 files that I am currently working with.


class FrontController {
public function __construct() {

public function go() {
$action = explode("/", $url); // SPLITS UP URL INTO SECTIONS

$object = ucfirst($action[2]) . "Controller"; // SETS 2ND SECTION OF URL TO UPPERCASE AND IDENTIFIES THE CONTROLLER
$file = APP_DIR . "/" . $object . ".php"; // IDENTIFIES THE FILE THAT WILL BE USED

if(!is_file($file)){ // DETERMINES IF FILE EXISTS
$this->fail(); // IF NOT, FAILS
} else {
require_once $file; // IF EXISTS, PULLS IT IN
$method = ucfirst($action[3]); // THE 3RD SECTION OF THE URL IS THE METHOD
$controller = new $object(); // CREATE INSTANCE OF THE IDENTIFIED OBJECT

if(!method_exists($controller, $method)){ // DETERMINES IF METHOD EXISTS IN THE CLASS
$this->fail(); // IF NOT, FAILS

$controller->$method(); // RUN METHOD

public function fail() {
echo "<h1>Failure</h1>"; // FAILURE MESSAGE


class BaseController {
public function __construct() {

public function session() {
$_SESSION['is_logged_in'] = 1;
echo "hi";

So what I would like to be able to do is extend the BaseController with the FrontController. I figured that extending the BaseController would allow me to add common functionality to my entire application. The problem is that I am not certain how to do this properly. I know that I need to 'require' BaseController.php into FrontController.php somehow, but I have seen many different ways and I want to know which is most correct.

What I have tried is simply adding 'require_once("/application/BaseController.php");' to the top of FrontController.php and then extending the FrontController class, but this isn't working (blank page), and from what I have read, it is not the best way.

I read into __autoload() but I do not understand how to use it effectively. Do I just put this at the top of my FrontController.php file and extend my class after that?

So, to summarize, I would like to extend my FrontController class (and other future classes, when necessary) with my BaseController. I would just like some advice for how to accomplish this task effectively. It may even be possible that the way I have this thought out is ass backwards, and if that is the case, please let me know!!