Saturday, 31 August 2013

arrays does not null from beginning

arrays does not null from beginning

I'm a beginner in C .... I have a little code:
#include <stdio.h>
#include <string.h>
int main(){
char str1[100];
char str2[100];
char str3[100];
char str4[100];
puts(str1)
puts(str2);
puts(str3);
puts(str4);
return 0;
}
I got result
2
èý(
'Q]wØ„ÃîþÿÿÿÀ"bwd&bw
I don't know why my array does not empty from the begin. And I have to set
first element to "\0" to clear content of array. Can anyone explain for
me. Thank a lot.

Whyisn't my flexslider working? [on hold]

Whyisn't my flexslider working? [on hold]

Take a look and let me know. Yeah yeah they're kittens.
http://shopmoonfall.bigcartel.com/

ExtJS Panel item listener of click event only fires once

ExtJS Panel item listener of click event only fires once

the select listener is only firing once.Than returns and appended property
of firing: false on the second click. How can I prevent this from
happening?
xtype: 'combo',
store: ds,
displayField: 'title',
typeAhead: false,
hideLabel: true,
hideTrigger:true,
anchor: '100%',
minChars: 1,
listConfig: {
loadingText: 'Searching...',
emptyText: 'No matching buildings found.',
// Custom rendering template for each item
getInnerTpl: function() {
return '<div class="search-item">{name}</div>';
}
},
pageSize: 10,
// override default onSelect to do redirect
listeners: {
'select': function(combo, selection) {
console.log('you there?');
var building = selection[0];
if (building) {
retrieveBuildingInfo(Ext.String.format(env_url +
'building.php?id={0}', building.get('id')));
}
},
'expand': function() {
Ext.Msg.alert("test","do you see me");// this
alert never show, when the combo expanded
console.log(this.events.select);
}
}

Different text color for each class object?

Different text color for each class object?

I'm making some kind of "game score tracker". Here's how the app currently
works:
User adds players by typing a name into EditText and then clicking ok button.
After the user finished adding new players, he presses "start game" button
and a new activity opens.
Players are added to Parcelable extra and taken to the next activity.
In the next activity, a user has a spinner, EditText and +, - buttons.
After the user selects a certain player from the spinner, types in a
certain score and then either a + or -, a new TextView will appear
containing Player name and score.
Example: If there are 3 Players "James, John and Robert". The user then
adds 5 points to James, 10 points to John and 15 points to Robert. This is
how TextViews will look like:
James 5
John 10
Robert 15
Then if user will do the exactly same thing again, this will happen:
James 5
John 10
Robert 15
James 10
John 20
Robert 30
So as you can see, I don't keep the same TextView for each player but I
keep adding them (I do want that, I want the user to be able to see his
actions, when he clicked - and when +. But is there a way to somehow set a
color for each user? Example: James will be blue, John will be red and
Robert will be green. How do I pre-determine the color of each Player's
TextView?
Player class:
public static class Player implements Parcelable{
String name;
int score;
@Override
public int describeContents() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(score);
dest.writeString(name);
}
public Player(Parcel source){
score = source.readInt();
name = source.readString();
}
public Player(){
}
public static final Parcelable.Creator<Player> CREATOR = new
Parcelable.Creator<Novaigra.Player>() {
@Override
public Player createFromParcel(Parcel source) {
return new Player(source);
}
@Override
public Player[] newArray(int size) {
return new Player[size];
}
};
}
Can I add some kind of color palette to the activity when players are
being added so that a user can pre-determine a color or something?

Ember.js pushState router takeover Laravel route

Ember.js pushState router takeover Laravel route

I'm developing a Laravel/Ember.js app where Laravel serves a general role
of a backend framework and RESTful data supplier and Ember.js partially
for the client side.
So far it works fine. However I want Ember.js to take control for some of
the sub-urls.
Say I have /members route in Laravel which serves Ember app and I want
sub-consequent URL to take advantage of pushState w/ Ember like so:
/members/add, /members/edit/1 etc.. instead of /members#/add,
/members#/edit/1
With Ember this is easily achieved:
App.Router.reopen({
location: 'history', //instead of 'hash'
rootURL: '/members'
})
and it works fine when I click on the links.
However, when I refresh the page Laravel router kicks in with .htaccess
which tries to serve every url through laravel's index.php in public
folder. Here's Laravel original .htaccess file:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I'm no expert in Apache URL rewriting, so what I need to do is tell
.htaccess to rewrite everything that follows /members (/members/add,
/members/view etc..) back to /members route so Ember.js would take over
and redirect appropriately.
I was trying to do something like this, but it didn't work:
<IfModule mod_rewrite.c>
Options -MultiViews
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_URI} /members
RewriteRule (.*) members
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Any help on this topic of url rewriting is appreciated. Thanks!

model definition debug in django

model definition debug in django

my model definition is below,when I run python manage.py sql
application,it comes nothing. my application name is application. when I
change the models' content to the tutorial
https://docs.djangoproject.com/en/1.5/intro/tutorial01/ ,it comes the
right sql sentence,so it must some error in the models below,can anyone
point it out?
class Applicationinfo(models.Model):
applicationinfo_id = models.BigIntegerField(primary_key=True,
db_column='ApplicationInfo_id') # Field name made lowercase.
mainproduct = models.CharField(max_length=300,
db_column='MainProduct') # Field name made lowercase.
subproduct = models.CharField(max_length=300, db_column='SubProduct')
# Field name made lowercase.
appname = models.CharField(max_length=300, db_column='AppName') #
Field name made lowercase.
employee = models.CharField(max_length=48, db_column='Employee') #
Field name made lowercase.
employeeid = models.CharField(max_length=24, db_column='Employeeid') #
Field name made lowercase.
applicantmail = models.CharField(max_length=90,
db_column='applicantMail') # Field name made lowercase.
mailnotifytimes = models.IntegerField(db_column='MailNotifyTimes') #
Field name made lowercase.
applicantim = models.CharField(max_length=48, db_column='ApplicantIM')
# Field name made lowercase.
applicantmobilephone = models.CharField(max_length=33,
db_column='ApplicantMobilephone') # Field name made lowercase.
messagenotifytimes =
models.IntegerField(db_column='MessageNotifyTimes') # Field name made
lowercase.
applicantdpt = models.CharField(max_length=300,
db_column='ApplicantDPT') # Field name made lowercase.
applicationdate = models.DateTimeField(db_column='ApplicationDate') #
Field name made lowercase.
onlinestorid = models.CharField(max_length=30,
db_column='OnlineStorID') # Field name made lowercase.
appid = models.BigIntegerField(unique=True, db_column='AppID') # Field
name made lowercase.
tapesavecopies = models.IntegerField(null=True,
db_column='TapeSaveCopies', blank=True) # Field name made lowercase.
appowner = models.CharField(max_length=48, db_column='AppOwner',
blank=True) # Field name made lowercase.
appownermail = models.CharField(max_length=96,
db_column='AppOwnerMail', blank=True) # Field name made lowercase.
subproductowner = models.CharField(max_length=48,
db_column='SubProductOwner', blank=True) # Field name made lowercase.
subproductownermail = models.CharField(max_length=96,
db_column='SubProductOwnerMail', blank=True) # Field name made
lowercase.
mainproductowner = models.CharField(max_length=48,
db_column='MainProductOwner', blank=True) # Field name made lowercase.
mainproductownermail = models.CharField(max_length=96,
db_column='MainProductOwnerMail', blank=True) # Field name made
lowercase.
applicationreason = models.CharField(max_length=500,
db_column='ApplicationReason', blank=True)
filetype = models.BooleanField(db_column='FileType')
applicationstatus = models.IntegerField(db_column='ApplicationStatus')
class Meta:
db_table = 'applicationinfo'
app_label = 'backupcenter1'

Friday, 30 August 2013

What's the deal with catching exceptions?

What's the deal with catching exceptions?

So I've read a lot about catching exceptions. Let's talk about this and
iOS together. I've used it with Google Analytics to submit information
about the crash and using that to fix bugs.
But this raises a question. Can catching these exceptions help prevent
apps from crashing. Can you theoretically prevent that bit of code from
crashing the app and keep the app open. Now I get the fact that it would
probably be impossible to do if there was no memory to be used but it
would still be nice to know about.
Sorry if this sounds like a stupid questions and I really should read more
about it and do some more research. Any information would be helpful.
I do have a fairly decent knowledge of iOS obj-c for my age and am willing
to look into what you have to say.
Thanks!

Thursday, 29 August 2013

Ho to check if php session is valid?

Ho to check if php session is valid?

I'm using Zend framework 1.12 and I've been built a web app where the
users has to be logging in order to do tasks.
All the task are made through json calls to functions in php modules.
The problem it's when the session has expired and the user wants to
execute a task, the response from the JSON it's the login page and the
response code it's 200.
There is a way to check if the session it's expired?
In the controller of user validation I've:
if ($User->isValid()) {
$this->_redirect(base64_decode($this->redirect));
} else {
return $this->render('logging');
}
Can you help me?
Thanks

Is there standard format for represent date/time in URIs?

Is there standard format for represent date/time in URIs?

I am building an API endpoint that accepts DateTime as a parameter.
So far I have considered two formats:
A) Exclamation mark as minute delimiter:
http://api.example.com/resource/2013-08-29T12!15
Looks unnatural and even with clear documentation, API consumers are bound
to make mistakes.
B) URI segment per DateTime part:
http://api.example.com/resource/2013/08/29/12/15
Looks unreadable. Also, once I add further numeric parameters - it will
become incomprehensible!
Is there standard/convention for for representing date/time in URIs?

Wednesday, 28 August 2013

What is a good way to pause a thread?

What is a good way to pause a thread?

I'm creating a java 2D platformer game, and I'm having a little trouble
getting an animation to go through when the player dies. When the player
dies, all enemies are removed and an explosion animation is played where
they used to be. At the same time, the player begins to blink. I want that
to go on for about two seconds, and then have my setState() method switch
to the "PlayerDeadState", which is basically the retry or return to main
menu option screen. I've used Thread.sleep(), but it doesn't work, and
I've heard it's bad for GUI threads. Here is my code: public void update()
{ // check if player is dead if(player.dead == true) {
player.flinching = true;
for(int i = 0; i < enemies.size(); i++) {
Enemy e = enemies.get(i);
e.update();
e.hit(200);
if(e.isDead()) {
enemies.remove(i);
i--;
eExplosions.add(
new Explosion(e.getx(), e.gety()));
}
}
gsm.setState(3);
}
}
The animations go through if I comment out my setState() method.
Any suggestions?

How to create ArrayList properly?

How to create ArrayList properly?

Below are two ways how to create ArrayList:
List<String/*or other object*/> arrList = new ArrayList();//Imports List,
ArrayList
ArrayList<String/*or other object*/> arrList = new ArrayList();//Imports
just ArrayList
What is the difference? Which method should be used?

GIMP does not see Windows fonts

GIMP does not see Windows fonts

I have downloaded some fonts and installed them by double-clicking to open
them, then clicking "Install font". Word and other Windows programs can
see them, but GIMP does not list them in the text tool. Why is this?
These are TrueType fonts (packaged in .ttf files). I'm using Gimp 2.8.2

On asp.net formview, when are the ModeChanged and ModeChanging events raised?

On asp.net formview, when are the ModeChanged and ModeChanging events raised?

This popped up, when I was trying to find why the OnModeChanging handler
wasnt being called when I called the ChangeMode event of my formview.
On the msdn page about the formview's ChangeMode method, it says that it
"switches the FormView control to the specified data-entry mode" but also
that "the ModeChanged and ModeChanging events are not raised when this
method is called.". And in the pages about ModeChanged and ModeChanging
events, it says that they occur "when the FormView control switches
between edit, insert, and read-only mode" (after/before the mode changes,
respectively).
This got me confused! Can you explain it to me: when are the
ModeChanged/ing events raised? And, is there a way to force these events
to be raised? I wasnt able to find a explanation about this..
Thank you!

copy char* array in local variable

copy char* array in local variable

C++ newbie.
I have following class and its argument is char* which is array of
strings, How do I copy that to member variable char* ? After that I need
to know the size of array ?
class TestParam {
public:
char*[] arr;
TestParam (const char* Pre, char* Post[]){
arr = Post;
}
};

Tuesday, 27 August 2013

Div color does not render properly

Div color does not render properly

I have used few divs to organize my page, but the problem is in the div
that acts like a footer. It has the same color property as the header
#1D0870 ( dark blue ), but is not displaying it property.
The color in the footer is little bit lighter that it really should be. I
have tried with overflow:auto and hidden and clear:both CSS properties but
still no luck.
#footer {
position: relative;
margin-top: -150px; /* negative value of footer height */
height: 150px;
clear:both;
background-color:#1D0870;
width: 98.5%;}
Full code: http://jsfiddle.net/sR87v/2/

AngularJS app not rendering properly in IE 8 for multiple reasons

AngularJS app not rendering properly in IE 8 for multiple reasons

I have been working on a portfolio site called maxmythic.com using
AngularJS and have managed to get it to show up good in everything but IE
8 and 7 (I'm not even bothering with IE 6). I even added all the IE8
AngularJS fixes found http://docs.angularjs.org/guide/ie and
http://henriquat.re/appendix/angularjs-and-ie8/necessary-changes-for-ie8-compatibility.html
I thought those fixes would make it work but its seems like nothing
changed.
At http://maxmythic.com/ and http://maxmythic.com/design, a 3 x 6 grid of
'design tile' divs (with titles and background images) are supposed to
display. It gets created by ng-repeat in the Angular view called
design.html
<section ng-controller="MainCtrl" class="main">
<a href="#" ng-repeat="tile in designTiles" ng-href="">
<div ng-mouseenter="blankBar='blueBar'" ng-mouseleave="blankBar =
'blankBar'" class="tile-info">
<div class="blankBar" ng-class="blankBar"></div>
<h3 class="tile_title">{{tile.title}}</h3>
</div>
</a>
</section>
In IE 8, ngRepeat will seem to overwrite each design tile div with the
next design tile div in the order they appear in my designTile object list
angular.module('maxmythicApp')
.controller('MainCtrl', function ($scope) {
$scope.designTiles = [
{
url : '/design/vance-and-gary-unhinged',
bgImageClass : 'vance-and-gary-unhinged',
title : 'Vance & Gary Unhinged',
// use : 'Album Art'
},
{
url : '/design/dam-funk',
bgImageClass : 'dam-funk',
title : 'Dam-Funk',
// use : 'Logo'
},
.....
.....
.....
{
url : '/design/various-sketches',
bgImageClass : 'various-sketches',
title : 'Various Sketches',
// use : 'Logo'
},
{
url : '/design/maxmythic-dot-com',
bgImageClass : 'maxmythic-dot-com',
title : 'maxmythic.com',
// use : 'Logo'
},
];
});
As the page is loading, I can see the first one appear but, as soon as it
appears, it gets replaced by the next one. Only one design tile div is
ever seen at one time and ultimately the last design tile equates to the
last object in the the designTile list which is:
{
url : '/design/maxmythic-dot-com',
bgImageClass : 'maxmythic-dot-com',
title : 'maxmythic.com',
},
If I look into IE's developer tools HTML tab I see what seems to be a
messed up out of order DOM and look, you can see all the 18 design tile
divs displayed there. It all looks like this

So none of the design tiles show up there but if I look at the original
source it looks totally different. In fact, the <section> element that
contains the list of design tile divs does not even appear.
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js"> <![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>/\/\/\</title>
<meta name="fragment" content="!">
<meta name="description" content="Max Mythic : Designer & Front-end
Developer">
<link rel="apple-touch-icon" href="apple-touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72"
href="apple-touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="114x114"
href="apple-touch-icon-iphone4.png">
<link rel="apple-touch-icon" sizes="144x144"
href="apple-touch-icon-retina.png">
<link href="favicon_32x32.ico" rel="icon">
<!--[if IE]><link rel="shortcut icon"
href="mm_favicon_32x32.ico"><![endif]-->
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage"
content="apple-touch-icon-retina.png">
<meta name="viewport" content="width=device-width">
<base href="/">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="styles/aff564d2.main.css">
</head>
<body id="ng-app" ng-app="maxmythicApp">
<div id="page">
<header>
<h1 class="logo">
Max Mythic : Designer, Illustrator & Developer
<a href="/">
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 97
27.623"><path d="M97 27.623h-3.73c-3.687
0-6.687-4.524-8.917-13.448C82.29 5.9 79.8 3 78.3 3c-1.481
0-3.943 2.927-6.006 11.2 c-2.23 8.923-5.23 13.448-8.916
13.448s-6.687-4.524-8.918-13.448C52.444 5.9 50 3 48.5 3c-1.482
0-3.944 2.927-6.006 11.2 c-2.23 8.923-5.23 13.448-8.917
13.448s-6.686-4.524-8.916-13.448C22.598 5.9 20.1 3 18.7
3s-3.944 2.927-6.006 11.2 c-2.23 8.923-5.23 13.448-8.917
13.448H0v-3h3.73c1.482 0 3.945-2.927 6.007-11.175C11.968 4.5
15 0 18.7 0 s6.686 4.5 8.9 13.448c2.062 8.2 4.5 11.2 6
11.175c1.482 0 3.945-2.927 6.007-11.175C41.814 4.5 44.8 0 48.5
0 c3.687 0 6.7 4.5 8.9 13.448c2.063 8.2 4.5 11.2 6
11.175c1.481 0 3.943-2.927 6.006-11.175 C71.66 4.5 74.7 0 78.3
0c3.687 0 6.7 4.5 8.9 13.448c2.063 8.2 4.5 11.2 6
11.175H97V27.623z"></svg>
</a>
</h1>
<nav class="pagenav" role="navigation">
<ul>
<li>
<a href="/design">
design
</a>
</li>
<li>
<a href="/about">
about
</a>
</li>
<li>
<a href="/contact">
contact
</a>
</li>
</ul>
</nav>
<!-- <div class="navicon">Nav Icon</div> -->
</header>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an outdated browser. <a
href="http://browsehappy.com/">Upgrade your browser today</a> or <a
href="http://www.google.com/chromeframe/?redirect=true">install
Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->
<!--[if lt IE 9]>
<script src="components/es5-shim/es5-shim.js"></script>
<script src="components/json3/lib/json3.min.js"></script>
<![endif]-->
<!-- Add your site or application content here -->
<div class="container" ng-view=""></div>
<div id="layout_footer"></div>
</div>
<footer role="footer" id="footer">
<ul>
<li>
<a class="icon" target="_blank"
href="https://www.facebook.com/maxmythic">
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30
30"><path
d="M13.359,14.948H9.168c0,6.7,0,14.949,0,14.949H2.955c0,0,0-8.165,0-14.949H0V9.671h2.955V6.25
c0-2.448,1.162-6.269,6.271-6.269L13.827,0v5.126c0,0-2.798,0-3.34,0c-0.545,0-1.317,0.271-1.317,1.437v3.109h4.736L13.359,14.948z"></svg>
</a>
</li>
<li>
<a class="icon" target="_blank"
href="https://twitter.com/maxmythic">
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30.246
24.584"><path d="M27.149 6.125c0.015 0.3 0 0.5 0 0.803c0
8.201-6.242 17.656-17.657 17.656c-3.504
0-6.768-1.027-9.513-2.787 c0.484 0.1 1 0.1 1.5 0.086c2.908 0
5.584-0.992 7.707-2.656c-2.715-0.051-5.006-1.846-5.796-4.311
c0.378 0.1 0.8 0.1 1.2 0.109c0.566 0 1.114-0.072
1.635-0.217c-2.84-0.568-4.979-3.08-4.979-6.084 c0-0.025
0-0.053 0.001-0.08C2.05 9.1 3 9.4 4 9.422C2.358 8.3 1.3 6.4
1.3 4.3 c0-1.137 0.306-2.204 0.84-3.12C5.166 4.9 9.7 7.4 14.9
7.619c-0.104-0.453-0.161-0.93-0.161-1.414 C14.734 2.8 17.5 0
20.9 0c1.785 0 3.4 0.8 4.5 1.959c1.414-0.277 2.742-0.795
3.94-1.506 c-0.465 1.449-1.446 2.666-2.729 3.433c1.258-0.149
2.453-0.483 3.565-0.977C29.417 4.2 28.4 5.2 27.1
6.125z"></svg>
</a>
</li>
<li>
<a class="icon" target="_blank"
href="https://plus.google.com/113556551990494099731">
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 28.939
29.768"><path d="M15.263
16.994l-1.396-1.084c-0.426-0.354-1.007-0.818-1.007-1.67c0-0.855
0.581-1.399 1.086-1.903 c1.626-1.28 3.251-2.642
3.251-5.513c0-2.952-1.856-4.504-2.748-5.241h2.4L19.368
0h-7.633c-2.094 0-5.111 0.496-7.32 2.3 c-1.666 1.437-2.479
3.418-2.479 5.2c0 3 2.3 6.1 6.4 6.098c0.389 0 0.813-0.038
1.238-0.078 c-0.191 0.466-0.386 0.854-0.386 1.515c0 1.2 0.6
1.9 1.2 2.637c-1.744 0.121-5 0.314-7.4 1.8 C0.694 20.8 0 22.8
0 24.215c0 2.9 2.7 5.6 8.3 5.553c6.662 0 10.189-3.688
10.189-7.336 C18.517 19.8 17 18.4 15.3 16.994z M10.188
12.529c-3.333 0-4.843-4.31-4.843-6.908c0-1.012 0.19-2.058
0.851-2.874 C6.818 2 7.9 1.5 8.9 1.465c3.214 0 4.9 4.3 4.9
7.143c0 0.7-0.077 1.939-0.969 2.8 C12.198 12.1 11.2 12.5 10.2
12.529z M10.227 28.14c-4.145 0-6.817-1.981-6.817-4.74c0-2.756
2.479-3.688 3.331-3.995 c1.626-0.548 3.72-0.623
4.067-0.623c0.388 0 0.6 0 0.9 0.039c2.946 2.1 4.2 3.1 4.2 5.1
C15.923 26.3 13.9 28.1 10.2 28.14z"><polygon points="25,12.5
25,8.6 23.1,8.6 23.1,12.5 19.3,12.5 19.3,14.4 23.1,14.4
23.1,18.3 25,18.3 25,14.4 28.9,14.4 28.9,12.5"></svg>
</a>
</li>
<li class="madeby">
<p>Made by</p>
<svg class="maxmythic" xmlns="http://www.w3.org/2000/svg"
viewbox="0 0 97
27.623"><style>.style0{fill:#666666;}</style><path d="M97
27.623h-3.73c-3.687 0-6.687-4.524-8.917-13.448C82.29 5.9 79.8 3
78.3 3c-1.481 0-3.943 2.927-6.006 11.2 c-2.23 8.923-5.23
13.448-8.916 13.448s-6.687-4.524-8.918-13.448C52.444 5.9 50 3
48.5 3c-1.482 0-3.944 2.927-6.006 11.2 c-2.23 8.923-5.23
13.448-8.917 13.448s-6.686-4.524-8.916-13.448C22.598 5.9 20.1 3
18.7 3s-3.944 2.927-6.006 11.2 c-2.23 8.923-5.23 13.448-8.917
13.448H0v-3h3.73c1.482 0 3.945-2.927 6.007-11.175C11.968 4.5 15
0 18.7 0 s6.686 4.5 8.9 13.448c2.062 8.2 4.5 11.2 6 11.175c1.482
0 3.945-2.927 6.007-11.175C41.814 4.5 44.8 0 48.5 0 c3.687 0 6.7
4.5 8.9 13.448c2.063 8.2 4.5 11.2 6 11.175c1.481 0 3.943-2.927
6.006-11.175 C71.66 4.5 74.7 0 78.3 0c3.687 0 6.7 4.5 8.9
13.448c2.063 8.2 4.5 11.2 6 11.175H97V27.623z"
class="style0"></svg>
</li>
</ul>
</footer>
<script
src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script src="scripts/cdf6190d.scripts.js"></script>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
var _gaq=[['_setAccount','UA-37437533-1'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
</body>
</html>
Additionally, IE 8 throws the following error
TypeError: Unable to get value of the property 'childNodes': object is
null or undefinedundefined
Another funny thing is that if I enter http://maxmythic.com into the
address bar, IE8 will add a # (hashtag) turning that original URL into
http://maxmythic.com/#/. This screws up the pretty URL structure I had
going with HTML5 mode.
On top of all of that 98% of my CSS is not being applied to the html.
Maybe that is a separate question all together but I thought I'd mention
it just in case anyone had run into all of these issues before and had a
solution.
All of the site's files can be viewed at my gh-pages repo here
https://github.com/siddhion/maxmythic/tree/gh-pages
Any ideas on what is going on here and how to solve it?

didreceivememorywarnings message sent to deallocated instance

didreceivememorywarnings message sent to deallocated instance

In my app if I have a view that has been deallocated (via modal dismiss or
navigation stack pop) and I get a memory warning after that, my app
crashes.
I've tested by putting a modal create/dismiss very early on in my app that
looks like this:
WWebViewController *webViewController = [[WWebViewController alloc]
initWithPath:@"http://www.google.com"];
[webViewController setIsModal:YES];
WMainNavController *navController = [[WMainNavController alloc]
initWithRootViewController:webViewController];
[self presentViewController:navController animated:YES
completion:nil];
The web view is pretty simple:
- (void)viewDidLoad
{
[super viewDidLoad];
[self setNavigationDefaultsWithTitle:@"Loading..." withBackButton:YES
withSearchButton:YES deepLinked:false];
webView = [[UIWebView alloc] initWithFrame:[self.view bounds]];
webView.delegate = self;
[self.view addSubview:webView];
[webView scalesPageToFit];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL
URLWithString:self.path]]];
[self showNoConnectionImageIfNecessary:NO];
// Do any additional setup after loading the view.
}
...
- (void)dealloc {
[webView loadHTMLString:@"" baseURL:nil];
[webView stopLoading];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[webView setDelegate:nil];
webView = nil;
}
However, simply presenting and then dismissing this view followed by
simulating a memory warning gives this:
*** -[WMainNavController retain]: message sent to deallocated instance
0xba953c0
I've tried this by calling WWebViewController directly without
WMainNavController, tried by using a regular navigation controller, tried
simply pushing something to a nav stack. It always crashes if I have
popped or dismissed a view anywhere in the app.
Am I doing something fundamentally wrong? If I progress through the app
without dismissing/popping it handles memory warnings fine, and there is
only one screen before this which presents this screen as a modal and is
the root view of the program.
I'll provide any extra information needed, has anybody seen something like
this?
Edit -- This is an ARC implementation.

Trouble "overriding" values in a Groovy closure with .delegate

Trouble "overriding" values in a Groovy closure with .delegate

I'd like to call a closure with a delegate parameter to override or shadow
the calling context. But the following example prints prints "outside"
where I expect "inside".
What am I doing wrong?
def f(String a){
def v = { return a }
v.delegate = [a:"inside"]
// Makes no difference:
// v.resolveStrategy = Closure.DELEGATE_FIRST
println(v.call())
}
f("outside")

Scala String to Java Util Date Conversion

Scala String to Java Util Date Conversion

Hi the Conversion of String to Date is not possible here..
I search and use several methods but the error can not change..
here the date format is var q and convert that to formatedDate that is String
then the String convert into util date..
SearchDate is from method parameter and the value of SearchDate is "Thu
Aug 29 00:00:00 IST 2013"
var q: Date = SearchDate
var dateStr = q.toString()
var formatter: DateFormat = new SimpleDateFormat("E MMM dd HH:mm:ss Z
yyyy")
var dat = formatter.parse(dateStr)
var cal: Calendar = Calendar.getInstance()
cal.setTime(dat)
var formatedDate = cal.get(Calendar.DATE) + "-" +
(cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.YEAR)
println("formatedDate : " + formatedDate)
val date = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(dateStr)//
Error Occured Here..
the error is
Exception in thread "main" java.text.ParseException: Unparseable date:
"Thu Aug 29 00:00:00 IST 2013" at java.text.DateFormat.parse(Unknown
Source)
please share your answers ..

Regular Expression to Allow Only Numbers

Regular Expression to Allow Only Numbers

i want to give validation condition like,
var BlkAccountIdV = $('#txtBlkAccountId').val();
if (BlkAccountIdV == "") {
document.getElementById('lblAccountId').innerText = "Enter Valid
AccountID";
errorflag=1;
}
if condition should be Executed only when entered text box value contains
Letter.What value can i give inside Quotation marks(if (BlkAccountIdV ==
"") )?

Monday, 26 August 2013

Displaying a list of entries satisfying a condition from database to a jsp

Displaying a list of entries satisfying a condition from database to a jsp

I have a jsp page, a javabean and a servlet connecting to a database.
I wish to print all the rows satisfying a particular query in the form of
a table in the jsp page.
When i execute the code, i get only the last row satisfying the
conditions. I guess all the previous rows are overwritten. How can i print
all the required rows in table format? I am new to java so i am not
familiar with all the functionalities. The code i have written is given
below.
JSP Page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="ASB" class="project.bank.web.AccountSummaryBean"
scope="session" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Account Summary</title>
</head>
<body>
<form action="AccountSummary" method="post">
<table>
<tr>
<td>Customer ID:
<%=request.getSession().getAttribute("custID_user")
%></td>
<th><jsp:setProperty property="custID" name="ASB"
value="<%=request.getSession().getAttribute(\"custID_user\")
%>"/>
</tr>
</table>
-------------------------------------------------------------------------------
Servlet:
-------------------------------------------------------------------------------
package project.bank.web;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class AccountSummary extends HttpServlet {
Connection conn = null;
ResultSet rs = null;
PreparedStatement pst = null;
AccountSummaryBean asb = null;
public AccountSummary(AccountSummaryBean asb){
this();
this.asb = asb;
}
public AccountSummary() {
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("i am here");
conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/bankdb", "root", "root");
pst = conn
.prepareStatement("select * from custacc where
custID=(?)");
} catch (ClassNotFoundException e) {
System.out.println("Driver class not found in the classpath");
} catch (SQLException e) {
System.out.println(e);
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String custID = (String)
req.getSession().getAttribute("custID_user");
try {
int count = 0;
pst.setString(1, custID);
rs = pst.executeQuery();
HttpSession session = req.getSession(false);
while (rs.next()) {
session.setAttribute("accNo", rs.getString("accNo"));
count++;
}
RequestDispatcher rd = req
.getRequestDispatcher("/AccountSummaryPageScreen.jsp");
rd.forward(req, resp);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
-------------------------------------------------------------------------------------
Java Bean
-------------------------------------------------------------------------------------
package project.bank.web;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class AccountSummaryBean{
String custID;
String accNo;
String branch;
String balance;
int count=0;
Connection conn = null;
ResultSet rs = null;
PreparedStatement pst = null;
public AccountSummaryBean() {
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("i am here");
conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/bankdb", "root",
"root");
pst = conn
.prepareStatement("select * from custacc where
custID=(?)");
} catch (ClassNotFoundException e) {
System.out.println("Driver class not found in the
classpath");
} catch (SQLException e) {
System.out.println(e);
}
}
public void display(){
String custID = getCustID();
try{
pst.setString(1, custID);
rs = pst.executeQuery();
//HttpSession session = req.getSession(false);
while (rs.next()) {
rs.next();
//session.setAttribute("accNo", rs.getString("accNo"));
count++;
setAccNo(rs.getString("accNo"));
setBranch(rs.getString("branch"));
setBalance(rs.getString("balance"));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public String getCustID() {
return custID;
}
public void setCustID(String custID) {
this.custID = custID;
System.out.println("yoyo its working");
System.out.println("cust id is "+getCustID());
display();
}
public String getAccNo() {
return accNo;
//return "aabbccdd";
}
public void setAccNo(String accNo) {
this.accNo = accNo;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public String getBalance() {
return balance;
}
public void setBalance(String balance) {
this.balance = balance;
}
}
<table border="2" bgcolor="pink" width=300 height=50 align=center>
<tr>
<th>Account Number</th>
<th>Branch</th>
<th>Balance</th>
</tr>
<tr>
<th><jsp:getProperty property="accNo" name="ASB"/>
<th><jsp:getProperty property="branch" name="ASB"/></th>
<th><jsp:getProperty property="balance" name="ASB"/></th>
</tr>
</table>
<div align="center">
<br>
<a href="GenerateStatementScreen.jsp">Generate statement</a><br><br>
<a href="FundTransferHomepageScreen.jsp">Transfer Funds</a><br><br>
<a href="CheckCustID.jsp">Login Screen</a>
</div>

What are the circumstances where autovacuum can be disabled?

What are the circumstances where autovacuum can be disabled?

I have a table where I am performing only inserts, never deletes/updates.
I notice sometimes that autovacuum runs on this table, even though this is
the case.
autovacuum: VACUUM ANALYZE public.twitter_shares (to prevent wraparound)
It is taking a long time, and it is having an impact on the performance of
my DB. Is it safe for me to just disable autovacuum for this table? Since
I am not performing deletes/updates, I don't understand why autovacuum is
even needed, and why postgres decides to run it.

Dropping items "in place" on Mountain Lion desktop

Dropping items "in place" on Mountain Lion desktop

I run a multi-monitor setup at home with OS X ML as my main driver.
Sometimes for a task I need to be able to drag-and-drop items from a
folder to a particular spot on the desktop.
The problem here is that when I drag and drop an item on the desktop, it
doesn't fall where the cursor is. It automatically gets moved over to the
main monitor in the right column. And I have to drag it back where I want
it on the desktop. This is annoying.
How can I get osx to let me drop files precisely where the cursor is on
the desktop?

SQLite query not `ORDER BY` correctly

SQLite query not `ORDER BY` correctly

Here is my code:
// Get all gas fillup values in database
List<Gas> values = datasource.getAllGas();
Then
public List<Gas> getAllGas() {
List<Gas> gases = new ArrayList<Gas>();
Cursor cursor = database.query(MySQLiteHelper.TABLE_GAS, allColumns,
null, null, null, null, MySQLiteHelper.COLUMN_ID + " DESC");
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
Gas gas = cursorToGas(cursor);
gases.add(gas);
cursor.moveToNext();
}
cursor.close();
return gases;
}
As you see, I am ordering by " DESC"; though it continually orders as if I
put null here instead.

How to turn laptop onto wifi hotspot using USB Dongle internet

How to turn laptop onto wifi hotspot using USB Dongle internet

I use relience Netconnect dongle on my laptop i to share this internet
connection on my smartphone via wifi hotspot.i have installed 'intel my
wifi utility' software on loptop.But when i click on share my internet tab
,it show on internet connection.....

How to suppress "Name:" and underline in eqexam

How to suppress "Name:" and underline in eqexam

I want to write an exam without the Name bit in the upper right corner. I
only figured out how to change the text using \examNameLabel but not how
to suppress it altogether.

Notification redirecting to the last visible Activity

Notification redirecting to the last visible Activity

I have an App with some Activities, where MyActivity is the main, and I
use this code to show a Notification from a Service:
Intent intent = new Intent(this, MyActivity.class);
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
intent, 0);
/*
* Set up removteView
*/
mBuilder = new NotificationCompat.Builder(this)
.setContentIntent(pendingIntent);
mNotiMan = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
mNoti = mBuilder.build();
mNoti.flags = Notification.FLAG_NO_CLEAR;
mNotiMan.notify(NOTI_ID, mNoti);
The part of interest is the Intent and the PendingIntent. If I click the
Notification from the Homescreen or another App, I will be redirected to
the last visible Activity of my App.
I would expect that a click on the Notification would only redirect me to
MyActivity, starting it if it's actually not in the ActivityStack. But it
doesn't matter which Activity was the last visible one when I left the
App, I will be redirected to it. This is exactly what I need but I don't
know why this is possible.
Can someone please explain this to me?

Sunday, 25 August 2013

How to run asp.net 4.0 websites on asp.net 3.5.?

How to run asp.net 4.0 websites on asp.net 3.5.?

i have an application developed in 4.0 asp.net. and i want to make some
changes but i am using 3.5 asp.net.
is it possible? or i will have to download 4.0 version.
i modified the web config file according to 3.5 version........but it does
not work.

No warnings for that function int f() doesn't return any value?

No warnings for that function int f() doesn't return any value?

struct A
{
int f()
{} // Notice here!
};
int main()
{
A a;
a = a;
}
My compiler is the latest VC++ compiler (Visual Studio 2013 Preview)
The function A::f doesn't return any value; but no compiler warnings or
errors! Why?

PHP free file content analyzer library / function

PHP free file content analyzer library / function

I was wondering if you know about any good and accurate PHP library or
file I can include in my script in order to analyse the content of X file
and then check if it is an especific type like .doc, .docx .jpg, etc.
I know PHP offers a big number of libraries that we could use to check
them, but they're not that accurate at all, some just checks the file
extension or the file header (they don't even know if the file is broken
or not)
What I request is for something very accurate, simple and faster (probably
I'm requesting too much) but any link or suggestion will be accepted and
appreciated, Thank you!

Problems updating HP laptop graphics driver

Problems updating HP laptop graphics driver

So since I installed 64 bit Windows 7 on my HP laptop I have problem
finding updated drivers for my graphics card. The only driver that works
is the old driver I found on HP website
My laptop has Radeon 7470M and Intel 3000.
Every time I want to install a newer beta driver my laptop boots in
1024x768 resolution so it simply doesn't work.
I did uninstall the old driver before I installed the new one but it still
doesn't work.
I saw something about this saying that you have replace old installer with
new one or something like that. Can you tell me how?

Access 2013 on SharePoint 2013 Online - Wow and Duh?

Access 2013 on SharePoint 2013 Online - Wow and Duh?

Very long time since I even look at Access.. but on SPO, with a database
on Azure it seems really nice ... wondering tho..
Any way to remove that left pane with the Databases from the UI?
Set a list button to go to a URL formatted using selected column fields in
the row?
Join in oData datasource like SharePoint Online List?
Any file upload control and upload to a sharePoint Library? A way to add
metadata to a file and do some validation - like does file exist with this
metadata. Dynamically rename files to some unique string.
Perform complex field validation
Secure the application and database to SharePoint groups.
What's the business language of choice? Not clear on how to edit and save
macros. Can it make calls to webservices?
Any way to change that obsure url you get for the App in SharePoint 2013
Online?

Saturday, 24 August 2013

First ever script (Python) - feedback appreciated

First ever script (Python) - feedback appreciated

I have just managed to get my first ever script written, in any language
(apart from 'hello world', and other practise scripts!). I've only
self-taught, so I'm sure I've broken many rules, and gone about things in
an inefficient way, so feel free to be critical and suggest how I could
have done it better. It basically does what I want it to do, but the only
unresolved problem I have is that the output.xlsx file has written every
value as [u'Value], and I can't figure out how to write it simply as
Value. Also...I downloaded pyscripter and at the top was:
def main():
pass
if __name__ == '__main__':
main()
and I had no idea what I was supposed to do with that...so I just wrote
below it. Am I supposed to write inside it? Here is my working code...have
at it, and probably have laugh at the same time, at how I've done it! I
really appreciate it...
'''grab the file and declare some variables'''
import xlrd, os.path
data_folder = r"C:\users\hopkinsj\desktop\Python Projects\wus"
filename = r"original.xlsx"
workbook = xlrd.open_workbook(os.path.join(data_folder,filename))
sheet = workbook.sheet_by_index(0)
r = sheet.nrows
i = 1
employees = {}
'''import the employees into the employees dictionary'''
while i < r:
hrid = sheet.row_values(i,0,1)
name = sheet.row_values(i,1,2)
wuid = sheet.row_values(i,2,3)
wuname = sheet.row_values(i,3,4)
wum = sheet.row_values(i,4,5)
parentwuid = sheet.row_values(i,5,6)
employees[i] = hrid, name, wuid, wuname, wum, parentwuid
i += 1
'''put the unique workunits (wuids) as keys in a dictionary, and include
some values.
Where there's' more than one employee assigned to the same wuid, append their
name to the list of names for the given work unit'''
workunits = {}
for k, v in employees.iteritems():
if str(v[2]) not in workunits.keys():
print "Adding to %s to the list of Work Units" % (v[2])
workunits[str(v[2])] = v[3], v[4], v[5], [v[1]]
else:
workunits[str(v[2])][3].append(v[1])
'''put the keys and values of work units dictionary into an excel file'''
import xlwt
output = xlwt.Workbook()
outputsheet = output.add_sheet("output data")
r = 1
for k in workunits:
c = 0
outputsheet.write(r,0,[k])
for val in workunits[k]:
outputsheet.write(r,c+1,str(workunits[k][c]))
c += 1
r += 1
output.save('output.xls')

Custom Widget Not Saving Values to Database

Custom Widget Not Saving Values to Database

I'm trying to create a widget that will allow you to pick a CTA and a
Landing Page from two separate drop down menus. The drop downs are
populated based on two custom post types which is working fine. My problem
is that I can't figure out how to save the values to teh database (i.e.,
clicking save on the widget in the admin doesn't commit the values to the
database.
Here are the relevant functions from my widget class called cta_widget. (I
left out the code for the 2nd dropdown as it's identical).
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
/* Strip tags (if needed) and update the widget settings. */
$instance['cta_id'] = $new_instance['cta_id'];
$instance['url_id'] = $new_instance['url_id'];
return $instance;
}
function form( $instance ) {
/* Set up some default widget settings. */
$defaults = array( 'cta_id' => '23', 'url_id' => '28');
$instance = wp_parse_args( (array) $instance, $defaults );
?>
<p>
<label for="<?php echo $this->get_field_name( 'cta_id' );
?>"><?php _e( 'CTA:' ); ?></label>
<select name="<?php echo $this->get_field_name( 'cta_id' );
?>" id="cta_id<?php echo $this->get_field_name( 'cta_id' );
?>" style="width:100%;">
<option value=""></option>
<?php
$posts = get_posts(
array(
'post_type' => 'locable_ctas',
'numberposts' => -1
)
);
if($posts)
{
foreach( $posts as $p )
{
if ($p==$selected)
{
$selected = "selected = 'selected'";
}
else
{
$selected = "";
}
echo '<option value="' . $p->ID . '" '.$selected.'>'
.$p->post_title . '</option>';
}
}
?>
</select>
</p>
}

Finding the exact path of the file

Finding the exact path of the file

I am using the fileUpload control. When I upload the file, I want to find
the exact location of the file.
I tried using
string fname= Server.MapPath(FileUpload2.FileName);
string fname= FileUpload2.FileName;
string fname= FileUpload2.PostedFile.FileName;
2,#3 gave me the name of the file, #1 gave me the the path of my website
location.
I do not know what is the difference between 2 and 3, why both gave me
same results.
I read somewhere, that you cannot get the path. Is it true ? If not, what
code should I use ?

Streets and Intersections Data Structure

Streets and Intersections Data Structure

I am writing a program that is supposed to emulate a city, and one of the
problems I am running into is how to store a large amount of
interconnected data. For instance, each Street has a direction enumeration
(NORTH_ONE_WAY, EAST_WEST, etc.) and other attributes. The most important
attribute is that each street has a list of intersections (a map of the
street that it intersects with along with the block number at which it
intersects). From this data structure, I should be able to parse it and
create a visualization (that comes later and is not part of this
question).
The question is: what is the best type of data structure to use for this?
Obviously a relational database would be a good choice, but if I am
writing in C++ (not a constraint for this question, but C++ implementation
would be a plus), should I be using that? What other data structures may
work for this?

How to serialize a page with all controls that it contains

How to serialize a page with all controls that it contains

I'm quite new with the programming so please, don't be too hard in your
answers :-) I'm writing an app where in a page, or better in a grid of a
XAML page, I've put a couple of buttons, written directly in XAML (let's
call them "button1" and "button2"), and where it is possible to add two
more buttons in runtime ("button3" and "button4". Moreover, it is possible
to remove one or more of these buttons, included the ones created in XAML.
Till here there isn't any problem.
Obviously, if the status of the page, with the buttons present at the
moment, is not saved in the isolated storage, when the app is re-open I
find only the two buttons created in XAML. This is the tricky part of the
program. As far as I know, I should serialize the controls and then save
them in the isolated storage. I'd like to know if it is possible to
serialize the entire page with the controls present on it (if yes, how
should I proceed?) or if it is necessary to serialize every single control
(how to do that?) taking into account that, as written, not all buttons
could be present.
I tried to search in the Internet but I didn't find anything which could
help me with a clear example. I just know how to serialize arrays or save
strings in the isolated storage but this is new to me.
Thank you in advance

Is it possible to use the importHTML function with a concatenated URL?

Is it possible to use the importHTML function with a concatenated URL?

What I'm basically trying to do is use a URL previously made with the
CONCATENATE function in an IMPORTHTML function.
When I try
importHTML (H1, "table", 0)
Where H1 is the cell with the concatenated URL, I get a #VALUE! error. Not
even referencing H1 from a different sheet will work.
Any ideas about how to get past this? According to the usual syntax, the
URL needs to be enclosed in double quotes. I'm trying to set things up so
I only need to type in a few lines to automatically perform IMPORTHTML
runs.

Friday, 23 August 2013

Calculation of volume and centre of mass of an arbitrary polyhedron

Calculation of volume and centre of mass of an arbitrary polyhedron

Hi I am developing a thesis that will calculate the volume and center of
mass of an arbitrary block of rock.
1- The calculation starts with triple volume integrals. The formulas are
transformed to line integrals using the divergence theorem and Green
theorem. This is a proven method and I have developed software that does
the calculations. The input to the software is the coordinates of the
vertices of the faces.
2- From the field, the orientations of the planes that define the block of
rock are measured using dip and dip direction. These are simply angles
that perfectly identify the planes in space. Additionally, the coordinates
of a point in the planes are measured. This information allows us to
obtain the equation of all the planes that define the block. These planes
are, for example, faults, fractures or geologic layers.
3- The combination of the planes in groups of three, without repetition,
gives us the coordinates of all vertices and the faces they belong to.
4- The last piece of the puzzle is to figure out the sequence of the
coordinates in the face in counterclockwise direction. In other words, it
is necessary to create an index of the coordinates so we know in what
order they are on the face. Moreover, it is required to determine what
vertices really belong to the polyhedron.
I think I can use linear programming to define what vertices (defined by 3
intercepting planes) are really part of the polyhedron. I wont't have an
objective function and I don't know how to define the constraints.
Any suggestion? ideas?
Thanks Jair Santos UBC-Canada

Form options as radio buttons or regular buttons?

Form options as radio buttons or regular buttons?

I'm very new to Rails, doing a few tutorials, and I don't have a
background in web development, so apologies in advance.
I'm creating a pretty simple app that allows a user to select one of three
available status updates. Should I store these three status updates as a
string or integer? Currently, my Postgres database stores the statuses as
integers, though I'm also curious if there's a way I can specify that only
the numbers 1, 2, or 3 can be inserted.
Second question: I want to display a form that shows as three buttons,
each button corresponding to a specific, set status update. I want the
button to display with a string inside so that it's human readable, but
with that status update corresponding to either 1, 2, or 3. The user can
choose which status, change which status they've selected if they change
their mind before submitting, and then hit a submit button once they've
made up their mind.
Should I use radio buttons to accomplish this? If so, how should I make it
where the radio button displays text and then saves as the integer? Or
should I just use a normal button?
Many thanks!

Drawing image in each item of a a listView in a linear layout?

Drawing image in each item of a a listView in a linear layout?

So, I'm trying to draw a Circle on Touch for each item of a ListView.
This is my ListItem:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linkCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/linkTitle0001"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="4dp"
android:lineSpacingExtra="-2dp"
android:fontFamily="sans-serif-condensed"
android:maxLines="3"
android:text="hihi"
android:textColor="#717171"
android:textSize="49sp" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:onClick="imageOnClick"
android:src="@drawable/ic_launcher"/>
<com.example.piemenu.PieMenu
android:id="@+id/circle_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true" />
</FrameLayout>
This is where I fit in the ListItem in a ListView:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" >
</ListView>
</LinearLayout>
This is my adapter:
public class ListArrayAdapter extends ArrayAdapter<String> {
public ArrayList<String> links = new ArrayList<String>();
public Activity activity = new Activity();
TextView linkText;
TextView linkDesc;
public Context c;
public ListArrayAdapter(Context context, int textViewResourceId,
ArrayList<String> fiokiList, Object o) {
super(context, textViewResourceId, fiokiList);
this.links = fiokiList;
activity = (Activity) (o);
c = context;
//notifyDataSetChanged();
}
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(
R.layout.list_item, parent, false);
}
final String link = this.links.get(position);
linkText = (TextView) convertView.findViewById(R.id.linkTitle0001);
// linkImageView = (SmartImageView)
convertView.findViewById(R.id.faviconView0001);
linkText.setText(link);
FrameLayout fl =
(FrameLayout)convertView.findViewById(R.id.linkCardView);
ImageView imgView =
(ImageView)convertView.findViewById(R.id.imageView1);
PieMenu pieMenu = new PieMenu(imgView, activity);
fl.addView(pieMenu);
return convertView;
}
}
And this is my PieMenu class:
public class PieMenu extends FrameLayout{
// Linear
private static int ANIMATOR_DEC_SPEED15 = 1;
private static int ANIMATOR_ACC_SPEED15 = 2;
// Cascade
private static int ANIMATOR_ACC_INC_1 = ANIMATOR_ACC_SPEED15 + 1;
private static int ANIMATOR_ACC_INC_15 = ANIMATOR_ACC_INC_1 + 15;
// Special purpose
private static int ANIMATOR_BATTERY_METER = ANIMATOR_ACC_INC_15 + 1;
private static int ANIMATOR_SNAP_GROW = ANIMATOR_ACC_INC_15 + 2;
private static int ANIMATOR_END = ANIMATOR_SNAP_GROW;
private Paint mPieBackground = new Paint(COLOR_PIE_BACKGROUND);
private Paint mPieSelected = new Paint(COLOR_PIE_SELECT);
private Paint mPieOutlines = new Paint(COLOR_PIE_OUTLINES);
private Paint mSnapBackground = new Paint(COLOR_SNAP_BACKGROUND);
private static final int COLOR_OUTLINES_MASK = 0x22000000;
private static final int COLOR_ALPHA_MASK = 0xaa000000;
private static final int COLOR_OPAQUE_MASK = 0xff000000;
private static final int COLOR_SNAP_BACKGROUND = 0xffffffff;
private static final int COLOR_PIE_BACKGROUND = 0xaa000000;
private static final int COLOR_PIE_BUTTON = 0xb2ffffff;
private static final int COLOR_PIE_SELECT = 0xaaffffff;
private static final int COLOR_PIE_OUTLINES = 0x55ffffff;
private static final int COLOR_CHEVRON_LEFT = 0x0999cc;
private static final int COLOR_CHEVRON_RIGHT = 0x53d5e5;
private static final int COLOR_BATTERY_JUICE = 0x33b5e5;
private static final int COLOR_BATTERY_JUICE_LOW = 0xffbb33;
private static final int COLOR_BATTERY_JUICE_CRITICAL = 0xff4444;
private static final int COLOR_BATTERY_BACKGROUND = 0xffffff;
private static final int COLOR_STATUS = 0xffffff;
private static final int BASE_SPEED = 1000;
private static final int CHEVRON_FRAGMENTS = 16;
private static final float SIZE_BASE = 1.0f;
private ImageView _view;
private ArrayList<PieItem> mItems;
private Context _context;
private Animation animFadeOut;
public PieMenu(ImageView view, Context context) {
super(context);
_context = context;
_view = view;
setWillNotDraw(false);
mItems = new ArrayList<PieItem>();
// TODO Auto-generated constructor stub
}
public PieMenu(Context context, AttributeSet attrs) {
super(context, attrs);
// ~
}
public PieMenu(View view, Context context, AttributeSet attrs) {
super(context, attrs);
// ~
}
private CustomValueAnimator[] mAnimators = new
CustomValueAnimator[ANIMATOR_END + 1];
public void addPieMenu(int x, int y){
mItems = new ArrayList<PieItem>();
Path path = new Path();
path.addCircle(9, 9, 9, Path.Direction.CW);
PieItem item = new PieItem(_view,_context,path, x,y,40);
mItems.add(item);
//FrameLayout.LayoutParams lyp = new
FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
//pieView.setLayoutParams(lyp);
//addView(pieView);
// animateIn();
}
private class CustomValueAnimator {
@SuppressLint("NewApi")
public CustomValueAnimator(int animateIndex) {
index = animateIndex;
manual = false;
animateIn = true;
animator = ValueAnimator.ofInt(0, 1);
animator.addUpdateListener(new
CustomAnimatorUpdateListener(index));
fraction = 0;
}
@SuppressLint("NewApi")
public void start() {
if (!manual) {
animator.setDuration(duration);
animator.start();
}
}
@SuppressLint("NewApi")
public void reverse(int milliSeconds) {
if (!manual) {
animator.setDuration(milliSeconds);
animator.reverse();
}
}
@SuppressLint("NewApi")
public void cancel() {
animator.cancel();
fraction = 0;
}
public int index;
public int duration;
public boolean manual;
public boolean animateIn;
public float fraction;
public ValueAnimator animator;
}
private class CustomAnimatorUpdateListener implements
ValueAnimator.AnimatorUpdateListener {
private int mIndex;
CustomAnimatorUpdateListener(int index) {
mIndex = index;
}
@SuppressLint("NewApi")
@Override
public void onAnimationUpdate(ValueAnimator animation) {
mAnimators[mIndex].fraction = animation.getAnimatedFraction();
invalidate();
}
}
private void animateIn() {
// Cancel & start all animations
cancelAnimation();
invalidate();
for (int i = 0; i < mAnimators.length; i++) {
//mAnimators[i].animateIn = true;
mAnimators[i].start();
}
}
private void cancelAnimation() {
for (int i = 0; i < mAnimators.length; i++) {
if (mAnimators[1] != null)
mAnimators[i].cancel();
}
}
@SuppressLint({ "NewApi", "DrawAllocation" })
@Override
protected void onDraw(Canvas canvas) {
// super.onDraw(canvas);
// Toast.makeText(_context, "text",Toast.LENGTH_LONG).show();
/*canvas.drawCircle ('1', '2', (true ?
mAnimators[ANIMATOR_SNAP_GROW].fraction *
Math.max(getWidth(), getHeight()) * 1.5f : 0),
mSnapBackground);
mSnapBackground.setAlpha((int)(10.0));
int len = (int)(10.0 * 1.3f);
int thick = (int)(len * 0.2f);
Path plus = new Path();
plus.addRect(10 - len / 2, 10 - thick / 2, 10 + len / 2, 10 +
thick / 2, Path.Direction.CW);
plus.addRect(10 - thick / 2, 10 - len / 2, 10 + thick / 2, 10 +
len / 2, Path.Direction.CW);
canvas.drawPath(plus, mSnapBackground);
canvas.save();
*/
if(mItems != null)
{
for (int i = 0; i < mItems.size();i++)
{
Paint paint1 = new Paint();
Bitmap bitmap = Bitmap.createBitmap(10, 10,
Config.ARGB_8888);
//canvas.drawBitmap(bitmap,
mItems.get(i).x+1,mItems.get(i).y+8, paint1);
Bitmap bgr =
BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
Paint transparentpainthack = new Paint();
transparentpainthack.setAlpha(100);
// canvas.drawBitmap(bgr, mItems.get(i).x,
mItems.get(i).y, transparentpainthack);
ValueAnimator animator;
animator = ValueAnimator.ofFloat(0, 1); // values
from 0 to 1
animator.setDuration(5000); // 5 seconds duration
from 0 to 1
paint1.setColor(Color.RED);
paint1.setAntiAlias(true);
paint1.setFilterBitmap(true);
paint1.setDither(true);
paint1.setStyle(Paint.Style.STROKE);
//Bitmap myBitmap =
BitmapFactory.decodeResource(getResources(),
BitmapDrawable drawable = (BitmapDrawable)
_view.getDrawable();
Bitmap bitmap1 = drawable.getBitmap();
canvas.drawBitmap(bitmap1, mItems.get(i).x,
mItems.get(i).y, transparentpainthack);
canvas.drawCircle(mItems.get(i).x, mItems.get(i).y,
mItems.get(i).r + 50, paint1);
animator.addUpdateListener(new
ValueAnimator.AnimatorUpdateListener()
{
@Override
public void onAnimationUpdate(ValueAnimator
animation) {
float value = ((Float)
(animation.getAnimatedValue()))
.floatValue();
// Set translation of your view here.
Position can be calculated
// out of value. This code should move the
view in a half circle.
_view.setTranslationX((float)(200.0 *
Math.sin(value*Math.PI)));
_view.setTranslationY((float)(200.0 *
Math.cos(value*Math.PI)));
}
});
}
}
// this.draw(canvas);
//_view.draw(canvas);
//for (PieItem item : mItems) {
// //if (!canItemDisplay(item)) continue;
//drawItem(canvas, item);
//\] }
}
/*
@SuppressLint("NewApi")
private void drawItem(Canvas canvas, PieItem item) {
if (item.getView() != null) {
int state = canvas.save();
float angle = (float) Math.abs(Math.acos(10)) * 2.0f;
canvas.rotate(angle + 20, 10, 10);
canvas.drawPath(item.getPath(), item.isSelected() ?
mPieSelected : mPieBackground);
canvas.drawPath(item.getPath(), mPieOutlines);
canvas.restoreToCount(state);
state = canvas.save();
ImageView view = (ImageView)item.getView();
canvas.translate(view.getX(), view.getY());
// canvas.rotate(angle,(float)10,view.getWidth() / 2,
view.getHeight() / 2);
view.draw(canvas);
canvas.restoreToCount(state);
}
}
*/
@Override
public boolean onTouchEvent(MotionEvent evt) {
if (evt.getPointerCount() > 1) return true;
final float touchX = evt.getRawX();
final float touchY = evt.getRawY();
BitmapDrawable drawable = (BitmapDrawable) _view.getDrawable();
Bitmap bitmap1 = drawable.getBitmap();
Log.d("height",String.valueOf(bitmap1.getWidth()));
if(mItems.isEmpty()){
Path path = new Path();
path.addCircle(9, 9, 9, Path.Direction.CW);
PieItem item = new PieItem(_view,_context,path,
touchX,touchY,40);
mItems.add(item);
}
switch (evt.getAction()) {
case MotionEvent.ACTION_DOWN:
//if (mItems == null){
//}
for(int i = 0;i<mItems.size();i++){
// Toast.makeText(_context,
"tas",Toast.LENGTH_SHORT).show();
if (touchX >= mItems.get(i).x &&
touchX <= (mItems.get(i).x + bitmap1.getWidth()) &&
touchY >= mItems.get(i).y &&
touchY <= (mItems.get(i).y + bitmap1.getHeight())) {
// click code
Toast.makeText(_context, "asa",
Toast.LENGTH_SHORT).show();
}
}
break;
}
//Toast.makeText(_context, String.valueOf(mX),
Toast.LENGTH_LONG).show();
invalidate();
return true;
}
}
I'm just finding it a bit difficult to understand how to draw a
cirle/piemenu for onTouch of each item of a listview.

EditText not scrollable inside the Listview?

EditText not scrollable inside the Listview?

I have ListView which is also scrollable and inside it there is MultiLine
EditText which is not scrollable properly when I wanted to scroll the
EdiText then Listview's scroll works while I wanted to scroll the Editext.
so please suggest some good ways to handle this.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/et_address"
style="@style/Text.Medium"
android:layout_width="0dp"
andr`enter code here`oid:layout_height="wrap_content"
android:layout_weight="9"
android:gravity="top"
android:hint="@string/address"
android:inputType="textMultiLine|textCapSentences"
android:maxHeight="75dp"
android:maxLength="256"
android:minLines="2"
android:scrollbars="vertical"
/>
</LinearLayout>

Move div background position on jquery hover

Move div background position on jquery hover

I'm trying to get this to work but for some unknown reason the image isn't
budging.. Check out the JSfiddle I created here.
//Ignore this comment

Thursday, 22 August 2013

Windows 2008 Server GPO Add personal shares

Windows 2008 Server GPO Add personal shares

Right now each employee has their own share on the file server that uses
their first initial of their first name and their last name (ex. jsmith).
Of course John Simth has to be logged on to access the share jsmith.
The Issue: Right now I have two options to establish the jsmith share
everytime a employee logins into the domain creating a domain profile for
the 1st time. I ether 1.) manually map the drive to the share. Or 2.) use
the VBScript below and manually open it or manually put it in the startup
folder.
The Goal: I woud like to use a GPO login script or the GPO map drive
function to make sure the employee has their personal share (mapped to
W:). Right now the only solution I can figure out is to add the VBScript
below as a Login script(using GPO), BUT it will not run like it should.
There is NOTHING wrong with the script if I manually put it on the users
computer and click it. But how would I make sure the users personal share
is being mapped everytime the login to the domain on ANY computer? NOTE: I
do not need to use the login script below, but its the only option I
currently know of.
VBScript:
' Section removes W drive if exists
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
If (objFSO.DriveExists("W:") = True) Then
objNetwork.RemoveNetworkDrive "W:", True, True
End If
' Section Remaps W drive based on User Name, the OU is also stored but not
used.
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strUserName = objUser.samAccountName
strOUPath = objUser.Parent
arrContainers = Split(strOUPath, ",")
arrOU = Split(arrContainers(0), "=")
strOU = arrOU(1)
strDrive = "\\SERVER001\" & strUserName
strFirstInt= Left(strUserName,1)
strLastName= Split(strUserName, " ")(1)
strDrive = "\\192.168.0.1\" & strFirstInt & strLastName
'WScript.Echo (strDrive)
Set objNetwork = CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive "W:", strDrive

n+1 vectors in $\mathbb{R}^n$ cannot be linearly independent

n+1 vectors in $\mathbb{R}^n$ cannot be linearly independent

I was looking for a short snazzy proof on the following statement:
n+1 vectors in $\mathbb{R}^n$ cannot be linearly independent
A student of mine asked this today morning and I couldn't come up with a
proof solely from the definition of linear independence.
From a higher level perspective, I explained that if I put the vectors in
a matrix then if the only null space entry is the zero vector, then the
vectors are independent but since we have one extra column than row and
that the row and column rank are equal, there is no way we can have $n+1$
as the rank of the matrix and hence from Rank-Nullity theorem, the
dimension of the Nullspace is at least one which implies that there is a
combination of the vectors where not all the scalar multiples in the
definition are 0 but yet we get a zero as the linear combination. The
student hasn't completely learnt the fundamental subspaces yet so I am not
sure he grasped what I was saying.
Is there a cleaner proof?
EDIT: I am stunned how many beautiful answers I got with so much diversity.

Do chatrooms help when stuck on programming obstacles?

Do chatrooms help when stuck on programming obstacles?

I'm curious, sometimes when I'm working on a project, I am lost about
where to begin and so I can't exactly ask something on StackOverflow
because I'm not at a specific problem. But I'd like to perhaps chat with
people. Are chatrooms good ways to do so? i heard of IRC rooms, how do you
utilize these to advantage?

Center aligned paragraph on top of left aligned paragraph

Center aligned paragraph on top of left aligned paragraph

Suppose I have:
<p align="center">Title</p>
<p>Body</p>
How can I make it so there is no line space between "Title" and "Body" ?

Case/Switch using Strings

Case/Switch using Strings

I have this weather script that and I'm trying to display a different
image for every weather condition (case), the image will also be different
if it's day or night.
Here is what I'm doing...
GETTING THE XML Info. into .PHP
<?php
$CapDCityANDState = "Atlanta, GA";
$url="https://www.google.com/ig/api?weather=$CapDCityANDState&hl=en&referrer=googlecalendar";
$xml = simplexml_load_file($url);
//print_r($xml);
//echo "Test: " . $xml->current_conditions->temp_f['data'];
$DayNow = date(D);
$DayTomorrow = date('D', strtotime('+1 day'));
$DayAfterTomorrow = date('D', strtotime('+2 day'));
$DayAfterAfterTomorrow = date('D', strtotime('+3 day'));
$CurrentTxt =
$xml->weather->current_conditions->condition->attributes()->data;
$CurrentTemp =
$xml->weather->current_conditions->temp_f->attributes()->data;
//echo $CurrentTemp[0];
echo("<BR><BR>");
$DayOneLow =
$xml->weather->forecast_conditions[0]->low->attributes()->data;
$DayOneHi =
$xml->weather->forecast_conditions[0]->high->attributes()->data;
$DayOneTxt =
$xml->weather->forecast_conditions[0]->condition->attributes()->data;
//echo $DayOneLow[0];
$DayTwoLow =
$xml->weather->forecast_conditions[1]->low->attributes()->data;
$DayTwoHi =
$xml->weather->forecast_conditions[1]->high->attributes()->data;
$DayTwoTxt =
$xml->weather->forecast_conditions[1]->condition->attributes()->data;
//echo $DayTwoLow[0];
$DayTriLow =
$xml->weather->forecast_conditions[2]->low->attributes()->data;
$DayTriHi =
$xml->weather->forecast_conditions[2]->high->attributes()->data;
$DayTriTxt =
$xml->weather->forecast_conditions[2]->condition->attributes()->data;
//echo $DayTriLow[0];
$DayFourLow =
$xml->weather->forecast_conditions[3]->low->attributes()->data;
$DayFourHi =
$xml->weather->forecast_conditions[3]->high->attributes()->data;
$DayFourTxt =
$xml->weather->forecast_conditions[3]->condition->attributes()->data;
//echo $DayFourLow[0];
?>
DISPLAY WEATHER FORCAST INFO.
<div>Currently: <?php echo $CurrentTemp[0]; ?>&deg; - <?php echo
$CurrentTxt[0]; ?> - H: <?php echo $DayOneHi[0]; ?>&deg; L: <?php echo
$DayOneLow[0]; ?>&deg; - Rest of the Day: <?php echo $DayOneTxt[0];
?></div>
<div><?php echo($DayTomorrow);?>: <?php echo $DayTwoHi[0];
?>&deg;/<?php echo $DayTwoLow[0]; ?>&deg; - <?php echo
$DayTwoTxt[0]; ?></div>
<div><?php echo($DayAfterTomorrow);?>: <?php echo
$DayTriHi[0]; ?>&deg;/<?php echo $DayTriLow[0]; ?>&deg; -
<?php echo $DayTriTxt[0]; ?></div>
<div><?php echo($DayAfterAfterTomorrow);?>: <?php echo
$DayFourHi[0]; ?>&deg;/<?php echo $DayFourLow[0]; ?>&deg; -
<?php echo $DayFourTxt[0]; ?></div>
<br>
FINDOUT IS IT DAY OR NITE CURRENTLY
<?php
$img = time() > $sunriseTime && time() < $sunsetTime ? 'day' : 'nite';
// $img <-- will say 'day' if it's day and 'nite' if its nite
?>
GET WHAT IMAGE TO SHOW DEPENDING IF IT'S DAY OR NITE AND ALSO GET THE
WEATHER CONDITION TEXT AND BASE THE IMAGE ON THOSE TWO FACTORS.
SHOW WHAT IMAGE NAME TO USE e.g. "32.png"
<?php echo($WeatherIMG); ?>
The image always shows "1.png" and that is wrong :(

how to select and sum in single sql query

how to select and sum in single sql query

Is it possible or another solution to sum and select multiple rows in
single sql query and print with while looping like that:
$query = mysql_query("SELECT SUM(Total), * FROM table");
while ($fetch = mysql_fetch_row($query)) {
echo $fetch[a];
echo $fetch[b];
echo $fetch[c];
}

Wednesday, 21 August 2013

How to split email address to retrieve name only?

How to split email address to retrieve name only?

With javascript, how do we remove the @gmail.com or @aol.com from a string
so that what only remains is the name?
var string = "johndoe@yahoo.com";
Will be just "johdoe"? I tried with split but it did not end well. thanks.

WMI Query to count number of messages in MSMQ poison queue

WMI Query to count number of messages in MSMQ poison queue

I can query the Win32_PerfFormattedData_msmq_MSMQQueue WMI object to get
the count of messages on an MSMQ queue as below, however this will return
a cumulative count of messages on the queue and it's subqueues (e.g.
poison and retry). Ideally I would like to get a count of messages on the
poison queue alone.
Is this possible using WMI?
Dim Locator
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Dim objs
Set Service = Locator.ConnectServer(".", "root\cimv2")
Set objs = Service.ExecQuery("SELECT MessagesinQueue " &_
"FROM Win32_PerfFormattedData_msmq_MSMQQueue " &_
"WHERE Name LIKE '%\\private$\\myqueue'")
For Each object In objs
WScript.Echo "Name: " & object.Name
WScript.Echo "MessageCount: " & object.MessagesInQueue
Next
Given the docs on subqueues this makes sense as they are just a partition
of the main physical queue, but is there any other WMI object or attribute
I can query to identify poison messages?
Subqueues are implicitly created local queues that are logical partitions
of a physical queue. Applications can use subqueues to group messages.
Subqueues are implicitly created when opened, are deleted when empty, and
have no open handles. Messages cannot be sent to a subqueue. Messages can
be received from subqueues, moved between the main queue and its subqueue,
or moved between a pair of sibling subqueues.
Subqueues do not have their own properties or state, but share the
properties and state of their parent queue. For example, a subqueue does
not have its own quota, access control list (ACL), or transactional type.

Table cells not fitting in row properly

Table cells not fitting in row properly

Preface: the table layout/old html is due to using this for a email
newsletter.
I'm in the process of building a simple navigation with a table. What I'm
looking for is a 650px wide table with a header row for a banner, and then
six cells equally spaced underneath that for the navigation links. Right
now, the second row has one really long cell with the "ABOUT" link, and
then the following five cells are way to the right of the table. It only
does this when I have an image in the top row.
Code:
<!DOCTYPE html>
<head>
<title></title>
<style>
#container {
background-color: #efefef;
width: 650px;
}
#row_nav {
width: 650px;
}
.nav_link {
width: 108px;
background-color: #AB2328;
}
</style>
</head>
<body>
<table id = "container" align="center">
<tr>
<td>
<a href="#"><img src="banner.jpg"/></a>
</td>
</tr>
<tr id = "row_nav">
<td class = "nav_link">
<a href="">ABOUT</a>
</td>
<td class = "nav_link">
<a href="">AGENDA</a>
</td>
<td class = "nav_link">
<a href="">SPEAKERS</a>
</td>
<td class = "nav_link">
<a href="">SPONSORS</a>
</td>
<td class = "nav_link">
<a href="">TRAVEL</a>
</td>
<td class = "nav_link">
<a href="">REGISTER</a>
</td>
</tr>
</table>
</body>
</html>
Any help would be much appreciated.

Shouldn't nHibernate ISession.BeginTransaction() fail when a transaction is already open?

Shouldn't nHibernate ISession.BeginTransaction() fail when a transaction
is already open?

I know these kinds of questions can lead to flame wars. Personally I'm a
huge fan of nHibernate and I realize no ORM is perfect. I'm just trying to
determine if there's a good reason for this I'm unaware of or if it's a
design flaw that exists because changing it would break existing code.
Here's the behavior I'm describing:
Assuming I have an existing ISession named session shouldn't the following
code throw an exception on the third line due to the fact that nHibernate
does not support nested transactions.
ITransaction tx = null;
tx = session.BeginTransaction();
tx = session.BeginTransaction();
If we assume that there are no other transactions open on the current
thread the first call to BeginTransaction() does indeed begin a
transaction. However the second merely returns the existing transaction.
It gives the impression that nested transactions are supported. Is this
bad nomenclature?
Would it make more sense to create two methods? One for grabbing an
existing transaction or creating one if none exists in situations where
the developer doesn't care and another method that specifically creates
new transactions and fails when it cannot?
This question is about nHibernate but perhaps this applies to Hibernate as
well.

Match a row as long as possible

Match a row as long as possible

I'm going to parse a position base file from a legacy system. Each column
in the file has a fixed column width and each row can maximum be 80 chars
long. The problem is that you don't know how long a row is. Sometime they
only have filled in the first five columns, and sometimes all columns are
used.
If I KNOW that all 80 chars where used, then I simple could do like this:
^\s*
(?<a>\w{3})
(?<b>[ \d]{2})
(?<c>[ 0-9a-fA-F]{2})
(?<d>.{20})
...
But the problem with this is that if the last columns is missing, the row
will not match. The last column can even be less number of chars then the
maximum of that column.
See example
Text to match a b c d
"AQM45A3A text " => AQM 45 A3 "A text " //group d has 9 chars instead
of 20
"AQM45F5" => AQM 45 F5 //group d is missing
"AQM4" => AQM 4 //group b has 1 char instead
of 2
"COM*A comment" => Comments do not match (all comments are prefixed
with COM*)
" " => Empty lines do not match
In this example, EACH row that I want to parse, is starting with AQM
How should I design the Regular Expression to match this?