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.

Yii Time Table genaration

Yii Time Table genaration

I am new to yii framework. As a project we do a school information
management system. In that system we have to create a time table.
The time table has 5-days(Monday-friday) as columns and 8 periods as rows.
In a cell there should be two dropdown lists for subject and corresponding
teacher. All together there are 80 dropdown lists.So I have to write code
for all 80 dropdowns.
Is there any way to minimize the code for dropdowns or can anyone suggest
a better way to do this.
(In the beginning of the time table form class is select and according to
that subjects are updated to dropdowns. From the subject can select the
corresponding teacher)

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!

Can I use ArrayList in a class which extends Thread?

Can I use ArrayList in a class which extends Thread?

Is it possible to use an ArrayList within a class that extends Thread? I
have written some code to read from Bluetooth serial which was working,
but I've added an ArrayList to keep track of what I'm reading. However I'm
getting NullPointException on any line that accesses results. I know that
ArrayList is not thread safe (although I may not understand fully what
that means) so I may be trying to do impossible things but I thought I
would check with the experts as ArrayLists are otherwise very easy to work
with.
private class ConnectedThread extends Thread {
private final BluetoothSocket mmSocket;
private final InputStream mmInStream;
private List<String> results;
public ConnectedThread(BluetoothSocket socket) {
Log.d(TAG, "create ConnectedThread");
mmSocket = socket;
InputStream tmpIn = null;
OutputStream tmpOut = null;
List<String> results = new ArrayList<String>();
// Get the BluetoothSocket input and output streams
try {
tmpIn = socket.getInputStream();
tmpOut = socket.getOutputStream();
} catch (IOException e) {
Log.e(TAG, "temp sockets not created", e);
}
mmInStream = tmpIn;
mmOutStream = tmpOut;
init();
}
private void init(){
code = new byte[16];
checksum = 0;
tempbyte = 0;
bytesread = -1;
if(!results.isEmpty()){
Log.i(TAG, "Already have found: " + results.size() + " things.");
}
}
public void run(){
//do things
}
}

increase jvm heap space while runnig from hadoop unix

increase jvm heap space while runnig from hadoop unix

I am running a java class test.java from hadoop command :
$ hadoop test
I am using a stringBuilder, and its size is going out of memory :
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.

java:100)
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572

)
at java.lang.StringBuffer.append(StringBuffer.java:320)
at java.io.StringWriter.write(StringWriter.java:60)
at org.json.JSONObject.quote(JSONObject.java:1287)
at org.json.JSONObject.writeValue(JSONObject.java:1597)
at org.json.JSONObject.write(JSONObject.java:1649)
at org.json.JSONObject.writeValue(JSONObject.java:1574)
at org.json.JSONArray.write(JSONArray.java:929)
at org.json.JSONObject.writeValue(JSONObject.java:1576)
at org.json.JSONObject.write(JSONObject.java:1649)
at org.json.JSONObject.writeValue(JSONObject.java:1574)
at org.json.JSONObject.write(JSONObject.java:1632)
at org.json.JSONObject.toString(JSONObject.java:1443)
I know in java we can run a java program by providing a heap space size :
java -Xmx4G test
How can I do this while running with hadoop, if I run it like :
$ hadoop -Xmx4G test
it throws exception :
Caused by: java.lang.ClassNotFoundException: java
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: java. Program will exit.
Error: No command named `-Xmx4g' was found. Perhaps you meant `hadoop
Xmx4g'
I would like to change the heap size permanently.

Friday, 30 August 2013

Create Xcode project for existing cross-platform file structure

Create Xcode project for existing cross-platform file structure

I am creating a C++ static library which is meant to be compilable on
Windows, OSX/iOS, or Linux. At the moment, the existing directory
structure is:
LibraryRoot
.git - git repository
Core - core OS independent source code
OSX - OSX specific code, including Xcode project files
Windows - Windows specific code, including developer studio project
files
Linux - Linux stuff
I dont understand how to create the project using this file structure
within Xcode. It seems that Xcode wants to create a directory with the
project name and put a new repository and project files inside, which is
not what I want here. Also I'm not sure how to make Xcode recognize the
git repository which is above the directory which is intended to host the
Xcode project files. I don't need to create any special makefile or rules
outside of the Xcode project file.
Is doing it this way possible with Xcode?

Thursday, 29 August 2013

How to get and display all the data of database in php

How to get and display all the data of database in php

Well i am creating a web app in which i need to display all the rows from
the database , the code and database structure is :
------------------------------------------
id | product_name | link
------------------------------------------
1 | example_1 | #
2 | example_2 | #
3 | example_3 | #
$sql = "SELECT * FROM `site_product` WHERE `product_cat` = 'home'";
while ($row = mysql_fetch_assoc($result)) {
echo "$row['product_name']; }
so however i get only one result and rest of the rows are not being in
output I think of using "forloop" but dnt have any idea to implement it ..
please help .

how to change color by inline css

how to change color by inline css

I have a div, in css there is blue color for that div. Now I need to
change that color dynamically. I store color in database and want to use
database hexadecimal color code in that div.
How to change the default blue color?
I can fetch color from database. But can't use inline css to apply color
came from database.. Lets suppose from database color will come like
#3B5323.

Wednesday, 28 August 2013

Using angular ng-repeat properly

Using angular ng-repeat properly

So i'm fairly new to angular and what i'm trying to do is take a json
collection that is obtained from a RESTful call and loop through each one
to display their value while associating its designated id in a href.
below you will find what I have tried:
<div class="span2">
<!--Sidebar content-->
Search: <input ng-model="query">
Sort by:
<select ng-model="orderProp">
<option value="name">Alphabetical</option>
<!--option value="age">Newest</option>
<option value="-age">Oldest</option-->
</select>
</div>
<div class="span10">
<!--Body content-->
<ul class="documents">
<li ng-repeat="document in documents | orderBy:orderProp"
class="thumbnail">
<a
href="#/rest/{{document.document_id}}">{{document.title}}</a>
</li>
</ul>
<pre>{{ documents | json }}</pre>
</div>
the Shttp call:
function DocListCtrl($scope, $http)
{
console.log('getting documents data');
$http.get('/*RESTful call here*/').success(function(data)
{
$scope.documents = data;
});
$scope.orderProp = 'name';
}
when I run the page i get my list no problem using the
<pre>{{ documents | json }}</pre>
but the ng-repeat fails to implement.
What exactly am I doing incorrectly with the ng-repeat call that fails to
list my data the way i wish?
Thanks for the help

Delay a code by given seconds

Delay a code by given seconds

This a code written using java to delay the execution of the code by 5
seconds. But it is not working. either "this.jLabel2.setText("TDK");"
statement not working. Can any one please help me to solve this problem.
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
this.jLabel2.setText("TDK");
boolean result=false;
result=stop();
if(result)
{
this.jLabel1.setText("MDK");
}
}
public boolean stop()
{
String current= new java.text.SimpleDateFormat("hh:mm"
+ ":ss").format(new java.util.Date(System.currentTimeMillis()));
String future=new java.text.SimpleDateFormat("hh:mm"
+ ":ss").format(new
java.util.Date(System.currentTimeMillis()+5000));
while(!(current.equals(future)))
{
current= new java.text.SimpleDateFormat("hh:mm"
+ ":ss").format(new
java.util.Date(System.currentTimeMillis()));
}
return true;
}

UITextView Attributed Text

UITextView Attributed Text

I have a UITextView I want to apply attributes to. It can hold 5
characters per line. When I set the attributedText to my
NSMutableAttributedString, spaces within the string are removed. For
example:
NSMutableAttributedString *moreThan5spaces = [[NSMutableAttributedString
alloc] initWithString:@" AAA"]; //7 spaces and then text
self.textView.attributedText = moreThan5spaces;
When I do this, the text "AAA" should appear on the 2nd line, starting
with 2 spaces in front of it. I will use underscores to represent space in
this example:
//I want this:
_____
__AAA
//But I get this:
_____
AAA
When the characters wrap to a new line, spaces are removed. How can I
prevent this?

Brussels At Halloween – travel.stackexchange.com

Brussels At Halloween – travel.stackexchange.com

I visited Brussels in May and fell in love with the city. I am planning a
return visit for Halloween and was wondering do the Belgians celebrate
Halloween and if so in what way (Fancy Dress, ...

How does SLComposeViewController display the displaying viewController in background?

How does SLComposeViewController display the displaying viewController in
background?

I thought if we display something modally, the viewController in
background will be completely filled.
Yet SLComposeViewController did it differently. We can still see the
viewController in background partially.
How did they do so?
Is this new in iOS 6?

Pagination having issues with page id

Pagination having issues with page id

If i have 10 data in page=1 in pagination,another page having i.e page=2
having another 10 data.and after that page=3 doesn't contain any data.if i
select previous button then that page goes in page-1,page=-2.....and if i
press next button,it will also going on like page=2,page=3 and so on.So
how to disable prev and next button if the record is no longer available
???
<?php
include("config.php");
$start = 0;
$per_page = 5;
if(!isset($_GET['page'])){
$page = 1;
}
else{
$page = $_GET['page'];
}
if($page<=1)
$start = 0;
else
$start = $page * $per_page - $per_page;
$sql="select id,question,correctAnswer,category
from math order by id";
$num_rows = mysql_num_rows(mysql_query($sql));
$num_pages = $num_rows / $per_page;
$sql .= " LIMIT $start, $per_page";
$result=mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($result))
{?>
.......
........
<?php
$prev = $page - 1;
$next = $page + 1;
echo "<a href='?page=$prev'>prev</a> ";
echo " <a href='?page=$next'>next</a> ";
?>

Tuesday, 27 August 2013

PHP /or/ PYTHON : How to code a script to get e-mails of top 1 mil web sites in the world, and then send them all this ARTICLE?

PHP /or/ PYTHON : How to code a script to get e-mails of top 1 mil web
sites in the world, and then send them all this ARTICLE?

You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1: you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
4: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..

will provide you with the top 1 million web sites in the world.
updated daily in a csv file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.

always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.

google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a csv file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
a=`xclip -o`
b=`echo "$a" | sed -e 's/^ *//g' -e 's/ *$//g'`
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool type "$b"
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest. ..........................................
..........................
.............................................................. . . . . ..
. .............................................

is there any account recovery gem for ruby on rails that uses SMS?

is there any account recovery gem for ruby on rails that uses SMS?

I was wondering if there was any account recovery gem for a ruby on rails
password allowing the app to send the user to his sms a pin to reset their
password in the event the user forgets it? Googled but didn't see
anything, figured I would ask here in case my google search string was
just poorly written.
ruby on rails account recovery via sms

List directory files in a DataGrid

List directory files in a DataGrid

I have searched many topics and can't find an answer on using the WPF
DataGrid to list file name contents from a directory. I am able to output
the contents in a ListBox but have no idea how to add items to a Column in
DataGrid.
This works for a ListBox
string path = "C:";
object[] AllFiles = new DirectoryInfo(path).GetFiles().ToArray();
foreach (object o in AllFiles)
{
listbox.Items.Add(o.ToString());
}
How can I do the same with a DataGrid? Or atleast place strings from an
array into a DataGrid Column?

Files saved with Ubuntu is not visible in Windows 8

Files saved with Ubuntu is not visible in Windows 8

I have dual booted my laptop with ubuntu 12.10 and windows 8. When I
download some file via ubuntu (e.g a pdf) and save it on a windows
partition(NTFS), I do not see it through windows 8. Even when I set to
view hidden files, the files do not appear. But when I boot with Ubuntu I
see the file is there.
What is the issue here. This is not a very good experience for me. Please
let me know how to fix the issue.

Decompose floating-point number

Decompose floating-point number

Given a floating-point number, I would like to separate it into a sum of
parts, each with a given number of bits. For example, given 3.1415926535
and told to separate it into base-10 parts of 4 digits each, it would
return 3.141 + 5.926E-3 + 5.350E-8. Actually, I want to separate a double
(which has 52 bits of precision) into three parts with 18 bits of
precision each, but it was easier to explain with a base-10 example. I am
not necessarily averse to tricks that use the internal representation of a
standard double-precision IEEE float, but I would really prefer a solution
that stayed purely in the floating point realm so as to avoid any issues
with endian-dependency or non-standard floating point representations.
No, this is not a homework problem, and, yes, this has a practical use. If
you want to ensure that floating point multiplications are exact, you need
to make sure that any two numbers you multiply will never have more than
half the digits that you have space for in your floating point type.
Starting this this kind of decomposition, then multiplying all the parts
and convolving, is one way to do that. Yes, I could also use an
arbitrary-precision floating-point library, but this approach is likely to
be faster when only a few parts are involved, and it will definitely be
lighter-weight.

How to make the whole record readonly in openerp7

How to make the whole record readonly in openerp7

I know to make a field readonly with the "readonly" attribute. Is it
possible to make the entire record readonly. That means that all field in
a form should be readonly on a condition.
One insignificant way i found is to make this
attrs="{'readonly':[('state','=','close')]}" in all the fileds present in
the form.
<field name="responsible_id" class="oe_inline" attrs="{'readonly':
<field name="type" attrs="{ 'readonly':[('state','=','close')]}"
class="oe_inline"/>
<field name="send_response"
attrs="{'readonly':[('state','=','close')]}"/>[('state','=','close')]}"/>
However i don't think this be the right one. I expect some way to put
readonly attribut common for the form. Kindly suggest.
In my example, People can view all the records and edit only their own
records.
Thank You.

Monday, 26 August 2013

openvpn to share internet connection: client side (kubuntu) configuration

openvpn to share internet connection: client side (kubuntu) configuration

Server Debian 7.0
Client Kubuntu 12.10
Followed debian wiki about OpenVPN with success until TLS-enabled VPN
section. Now from client I want to have internet thru vpn.
For that I opened KDE manager where I tried
- gateway: server ip
- connection type: pre-shared key
- shared key: /etc/openvpn/static.key
- Key direction: none
- Local ip: 61.5xxxxxx
- remote ip: 10.9.0.2
I tested to ping google from client: nothing
But I got some log from server
Mon Aug 26 12:40:03 2013 us=340969 UDPv4 READ [100] from [AF_INET] (...)
Mon Aug 26 12:40:03 2013 us=341053 TUN WRITE [60]
How to have internet thru my openvpn ?
edit:
client config
remote **SERVER ADDRESS**
dev tun0
ifconfig 10.9.8.2 10.9.8.1
secret /etc/openvpn/static.key
route-delay 2
route-method exe
redirect-gateway def1
server config
dev tun0
ifconfig 10.9.8.1 10.9.8.2
secret /etc/openvpn/static.key
push "redirect-gateway def1"
push "redirect-gateway"

Developing ASP.Net with reportviewer / wizard - missing UI options

Developing ASP.Net with reportviewer / wizard - missing UI options

I'm new to C# .net web development and I'm trying to learn how to create a
simple reporting site from online walkthroughs etc. I'm a SQL Dev by
trade... So I'm probably missing something basic.
Here's the instructions I'm working from
(http://msdn.microsoft.com/en-us/library/ms252123.aspx): 1. Make sure that
the top-level Web site is selected in Solution Explorer. 2. Right-click on
the Web site and select Add New Item. 3. In the Add New Item dialog box,
select Report Wizard, enter a name for the report file, and then click
Add.
The problem is, "Report Wizard" is not on the list of installed items in
the add item dialog box. In fact there is nothing report related on the
list.
I'm using Microsoft Visual Studio Express for Web, which AFIK includes the
correct report components. I created the project as a website (File -> New
Website, ASP.Net Website)
I bet I'm missing something that will earn me a face palm, but I've
searched high up and low down and wasted the best part of a day. I'd
appreciate any help! Thanks

Using box-sizing to create an inside border

Using box-sizing to create an inside border

I want to create an HTML table where each cell is clickable, and clicking
on a cell adds a border to the single div within the cell. I want that
div's border to exist entirely within the existing confines of the td that
contains it, without resizing the table or its cells at all. I can't seem
to make this happen correctly.
This previous question seems to address the same issue and points to some
articles about the box-sizing CSS options. I have a fiddle where I tried
to implement this without success: http://jsfiddle.net/YsAGh/3/.
* {
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
<table>
<tr>
<td><div>1</div></td>
<td><div>2</div></td>
<td><div>3</div></td>
</tr>
....
</table>
Here's what currently happens. The border causes the containing td to grow
to accommodate the div's border.

How can I add the border to the div without it affecting the containing
table?

UiImagePickerController doesn't crop when using setShowsCameraControls:NO

UiImagePickerController doesn't crop when using setShowsCameraControls:NO

precode- (IBAction)showImagePickerCamera:(id)sender {
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self.picker setDelegate:self]; self.picker.allowsEditing = YES;
self.customView = [[CustomCameraViewController
alloc]initWithNibName:@CustomCameraViewController bundle:nil];
[self.customView setCustomCameraDelegate:self]; [self
presentViewController:self.picker animated:NO completion:nil];
self.needsToShowImageSource = NO; [self
performSelector:@selector(customCameraTakeAPicture) withObject:nil
afterDelay:3]; [self.picker setShowsCameraControls:NO]; } /code/pre pHi
all! :D I have this piece of code. I'm using setAllowsEditing:YES and
setShowsCameraControls:NO. But if I set ShowsCameraControls = NO, the
uiimagepickercamera doesn't allow me to crop the image. I'm using a custom
view (CustomCameraViewController) to create the buttons to take a picture,
select the camera, the flash, etc. That's why i'm setting
ShowsCameraControls to NO. When I press to take a picture i'm calling/p
precode -(void)customCameraTakeAPicture { [self.picker
setShowsCameraControls:YES]; [self.picker takePicture]; } /code/pre pThat
takes me to the crop view but it doesn't show the square. And when i press
USE the app crashes with this error :/p precodeAug 26 04:42:50
Chad-DePues-iPod Modabound[13518] lt;Errorgt;: UIImage
*PLCreateCroppedImageFromImageWithQuality(UIImage *, CGRect, CGSize,
CGInterpolationQuality): failed to create context 2013-08-26 04:42:50.754
Modabound[13518:861b] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot
be nil (key: croppedImage)' *** First throw call stack: (0x31c1f2a3
0x3989d97f 0x31b81313 0x36d538b7 0x36d79307 0x32535e85 0x39cf4311
0x39cf41d8) libc++abi.dylib: terminate called throwing an exception
/code/pre pAny suggestions ? I've been stack for hours with this and I run
out of ideas. /p pThanks!/p

Break Batch Script Execution during Pause

Break Batch Script Execution during Pause

I'm developing a complex, long-running batch script, and came upon a
little issue when debugging. I have a command-line window open to the root
path of the script, so I can type myscript.bat to fire it off for testing.
I am using PAUSE commands between statements to watch the behavior of the
script. However, I discovered that typing CTRL+C during a PAUSE command to
cancel execution is simply interpreted as a key to continue execution,
rather than breaking the script as intended.
I know I can simply kill/close the command window, but it's a little
annoying to navigate back to the correct path in a new command-window
every time. Is there a way to properly break a batch script's execution
easily while it is currently in a PAUSE?



Edit: It looks like PAUSE works fine in simple scripts, as indicated by
@dbenham. However, if you have multiple PAUSE statements nested inside of
a FOR iteration, then you can't break in the middle of the FOR iteration -
only at the end. Here is a sample script that demonstrates the issue:
@echo off
for /l %%y in (2008, 1, 2013) do (
echo 1
pause
echo 2
pause
echo 3
pause
echo 4
pause
echo 5
pause
)
If you try to terminate any of the first four PAUSE statements, you will
find that your terminate command is ignored and execution continues
anyway. But once you reach the end, to the fifth PAUSE, you do get the
terminate prompt (in the example output below, I was pressing CTRL+C at
every prompt):
Z:\>test
1
Press any key to continue . . .
2
Press any key to continue . . .
3
Press any key to continue . . .
4
Press any key to continue . . .
5
Press any key to continue . . .
Terminate batch job (Y/N)? y
Any ideas how to prevent this behavior?

Best way to update Tomcat 7 of Ubuntu Server 12.04

Best way to update Tomcat 7 of Ubuntu Server 12.04

Ubuntu Server 12.04 repository has Tomcat 7 in version 7.0.26. I prefer
using this installation because it creates the user, init script and log
rotation configuration.
What would you suggest to keep it updated with the latest version:
download from tomcat.apache.org, copy the jars and diff the configuration
files or use the Debian repository?
Thanks, Philip

Getting ClientID of asp controls within a asp:GridView's ITemTemplate

Getting ClientID of asp controls within a asp:GridView's ITemTemplate

I am having
<asp:GridView ID="gdvResxKeyValue" runat="server" Width="100%"
AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField >
<ItemTemplate>
<asp:Image ID="imgEditResxValue" CssClass="sfEdit"
onclick="ClickImage(this)" runat="server"
ImageUrl="~/Administrator/imgedit.png" />
<asp:Button ID="hiddenButton" runat="server"
OnClick="hiddenButton_Click" style="display:none"></asp:Button>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
and now need to take clientID of asp:Button and tried taking as,
$(document).ready(function () {
function ClickImage(imageControl) {
document.getElementById('<%=hiddenButton.ClientID%>').click();
}
}
But this throws an error while building as,

Is there any way to take the ClientID?
Thank you.

Sunday, 25 August 2013

Soundcloud SDK for Android

Soundcloud SDK for Android

May I know, is it possible to use Soundcloud API with Android ?
If it is, does anyone know how to use Soundcloud SDK with an Android
project ? Any sample projects or guideline links will be helpful.
Thank you !

Can the following proof concerning irrationality of square roots be improved?

Can the following proof concerning irrationality of square roots be improved?

Is the following proof too lengthy? Can it be made shorter, yet still be
elaborate?
Prove that there is no rational number whose square is $\sqrt{12}$.
Suppose $p, q \in \Bbb Q$. Of course, both elements cannot both be even if
they are expressible in a rational field. Suppose there was a rational
number such that $$({p \over q})^2 = 12$$
then $p^2 = 12q^2$. This implies $p^2$ (and therefore $p$) is even since
an odd number multiplied by itself gives an odd number. Since any number
multiplied by an even number is even, this implies the RHS is even.
Thus, the RHS must be divisible by 4, so the result is $p^2 = 3q^2$. This
implies that there is no rational whose square is $\sqrt{3}$, as the RHS
isn't divisible by 4 when q is odd. Since $4\sqrt{3}$ yields an irrational
number, there is no rational whose square is 12. QED.

executing cd command and ffmpeg in java

executing cd command and ffmpeg in java

How to run cd command(In linux Ubuntu) and ffmpeg on the changed directory
The jsp code given below:
String cmd = "cd "+getServletContext().getRealPath("/")+"Files/videos/";
out.println(cmd);
ProcessBuilder pb = new ProcessBuilder(
"/bin/sh", "-c",
cmd + "&& ffmpeg -i nature.MP4");
Process p = pb.start();
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()) );
String line;
out.println("Meta-data...");
while ((line = in.readLine()) != null) {
out.println(line);
}
in.close();

How to get screen capture in ios using coding in simulator ?? and later use that screenshot in program..?

How to get screen capture in ios using coding in simulator ?? and later
use that screenshot in program..?

I want to capture a screenshot in my ios simulator and use that image to
create a custom animation. The problem is to how to get a scrrenshot in
simulator ??

Add html to cpt main page / admin edit.php

Add html to cpt main page / admin edit.php

I want to add some html under the title of a custom post type I created.
See area in image here:
http://i.stack.imgur.com/rpkV3.png
I tried using different methods including post_row_actions (depricated)
filter to do this. Does anyone know of a function or a method on how to do
this? I was hoping to use an action hook or filter. I want to add a simple
with some instructions and maybe an image to that area.
Thanks

Saturday, 24 August 2013

Why does my Java code execute bash command incorrectly?

Why does my Java code execute bash command incorrectly?

I am trying to make my Java program interact with Linux bash but something
goes wrong. I have a simple executable prog that reads the one integer
from stdin and outputs its square. Executing
echo 5 | ./prog
from bash itself prints correct answer 25 in stdout but running
import java.io.*;
public class Main {
public static void main(String[] args) throws InterruptedException,
IOException {
Runtime run = Runtime.getRuntime();
Process proc = run.exec("echo 5 | ./prog");
proc.waitFor();
BufferedReader br = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
while(br.ready())
System.out.println(br.readLine());
}
}
unexpectedly gives 5 | ./prog. What is the solution?

need an help for ereg_replace (deprecated)

need an help for ereg_replace (deprecated)

Hello i've writen a few scripts 2 or 3 years ago. Now it's not running. My
scripts :
<?php
function tolink($text){
$text = " ".$text;
$text = ereg_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1" target="_blank" rel="nofollow">\\1</a>', $text);
$text = ereg_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1" target="_blank" rel="nofollow">\\1</a>', $text);
$text =
ereg_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2" target="_blank" rel="nofollow">\\2</a>', $text);
$text = ereg_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})',
'<a href="mailto:\\1" rel="nofollow">\\1</a>', $text);
return $text;
}
?>
When i replace ereg_replace with preg_replace it gives me an error.
I need your help... Thank you...

how do i get the y potition of an image in javaScript? (in relation to the document)

how do i get the y potition of an image in javaScript? (in relation to the
document)

I am trying to dynamically get the y position of an image in JavaScript.
In relation to the screen/document, that is. How can i do that? is there
anything like in AC3 where you can do: getPropery(obj,_x)?

html form enctype=multipart/form-data

html form enctype=multipart/form-data

Hi I'm trying to create a form that will load images following some web
examples but I can't get the images to load. I'm working on my personal
fedora box running apache. Is there some settings that I have to do
differently with Apache? Here's my form script that should be uploading
image:
<form name ="input" enctype="multipart/form-data" action =
"addPhotograph.php" method = "get">
<table>
<tr>
<th>Title:</th> <td><input type="text" name
="photoname"></td>
</tr>
<tr>
<th>Photograph:</th> <td><input type="file" id="file"
name="file" accept="image/*"></td>
</tr>
<tr>
<th>Photographer:</th><td><input type=""
name="photographer"></td>
</tr>
<tr>
<th>Genre:</th><td><input type = "" name="genre"></td>
</tr>
<table>
<input type="submit" value = "Submit">
</form>
And Here's my PHP script:
<?php
$uploaddir = '/var/www/html/photodb';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['file']['name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
When I add an image through the form the php form fails saying "Possible
file upload attack!" I guess this means either the file was not able to be
moved or the file was not uploaded?
I'm doing this for my college assignment any response or other idea is
dearly appreciated :).

Bolton vs QPR Live Stream On pc

Bolton vs QPR Live Stream On pc

Watch Live Streaming Link
The Queens Park Rangers (officially: Queens Park Rangers Football Club,
often short also called as QPR) are an English football club from London.
The association plays since of the season 2011/2012 in the highest English
Class in, the Premier League. The Queens Park Rangers are referred to
(tire Super) because of their striated jerseys also as a super Hoops.
The association has its roots in the 1882 founded in London's west youth
clubs St. Jew's Institute at and Christchurch Rangers. St. Jew's was a
actuation field for boarding students at the Droop Street and had with the
support of parish priest Gordon Young also one ecclesial background. After
players had played in parallel also at the Christchurch Rangers founded of
George Wodehouse, themselves both pages resolutely 1886 to a merger. The
association called himself due to the homeland in the Queen's Park
district henceforth Queen's Park Rangers - the solution lay near
therefore, because the Christchurch Rangers were been already more or less
called that. In the choice of blue striped jerseys one oriented oneself
derives from the models from Oxford and Cambridge.
Watch Live Streaming Link

What is the purpose of the Legacy Artifact?

What is the purpose of the Legacy Artifact?

Vulgrim sells an item called the Legacy Artifact, worth 25000 Gilt. I
purchased it, only to find that it is a level 40 (effectively unusable)
talisman with no effects. Am I missing something?
Note: This item is only available with the Argul's Tomb DLC pack installed.

Friday, 23 August 2013

nunit how to have a once off setup method (for all tests)

nunit how to have a once off setup method (for all tests)

I need a once-off setup method, called only once, across all test fixtures.
This is to setup common stuff like AutoMapper, some mocks used by everything.
How can I do this? (And I'm not talking about TestFixtureSetup)

Trying to select by field from different class using foreign key, getting errors

Trying to select by field from different class using foreign key, getting
errors

I'm creating a reddit clone as a personal project to get to grips with
django, and so far I've got two classes:
from django.db import models
from django.contrib.auth.models import User
class Board(models.Model):
name = models.CharField(max_length =100, blank = False)
created_on = models.DateTimeField('Date Created', auto_now_add=True)
deleted = models.BooleanField(default = False)
def __unicode__(self):
return self.name
class Notice(models.Model):
title = models.CharField(max_length=200) #title as it appears on the
notice
author = models.ForeignKey(User, null=False, blank=False)
posted_on = models.DateTimeField('Posted On', auto_now_add= True)
updated_on = models.DateTimeField('Last Updated', auto_now = True)
board = models.ForeignKey(Board, null=False)
isText = models.BooleanField(null=False, blank = False)
content = models.TextField()
thumps_up = models.PositiveIntegerField()
thumps_down = models.PositiveIntegerField()
deleted = models.BooleanField(default=False)
def __unicode__(self):
return self.title
And in my urls I have:
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^(?P<board_name>\w+)/$', views.board_lv)
)
What I want to do is have the url pattern compare against the "name" field
in the "Board" model using the "board" foreign key in the "Notice" model,
and then open up a page listing all the notices with in that board
(similar to subreddits in reddit).
I'm getting a type error saying "Notice object is not iterable", which
leads me to think I've only got one object instead of a list, but I
shouldn't have should I?
The iteration is in this part of the html file;
{% for n in latest_notices %}
<li>
{% if not n.isText %}
<h2><a href="{{ n.content }}">{{ n.title }}</a></h2>
{% else %}
<h2>{{ n.title }}</h2>
<p>{{ n.content }}</p>
{% endif %}
</li>
{% endfor %}
where the views are:
def index(request):
latest_notices = Notice.objects.order_by('-posted_on')
context = {'latest_notices': latest_notices}
return render(request, 'noticeList.html', context)
def board_lv(request, board_name):
latest_notices = get_object_or_404(Notice, board__name=board_name)
context = {'latest_notices': latest_notices}
return render(request, 'noticeList.html', context)
Also, in the error traceback, the board_name variable value is preceded by
a 'u' before the quoted string, e.g:
Variable Value
board_name u'worldnews'
If I'm getting the url pattern wrong or haven't explained the problem well
enough, please let me know as any help would be greatly appreciated.

What does this mean?: *(int32 *) 0 = 0;

What does this mean?: *(int32 *) 0 = 0;

In the following piece of code, what does *(int32 *) 0 = 0; mean?
void
function (void)
{
...
for (;;)
*(int32 *) 0 = 0; /* What does this line do? */
}
A few notes:
The code seems to not be reachable, as there is an exit statement before
that particular piece of code.
int32 is typedef'ed but you shouldn't care too much about it.
This piece of code is from a language's runtime in a compiler, for anyone
interested.

How to plot an irrational function with tikz?

How to plot an irrational function with tikz?

how to plot the function $f:x\mapsto \int_x^{2x}\frac{4}{\sqrt{1+t^4}}\,
\textrm{d}t$ with TikZ?

Reseed database not working Entity ASP.NEt

Reseed database not working Entity ASP.NEt

In my ASP.NET MVC project I enabled migrations, and filled in the Seed
method. So I did update-database -Verbose, and that worked fine. But I
added some extra things that should be Seeded aswell. But how to drop the
database and reSeed it all?
internal sealed class Configuration :
DbMigrationsConfiguration<Actual.Models.ActualContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(X.Models.MyContext context)
{
var footers = new List<Foobar>
{
The update-database -Verbose command in the Package Manager Controller
isn't doing something like re-seed.
> PM> update-database -Verbose -Force Using StartUp project 'XX'. Using
> NuGet project 'XX'. Specify the '-Verbose' flag to view the SQL
> statements being applied to the target database. Target database is:
> 'X.Models.MyContext' (DataSource: (localdb)\v11.0, Provider:
> System.Data.SqlClient, Origin: Convention). No pending code-based
> migrations. Applying automatic migration:
> 200308230838465_AutomaticMigration. ALTER TABLE [dbo].[Foobars] ALTER
> COLUMN [Name] [nvarchar](50) NOT NULL ALTER TABLE [dbo].[Foobars]
> ALTER COLUMN [Email] [nvarchar](max) NOT NULL [Inserting migration
> history record] Running Seed method.

Thursday, 22 August 2013

Querying an array field that contains hashes in mongoDB?

Querying an array field that contains hashes in mongoDB?

I have a problem in fetching the data from database. I have a array type
column in mongodb database, in which i am saving hash type data in each
array index. I have to get data on the basis of that hash match from the
data base.
My data in database is saving like this
{
"_id" : ObjectId("521603970ff5fa4b47000018"),
"message_text" : "#cricket #badminton #sachin #tendulkar #ibl
#masterblaster #srt Cricketing world lights up IBL http://t.co/RWskRM2EQf
via @msncricket",
"source" : "<a href=\"http://twitter.com/tweetbutton\"
rel=\"nofollow\">Tweet Button</a>",
"status_id" : NumberLong("370521615638884352"),
"status_created_at" : "2013-08-22 17:53:31 +0530",
"user_id" : "31677680",
"screen_name" : "msncricket",
"name" : "MSN Cricket",
"followers_count" : 11515,
"friends_count" : 303,
"query" : [
{
"filterId" : "5215b40c0ff5fa111e000001",
"subfilterId" : "60728003610375795",
"type" : "keyword",
"source" : "twitter",
"monitoring_type" : false,
"search_type" : false,
"searchParameter" : "sachin",
"geo" : "india",
"language" : "en"
}
]
}
The query column is the array type column.
During searching i make a hash again form matching it like follows
query = {"filterId"=>"5215b40c0ff5fa111e000001",
"subfilterId"=>"60728003610375795", "type"=>"keyword",
"source"=>"twitter", "monitoring_type"=>false, "search_type" => false,
"searchParameter"=>"sachin", "geo"=>"india", "language"=>"en"}
@result = Statuses.where(query: query)

How to store dynamically built lists in database in a natural way so that they are just ready for reads?

How to store dynamically built lists in database in a natural way so that
they are just ready for reads?

For a social network site, I need to store dynamic lists for each entity(&
millions of such entities) which are:
frequently appended to
frequently read
sometimes reduced
lists are keyed by primary key
Need to consider for easy scaling & administration by small team &
starting out with just 1 or 2 medium sized VPS(s) & adding more as data &
load grows.
I'm already storing some other type of data in mysql but for these storing
dynamic lists, MySQL is not anyway ideal. I know that I could store my
data in an RDBMS in such a way that using JOIN(s) I'll be able to generate
those lists but I'm trying to avoid JOINs altogether to make the system
easy scalable & instead store prepared lists in a natural way. Since lists
are of variable length, storing list items as columns within a row is not
possible.
So how do I solve this ? Should I use another database for this data,
probably the one that provide adding variable no of columns to keyed by a
primary key. Something like Cassandra ?

Drupal 7 content without article tag

Drupal 7 content without article tag

I would like to use drupal, but after searching for a long time I cannot
find anything that allows me to put the main content outside of an article
tag. I really don't like putting php into a wiki text box and would like
to know if there is a way to make the main content a div or something.

what is wrong with json response

what is wrong with json response

json response which is working correctly :
obj = urllib.urlopen("http://www.omdbapi.com/?t=Fight Club")
response_str = obj.read()
response_json = simplejson.loads(response_str)
above code making the json request which looks like :
{
"Title":"Fight Club",
"Year":"1999",
"Rated":"R",
"Released":"15 Oct 1999",
......
"Response":"True"
}
so i can sleep now... but
json response which is not working correctly :
obj =
urllib.urlopen("https://api.stackexchange.com/2.1/answers?order=desc&sort=activity&site=stackoverflow")
response_str = obj.read()
response_json = simplejson.loads(response_str)
above code making the json request which looks like :
{
"items": [
{
"question_id": 18384375,
"answer_id": 18388044,
"creation_date": 1377195687,
"last_activity_date": 1377195687,
"score": 0,
"is_accepted": false,
"owner": {
"user_id": 1745001,
"display_name": "Ed Morton",
"reputation": 10453,
"user_type": "registered",
"profile_image":
"https://www.gravatar.com/avatar/99a3ebae89496eb16afe453aae97f5be?s=128&d=identicon&r=PG",
"link": "http://stackoverflow.com/users/1745001/ed-morton"
}
},
{
"question_id": 18387447,
"answer_id": 18388040,
"creation_date": 1377195667,
"last_activity_date": 1377195667,
"score": 0,
"is_accepted": false,
"owner": {
"user_id": 2494429,
"display_name": "kpark91",
"reputation": 140,
"user_type": "registered",
"profile_image":
"https://www.gravatar.com/avatar/d903a03e7c5b6d9b21ff598c632de575?s=128&d=identicon&r=PG",
"link": "http://stackoverflow.com/users/2494429/kpark91"
}
}
]
}
returns
JSONDecodeError at /
No JSON object could be decoded: line 1 column 0 (char 0)
instead of using simplejson i tried json which gave following error :
ValueError at /
No JSON object could be decoded
what i tried and failed:
I tried my questions's answers on stackoverflow having same problem but
none of them gave clear cut solution although every one helped me in some
way
1) i checked whether json content encoding is correct or not
obj.info()
Content-Type: application/json; charset=utf-8 Content-Length: 2398
2) i decoded the response_str in utf-8
json.loads(response_str).decode("utf-8")
3) i used jsonlint to check format of json response
Parse error on line 1:
^
Expecting '{', '['
surprisingly following link of rescued my sleep. JSONDecodeError:
Expecting value: line 1 column 1 (char 0)
Basically i was using exact code to get json response in both cases , but
whats wrong with the second json response, only difference i noticed that
the structure of second json response was different from first one.
please provide explanation to understand the issue.

Network traffic filtering by developing a Linux kernel module

Network traffic filtering by developing a Linux kernel module

I am trying to make my own network traffic filter. To achieve this, I am
building a Linux kernel module using netfilter and getting access to all
the network packets. In order to filter these captured network packets I
need to use a separate program (*filter_prog*) which I have developed. The
output of this *filter_prog* determines whether the packet will be allowed
to go through or not.
My query is, how can I use this *filter_prog* in a kernel module?
Secondly, is the approach correct? or there is an alternative approach
which is more easy to implement and is fast.
Thanks for any help.

How to Handle the Child Window in the Selenium Web Driver TestNg by Using Frame Work?

How to Handle the Child Window in the Selenium Web Driver TestNg by Using
Frame Work?

In this code i am using the Single class and the Functional Class, Here
AllpagesLogins it is a Class Name and the this Code is Writing in the
Functional Class, Overall Scripit is running in the TestNg Class. So when
i click on the linkBtn Name as matrimonials@shaadi.com it is displaying
the Child Window in that Child Window Close Link Button Is There, So i am
write the Code for the Child Window Code also and by Direct Code, But no
one is not Working Correctly? How can i handle this Child Window?
package EmailMessage;
import java.util.Set;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import Class.AllpagesLogins;
//Declaring the Class Name
public class EmailMessage {
public void EMSG(WebDriver driver) throws Exception {
//Here AllpagesLogins is a Class Name
AllpagesLogins APL = new AllpagesLogins();
//Clicking on the Email Message Menu Button
driver.findElement(By.id(APL.EMSG_EmailMsg_MenuBtn_ID)).click();
System.out.println("Clicked on the Email Message Menu Button");
Thread.sleep(2000);
//Checking the Text for the Email Message Title
WebElement asserta=driver.findElement(By.id(APL.EMSG_EmailMsg_MainTitle_ID));
String a=asserta.getText();
try
{
Assert.assertEquals("Email Messages", a);
System.out.println("Main Title Name as Email Messages");
}
catch (Error e1)
{
System.out.println("Wrong Title");
}
//Checking the Text for the Sub Label
WebElement assertb=driver.findElement(By.id(APL.EMSG_EmailMsg_SubLbl_ID));
String b=assertb.getText();
try
{
Assert.assertEquals("Click on the Sender Email to view its details.", b);
System.out.println("Main Title Name as Sub Label");
}
catch (Error e1)
{
System.out.println("Wrong Title");
}
//Clicking on the Child Window
//getting parent Id
String Currenthandle=driver.getWindowHandle();
System.out.println("parent window id:"+Currenthandle);
//handle the child window
Set handles= driver.getWindowHandles();
handles.remove(Currenthandle);
//performing action on child window
driver.switchTo().window(handles.iterator().next());
Thread.sleep(3000);
//Clicking on the Email Message Menu Button
if(driver.findElement(By.linkText("matrimonials@shaadi.com")).isDisplayed())
{
System.out.println("Link Name is Displaying");
driver.findElement(By.linkText("matrimonials@shaadi.com")).click();
System.out.println("Clicked on the Email Id Link Button");
Thread.sleep(2000);
}
else
{
System.out.println("Link Name is Not Displaying");
}
//Handing the Child Windows
if(driver.findElement(By.name("Message Details")).isDisplayed())
{
System.out.println("Message Details Label is Displaying");
driver.findElement(By.id(APL.EMSG_ChildWindow_Close_LnkBtn_ID)).click();
System.out.println("Clicked on the Close Button in the Child Window");
Thread.sleep(2000);
}
else
{
System.out.println("Message Details Label is Not Displaying");
}
}
}

Link only available for my own app

Link only available for my own app

I upload some data to my server with my app. I send the data to a PHP-File
on the server and this PHP write the data in my database. This works fine.
But currently I have the link to this PHP unsave in my Android-code.
Is there a possibility to save this link or make my PHP only for my app
available?

Wednesday, 21 August 2013

Android - can no longer see google Maps after going to production

Android - can no longer see google Maps after going to production

All,
I have been banging my head over this one for a few weeks now. I got
google maps v2 setup for debug following all of their directions. I got my
debug key based on the debug.keystore and everything worked great.
I was then releasing my application to the Google Play Store and followed
the instructions on how to generate my release key and I generated my
Google API Key using the Sha1 of the release key as the instructions
state.
I released my application to the store and everything works great. Here is
the problem though, I can no longer get the maps to show up even when
switching back to the debug API key.
Currently to debug I have been releasing a build to Beta, waiting 3 hours,
and then fixing accordingly. Luckily my map work has stabilized on this
application but I would still like to understand what is going on.
Any ideas anyone?

Derivative of logarithmic function

Derivative of logarithmic function

If the function $f(x)=\log_{2x}x^2$ is given, what is $f'(4)$?
I tried to use the formula for derivative of logarithm but here the base
is $2x$, so it made me confused.
Note that the answer is $1/(18\ln 2)$.

Moodle foreign keys

Moodle foreign keys

i am installing moodle (2.2 or 2.5) and modified the sql generator.php to
have foreign keys and map the database for studies proposes and i get this
allways, i am using 5.5.27 - MySQL Community Server by the way
Debug info: Table 'config' already exists CREATE TABLE config ( id
BIGINT(10) NOT NULL auto_increment, name VARCHAR(255) CHARACTER SET utf8
COLLATE utf8_spanish_ci NOT NULL DEFAULT '', value LONGTEXT CHARACTER SET
utf8 COLLATE utf8_spanish_ci NOT NULL, CONSTRAINT PRIMARY KEY (id) )
ENGINE = InnoDB DEFAULT CHARACTER SET utf8 DEFAULT COLLATE =
utf8_spanish_ci Error code: ddlexecuteerror Stack trace:
line 429 of \lib\dml\moodle_database.php: ddl_change_structure_exception
thrown
line 842 of \lib\dml\mysqli_native_moodle_database.php: call to
moodle_database->query_end()
line 88 of \lib\ddl\database_manager.php: call to
mysqli_native_moodle_database->change_database_structure()
line 77 of \lib\ddl\database_manager.php: call to
database_manager->execute_sql()
line 417 of \lib\ddl\database_manager.php: call to
database_manager->execute_sql_arr()
line 369 of \lib\ddl\database_manager.php: call to
database_manager->install_from_xmldb_structure()
line 1479 of \lib\upgradelib.php: call to
database_manager->install_from_xmldb_file()
line 203 of \admin\index.php: call to install_core()
i found this is a minor bug at https://tracker.moodle.org/browse/MDL-20437
anyways its for the version 1.9 but this is not the version i try to
install
i have searched so far and no solution!. did someone actually fix this

Django Session Not Working - New Cart For Each Item

Django Session Not Working - New Cart For Each Item

I'm working on a simple e-commerce site (following the Coding for
Entrepreneurs course). I have view for the cart (below). I'm having a
problem with the session - each time I add an item to the cart it gets
added to a new cart, when they should be all added to the same cart for
that session. I'm new to Django, and can't see where I'm going wrong here.
Any advice on how to get each item added to go into the same cart would be
much appreciated.
# imports
def add_to_cart(request):
try:
cart_id = request.session('cart_id')
except Exception:
# If cart_id doesn't exist, make one
cart = Cart()
cart.save()
request.session['cart_id'] = cart.id
cart_id = cart.id
# If adding to the cart, need to POST
if request.method == "POST":
# Get data from the form
form = ProductQtyForm(request.POST)
if form.is_valid():
product_slug = form.cleaned_data['slug']
product_quantity = form.cleaned_data['quantity']
# Use that info to set up new objects in our cart
try:
product = Product.objects.get(slug=product_slug)
except Exception:
product = None
try:
cart = Cart.objects.get(id=cart_id)
except Exception:
cart = None
new_cart = CartItem(cart=cart, product=product,
quantity=product_quantity)
new_cart.save()
print new_cart.product, new_cart.quantity, new_cart.cart # Check
items are being added to the cart
return HttpResponseRedirect('/products/')
# If form is not valid, go to contact page
return HttpResponseRedirect('/contact/')
else:
raise Http404

Problems with oci_connect ORA-12541: TNS:no listener

Problems with oci_connect ORA-12541: TNS:no listener

Yo guys. I have the following snippet:
$conn = oci_connect('user', 'pass', '(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)
(HOST=myhost.net)(PORT=1521)
)
)
(CONNECT_DATA=
(SERVER = DEDICATED)
(SERVICE_NAME = MYSERVICE)
)
)');
That is giving me the following error: oci_connect: ORA-12541: TNS:no
listener
That's the first time I try to connect to a oracle database. What am I
doing wrong? I'm on Windows.

Running apache, php and mysql on blackberry

Running apache, php and mysql on blackberry

Can i run apache server, php engine and mysql database on a blackberry
device (device, not simulator)?
When i search at google, the results are how to do it on blackberry simulator

Opening port so that pgAdmin on Windows 7 can connect to PostgreSQL on Debian on VirtualBox

Opening port so that pgAdmin on Windows 7 can connect to PostgreSQL on
Debian on VirtualBox

Hello all :) I'm a having a little trouble connecting this.
On Windows 7 about my Debian 6 on VitualBox configured with Host-only
Adapter:
>nmap -T4 -A -v 192.168.56.1
[...]
5432/tcp unknown postgresql
On the Debian, PostgreSQl is listening:
>netstat -tulpn
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 2432/postgres
tcp6 0 0 :::5432 :::* LISTEN 2432/postgres
.. and the port is opened
>iptables -nL
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0./0 tcp dpt:5432
.. and Postgres is accepting all the connections in postgresql.conf
listen-addresses = '*'
port = 5432
In Windows I have this error message from pdAdmin:
Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "192.168.56.1" and accepting TCP/IP
connections on port 5432?
If you encounter this message, please check if the server you're trying
to contact is actually running PostgreSQL on the given port.
Test if you have network connectivity from your client to the server
host using ping or equivalent tools. Is your network / VPN / SSH tunnel /
firewall configured correctly?
For security reasons, PostgreSQL does not listen on all available
IP addresses on the server machine initially. In order to access
the server over the network, you need to enable listening on the
address first.
For PostgreSQL servers starting with version 8.0, this is controlled
using the "listen_addresses" parameter in the postgresql.conf file.
Here, you can enter a list of IP addresses the server should listen
on, or simply use '*' to listen on all available IP addresses. For
earlier servers (Version 7.3 or 7.4), you'll need to set the
"tcpip_socket" parameter to 'true'.
You can use the postgresql.conf editor that is built into pgAdmin III
to edit the postgresql.conf configuration file. After changing this
file, you need to restart the server process to make the setting effective.
If you double-checked your configuration but still get this error
message, it's still unlikely that you encounter a fatal PostgreSQL
misbehaviour. You probably have some low level network connectivity
problems (e.g. firewall configuration). Please check this thoroughly
before reporting a bug to the PostgreSQL community.
Best regards

Tuesday, 20 August 2013

how to develop slideble editor to a web site when textbox clicked .?

how to develop slideble editor to a web site when textbox clicked .?

I m developing a web site , now i want to develop editor ,editor means
when user clicked in a text box , slider must come , i have no idea to
develop this , please any one can guide me 1 any tutorials??

Creating 2 columns from 1 column in a single table

Creating 2 columns from 1 column in a single table

SELECT TOP 1000 [Value]
FROM [OnlineQnres].[dbo].[tmp_DataSets]
WHERE [VariableID] in ('1')
UNION ALL
SELECT TOP 1000 [Value]
FROM [OnlineQnres].[dbo].[tmp_oDataSets]
WHERE [VariableID] in ('4')
Hi All, I have this select query above using UNION ALL. There is a column
called Value and VariableID in tmp_datasets table. I need to create 2
separate columns and name them val1 for variableID is 1 and val2 if
variableID is 4. If i use UNION ALL it works it creates 2000 records with
the first 1000 as val1 records and next 1000 as val2 records but does not
separate out into 2 sep columns. How do I sep this value column in 2 sep
columns as stated above.

Is ARM supported on WinPhone8 at all?

Is ARM supported on WinPhone8 at all?

I'm facing a weird issue, somewhat similar to this. I have a Windows Phone
8 native DLL project, mostly C++ but with an ARM assembly source in it.
The source is in ARM mode (i. e. not Thumb). C++ is compiled to Thumb.
The app crashes when C++ tries to call into an assembly routine. The call
command in the disassembly is BLX with an immediate offset - it's supposed
to switch mode back to ARM, unconditionally, but somehow it doesn't.
I have the details of the exception. The exception code is 0xc000001d
(invalid operation), and the value of the PC in the crash context struct
is 0x696d5985. That's impossible in either mode - it's misaligned, bit
zero is one. The BLX instruction goes 1b f0 0c eb - if you decipher,
that's a two-part Thumb-style BLX all right, with a 4-aligned
displacement. The T flag in the crash context is SET (CPSR=0x60000010).
I don't have a device, but the crash log from a beta tester is pretty
conclusive. I have a debug log record right before the call into assembly.
Then the crash.

Python: using for loops to output ASCII table

Python: using for loops to output ASCII table

For a tutorial, I need to output the following table on python using
nested for loops:
asc: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
chr: 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
asc: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
chr: @ A B C D E F G H I J K L M N O
asc: 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
chr: P Q R S T U V W X Y Z [ \ ] ^ _
asc: 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
chr: ` a b c d e f g h i j k l m n o
asc: 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
chr: p q r s t u v w x y z { | } ~
asc: 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127'''
Since this is the beginners class we have not learned def. This question
has been answered in previous posts but the answers use def and I cannot
So far my code looks like this:
X=0
for Rows in range(0,12,2):
X=X+1
if Rows%2==0:
print('chr:',end="")
for chrColumns in range (32,48):
print('%4s'%chr(chrColumns+(X-1)*16), end="")
print()
if Rows%2==1:
print('asc:',end="")
for ascColumns in range (16,32):
print(ascColumns+(X-1)*16,end="")
print()
I cannot find a way for the "chr:" rows to alternate with "asc:" rows.
Please help me

What is fontsize 20 in MS WORD in CSS?

What is fontsize 20 in MS WORD in CSS?

how can help me? I need a calculation for a fontsize of 20 (for example in
MS Word) in css. How can i recalculate this value in a suitable way in
css? Are MS Word fontsize 20 == 20px in css?
Thank for help !!

Notice: Undefined index $_POST

Notice: Undefined index $_POST

I am new to php and I made a contact form but i get a
*Notice: Undefined index: name in
C:\xampp\htdocs\portfolio\portfolio\html\contact.php *
for the lines $_POST - Name, email, message and human.
How can I get take the error away??
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From:';
$to = '86376@ict-idcollege.nl';
$subject = 'Hello';
$human = $_POST['human'];
$body = "From: $name\n E-Mail:
$email\n Message:\n $message";
if (isset($_POST['submit'])) {
if ($name != '' && $email !=
'') {
if ($human == '4') {
if (mail ($to,
$subject, $body,
$from)) {
echo '<p>Your message
has been sent!</p>';
} else {
echo '<p>Something
went wrong, go back
and try again!</p>';
}
} else if ($_POST['submit'] &&
$human != '4') {
echo '<p>You answered the
anti-spam question
incorrectly!</p>';
}
} else {
echo '<p>You need to fill
in all required
fields!!</p>';
}
}
?>
<form method="post" action="contact.php">
<label>Name</label>
<input name="name" placeholder="Type
Here">
<label>Email</label>
<input name="email" type="email"
placeholder="Type Here">
<label>Message</label>
<textarea name="message"
placeholder="Type Here"></textarea>
<label>*Wat is 2+2? (Anti-spam)</label>
<input name="human" placeholder="Type
Here">
<input id="submit" name="submit"
type="submit" value="Submit">
</form>

Monday, 19 August 2013

arm-linux-gnueabi compiler options

arm-linux-gnueabi compiler options

I am using, arm-linux-gnueabi-gcc to compile C programs for ARM processor
in Linux. However, I am not sure what is the default ARM mode for which it
compiles.
For example, for the C code:
test.c
unsigned int main()
{
return 0x1ffff;
}
arm-linux-gnueabi-gcc -o test test.c
now, when I look at the disassembly of main() function with objdump, I can
see:
arm-linux-gnueabi-objdump -d test
<main>:
push {r7}
add r7, sp, #0
movw r3, #65535 ; 0xffff
movt r3, #1
mov r0, r3
mov sp, r7
pop {r7}
bx lr
it appears that this is disassembly for Thumb mode of ARM (because of the
push instruction).
How can I display the disassembly as follows:
.sect ".text"
.global _fn
_fn: MOVW A1,#65535
MOVT A1,#1
BX LR
or this
.sect ".text"
.global _fn
_fn: LDR A1, CON1
BX LR
.sect ".text"
.align 4
CON1: .word 0x1ffff
I saw this example here:
http://e2e.ti.com/support/development_tools/compiler/f/343/t/40580.aspx
however, I am unable to view the disassembly the way it is displayed there.
Thanks.

C function headers location: .h or .c?

C function headers location: .h or .c?

Suppose we have function (external only considered here) int foo(int a,
char *b), normally there will be a header that goes with it documenting
what the function does, what each parameter and return value does, etc.
It'll probably be in doxygen format too. My habit is that such header
should go into .h files because that's where the interface is defined and
reader should have all the information in that place. But a lot of people
keep such headers in C file where the actual implimentation goes. I've
seen this in the Linux kernel code also. So was I wrong? Which would you
prefer?

Ember.js ember-model leak issue?

Ember.js ember-model leak issue?

While working on a simple gallery app I realized that my ember app is
slowly eating up memory.
I created a very simple app to demonstrate the issue: index.html app.js
test.js.
Test setup:
Test 1 enters a route and then returns back: Link to Test 1
Test 2 repeats Test 1 100 times. Link to Test 2
From what I can see via Chrome->Profile->Snapshot Test 2 consumes
significantly more memory then Test 1.
Can somebody help me understand what's causing that issue?

How can I implement a two-way bound ComboBox with an "Add New" option?

How can I implement a two-way bound ComboBox with an "Add New" option?

I have a ComboBox that I would like to bind to a property on my class.
However, I would like to intercept the binding process when the first item
in my ComboBox is selected.
The reason is because I have populated my ComboBox with a list of
selectable values. However, I would like for my first item in the list to
be an "Add New..." option. When the user selects "Add New...", I want to
display a new record entry screen that the user can use to add an
additional option to the ComboBox. Once the user creates the new record,
the record will be selected from within my ComboBox.
I imagine this is a scenario that has been encountered numerous times
before. Basically, I want to databind a ComboBox but give my user's the
ability to add options and update the list within the ComboBox.
What is the correct way to do this?

Getting number of bytes of a bitmap

Getting number of bytes of a bitmap

Goal is to show progress of jpeg encoding from bitmap. I have couple of
bitmaps that need to be encoded. So I get the total number of bytes as was
suggested here:
for (var i:int = 0; i < bitmaps.length; i++)
{
bmp = bitmaps[eobj.currentImage];
total_bytes += bmp.getPixels(bmp.rect).length;
}
Then I'm trying to show progress when doing asychronous encoding. I get a
ProgressEvent which gives me bytesLoaded. So I calculate the progress like
so:
total_loaded_bytes += event.bytesLoaded;
var percentage:int = ((total_loaded_bytes / total_bytes) * 100);
However, total_bytes does not add up to total bytes loaded. Total bytes
loaded is way highter.

Difference Between controller and controller.content

Difference Between controller and controller.content

I have an ArrayController and was using {{#each item in controller}} to
iterate over the items in the controller. This was working fine while
using the same controller however after switching controllers I ran into
some weird behavior which stopped the items to being rerendered. Switching
to {{#each item in controller.content}} solved this problem. However I am
not sure how this even happened.
What's the difference between controller and controller.content in an each
expression (or any where else).

Sunday, 18 August 2013

Why is textFieldwithPlaceHolderText undefined for one view controller that conforms to UITextFieldDelegate?

Why is textFieldwithPlaceHolderText undefined for one view controller that
conforms to UITextFieldDelegate?

I have two UIViewController sublcasses, both of them conform to the
UITextFieldDelegate protocol. IOW, I have these classes.
# MyVC1.h
@interface MyVC1 : UIViewController <UITextFieldDelegate>
# MyVC1.m
@interface MyVC1 () {
// Private variable, so not a property
UITextField *_myTextField;
}
@end
@implementation MyVC1
- (void)viewDidLoad
{
_myTextField = [self textFieldwithPlaceHolderText:@"*Text"];
}
@end
SAME CODE for MyVC2 class, except of course the class name.
However, and this is the strange part, my code compiles for MyVC1, but NOT
for MyVC2. For MyVC2, compiler says "No visible @interface for "MyVC2"
declares the selector "textFieldwithPlaceHolderText". What am I missing
for MyVC2? I've double- and triple-checked!

Audio driver ctoss2k.sys is causing excessive DPC lag and music playback is not smooth. How can I solve it?

Audio driver ctoss2k.sys is causing excessive DPC lag and music playback
is not smooth. How can I solve it?

My audio card is an Auzentech x-fi prelude and I have the latest drivers
installed, on windows 7 64 bit. Running a trace showed that ctoss2k, it's
driver, was causing the most latency by an order of magnitude, which
apparently is causing my audio to occasionally skip and stutter.
Is there any combination of card settings to change/enable/disable,
changing the sample rate etc, that would solve the problem? And otherwise,
are there any third party drivers that would fix the issue?
(The procedure I followed for running the trace is here)

Mistaken call to a hash table results in strange ruby irb prompt

Mistaken call to a hash table results in strange ruby irb prompt

I'm running the Ruby irb on a DOS environment.
I've defined a dictionary.
irb(main):001:0> stuff = {'name'=> 'Zed', 'age'=>36, 'height'=>6*12+2}
I've made a mistake in calling it
irb(main):004:0> puts stuff['age]
the ruby prompt changes to an apostrophe ' instead of the usual >
irb(main):006:1'
irb(main):007:1'
IRB doesn't work anymore.
What has happened here and how do I get the shell to function again
without quitting the program?

RSS feed to Google+ Page

RSS feed to Google+ Page

Is there a free service available that lets users post an RSS feed
automatically to a Google+ Business Page? I just found http://dlvr.it/,
but it's a bit expensive for a hobby project.

How to prove that for each $n> 0$, $\mathrm{Mat}_n(R)$ is a ring?

How to prove that for each $n> 0$, $\mathrm{Mat}_n(R)$ is a ring?

How to prove that for each $n> 0$, $\mathrm{Mat}_n(R)$ is a ring? and that
if $R$ has an identity, so does $\mathrm{Mat}_n(R)$ (namely the identity
matrix $I_n$).
Note: The set of all $n \times n$ matrices over R is denoted as
$\mathrm{Mat}_n(R)$.

How can I eliminate prompts and dialog boxes in Emacs and enable auto-saving?

How can I eliminate prompts and dialog boxes in Emacs and enable auto-saving?

I never want to answer a prompt that asks me to save changes.
Whenever I close Emacs, I'm bombarded with dialog boxes and prompts. How
can I avoid them and make Emacs automatically save all unsaved changes?
Also, how can I avoid the prompt when I close a single buffer with C-k and
make Emacs automatically save the changes?

Saturday, 17 August 2013

What is the hyperplane bundle (as defined in Fulton's *Young Tableaux*)?

What is the hyperplane bundle (as defined in Fulton's *Young Tableaux*)?

On page 142 of Fulton's Young tableaux, he says that on any projective
space $\Bbb{P}^\ast(V)$ there is a hyperplane line bundle $\mathcal{O}(1)$
described by a quotient line $ V \to L$ whose fiber over a point is the
line $L$. What exactly does this mean?
From what I understand of the hyperplane bundle, it is the bundle over
$\Bbb{P}^n$ whose the total space is constructed from specifying the
transition functions
$$\begin{eqnarray*} \varphi_{ij} : &U_i \cap U_j& \to \Bbb{A}^1 \\
&(x_0,\ldots,x_n)& \mapsto \frac{x_i}{x_j}\end{eqnarray*}$$
where $U_i,U_j$ are the standard affine covers of $\Bbb{P}^n$. More
specifically, the total space $E$ is the disjoint union $\bigsqcup U_i
\times \Bbb{A}^1$ modulo the equivalence relation $(j,u,a) \sim
(i,u,\varphi_{ij}(u)(a))$. How does this construction agree with what
Fulton is saying (and what is he really saying)?

None, Some and conditionnal treatments

None, Some and conditionnal treatments

I would like to get this thing:
a variable named abc must be None, except if the result of complicated
treatments is true. I wrote a beginning of answer but it doesn't work:
def abc={
None
copie.getRoot().asInstanceOf[DefaultMutableTreeNode].children() foreach ({
site => <...more things after...>
}
in the you can find the result e.g. Some(site)
but the compiler does not accept this order, I mean "None" followed by
some conditions eventually finishing by Some(xxx). and if I put "None"
after the conditions, the result will always be "None" of course, and it's
not what is expected.
can you tell me if this way can work, and how? Or otherwise how can I
proceed?
thanks
olivier

Issue with JS and dynamic select form fields -

Issue with JS and dynamic select form fields -

Currently I have a select form field (which I will refer to as state)
which needs to dynamically populate another select form field (which I
will refer to as school). The use case is that the user selects their
state, and based on that state chosen, they are presented with selects for
a school that populate that state.
The states are read from a flat file (data.php) and stored in $state_arr,
and the schools are read from the same flat file, stored in $stateSchool.
To complicate the matter, the select fields are heavily stylized.
The following code populates the state select based on the flat file:
<div id="stateField" class="selectStyled">
<select class="singleField styled" name="kp_state"
id="kp_state">
<option value="default">STATE</option>
<?
foreach ( $state_arr as $state_abv )
{
echo '<option value="' . $state_abv .
'">' . $state_abv . '</option>';
}
?>
</select>
</div><!-- //selectStyled -->
This part works fine… and appropriately populates the state field. The
issue is that when the user selects their state, it's not changing the
school select form. The code I'm using for the school select form is as
follows:
<div id="schoolField" class="selectStyled">
<select class="longField styled" name="kp_school1"
id="kp_school1">
<option value="default">CURRENT SCHOOL</option>
</select>
</div><!-- //selectStyled -->
The JS that I'm using to try to get the above schoolField to populate is
as follows:
<script>
var kp_dropdownOpts = {}
$(function(){
<?php
foreach ($state_arr as $sa)
{
if ( isset($stateSchool[$sa]) )
{
foreach ($stateSchool[$sa] as $value)
{
?>
window.kp_dropdownOpts.<?php echo $sa; ?> += '<option
value="<?php echo $value; ?>"</option>';
<?php
}
}
}
?>
$('#kp_state').change(function(){
var state = $(this).val();
var len = 0;
for (var o in window.kp_dropdownOpts[state]) {
len++;
}
if(len > 0){
var newDrop = window.kp_dropdownOpts[state];
$('#kp_school1').html(newDrop.replace('undefined', ''));
}
else {
$('#kp_school1').html('<option value="default">No Schools
Listed For Your Area</option>');
}
});
});
</script>
In addition, I have the following code which styles the drop downs:
// Iterate over each select element
function custom_select()
{
if($('select').length)
{
$('select').not('.s-hidden').each(function() {
// Cache the number of options
var $this = $(this),
numberOfOptions = $(this).children('option').length;
// Hides the select element
$this.addClass('s-hidden');
// Wrap the select element in a div
$this.wrap('<div class="select"></div>');
// Insert a styled div to sit over the top of the hidden
select element
$this.after('<div class="styledSelect"></div>');
// Cache the styled div
var $styledSelect = $this.next('div.styledSelect');
// Show the first select option in the styled div
$styledSelect.text($this.children('option').eq(0).text());
// Insert an unordered list after the styled div and also
cache the list
var $list = $('<ul />', {
'class': 'options'
}).insertAfter($styledSelect);
// Insert a list item into the unordered list for each select
option
for (var i = 0; i < numberOfOptions; i++) {
$('<li />', {
text: $this.children('option').eq(i).text(),
rel: $this.children('option').eq(i).val()
}).appendTo($list);
}
// Cache the list items
var $listItems = $list.children('li');
// Show the unordered list when the styled div is clicked
(also hides it if the div is clicked again)
$styledSelect.click(function(e) {
e.stopPropagation();
$('div.styledSelect.active').each(function() {
$(this).removeClass('active').next('ul.options').hide();
});
$(this).toggleClass('active').next('ul.options').toggle(0,
function(){
$('ul.options').jScrollPane();
});
});
// Hides the unordered list when a list item is clicked and
updates the styled div to show the selected list item
// Updates the select element to have the value of the
equivalent option
$listItems.click(function(e) {
e.stopPropagation();
$styledSelect.text($(this).text()).removeClass('active');
$this.val($(this).attr('rel'));
$list.hide();
/* alert($this.val()); Uncomment this for demonstration! */
});
// Hides the unordered list when clicking outside of it
$(document).click(function() {
$styledSelect.removeClass('active');
$list.hide();
});
});
}
}
I recognize this is fairly complicated. At least for me it is... It's the
styling of the drop downs, which is throwing this off (I think). I have
tried to be as thorough as I can here so as to give you a better idea of
what the issue is and the problem I can't seem to conquer. The current
codebase is here:
http://www.summerserver.com/elance/1
Currently there are only school data for the states of IL and NE, so
choosing any other state should bring up the "No Schools Listed For Your
Area" selection.
I can't thank you all enough for helping me with this problem. I have
literally been trying to figure this out for the last 5 days, with no
luck. I've scoured the internet, and I'm truly at a loss... If there is
any information I've left out, please let me know and I'm more than happy
to provide it. Thank you again.