Friday, April 20, 2012 imagebutton new window

I have a Telerik Grid. In that I have the following code in an .aspx page. What I want to happen is that when the user click on the imagebutton control it launches a new window to show that image. Note, I have seen some code which use Postback but they are blocked by popup blockers. The control's image is set via codebehind but that should not matter for this question. Here is my code. Thanks!

<asp:ImageButton ID="prod_image_main" runat="server" AlternateText="Product Main Image"
Height="500PX" Width="540PX" />

Windows service implementation in MVC3

Hi I am working on MVC3 Application i want to call a function when the date is expire.For that i want to use windows service.Can anyone tell me steps to implement window service in MVC and if there is any other better option to call the function at certain date.

Thanks in advance.

Shell scripting: export test1="a b c" works, but $(echo 'export test2="a b c"') doesn't

I seem to be having issues with some shell scripting (ZSH in particular), where the shell fails to understand exports with spaces in them. The problem only happens when `runcommand` or $(runcommand) is used.

Test case:

# Works fine:
export test1="a b c"

# Does not work:
$(echo 'export test2="a b c"')

The error is something along the lines of export:4: not valid in this context: c". Adding 1-2 \-escapes before the spaces and/or the quotes might change the error message to export:4: not valid in this context: b\.

Might anyone have insight into what the problem is? Thank you.

(The reason I am doing this is a hack to allow python to set shell variables by dynamically generating code which gets run in .myshellrc; if anyone knows of a more elegant way to do this, that would be quite welcome as a comment. Thank you.)

(&ast;sigh&ast;, I hope this isn't a version-specific issue in 4.3.12... I think this may have worked in the past.)

FabricJS support for SVG viewBox element?

Does fabricJS support SVG viewBox element so that it will render only that on canvas? That way, zooming of the entire screen could be implemented easily.

Webdevelopment using JSP and XML

I am developing an online exam for which I retrieve questions from an XML file. But when I retrieve the questions using JSP, I am getting all questions at a time in a single page.

I want to show one question in one page, for the next question the user needs to click on the next buttun. There is also a timer for each question and when that expires the system automatically moves to the next question.

I tried different codes but I didn't get what I wanted. Can some one help me in this?

How to bypass MAC address filters

I have a program that gets my MAC address, and it won't work with the real one, i need to clone it. The problem is that if i try to spoof it from regedit the software will recognize it. I cannot use another software. Is there any other way to change the MAC address??

I want to display a text in a textbox

C# Problem
I have a textbox and text file in the debug folder
I just want to display this text in the textbox

Drupal 7 Views Contextual Filters Title Override

I have a view that returns search results via the search API. It performs this use case adequately and I am happy. To crown the deliverable, I need to add a title override of the form Showing search results for '%1' which looks easy enough initially but it isn't working entirely as planned.

For a URL =, where the search value is gathered from an exposed form within a block, I am either getting:

Showing search results for 'Search for "all"'

or, if I enter %1 in the title override for subject not appearing in the URL, I get:

Showing search results for %1". My goal is to get "Showing search results for 'wombat'

The title override works in that it removes the Search for ... part but the substitution picks up on "all" as the exception value (or anything else that I set as the exception value) where I need to be able to pick up the value of the query string (search=wombat).

Can anyone shed some light here?

How to generate the password in PHP as it did by Devise Gem in Ruby on Rails

I'm renewing a website from Ruby on Rails to PHP.
I need to generate the passwords which are generated by Devise Gem in Ruby on Rails.
I have to know what is the hashing method for password to create same method with PHP.
but it's not easy to find that codes inside the Ruby on Rails as a beginner.
If somebody know where should I check to find it, please help me.

These two are all what I found:

1) The configuration of encryptor is disabled in devise.rb like below:
# config.encryptor = :sha1
2) I read the comments very carefully then I found that they using sha512 and bcrypt as default encryptor.
# (default), :sha512 and :bcrypt. Devise also supports encryptors from others

I tried to make the same encrypted password in different ways with PHP:

1) sha1('--'.$password_salt.'--'.$encrypted_password);
2) sha1($password_salt.'-----'.$encrypted_password);
3) sha1('--'.$password_salt.'--'.$encrypted_password.'--');
4) sha1($password_salt.$encrypted_password);
5) sha1($encrypted_password.$password_salt);
6) substr(hash('sha512', $password_salt.$encrypted_password, false), 20);
7) substr(hash('sha512', $encrypted_password.$password_salt, false), 0, 40);
8) hash('sha512', $encrypted_password.$password_salt, false);
9) hash('sha512', $password_salt.$encrypted_password, false);
10) substr(hash('sha512', '--'.$password_salt.'--'.$encrypted_password.'--', false), 0, 40);

I couldn't get the same result from any of above.
Is there anybody whom could tell me the encryption method of Devise Gem??


ps. I'm not good at English. Even if my English is not correct, please don't be angry.

Dear W00d5t0ck,

Thank you for asking the test data.

Here is a test password.

password: shfogkwk1

password_salt: hnhbvKFgFVBQ4rLagcbb

encrypted_password: 30f5113d36ba649f1c89180495f01988bc78b529

I don't know which combination Devise Gem is using with password and password_salt.

Even I don't know whether Devise Gem is using salt or not.

Dear Jazz

I found config.pepper on /config/initializers/devise.rb.

# ==> Configuration for :authenticatable
# Invoke `rake secret` and use the printed value to setup a pepper to generate
# the encrypted password. By default no pepper is used.
# config.pepper = "rake secret output"

it's commented.

Thank you for the Answer, W00d5t0ck

I don't see any data field or configuration for "$pepper".

I found the information in devise.rb:

1)  # the encrypted password. By default no pepper is used.
# config.pepper = "rake secret output"

2) # Configure how many times you want the password is reencrypted. Default is 10.
# config.stretches = 10

so I called like this

sha512_digest('shfogkwk1', 10, 'hnhbvKFgFVBQ4rLagcbb', '')

then it returns 39dad169b4b2ac72471fad6c20cc1d5289fce0d0.......

it's not same as it was (30f5113d36ba649f1c89180495f01988bc78b529)

How do you use bcrypt for hashing passwords in PHP?

I tried bcrypt with advice from above.

the result is $1$eT0.Pf5.$i6ML4YMP59CNOil49xTcR0.

it's not even close as sha512.

what should I do?

Looks like MSVS 11.0 Beta spoiled a MSVS 10.0 installation

I ran into compilation problems with my MSVS 10 after installing MSVS 11Beta. Now, when I compiling my C# Projects in MSVS 10 (Projects created in MSVS 10; Target framework: 3.5), I've got such an errors with following text in output window:

1>Task "GenerateResource" skipped, due to false condition; ('%(EmbeddedResource.Type)' == 'Resx' and '%(EmbeddedResource.GenerateResource)' != 'false' and '$(GenerateResourceMSBuildRuntime)' != 'CLR2') was evaluated as ('Resx' == 'Resx' and '' != 'false' and 'CLR2' != 'CLR2').
1>Task "GenerateResource"
1> Launching task "GenerateResource" from assembly "Microsoft.Build.Tasks.v3.5, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" in an external task host with a runtime of "CLR2" and a process architecture of "x86".
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2199,5): error MSB4216: Could not run the "GenerateResource" task because we could not create or connect to a task host with runtime "CLR2" and architecture "x86". Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NetFX 4.0 Tools\MSBuildTaskHost.exe" exists.
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2217,7): error MSB4028: The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.
1>Done executing task "GenerateResource" -- FAILED.

How can I rid of these errors?

removing text from a string

I have a string which is holding this below, is it possible to take out the url and decription inside it, so and Louis travels to DLC Warren in New Jersey, an innovative autism school preferably splitting them into two variables

&lt;a href=&quot;;&gt;
&lt;img src=&quot;; alt=&quot;Louis Theroux: Louis Theroux - Extreme Love: Autism&quot; /&gt;
Louis travels to DLC Warren in New Jersey, an innovative autism school.

How do I make Internet Explorer include the required line feeds when transferring innerHTML to a <textarea>?

The purpose of this JavaScript program is to enable the user to report a problem on a social network with all the pertinent information in his initial message.

The user enters the information by answering a set of questions on a form consisting of text boxes, &c.  The answers are used to create an array of string literals, the elements of which are concatenated to form a single string. This string is then presented at the end of the page for the user to copy and then to paste on to the social-network page.

Hitherto this has been done by placing the string (using document.getElementById('divName').innerHTML) in a <div> set up for the purpose. That's fine: works in all five browsers and even on the Iphone.

Now, in order to make it easier for the user to make minor changes to the report before posting it (and to make it easier to copy), I want to be able to place the report not in a <div> but in a <textarea> part of the input form. This too is fine: works in Firefox, Chrome, Opera and Safari – even on the Iphone – but...

With some inevitability the only browser on the whole parade ground marching in step – MSIE – cannot handle it. It puts the information in the <textarea>– minus all the line feeds.
The array is initialized:

function createReport() { // [0] and [21] are constant.
outReportArray[0] = 'E M E R G E N C Y' + horizLine;
for (i=1 ; i&lt;outReportArray.length ; i++) {
outReportArray[i] = '';
outReportArray[21] = 'Thank you.';

(Global variable horizLine is a sequence of m-rules () with a line feed at each end.)

As the user progresses through the form, the array is updated:

outReportArray[element] = label + value + (underLine ? horizLine : '

(The following also have been tried for generating the line feed: '\n', '\r\n', '\r', ' ', ' ')

The output string is continually rebuilt and pasted to the <textarea> so that when he arrives at the foot of the form he presses an 'update' button and is simply transferred to the <<textarea>:

outReportStr = '';  // Initialize the output string.
// Build the output string from the output array.
for (i=0 ; i<outReportArray.length ; i++) {
outReportStr += outReportArray[i];
// Populate the <textarea> 'outbox'.
document.getElementById('outbox').innerHTML = outReportStr;

Normally the content of the <textarea> looks like this:

Name: John Doe
Land-line: (213) 555 1234
Cell-phone: (213) 555 1235
Location of animal now:
Washington (St Landry Parish), La

(There's more to it but this demonstrates the layout required in the output.)

In Internet Explorer, however, each line feed is replaced by a single space:

E M E R G E N C Y ——————————— Name: John Doe Land-line: (213) 555 1234 Cell-phone: (213) 555 1235 E-mail: ——————————— Location of animal now: Washington (St Landry Parish), La ——————————— &c.

My question is this: how do I make Internet Explorer include the required line feeds in the innerHTML transferred to <textarea> 'outbox'?

(I have tried creating a textNode consisting of the innerHTML and then appending it as a child to the <textarea>; no dice: what I then get are all the character-entity codes (&#...) instead of the characters themselves.)

I'm very much an amateur at this game so, quite apart from not wanting to impose anything more complicated than HTML, CSS and JavaScript on the user, I don't want to get involved with complicated add-ins and proprietary libraries. A front seat at the pearly gates to any-one that can help me solve this problem!

The opener re-bids

First let me express sincere thanks to all that responded to my question. I had had some doubt of even getting a response, never mind one so quick.

Your insightful answers not only solved my problem but taught me quite a bit about the languages I'm deploying way above my pay grade – even of one I've never used!

@Kolink and @JayC told me to use .value rather than .innerHTML (and Kolink was quite right to adopt a tone of admonishment). Although I was aware of .value as part of the process of transferring data from an input element to the program, it had not even occurred to me that it might be written to: d'oh! I believe is the term.

Thank you, @RobG also, for your account of the use of \u codes; when it came to using .value vice .innerHTML, that was an important part of the solution.

@deceze recommended, indeed pleaded, that I learn 'Markdown' (which I always thought was something retailers applied to merchandise they were putting in to the clearance sale). He didn't say whether that was for my benefit or for his as a possible respondent but, searching for it on Google, I found a very interesting alternative to the jEdit I use, its strength being that the 'code' (the Markdown version of the text) is legible by a human, which must make it much simpler to edit. Thank you, deceze, I'll look in to that in due course (I've even tried coding this message in it); for the time being, not to the best of my knowledge having Perl to hand, I shall have to stick with what I (almost) know.

And, naturally, you all qualify for a front seat at the pearly gates. Thank you all for making my first visit to such a forum both fruitful and enjoyable.


PHP: Convert array to Multidimensional array

Could really do with some help.

So I have an array like so

[0] => KK777ET#ABU|HX528E
[1] => KK777ET#ABU|UE342E
[2] => LG671ET#ABU|QK639AA
[3] => LG671ET#ABU|XX046AA
[4] => LG671ET#ABU|LX729AA

I need it converted to

[0] => Array
[KK777ET#ABU] => HX528E
[KK777ET#ABU] => UE342E

[1] => Array
[LG671ET#ABU] => QK639AA
[LG671ET#ABU] => XX046AA
[LG671ET#ABU] => LX729AA


Any help is appreciated.

Many thanks in advance.

Why writeln(); not producing a new line?

  <script type='text/javascript'> 
for(var j = 0; j < 6;) {

in the above code it suppose to give a new line if referring to the definition of the The writeln() method is identical to the write() method, with the addition of writing a newline character after each statement.

But in my case the output is 123456

How to get Browser Information + Time Stamp with PHP

I'm trying to write a function, which will execute on user login. It should get the browser, OS, resolution and time currently on user's PC?

Is it even possible to obtain such info and how?

SharedLib dependency @ Mixed mode APK

  1. I am building a mixed mode Android project, the project is using the native ffmpeg

  2. The Libs are

    2.1. ->

    2.2. ->

    2.3. ->

  3. My Java code include the following JNI section to load the native libs:

    static {





  4. '' depends on '' AND NOT on ''.

  5. When running my activity  System.loadLibrary("avcodec"); excepts with "could not load needed library '' for '' (Library '' not found)"

  6. On my I have the following section to have the native libs added to the APK:

    include $(CLEAR_VARS)

    LOCAL_MODULE := mylib

    LOCAL_SRC_FILES := ../../../Android/ffmpeg/libavcodec/


  7. replacing with cause the build to fail with [LOCAL_SRC_FILES should point to a file ending with ".so"]

    Having the above in mind, how can have libavcodec loading w/o the dependency problem ?

    • Can I fix dependency to point to and not to ?

    • Can I change so it will be able to pack ( non .SO extention ).

      Any help will be appreciated!!!

      Nadav at Sophin

use existing aspect in other java projects

I have a project containing a loging aspectJ-aspect using annotations (see this tutorial).

Is it possible to use that aspect in all other java projects?

I tried to import aspectJ project to a java project
-> it doesn't work

Added to this java project META-INF/aop.xml
-> it doesn't work

Added vm options -javaagent:lib\aspectjweaver.jar
-> it doesn't work

Has anybody of you managed to import aspects to exisiting java projects?

DataTable internal index is corrupted: '5'.used in threading

I have used a static Global dataset shared between a number of threads.

I got the following exception :

Data Table internal index is
corrupted: '5'.

In threading, I read the value from the datatable & update(used merge) the value in datatable both operation done in threading.

When to use "getResourceAsStream" method?

I was confused using the said method because while loading some properties file people are following a different approaches...

Properties prop 
= new Properties(new FileInputStream(new File("<path of the properties file>"));

and few are using..

Properties prop 
= new Properties(getClass().getResourceAsStream("<path of the properties file>"));

Which one to use when?

RMySQL: LAST_INSERT_ID() always returns 0 - separate connection issue or bug?

Original example as found in some post

According to this post the following SQL statements should give me a vector
1, 2, 2, 2, 2 in the end:

con <- dbConnect(
> con
> dbSendQuery(con, "DROP TABLE IF EXISTS t;")
> dbSendQuery(con, "INSERT INTO t VALUES(NULL);")
> dbGetQuery(con, "SELECT LAST_INSERT_ID() FROM t;")
1 0
> dbSendQuery(con, "INSERT INTO t VALUES(NULL),(NULL),(NULL);")
> dbGetQuery(con, "SELECT LAST_INSERT_ID() FROM t;")
1 0
2 0
3 0
4 0

Following suggestions by N.B. and Jeff Allen

dbSendQuery(con, "DROP TABLE IF EXISTS t;")
dbSendQuery(con, paste("CREATE TABLE t",
dbSendQuery(con, "INSERT INTO t SET x=1;")
> dbGetQuery(con, "SELECT * FROM t;")
i x
1 1 1
> dbGetQuery(con, "SELECT LAST_INSERT_ID();")
1 0
dbSendQuery(con, "INSERT INTO t SET x=2;")
> dbGetQuery(con, "SELECT LAST_INSERT_ID();")
1 0
> dbGetQuery(con, "SELECT * FROM t;")
i x
1 1 1
2 2 2

Well, it doesn't, really ;-)

I've googled a bit and AFAIU, LAST_INSERT_ID() is "connection-aware" in the sense that the same connection must be used if it is to work properly. However, I thought that by assigning the connection object to con I was making sure that indeed the same connection is used in each of the statements above.

Well, apparently not ;-) Can anyone help me out with some explanations and/or workarounds?
Using something like select max(<ID>) from <TABLE> isn't going to cut it, though, as I'm running multiple threads that simultaneously write to the DB, thus messing up ID retrieval if done that way.


I get a force close when I set a string array with ListView

I am making a list view, I would like it to show stuff from a String Array. Here is my Scanner class:

package com.rezoluz.planesim;

import java.util.ArrayList;

public class Scanner {

public ArrayList<String> gameList;
public String[] gameListFin;

public void getFiles() {
gameListFin = gameList.toArray(new String[gameList.size()]);


Here is my ShortcutListActivty class:

package com.rezoluz.planesim;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ShortcutListActivity extends Activity {

Scanner scanner = new Scanner();

public void onCreate(Bundle savedInstanceState) {

ListView listView = (ListView)findViewById(;
listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, scanner.gameListFin));


But when I open ShortcutsListActivity up, it force closes, here is the logcat.

04-20 15:29:24.343: D/AndroidRuntime(17039): Shutting down VM 04-20
15:29:24.343: W/dalvikvm(17039): threadid=1: thread exiting with
uncaught exception (group=0x4001d7e8) 04-20 15:29:24.478:
E/AndroidRuntime(17039): FATAL EXCEPTION: main 04-20 15:29:24.478:
E/AndroidRuntime(17039): java.lang.RuntimeException: Unable to start
java.lang.NullPointerException 04-20 15:29:24.478:
E/AndroidRuntime(17039): at
04-20 15:29:24.478: E/AndroidRuntime(17039): at
04-20 15:29:24.478: E/AndroidRuntime(17039): at$2300( 04-20
15:29:24.478: E/AndroidRuntime(17039): at$H.handleMessage(
04-20 15:29:24.478: E/AndroidRuntime(17039): at
android.os.Handler.dispatchMessage( 04-20
15:29:24.478: E/AndroidRuntime(17039): at
android.os.Looper.loop( 04-20 15:29:24.478:
E/AndroidRuntime(17039): at 04-20
15:29:24.478: E/AndroidRuntime(17039): at
java.lang.reflect.Method.invokeNative(Native Method) 04-20
15:29:24.478: E/AndroidRuntime(17039): at
java.lang.reflect.Method.invoke( 04-20 15:29:24.478:
E/AndroidRuntime(17039): at$
04-20 15:29:24.478: E/AndroidRuntime(17039): at 04-20
15:29:24.478: E/AndroidRuntime(17039): at
dalvik.system.NativeStart.main(Native Method) 04-20 15:29:24.478:
E/AndroidRuntime(17039): Caused by: java.lang.NullPointerException
04-20 15:29:24.478: E/AndroidRuntime(17039): at
com.rezoluz.planesim.Scanner.getFiles( 04-20
15:29:24.478: E/AndroidRuntime(17039): at
04-20 15:29:24.478: E/AndroidRuntime(17039): at
04-20 15:29:24.478: E/AndroidRuntime(17039): at
04-20 15:29:24.478: E/AndroidRuntime(17039): ... 11 more

I can see it is referencing to this: gameList.add("testo7r"); and this and this scanner.getFiles(); but I don't see the problem in there, please help! Thanks for your time and help, zeokila.

Why Operator overloading behaves so strange

Hello Friend the output of the below program is so strange. I am not getting the reason.enter image description here

#include <iostream>
using namespace std;

class xyz
int ab, cd;

xyz(int i, int j)
ab = i;
cd = j;

xyz operator+(xyz);
void show()
cout << ab << " .... "<< cd;

xyz xyz :: operator +(xyz ob)
xyz temp;
temp.ab = ab + temp.ab; = cd +;
return temp;

int main()
// xyz xy, yz;

xyz xy(2, 3);
xyz yz(4, 5);
xy = xy + yz;;
return 0;

Using HTML5 file uploads with AJAX and jQuery

Admittedly, there are similar questions lying around on SO. But it seems none quite meet my requirements. Here is what I'm looking to do:

  • Upload an entire form of data, one piece of which is a single file

  • Work with Codeigniter's file upload library

Up until here, all is well. The data gets in my database as I need it. Good good. But I'd also like to submit my form via an AJAX post:

  • Using the native HTML5 File API, not flash or an iFrame solution

  • Preferably interfacing with the low-level .ajax jQuery method

I think I could imagine how to do this by auto-uploading the file when the field's value changes using pure javascript, but I'd rather do it all in one fell swoop on for submit in jQuery. I'm thinking it's not possible to do via query strings as I need to pass the entire file object, but I'm a little lost on what to do at this point. Am I chasing a unicorn here?

Thanks so much for any help you could give.

Triger the event in DataGrid when changing occur in TemplateColumn(asp:radiobuttonlist)

To get the row index of DataGrid when change(asp:radiobuttonlist) occur in row of the TemplateColumn

<asp:DataGrid ID="dgTier2" runat="server" AutoGenerateColumns="False" Width="578px" 
Height="83px" OnItemDataBound="dgTier2_ItemDataBound">
<asp:BoundColumn DataField="TypeID" HeaderText="TypeID">
<asp:BoundColumn DataField="Type" HeaderText="Category Type">
<asp:TemplateColumn HeaderText="Manual Tracking Option" >
<ItemStyle VerticalAlign="Bottom" />
<asp:radiobuttonlist id="rdbtnManual" runat="server" on RepeatDirection="Horizontal">
<asp:listitem id="M" runat="server" Text="Manual" Value="1" />
<asp:listitem id="A" runat="server" Text="NoManual" Value="0" />

After changing the rediobutton selection to get the Rowindex of the changed row.if at all change happens in many rows i need make the collection of the Rowindexs.Is that passible.

what is the difference between foo(array(...)) and foo($x=array(...))?

See this example:

This class extends DOMElement. Every DOMElement must be a part of
any DOMDocuement to be modifable.

class Xmlrize  extends DOMElement
private static $dom;

public function __construct(/*. string .*/ $name,$value =null) {
if(!self::$dom) {
self::$dom = new DOMDocument('1.0','UTF-8');

Used to add array into DOM. If value of the array is not Xmlrize, then I ignore it.

class Attributes extends Xmlrize {

public function __construct(array $attributes)

foreach($attributes as $name => $value) {
$element = new Xmlrize($name);
if($value instanceof Xmlrize)

You can add any DOMNode to the constructor. In my example
it will be instance of Xmlrize

class Html extends Xmlrize {

public function __construct(DOMNode $obj = null) {
if(!is_null($obj)) {
if($obj instanceof Attributes)

This method shows if attribute is or is not instance of Xmlrize.

    protected function addAttributes(Attributes $attributes)
$remove =array();
foreach($attributes->childNodes as $attribut) {
if($attribut->childNodes->length == 1) {
$item = $attribut->childNodes->item(0);
echo $attribut->nodeName.': ';
echo $item->nodeName.' has value '.$item->nodeValue.'. ';
echo 'Is it DomElement? ';
echo ($item instanceof DomElement) ? 'true' : 'false';
echo '. Is it Xmlrize? ';
echo ($item instanceof Xmlrize) ? 'true' : 'false';
echo '.'.PHP_EOL;
return null;

Example of initiating of Attributes by array. See the differences!

/* works as expected */
$like = new Html(new Attributes(
$xx = array('XXX'=> new Xmlrize('foo', 'baar'))

/* do not work as exptected */
$like = new Html(new Attributes(
array('XXX'=> new Xmlrize('foo', 'baar'))

The example above returns:

XXX: foo has value baar. Is it DomElement? true. Is it Xmlrize? true.
XXX: foo has value baar. Is it DomElement? true. Is it Xmlrize? false.

Why if I add '$xx =' the element is considered as Xmlrize and if not, it isn't?

How to re-direct to another view controller if user's Facebook session is valid?

I'm looking to check to see if a user's Facebook session is valid and if it is then redirect them to a certain view controller.

 if ([facebook isSessionValid]) {


I was wondering how I'd go about doing this. I'm using a Storyboard in an ARC enabled app.

thanks for any help

Choosing a solr/lucene commit strategy

I have 120k db records to commit into a Solr index.

My question is:
should I commit after submitting every 10k records, or only commit once after submitting all the 120k records?

Is there any difference between these two options?

Excluding elements contained within another element with CSS or XPath

Here's a chunk of XML:

<section class="ignored">

It's easy enough to select all elements, or all elements inside a section.ignored:

=> "goodbad"
@doc.css('section.ignored element').text
=> "bad"

But how do I select all elements that are not inside section.ignored? This doesn't work:

@doc.css('section:not(.ignored) element').text
=> "goodbad"

...because that actually means "all elements that are contained in any section that is not ignored", including the top-level section that wraps everything else!

Additional twist: unlike the simplified sample above, the real XML I have to deal with is nested to arbitrary depth, including sections within the ignored section(s).

And yes, I could just substract the bad array from the full array in Ruby and call it a day, but I'd prefer a pure CSS solution (or, if you must, XPath) if possible.

orient a circle under an object?

I would like to orient a 2D circle underneath or aligned a 3D Object as it appears that the circle is a base to the to hemisphere.
Kindly find the attached picture for more clarification.
enter image description here

I use the following code that gives wrong orientation.

Quatf q;
Vec3f dir = m_tentacle[0]->geNodesPos()[0] - m_tentacle[0]->geNodesPos()[8];





Vec3f axis = q.getAxis();
float angle = q.getAngle();
Quatf incQuat(dir,angle);


String was not recognized as a valid DateTime

I want to add a date in session (date1) like this:

Session["DateLesson"] = date1.ToString("dd.MM.yyyy");

Now from the session I want take this value:

var asd = Session["DateLesson"];
/*asd = "20.04.2012"*/
var datelesson = DateTime.Parse((string) asd);

And it gives me this exception:

FormatException not recognized as a valid DateTime