Monday, 30 September 2013

Can a user gain more than 2 rep for editing=?iso-8859-1?Q?=3F_=96_meta.stackoverflow.com?=

Can a user gain more than 2 rep for editing? – meta.stackoverflow.com

I edited this post and noticed my reputation change from 1466 to 1470 (i.e
+4). I went to check my reputation changes and found: Note: My reputation
later went down from 1470 to 1468, so it ...

How to find the derivative to this equation=?iso-8859-1?Q?=3F_=96_math.stackexchange.com?=

How to find the derivative to this equation? – math.stackexchange.com

Can someone please explain the steps to find the derivative of:
$$\dfrac1{2(\sqrt[3]{x^2})}$$ I know the answer is $\dfrac{-1}{3x^{5/3}}$
but I'm confused on how to get there. Sorry if this was hard …

how to check if a substring exist

how to check if a substring exist

I have the following string
msg="bbb. aaa.ccc. bbb.dddd. aaa.eee."
the separator between the sub strings is the space.
I want to check for example if "aaa." exist. in the above msg it does not
exist.
I want to check for example if "bbb." exist. in the above msg it exists.
I tried with grep, but grep works with newlines as the separators between
substrings
How to do that?

Appcache loading files from browser cache

Appcache loading files from browser cache

Circumstances
I'm building a webapp that will be used offline but will also be updated
regularily when it's used online. I'm invalidating the manifest server
side by adding a comment containing a tstamp and then reload the page
automatically via JS as soon as that change is detected. That worked
perfectly fine until now.



Problem
The above process is still executed completely, but for some reason,
everytime the browser tries to fetch the new files, chromes developer
tools tell me it's loaded "from cache" for every file. So only old files
are loaded, changes are ignored.
This occurs even if I deleted the browser cache before. Also, I'm already
using several anti-cache metas and changed IIS's invalidation header for
immediate invalidation.



Additional Info
When I delete the application cache manually the problem is solved. But it
will reoccur after some time (unfortunately i have no idea that triggers
this)

Sunday, 29 September 2013

Operator-- in Linked List

Operator-- in Linked List

I am trying to overload operator-- in a singly linked list.
I have a node class with: T info nodeType *link
Iterator class (which is a friend to singly linked list) with: nodeType
*first nodeType *current bool offTheEdge
Singly Linked List class with: *first *last
I have successfully modified the operator++ method and i am passing all
the tests. The code is as follows:
if(offTheEdge == true)
{
return *this;
}
else
{
if(current->link == NULL)
{
offTheEdge = true;
return *this;
}
else
{
current = current->link;
}
}
return *this;
My instructions are as follows: Same as the operator++, but going
backwards. Going backwards in a singly linked list means you have to start
from the beginning, and identify the node behind where this->current is.
Please help, no matter what i try i am unable to get the previous elements
and work backwards. Thank you!

Date Displaying with time in Application

Date Displaying with time in Application

I have a column with a date datatype in my sql-server database and I
insert this into it 1999-12-23. When i run the select query in my database
is shows the date as 1999-12-23 but when i connect the database to my c#
winform application and retrieve the date it displays as 1999-12-23
00:00:00 (i.e it displays date and time).
These are the codes i used
Create Table
CREATE TABLE Users.Personal
(
/*...Other Codes for the table this is the main problem*/
DateofReg date NOT NULL
)
Select query
SELECT * FROM Users.Personal
(This displays the date as 1999-12-23)
Connection to Database
private void RetrievePersonalDetails()
{
SqlConnection myConnection = new SqlConnection("server=AMESINLOLA;" +
"Trusted_Connection=yes;" +
"database=Crm_Db;");
myConnection.Open();
SqlCommand myCommand = myConnection.CreateCommand();
myCommand.CommandText = "SELECT * FROM Users.Personal WHERE
UniqueID='" + uniqueid + "'";
myCommand.CommandType = CommandType.Text;
SqlDataReader myReader = myCommand.ExecuteReader();
if (myReader.Read())
{
//Other codes inserting to textbox but this is the main problem
txtDor.Text = myReader["DateofReg"].ToString();
}
else
{
MessageBox.Show("Empty");
}
myConnection.Close();
myReader.Close();
}
(This displays the date as 1999-12-23 00:00:00)
Why is the date displaying with time in the application but displaying
well in the database and what can i do to display only date?

HTML5 tag order

HTML5 tag order

Does it matter which order you write HTML5 tags in?
For example could nav be written before header or section before nav?
I would say yes because the tag itself indicates what it is not the order.
Interested to hear what other people think, especially in terms of SEO.
S

How to write a style for a control that changes width of another control?

How to write a style for a control that changes width of another control?

Is there any way to write a style for a control that changes width of
another control?
<Style x:Key="SubMenuStyle" TargetType="Label">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="LightCyan"/>
<Style.Triggers>
<EventTrigger RoutedEvent="MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Menu"
Storyboard.TargetProperty="Width" To="0"
Duration="0:0:.5"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
This code leads to error "TargetName property cannot be set on a Style
Setter"
I know I can write codes below and it works:
<Label Name="Owners" Margin="0,1,0,0" MouseLeftButtonDown="SubMenuClicked"
Style="{StaticResource SubMenuStyle}">
<Label.Triggers>
<EventTrigger RoutedEvent="MouseLeftButtonDown">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Menu"
Storyboard.TargetProperty="Width" To="0"
Duration="0:0:.5"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Label.Triggers>
</Label>
but since I use this trigger in multiple labels I want to write it in a
style once
this is my code to define controls:
<Border Name="Menu" Grid.Column="2" Grid.Row="1" Width="0"
HorizontalAlignment="Right" BorderBrush="LightBlue" BorderThickness="2"
CornerRadius="2" Background="LightCyan">
<StackPanel Name="MenuPanel">
<Button Style="{StaticResource MenuButtonsStyle}">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="ListsMenu"
Storyboard.TargetProperty="Height"
To="86" Duration="0:0:.6"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<StackPanel Name="ListsMenu" Height="0">
<Label Name="Owners" Margin="0,1,0,0"
MouseLeftButtonDown="SubMenuClicked"
Style="{StaticResource SubMenuStyle}"/>
<Label Name="Contacts"
MouseLeftButtonDown="SubMenuClicked"
Style="{StaticResource SubMenuStyle}"/>
<Label Name="Groups"
MouseLeftButtonDown="SubMenuClicked"
Style="{StaticResource SubMenuStyle}"/>
</StackPanel>
</StackPanel>
</Border>

Saturday, 28 September 2013

How To Integrate Easypay.pt API With Opengateway

How To Integrate Easypay.pt API With Opengateway

I need to integrate Easypay.pt with opengateway so if any one know
somehting about this i would like to know if some one can help for this i
will appreciate thanks

How could I trigger func when another has been completed?

How could I trigger func when another has been completed?

I have forgoten my pass for stack overflow, so I had to log in with yahoo
:lol:
I think that this doubt is very simple to solve (not for me of course).
I am doing some jquery to collect latest tweets using twitter api, but I
am having some issues when calling two functions.
$(document).ready(function(){
JQTWEET.loadTweets();
});
This, is working ok, but then I want to call this function:
showHideTweets: function() {
alert("hola");
var ojeto = $(JQTWEET.appendTo).find(".item").first();
$(JQTWEET.appendTo).find(".item").first().css("display", "block");
},
Both functions are inside: jqtweet.js ...
loadTweets: function() {
var request;
// different JSON request {hash|user}
if (JQTWEET.search) {
request = {
q: JQTWEET.search,
count: JQTWEET.numTweets,
api: 'search_tweets'
}
} else {
request = {
q: JQTWEET.user,
count: JQTWEET.numTweets,
api: 'statuses_userTimeline'
}
}
$.ajax({
url: 'tweets.php',
type: 'POST',
dataType: 'json',
data: request,
success: function(data, textStatus, xhr) {
if (data.httpstatus == 200) {
if (JQTWEET.search) data = data.statuses;
var text, name, img;
try {
// append tweets into page
for (var i = 0; i < JQTWEET.numTweets; i++) {
img = '';
url = 'http://twitter.com/' + data[i].user.screen_name +
'/status/' + data[i].id_str;
try {
if (data[i].entities['media']) {
img = '<a href="' + url + '" target="_blank"><img
src="' + data[i].entities['media'][0].media_url + '"
/></a>';
}
} catch (e) {
//no media
}
var textoMostrar = JQTWEET.template.replace('{TEXT}',
JQTWEET.ify.clean(data[i].text) ).replace('{USER}',
data[i].user.screen_name).replace('{IMG}',
img).replace('{URL}', url );
/*.replace('{AGO}', JQTWEET.timeAgo(data[i].created_at) )
*/
//alert(JQTWEET.timeAgo(data[i].created_at));
$(JQTWEET.appendTo).append(
JQTWEET.template.replace('{TEXT}',
JQTWEET.ify.clean(data[i].text) )
.replace('{USER}', data[i].user.screen_name)
.replace('{NAME}', data[i].user.name)
.replace('{IMG}', img)
.replace('{PROFIMG}', data[i].user.profile_image_url)
/*.replace('{AGO}',
JQTWEET.timeAgo(data[i].created_at) )*/
.replace('{URL}', url )
);
if ( (JQTWEET.numTweets - 1) == i) {
$(JQTWEET.appendTo).find(".item").last().addClass("last");
}
}
} catch (e) {
//item is less than item count
}
if (JQTWEET.useGridalicious) {
//run grid-a-licious
$(JQTWEET.appendTo).gridalicious({
gutter: 13,
width: 200,
animate: true
});
}
} else alert('no data returned');
}
});
callback();
},
showHideTweets: function() {
alert("hola");
var ojeto = $(JQTWEET.appendTo).find(".item").first();
$(JQTWEET.appendTo).find(".item").first().css("display", "block");
},
The problem is that if a call functions like this:
$(document).ready(function(){
JQTWEET.loadTweets();
JQTWEET.showHideTweets();
});
Second function executes before tweets has been loaded, so it have nothing
to search in, because I can see the alert("hola") working, but Ojeto is 0.
I was trying to create some kind of callback inside loadTweets(); but I
could not.
Any help would be appreciated, thank you very much!

Sort a Single Column in Ascending or Descending Order using Perl

Sort a Single Column in Ascending or Descending Order using Perl

I am trying to sort the following price columns within a text file using
Perl.
Time Num Size Price Act | Act Price Size Num Time
11:30:12.957 1 3000 11.90 A | A 11.05 500 1 11:30:12.954
11:30:12.957 1 100 11.75 A | A 14.00 1676 3 11:30:12.957
I can read the text file into an array and sort it fine by row but I
cannot think of how to sort a specific column in Ascending or Descending
order? Tried reading in the text file one element at a time as follows to
start with and then attempting to sort the first Price Column in
descending order
use strict;
use warnings;
open(my $file_handle, '<', 'Data.txt') or die("Error: File cannot be
opend: $!");
my @words;
while (<$file_handle>) {
chomp;
@words = split(' ');
}

RESTful API authorisation through client

RESTful API authorisation through client

I'm currently writing an API to service my web APP. The APP is very client
side oriented, having javascript handle routing and rendering etc. in the
front end. To increase scalability the API is a completely separate
resource. Having this setup I need to continually call the API from the
front end to receive different types of data.

Some of the services exposed by the API should be accessible only to the
authorised user. So whenever users log in they are authorised server side
and an access_token is created which should be passed through the HTTP
Auth. header or as a query string for every request to a protected
service. My concern is that to automate the authorised requests and avoid
compromising the 'RESTfulness' of the API that i would need to store the
access_token in the client side cache short term and as a cookie for
returning users.

My question is, does it make sense to authorise in this fashion? I feel i
don't need to use oauth at this development stage because the API only
will be utilised by the APP itself. Moreover is it safe to store a 'long
lived' token in the client cache or in a cookie to persist the logged in
state?

Friday, 27 September 2013

QT write to tcpSocket fails with different thread error

QT write to tcpSocket fails with different thread error

I have created a simple threaded TCP server which collects 3 lines read
from the socket, and then tries to echo them back to the socket. The
function below crashes
void MyServer::echoCommand()
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
for ( QStringList::Iterator it = commandList.begin(); it !=
commandList.end(); ++it ) {
out << "Command: " << *it << endl;
}
out << endl;
tcpSocketPtr->write(block);
tcpSocketPtr->disconnectFromHost();
tcpSocketPtr->waitForDisconnected();
}
as soon as I try to write to the socket, with this error:
QObject: Cannot create children for a parent that is in a different
thread. (Parent is QNativeSocketEngine(0x7f19cc002720), parent's thread is
FortuneThread(0x25411d0), current thread is QThread(0x220ff90)
Since I create the tcpSocketPtr in the run() function, I know it is in the
same thread as this function. Why would the socket write operation fail?

How to generate maven parent pom file

How to generate maven parent pom file

How can I generate a parent pom file for my project? Looking to generate a
pom file like my-project-parent.pom with packaging as pom (not
jar/war/ear). Tried searching but can't find it. Only getting suggestions
to create jar/war/ear archetypes. Thanks.

Deploying an Qt app on virtual Android device

Deploying an Qt app on virtual Android device

I am trying for several days to simply deploy a qt 5 application to an
Android machine. I have done the following:
1. Install AVD Manager and use a template device(NexusS, 343RAM, 480x800)
2. Start the device with start->run->cmd-> "emulator-arm @NexusS",
emulator start without a problem.
3. Qt 5.1 creator->New Project->Qt quick2(built-in types)
->3.1.Select build kit: Android for arm(gcc 4.7, Qt 5.1.1)
4.In project settings says that mingw32-make is not found and I set it to
the path that I found in
qt(Qt5.1.1_Android_x86\Tools\mingw48_32\bin\mingw32-make.exe)
5.Build the app, it builds ok
6.Run the app.(the NexusS device remained open)
In the application Output I get:
E/libEGL ( 848): called unimplemented OpenGL ES API
E/libEGL ( 848): called unimplemented OpenGL ES API
W/Qt ( 848): opengl\qopenglshaderprogram.cpp:319 (bool
QOpenGLShaderPrivate::compile(QOpenGLShader*)):
QOpenGLShader::compile(Vertex): failed"
W/Qt ( 848): opengl\qopenglshaderprogram.cpp:319 (bool
QOpenGLShaderPrivate::compile(QOpenGLShader*)):
QOpenGLShader::compile(Fragment): failed
E/libEGL ( 848): called unimplemented OpenGL ES API
......
And the NexusS emulator enters the application, for ~1 sec displays the
name of the application and after that it displays a grey screen and
remaines in the grey screen until i exit the app.
Does anybody has any idea on what is the problem? Thank you very much!

Changing back button in iOS 7 disables swipe to navigate back

Changing back button in iOS 7 disables swipe to navigate back

I have an iOS 7 app where I am setting a custom back button like this:
UIImage *backButtonImage = [UIImage imageNamed:@"back-button"];
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[backButton setImage:backButtonImage forState:UIControlStateNormal];
backButton.frame = CGRectMake(0, 0, 20, 20);
[backButton addTarget:self
action:@selector(popViewController)
forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:backButton];
viewController.navigationItem.leftBarButtonItem = backBarButtonItem;
But this disables the iOS 7 "swipe left to right" gesture to navigate to
the previous controller. Does anyone know how I can set a custom button
and still keep this gesture enabled?

How to open default camera without showing chooser?

How to open default camera without showing chooser?

How to open default camera in your application? I don't want to open
chooser for it. I am using this intent android.media.action.IMAGE_CAPTURE
and calling activity for result. Everything is fine but apps like Line
Camera, Paper Camera are appearing in chooser with default camera app, i
dont want to show chooser for. Your attentions will be highly appreciated.

Reorder toolStrip items within the same toolStrip without holding the ALT Key pressed in C# VS 2008

Reorder toolStrip items within the same toolStrip without holding the ALT
Key pressed in C# VS 2008

I have a toolStrip1 placed on a Form (System.Windows.Forms) in C# and
added five toolStrip buttons to it. Now I wonder how to let the user
reorder these buttons by dragging them on another positions within the
toolStrip1. I set the toolStrip1.AllowItemReorder to true and the
AllowDrop to false as Microsoft in an article suggests.
Now shall be enabled automatic handling of item reorder in the toolStrip1.
But it doesn't work - only if I hold ALT-Key pressed the toolStrip1 reacts
to the reordering attempts by the user. Have I really to handle the
DragEvent, DragEnter, DragLeave myself to avoid holding the Alt Key during
reordering the items?
If it so, please give me an example how this events would look like on a
toolStrip with toolStripButtons, if I wish to drag the one item on a
different position within the toolStrip1 without holding any ALT Keys
(like Internet Explorer Favorites does).

Thursday, 26 September 2013

Creating a file in ssh client for golang

Creating a file in ssh client for golang

I have been struggling with this for around a week now. I have tried an
scp client for golang but was informed that the code was broken, and the
contributed "fixed" code didn't work as well. Anyway, i'm giving up on
file transferring and decided to just use ssh to create files and save on
the remote machine.
I successfully ran the ssh client in golang before going into scp route so
this may be a good solution.
In the ssh client it just executed the "ls" command and I am aware that
there is a "touch" command to create a file.
var b bytes.Buffer
session.Stdout = &b
if err := session.Run("ls"); err != nil {
panic("Failed to run: " + err.Error())
}
fmt.Println(b.String())
Ultimately what I would like to achieve is read a local file maybe through
os.Open(localfile) get it's contents then create a new file on the remote
machine with the "touch" command then edit it and stick in the contents
from the local file earlier. Or maybe there is a command that will make a
new file and prepare it's contents already?
This looked promising, although this code gives me an error but from my
observation, this would create a file called "testfile" with content of
"123456789\n" then I think upload it using session.Run("/usr/bin/scp -qrt
./");?
go func() {
w, _ := session.StdinPipe()
defer w.Close()
content := "123456789\n"
fmt.Fprintln(w, "C0644", len(content), "testfile")
fmt.Fprint(w, content)
fmt.Fprint(w, "\x00") // ´«ÊäÒÔ\x00½áÊø
}()
if err := session.Run("/usr/bin/scp -qrt ./"); err != nil {
panic("Failed to run: " + err.Error())
}
The above code can be found in my previous question about scp in golang
I'm not sure if this is what the code does, as I can't run it because of
the error. I've tried to find out what the /usr/bin/scp -qrt ./ command
does although couldn't exactly understand it.
I've been on this project for a week now and is very frustrating. Any help
would be greatly appreciated. Thanks in advance.

Wednesday, 25 September 2013

Nothing appears parsing a page

Nothing appears parsing a page

@Override
protected String doInBackground(String... params) {
try {
// NB: controllate di importare le classi giuste
// all'inizio ci deve essere org.jsoup
// ricavo l'html della pagina con user agent desktop (Chrome)
// e timeout 30000
Document doc = Jsoup.connect("http://www.androidiani.com/forum")
.userAgent("Mozilla/5.0 (Windows NT 6.2; WOW64)
AppleWebKit/537.22 (KHTML, like Gecko)
Chrome/25.0.1364.172 Safari/537.22")
.timeout(30000).get();
// prendo la tabella
// (con .first() ottengo il primo elemento, in questo caso
l'unico )
Element tabella =
doc.getElementsByClass("floatcontainer").first();
// prendo gli elementi che mi interessano dalla tabella
Elements sezioni = tabella.getElementsByClass("forumtable td");
for(Element sezione : sezioni)//per ogni sezione tra gli
elementi ricavati prima
{
//ricavo ogni riga nella sezione
Elements righe_sezione =
sezione.getElementsByClass("foruminfo");
for(Element riga : righe_sezione)
{
//prelevo la cella delle info
Element info =
riga.getElementsByClass("datacontainer").first();
// ricavo il titolo
// (con .text() ottengo il testo non formattato
String titolo =
info.getElementsByClass("forumtitle").first().text();
// ricavo la descrizione
// (uso .first() per essere sicuro che sia proprio la
descrizione
// e non i moderatori )
String descrizione =
info.getElementsByTag("p").first().text();
// inserisco nei rispettivi arraylist
titoli.add(titolo);
descrizioni.add(descrizione);
}
}
} catch (Exception e) {
// gestione dell'eccezione
// ad esempio mostrare messaggio di errore o altro (qui nel
logcat)
Log.e("ESEMPIO", "ERRORE NEL PARSING");
}
return null;
}
I'm trying for the first time, to parse a html page to display a list of
sections of a forum (androidiani.com/forum).but nothing appears and I
can't understand why.the code is on top.

Thursday, 19 September 2013

Jar command line returns IO error

Jar command line returns IO error

When I type jar cvfm file_name.jar manifest.txt *.class in command prompt
I get this error:
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:410)
at java.util.jar.Manifest.read(Manifest.java:199)
at java.util.jar.Manifest.<init>(Manifest.java:69)
at sun.tools.jar.Main.run(Main.java:172)
at sun.tools.jar.Main.main(Main.java:1177)
I've never gotten this error before and I can't find anything on it, what
does it mean?

Installing Flann for python

Installing Flann for python

Can someone please explain how to install flann step by step
I have cmake but keep on getting errors, its driving me crazy thanks and I
need to use flann as soon as possible

Signed powershell script not signed after source control

Signed powershell script not signed after source control

I'm trying to set up some powershell build scripts. I've got a self-signed
certificate that I can use to sign the script and get it to run with
AllSigned. The problem is, this doesn't carry across our scm (git).
Whenever I try to clone and run the script, or change it and revert, I get
the error that the file is unsigned.
File <> cannot be loaded. The file <> is not digitally signed. The script
will not execute on the system. ...
If I re-sign the script, the signature block changes and I can run it again.
Is there any way to either preserve the signing?

Is there a way to create a ssh tunnel on a local server and the client application connect to it and the data is send to the remote server

Is there a way to create a ssh tunnel on a local server and the client
application connect to it and the data is send to the remote server

I make a ssh tunnel(home server) to connect to a database server with
PostgreSQL(remote server), so far everything is fine when i use psql -h
localhost -p 5433 -U user dbname, but the problem is i want my client
application connect to the (home server) on the forward port that i use in
ssh tunnel a then the port will be redirect to the port on the (remote
server), but so far is not working.
Can anyone help me to accomplish this.

Executing dynamically generated Jquery code

Executing dynamically generated Jquery code

Can any body please tell me the difference between
$(".level3_td[data-levelid=" + 01 + "]") and
$(".level3_td[data-levelid=01]")
I am dynamically generating $(".level3_td[data-levelid=" + 01 + "]") but
it doesn't seem to find the item that I am trying to find. Then I tried to
paste it in the console and found that it wasn't able to find the DOM
object. After that I tried the 2nd one by hard coding
$(".level3_td[data-levelid=01]") and it worked. Can anybody please tell me
what's the difference between both of these and how may I get the first
one to work?
Thanks

How to set Unlimited scrollback for xfce4-terminal?

How to set Unlimited scrollback for xfce4-terminal?

Considering xubuntu 13.04 (based on xfce4.10 distribution), How to set
Unlimited scrollback for xfce4-terminal?

DTD - attributes with fixed default values

DTD - attributes with fixed default values

Lets say I have a snippet of a DTD declaration like this.
<!ELEMENT book ANY>
<!ATTLIST book genre #FIXED "fantasy">
Note that the genre attribute was declared with a fixed default value of
fantasy.
What exactly is the meaning of such a declaration? Two possible
interpretations come to mind:
A document is not valid unless each book element contain a genre attribute
with value fantasy.
A document is valid if each book element either contains a genre attribute
with value fantasy or does not contain the genre attribute at all.
I did not find a definitive answer in the DTD specification, even though
the second one seems more likely because of the following part:
Validity constraint: Fixed Attribute Default
If an attribute has a default value declared with the #FIXED keyword,
instances of that attribute MUST match the default value.

Wednesday, 18 September 2013

dependsOn in configuration phase

dependsOn in configuration phase

Is it possible to use dependencies in configuration phase? Lets imagine
that we've got main project and 2 subprojects. What I want to achieve is
that configuration phases of subprojects should be started before main
project configuration phase:
:projectA
task init {
println 'init projectA'
}
:projectB
task init {
println 'init projectB'
}
:mainProject
:projectC(dependsOn: subprojects.finAll{ println it }) {
println 'init main project'
}
The output of gradle command looks like this:
init main project
init projectA
init projectB
but I want it to be
init projectA
init projectB
init main project

Classic ASP - Displaying page numbers in pagination

Classic ASP - Displaying page numbers in pagination

Im a very very newbie at ASP, but im trying to work out pagination.
So far im displaying 10 images per page and then just displaying the
'prev' and 'next' links at the bottom of the page which works perfect.
But i would like to display the amount of pages in between the prev and
next links .. i cant seem to get anything working.
What i have so far is as follows, if someone could help out i would be
very grateful.
Dim page
pageSize = 10
page = Request("page")
if len(page) = 0 then page = 0
if not(isNumeric(page)) then page = 0
'Enter pagination for loop
start = page * pageSize
finish = start + pageSize - 1
for current = start to finish
if current < ubound(arrMultiImages) then
Response.Write "<img src='" & arrMultiImages(current,1) &
"'><br />" & vbCrLf
end if
next
if start > 0 then response.write "<a href=""" & urlPage & "?page=" &
page - 1 & """>Prev</a><br>"
if finish < ubound(arrMultiImages) then response.write "<a href=""" &
urlPage & "?page=" & page + 1 & """>Next</a>"

Conflicting eigen vector outputs between Matlab and Numpy

Conflicting eigen vector outputs between Matlab and Numpy

I am calculating eigenvectors in Matlab and Numpy, but getting different
results. I was under the impression there was only one set of eigenvectors
for a given matrix, however both of these outputs seem valid.
Here is my matlab code:
m = [ 1.4675 + 0.0000i 0.1669 + 1.2654i;
0.1669 - 1.2654i 1.3085 + 0.0000i]
[eig_vec,eig_val] = eig(m)
eig_val contains:
eig_val =
0.1092 0
0 2.6668
eig_vec contains:
eig_vec =
0.0896 + 0.6789i 0.0953 + 0.7225i
-0.7288 + 0.0000i 0.6848 + 0.0000i
Here is my python code:
m = np.array([[1.46753694+0.j, 0.16692111+1.26535838j],
[0.16692111-1.26535838j, 1.30851770+0.j]])
eig_val,eig_vec = linalg.eigh(m)
eig_val contains:
array([ 0.10923247, 2.66682217])
eig_vec contains:
array([[-0.68477170+0.j , -0.72875765+0.j ],
[ 0.09530915-0.72249836j, -0.08955653+0.67889021j]])
Can anyone explain why these outputs are different, it seems like each the
two different sets of eigenvectors are rotated versions of each other. Is
one set more correct that the other?

AngularJS Custom Directive Two Way Binding

AngularJS Custom Directive Two Way Binding

If I have an AngularJS directive without a template and I want it to set a
property on the current scope, what is the best way to do it?
For example, a directive that counts button clicks:
<button twoway="counter">Click Me</button>
<p>Click Count: {{ counter }}</p>
With a directive that assigns the click count to the expression in the two
way attribute:
.directive('twoway', [
'$parse',
function($parse) {
return {
scope: false,
link: function(scope, elem, attrs) {
elem.on('click', function() {
var current = scope.$eval(attrs.twoway) || 0;
$parse(attrs.twoway).assign(scope, ++current);
scope.$apply();
});
}
};
}
])
Is there a better way to do this? From what I've read, an isolated scope
would be overkill, but do I need a child scope? And is there a cleaner way
to write back to a scope variable defined in the directive attribute other
than using $parse. I just feel like I'm making this too difficult.
Full Plunker here.

Opencar 301 Redirecting issue with ?route=

Opencar 301 Redirecting issue with ?route=

I have restructure the website from WordPress to Opencart and so all URL
has been changed. I am trying to redirect my old products page with new
but it is not redirecting since OpenCart adding some weird ?route= and so
on..
Here is my .htaccess
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Redirect 301 /store/products/old-item-name/
http://store.mydomain.com/new-item-name
It is redirecting to this weird url
http://store.mydomain.com/new-item-name?_route_=store/products/old-item-name/
I appreciate your great help.. million thanks

increase button width with screen size

increase button width with screen size

I have 3 buttons inside a horizontal layout that fills the whole screen.
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="100dp"
android:layout_height="50dp"
android:text="1" </>
Button 2
android:layout_width="100dp"
android:layout_height="50dp"
android:text="2"</>
Button 3
android:layout_width="100dp"
android:layout_height="50dp"
android:text="3"</>
My 2 problems are, how can I make the right button stick to the right edge
of the screen without modifying it's width and how can I make button
number 2 fill the vaccant space between button 1 and 3 without modifying
its width?

Saving the window.getSelection().getRangeAt(0) at server end

Saving the window.getSelection().getRangeAt(0) at server end

How can we save the current selection at server end. Because result is
saved as the string when we return the result. I am using C# .net in the
server end. The problem is that when i save the current selection it will
return me the string. Then on restore of the selection it will treat him
like string and desired text not selected. How can i convert string back
to window range object.
Also i want to include one more thing here that if i save the
var range = window.getSelection().getRangeAt(0);
and then restore it on client side it is working perfectly.
Thanks in advance.

adding other library crashes other one

adding other library crashes other one

I try to add facebookSDK library to my project and everything crashed.
Firstly appear the problem that I have 3 version of
android-support-v4.jar, so I copied the file from my project and paste it
in other 2 direction. Then I get the problem with the action bar buttons
like something wrong was with these library, I remove all files and add it
one more time.
Now I have error in every single case
public boolean onOptionsItemSelected(MenuItem item)
{
Intent intent;
switch (item.getItemId())
{
here -> case R.id.Choice1:
intent= new Intent(this, Chooser.class);
startActivity(intent);
return true;
like he didn't see the items from menu. I have to add
android-support-v4.jar one more time ?

Tuesday, 17 September 2013

How to use sqlite in android from the basic?

How to use sqlite in android from the basic?

Can anyone brief about how to use sqlite database in android? Do I need to
install Sqlite database? Please provide some sample codes for the same.

android - better way for activity navigation

android - better way for activity navigation

My app having the 3 activities(A1,A2 and A3). The activities to be stay in
the background when it goes another activity. For some instance I should
redirect to A1 from A3. For this, I used the one Boolean counter. I set to
true in A3 for that instance. In A2 onresume i checked the boolean value
if it is true then i finished that activity(A2). finally A1 is onResume.
But i think this is one solution but it's not better solution. can anyone
suggest the better solution?
A3 Activity
status = true;// for some instance
A2 Activity
onResume() { if(status){finish();} }
//A1 is onResumed
thanks

Pass values of checkBox to controller action in asp.net mvc4

Pass values of checkBox to controller action in asp.net mvc4

I want to test if the checkbox is checked or not from my acion methon,
what i need is to pass checkbox value from view to controller
this is my view
@using (Html.BeginForm("Index", "Graphe"))
{
<table style="width: 100%;" border="1">
<tbody>
<tr>
<td>Responsable:</td>
<td><select id="Responsables" name="responsables"
><option>Selectionnez --</option></select></td>
<td><input id="responsable" name="checkResp" type="checkbox" />
</td>
</tr>
<tr> <td><input type="submit" value="Afficher"
id="ButtonSubmit"/></td>
<td><input class="button" id="ButtonReset" type="button"
value="Annuler" /></td>
</tr>
</tbody>
and i try that :
public ActionResult Index( string responsables, bool checkAct)
{
Highcharts chart = new Highcharts("chart");
if (responsables != null)
{
if (checkAct)
chart = Global();
else
chart = Resp(responsables);
}
else
chart = Global();
return View(chart);
}
, but i have this error :
Le dictionnaire de paramètres contient une entrée Null pour le paramètre «
checkAct » de type non Nullable « System.Boolean » pour la méthode «
System.Web.Mvc.ActionResult Index(System.String, System.String, Boolean) »
dans « Project.Controllers.GrapheController ». Un paramètre facultatif
doit être un type référence, un type Nullable ou être déclaré en tant que
paramètre facultatif. Nom du paramètre : parameters
Can you help me please !

what dick over at facebook erased my top 20 movie favorites? Don't touch my shit. Fix it

what dick over at facebook erased my top 20 movie favorites? Don't touch
my shit. Fix it

I created a new account, included a top 20 movie list, logged in today,
now the entire list is gone. the only list saved was my top 10 favorite
artists. don't touch my shit.

Why size of char is 4 bytes in memory and empty class is 1 byte

Why size of char is 4 bytes in memory and empty class is 1 byte

Good time of day!
I wrote some code, but I cannot understand some strange memory anomalies.
Could anybody, who has a proper knowledge in class memory using give me a
explanation?
My code:
#include <iostream>
using namespace std;
class O
{
O();
~O();
};
class A
{
public:
A();
~A();
void someFunc();
private:
int m_a;
};
class B: public A
{
public:
B();
virtual ~B();
private:
int m_b;
};
class C: public B
{
public:
C();
~C();
private:
char m_c;
};
int main()
{
cout << sizeof(char) << endl;
cout << sizeof(int) << endl;
cout << sizeof(O) << endl;
cout << sizeof(A) << endl;
cout << sizeof(B) << endl;
cout << sizeof(C) << endl;
cin.get();
return 0;
}
output:
1 //normal for char
4 //normal for int on x32
1 //why empty class occupies 1 byte?
4 //int m_a. Where is 1 byte?
12 //4B virtual function, 8B - m_a and m_b.
16 //char needs 1 byte. Why it gets 3 more?
Thank you for attention and answers )

Powershell to count cells in one column based on filter value

Powershell to count cells in one column based on filter value

My excel spread sheet has 11028 rows, and two columns.
First column has organizational unit, and second column has value.
In Excel, I can filter the first column so that there are about 100
different organizational units. And for each organizational unit, I want
to count (1) total number of rows (2) number of rows with value "Unknown".
If I do this manually, it will take forever, hence I am looking for some
sort of API in powershell that will allow me to count number of rows in
column B based on filter set in column A.
Is this even possible in Powershell?

How to make a calculator with carried out result from previous operations using arraylist and while loop in java?

How to make a calculator with carried out result from previous operations
using arraylist and while loop in java?

Trying to make a calculator using arrayList. user inserts integers and
then type add, subtract, multiply, or divide which perform mathematical
operations with those integer, and when user types done , programme ends.
Here is the programme:
import java.util.Scanner;
import java.util.ArrayList;
class just{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
ArrayList<Integer> element = new ArrayList<Integer>();
String operation;
int counter;
int result = 0;
while(true){
operation = (input.nextLine()).trim();
if(operation !=null && !operation.isEmpty()){
if (operation.equalsIgnoreCase("done")){ break;}
try{
counter = Integer.parseInt(operation);
element.add(counter);
}catch(NumberFormatException e){
if("add".equalsIgnoreCase(operation)){
for( int i : element){
result += i;
}
System.out.println("Result is: "+result);
element.clear();
}else if("subtract".equalsIgnoreCase(operation…
for( int i : element){
result -= i;
}
System.out.println("Result is: "+result);
element.clear();
}else if("multiply".equalsIgnoreCase(operation…
for( int i : element){
result *= i;
}
System.out.println("Result is: "+result);
element.clear();
}else if("divide".equalsIgnoreCase(operation))…
for( int i : element){
result /= i;
}
System.out.println("Result is: "+result);
element.clear();
}else{
System.out.println("Put some numbers, then type add , multiply, subtract
or divide to get the result, or type done to exit.");
}
}
}else{
System.out.println("Please either enter an integer or type done.");
}
}
}
}
Add and subtract work fine. Multiply and divide work ok also , but if the
first operation is multiply or divide the result becomes 0, because
initial value of variable result is 0, alternatively if i make different
variable for multiply and divide with initial value 1 instead of 0, it
still doesn't work , becasue if i make different variable for multiply and
divide then i have to multiply variable result with it(because of carried
out result of previously add and/or subtract, and as the initial value of
result is 0 it will now results 0 all the time. How to overcome this
problem?

Sunday, 15 September 2013

JsLint 'was used before it was defined'

JsLint 'was used before it was defined'

I am getting the following error from JsLint:
http://jslinterrors.com/a-was-used-before-it-was-defined/
But I have tried both solutions, and it keeps reporting me the same error,
any problem here? I have tried this:
/*global document:false */
$(document).ready(function () {
and this:
/*jslint browser:true */
$(document).ready(function () {

git checkout gets stuck at 87%

git checkout gets stuck at 87%

I'm facing an unusual issue...
I am trying to do a simple git clone of a remote repo on github to my
local system. When I attempt to clone using both git , https or http
protocol , the transfer always stops at 87% and the data transfer rate
drops to 0 bytes/s. My network connection is stable.
Any ideas?
This is what I'm running:
~/workspace/code$ git clone http://github.com/neo/ruby_koans.git
Cloning into 'ruby_koans'...
remote: Counting objects: 1523, done.
remote: Compressing objects: 100% (1061/1061), done.
Receiving objects: 87% (1333/1523), 2.17 MiB | 0 bytes/s

**Custom Message/Mail box for my social site**

**Custom Message/Mail box for my social site**

I am building a small social network for student's in my campus. It allows
users to view each other's profiles and optionally send them emails. But I
would rather create a messenger platform that enables the users to receive
the messages within the website(suc as the facebook's and twitters'
message/inbox ) as opposed to emails. Thing is, I have no clue where to
start :(.
Are there any credible resources i can read up on how to do this?
Thanks

Using GraphView Library for funtions to display multiple graphs

Using GraphView Library for funtions to display multiple graphs

i'm currently developing an android app for reading out multiple
sensorvalues via bluetooth and display them in a graph. When i stumbled
upon jjoe64's GraphViewLibrary, i knew this would fit my purposes
perfectly. But now I'm kind of stuck. Basically, i wrote a little function
that would generate and display the values of three sensors in 3 different
graphs one under the other. This works just fine when the acitivity is
started first, all three graphs a nicely rendered and displayed. But when
i want to update the graphs with different values using the
resetData()-method to render the new values in each graph, only the last
of the three graphs is updated. Obviously, because it's the last graph
generated using this rather simple function. My question is: Is there any
other elegant way to use a function like mine for generating and updating
all three graphs one after the other? I already tried to set the GraphView
variable back to null and different combinations of removing and adding
the view. Passing the function a individual GraphView-variable like
graphView1, graphView2... does also not work.
Here is the function:
private GraphView graphView;
private GraphViewSeries graphViewSerie;
private Boolean graphExisting = false;
...
public void makeGraphs (float[] valueArray, String heading, int graphId) {
String graphNumber = "graph"+graphId;
int resId = getResources().getIdentifier(graphNumber,"id",
getPackageName());
LinearLayout layout = (LinearLayout) findViewById(resId);
int numElements = valueArray.length;
GraphViewData[] data = new GraphViewData[numElements];
for (int c = 0; c<numElements; c++) {
data[c] = new GraphViewData(c+1, valueArray[c]);
Log.i(tag, "GraphView Graph"+graphId+": ["+(c+1)+"]
["+valueArray[c]+"].");
}
if (!graphExisting) {
// init temperature series data
graphView = new LineGraphView(
this // context
, heading // heading
);
graphViewSerie = new GraphViewSeries(data);
graphView.addSeries(graphViewSerie);
((LineGraphView) graphView).setDrawBackground(true);
graphView.getGraphViewStyle().setNumHorizontalLabels(numElements);
graphView.getGraphViewStyle().setNumVerticalLabels(5);
graphView.getGraphViewStyle().setTextSize(10);
layout.addView(graphView);
}
else {
//graphViewSerie = new GraphViewSeries(data);
//graphViewSerie.resetData(data);
graphViewSerie.resetData(new GraphViewData[] {
new GraphViewData(1, 1.2f)
, new GraphViewData(2, 1.4f)
, new GraphViewData(2.5, 1.5f) // another frequency
, new GraphViewData(3, 1.7f)
, new GraphViewData(4, 1.3f)
, new GraphViewData(5, 1.0f)
});
}
And this is the function-call depending on an previously generated array
(which is being monitored to be filled with the right values):
makeGraphs(graphData[0], "TempHistory", 1);
makeGraphs(graphData[1], "AirHistory", 2);
makeGraphs(graphData[2], "SensHistory", 3);
graphExisting = true;
Any help and / or any feedback in general is greatly appreciated! Lots of
thanks in advance!

Error trying to generate notes with reports package on R

Error trying to generate notes with reports package on R

I am trying to generate notes for the reports package
https://github.com/trinker/reports/ , and followed the steps from the
youtube video http://goo.gl/x9ulf0 . I did run the chunk Tyler has there
http://goo.gl/XHouuc but when I try to generate the notes i keep getting
the following error message:
> notes()
Error in value[[3L]](cond) :
Possible causes:
1) The main file directory is not set as the working directory
2) ~/ARTICLES/notes.xlsx or ~/ARTICLES/notes.csv does not exist
I then tried to set my working directory to different places and even to
move the ARTICLES directory to my home ~ directory, but i keep getting the
exact same message no matter where i place the wd. i read the source code
for the notes function but couldn't figure out where the problem might be.
the notes2 function also gives me the same error
here is my sessioninfo:
> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitcitations_0.4-7 bibtex_0.3-6 knitr_1.4.1
slidifyLibraries_0.3
[5] slidify_0.3.52 reports_0.2.0
loaded via a namespace (and not attached):
[1] digest_0.6.3 evaluate_0.4.7 formatR_0.9 httr_0.2
markdown_0.6.3
[6] RCurl_1.95-4.1 rJava_0.9-4 stringr_0.6.2 tools_3.0.1
whisker_0.3-2
[11] xlsx_0.5.1 xlsxjars_0.5.0 XML_3.95-0.2 xtable_1.7-1 yaml_2.1.8
any thoughts on what the problem might be?

The type org.springframework.context.ApplicationContextAware cannot be resolved. It is indirectly referenced from required .class files

The type org.springframework.context.ApplicationContextAware cannot be
resolved. It is indirectly referenced from required .class files

i have this code, and i have this compile eror:
The type org.springframework.context.ApplicationContextAware cannot be
resolved. It is indirectly referenced from required .class files (this
error is for last line of code)
i think i should add a jar file in build path, But i don't know what is it?
CamelContext context = new DefaultCamelContext();
ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL);
context.addComponent("test-jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

merge rows data in tsql

merge rows data in tsql

I have a table with one column that include this data
Data
'a'
'b'
'c'
'd'
'e'
'f'
How can I get combine Data column data in one varchar with cte?
result : 'abcdef'

Saturday, 14 September 2013

What is the best runtime complexity and spatial complexity of the 3 page sequence in a weblog exercise?

What is the best runtime complexity and spatial complexity of the 3 page
sequence in a weblog exercise?

I got a solution in java that works in runtime complexity: O(n^2) and in
spatial complexity: O(n^2), I use a map <Integer, List<String>> to hold
the ids, and the visited urls-List, that why I said the spatial complexity
is O(n^2) and when I am iterating that map the runtime complexity is
O(n^2) to make the sequences. Can someone give me a better idea on how to
solve this exercise? this is similar to this exercise thanks

Can JPA used with EE 5 servers

Can JPA used with EE 5 servers

Can JPA 2.1 be used in EE 5 servers? I want to benefit the option of
calling stored procedure capability. Iknow JPA can be used in a stand
alone but i woder if this will has any affect on transactions management
when used as a managed entity manager by the server as the specs specify
that only JPA 1 which must be supported

How can I set wget to download websites from a list, fixing a maximum byte quota for every website?

How can I set wget to download websites from a list, fixing a maximum byte
quota for every website?

I am trying to download a sampling of about 600kb of content from 500
websites that I have in a list.
I am using wget with the option -i to open the different urls, and with
the options -r -l2 to recursively download part of the websites.
Unfortunately, I cannot find a way to fix a maximum quota of kilobytes for
every website listed in the input file. I tried with -Q, but in this way
the quota regards the entire list, not the single listed urls.
Do you have some suggestions on how can I download documents and materials
for every site in the list, stopping the recursive retrieval and passing
to the following website when I have downloaded 600Kb from that website?
Just for knowledge, this is the command that I created:
wget -i listaq.txt -r -l 2 -R
pdf,jpeg,gif,css,txt,rft,doc,ppt,ps,dwf,klm,kmz,xls,js,mpeg,ico,png,svg,jpg
--cut-dirs=1 --cut-dirs=2 --cut-dirs=3 --cut-dirs=4 --cut-dirs=5
--cut-dirs=6 --cut-dirs=7 -Q 600K
The long list of -R pdf...jpg, and the series of --cut-dirs respectively
exclude the filetype that are not interesting for me, and stop the
creation of a directory tree. Everything is working, except for -Q 600K

Are there any Augmented Reality Unity toolkits that work with stereo cameras?

Are there any Augmented Reality Unity toolkits that work with stereo cameras?

I have experience with ARToolkit and Vuforia but want to include a dual
camera setup, do you know of any solutions (paid software is okay)?
Thankyou!

Alarm Clock that opens a webbrowser in python using Tkinter and displays time

Alarm Clock that opens a webbrowser in python using Tkinter and displays time

I'm very new to Python, and was trying to figure out a way of making an
alarm clock that could display time using Tkinter, and would open a url
when the desired time was reached. The issue as far as I can tell is that
the program skips the while loop, and so the url never opens. I know that
it can be improved in a lot of ways, but for now I really just want to
know how to get the url to open at the entered time.
from Tkinter import *
import time
import webbrowser
class App:
def __init__(self,master):
frame=Frame(master)
frame.pack()
self.w=Label(frame,text="",bg="red")
self.w.pack(side=LEFT)
self.entry=Entry(frame)
self.entry.pack(side=LEFT)
self.Button1=Button(frame,text="Enter Hour Here",command=self.hour)
self.Button1.pack(side=LEFT)
self.entry2=Entry(frame)
self.entry2.pack(side=LEFT)
self.Button2=Button(frame,text="Enter Minute
Here",command=self.minutes)
self.Button2.pack(side=LEFT)
def hour(self):
None
def minutes(self):
self.update_time()
def checktime(self):
alarmminute=self.entry2.get()
alarmhour=self.entry.get()
j=0
while j<1:
if time.localtime().tm_hour==alarmhour and
time.localtime().tm_min==alarmminute:
webbrowser.open("google.com")
else:
j=j+1
self.update_time()
def update_time(self):
now = time.strftime("%H:%M:%S")
self.w.config(text=now)
root.after(1000, self.checktime)
root=Tk()
app=App(root)
root.mainloop()

PHP Mailer array error

PHP Mailer array error

Having an annoying error with PHPMailer and can't figure what it's for
Mails send fine with it, but I get this:
Warning: in_array() expects parameter 2 to be array, boolean given in
/dir/class.phpmailer.php on line 574
Any idea's?

Recaptcha translation of labels

Recaptcha translation of labels

I am building custom recaptcha theme according to API documentation. In
the html I have:
<span class="recaptcha_only_if_image">Enter the words above:</span>
<span class="recaptcha_only_if_audio">Enter the numbers you hear:</span>
<input type="text" id="recaptcha_response_field"
name="recaptcha_response_field" />
I am using several locales and I am setting them like this:
<script type="text/javascript">
var RecaptchaOptions = {
lang : 'fr'
};
</script>
This translates most of the recaptcha but obviously it won't translate the
"Enter the words above:" label I shown above. I know that the default
recaptcha has all the translations for the labels. My question is: can I
somehow get those translations and apply them dynamically so I don't have
to store them on the server side?

Friday, 13 September 2013

How to style Scroller according to the PSD

How to style Scroller according to the PSD

I need to style my custom scroll bar, as of now i didn't get any solution
to achieve the desired results.

Bottom-Up-Parser: When to apply which reduction rule?

Bottom-Up-Parser: When to apply which reduction rule?

Let's take the following context-free grammar:
G = ( {Sum, Product, Number}, {decimal representations of a numbers, +,
*}, P, Sum)
Being P:
Sum ¨ Sum + Product
Sum ¨ Product
Product ¨ Product * Number
Product ¨ Number
Number ¨ decimal representation of a number
I am trying to parse expressions produced by this grammar with a
bottom-up-parser and a look-ahead-buffer (LAB) of length 1 (which
supposingly should do without guessing and back-tracking).
Now, given a stack and a LAB, there are often several possibilities of how
to reduce the stack or whether to reduce it at all or push another token.
Currently I use this decision tree:
If any top n tokens of the stack plus the LAB are the begining of the
right side of a rule, I push the next token onto the stack.
Otherwise, I reduce the maximum number of tokens on top of the stack. I.e.
if it is possible to reduce the topmost item and at the same time it is
possible to reduce the three top most items, I do the latter.
If no such reduction is possible, I push another token onto the stack.
Rinse and repeat.
This, seems (!) to work, but it requires an awful amount of rule
searching, finding matching prefixes, etc. No way this can run in O(NM).
What is the standard (and possibly only sensible) approach to decide
whether to reduce or push, and in case of reduction, which reduction to
apply?
Thank you in advance for your comments and answers.

ssrs repeating information on all pages

ssrs repeating information on all pages

I have a report with several row groups (since I can't post images here, a
screenshot can be seen at http://www.otssoftware.com/PackingSlip.png). I
need to be able to repeat everything in the red outlined area on every
page. I can't seem to find a way to do it. I've tried every suggestion I
can find including going into advanced mode and setting each field's
"Repeat on New Page" to "True".
Any help would be greatly appreciated. Thanks in advance.

Preview an audio file before Post

Preview an audio file before Post

I am new here apologies for any anomalies, The task I've been given is to
create an image/audio file upload or link page with preview before POST.
Not sure how late I am but just discovered Html5 audio tag, I'd like to
know how to preview an audio file on selection before upload.
here's my upload form:
<form id="attach" action="imageUpload.php" method="POST"
enctype="multipart/form-data" >
<h2>Select An Audio File to Upload</h2>
<br>
<div>
<input type='file' id="files" name="files" multiple
onchange="previewAudio(this);" />
<br>
<br>
<output id="list"></output>
<ul>
<li>
<label for="caption">Caption</label>
<input type="text" maxlength="30" name="caption" id="caption" />
</li>
<li>
<textarea id="desc" name="desc" rows="4"
cols="32">Description
</textarea>
</li>
</ul>
<audio controls>
<source id="test3" src="" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<input type="submit" value="Upload"/>
</div>
</form>
here is the code I've been playing with tryin to get it to preview:
function previewAudio(input)
{
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#test3').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
I'm most adamant that this should work but its not, any fixes or new
methods will be highly appreciated
Thanks in advance.

StackWalk64 returns weird addresses

StackWalk64 returns weird addresses

I use StackWalk64 to print a stack trace when the application crashes and
I noticed that sometimes it goes crazy and starts giving strange random
addresses at some point that belong neither to the application nor to any
of the DLLs loaded by it. For example:
#0 77c93e23 ntdll.dll
#1 77c93aa4 ntdll.dll
#2 00492ac1 *.exe
#3 00450689 *.exe
#4 0048c387 *.exe
#5 0048c4bc *.exe
#6 00488afd *.exe
#7 00495151 *.exe
#8 00495161 *.exe
#9 ffc30000 <--- the fun part begins here
#10 e8042474
#11 ffffffbf
#12 c01bd8f7
#13 4859d8f7 *.exe
#14 247c83c3 *.exe
#15 06740008 *.exe
#16 412d01c6 *.exe
#17 8b56d8f7
#18 f7d233f1
#19 83082474
#20 057609fa *.exe
#21 eb57c280
#22 30c28003 *.exe
#23 85411188
#24 c6e677c0
#25 8a490001
#26 88018a16
#27 06884911 *.exe
#28 72f13b46 *.exe
#29 55c35ef2 *.exe
#30 7d83ec8b *.exe
#31 458b0a10 *.exe
#32 850a7508
#33 6a067dc0 *.exe
#34 eb0a6a01
#35 ff006a05
#36 4d8b1075 *.exe
#37 ff9fe80c
#38 458bffff *.exe
#39 5d59590c *.exe
#40 244c8bc3 *.exe
#41 24448b08 *.exe
#42 ff006a04
#43 e8102474
#44 ffffff85
#45 1024448b *.exe
#46 e8c35959
I solved this by checking the most significant bit in the address and
discarding following frames. But is it really a good solution? I mean,
StackWal64 may be giving me those "incorrect" frames for a reason.

Angularjs minify best practice

Angularjs minify best practice

I'm reading
http://www.alexrothenberg.com/2013/02/11/the-magic-behind-angularjs-dependency-injection.html
and it turned out that angularjs dependency injection has problems if you
minify your javascript so I'm wondering if instead of
var MyController = function($scope, $http) {
$http.get('https://api.github.com/repos/angular/angular.js/commits')
.success(function(commits) {
$scope.commits = commits
})
}
you should use
var MyController = ['$scope', '$http', function($scope, $http) {
$http.get('https://api.github.com/repos/angular/angular.js/commits')
.success(function(commits) {
$scope.commits = commits
})
}]
all in all I thought the second snippet was for the old version of
angularjs but ....
Should I always use the inject way (the second one) ?

Thursday, 12 September 2013

Convert C# Structure to Json

Convert C# Structure to Json

I am working on C# structures and want to serialize it to json object but
the converted object should only contain value from the key: value
relationship please help hoe to achieve this

Is there a CRUD wizard for PHP?

Is there a CRUD wizard for PHP?

I have some work coming up and wanting to use php for it. It has been
suggested we use apex (oracle product) because it has wizards to easily
create CRUD functions for the data maintenance. The office will then use
Apex webapp while the public will be using the PHP based webapp.
Is there a CRUD wizard available for PHP (zend/symfony/etc) so that all
the website is in PHP? We're trying to move away from Apex as much as
possible.
Thanks

Dot product with arrays

Dot product with arrays

In class we had to write a small code using Dot Product to find the sum of
two arrays(array a and array b). I have written my code however when I run
it it does not it does not give me the answer. My professor said my loop
was wrong however I do not think it is. Is the part that says i<a.length
not allowed in a for loop parameter?
Here is my code:
> public class arrayExample {
> public static void main (String [] args) {
>
> int[] a = {1,2,2,1};
> int[] b = {1,2,2,1};
> int n = a.length;
>
> int sum = 0;
> for (int i = 0; i < a.length; i++) {
> sum += a[n] * b[n]; }
> System.out.println(sum);
> } }

iText PdfTextExtractor Missing Ligatures in Resulting Text

iText PdfTextExtractor Missing Ligatures in Resulting Text

I am attempting to take a pdf file and grab the text from it.
I found iText and have been using it and have had decent success. The one
problem I have remaining are ligatures.
At first I noticed that I was simply missing characters. After doing some
searches I came across this: http://support.itextpdf.com/node/25
Once I knew that it was ligatures I was missing, I began to search for
ways to solve the problem and haven't been able to come up with a solution
yet.
Here is my code:
import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfImportedPage;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.parser.PdfTextExtractor;
import com.itextpdf.text.pdf.parser.SimpleTextExtractionStrategy;
import com.itextpdf.text.pdf.parser.FilteredTextRenderListener;
import java.io.File;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Formatter;
import java.lang.StringBuilder;
public class ReadPdf {
private static String INPUTFILE =
"F:/Users/jmack/Webwork/Redglue_PDF/live/ADP/APR/ADP_41.pdf";
public static void writeTextFile(String fileName, String s) {
// s = s.replaceAll("\u0063\u006B", "just a test");
s = s.replaceAll("\uFB00", "ff");
s = s.replaceAll("\uFB01", "fi");
s = s.replaceAll("\uFB02", "fl");
s = s.replaceAll("\uFB03", "ffi");
s = s.replaceAll("\uFB04", "ffl");
s = s.replaceAll("\uFB05", "ft");
s = s.replaceAll("\uFB06", "st");
s = s.replaceAll("\u0132", "IJ");
s = s.replaceAll("\u0133", "ij");
FileWriter output = null;
try {
BufferedWriter writer = new BufferedWriter(new
OutputStreamWriter(new FileOutputStream(fileName), "UTF-8"));
writer.write(s);
writer.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (output != null) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public static void main(String[] args) {
try {
PdfReader reader = new PdfReader(INPUTFILE);
int n = reader.getNumberOfPages();
String str = PdfTextExtractor.getTextFromPage(reader, 1, new
SimpleTextExtractionStrategy());
writeTextFile("F:/Users/jmack/Webwork/Redglue_PDF/live/itext/read_test.txt",
str);
}
catch (Exception e) {
System.out.println(e);
}
}
}
In the PDF referenced above one line reads: part of its design difference
is a roofline
But when I run the Java class above the text output contains: part of its
design diference is a roofine
It is interesting to note that when I copy and paste from the PDF to
stackoverflow's textfield, it also looks like the second sentence with the
two ligatures "ff" and "fl" reduced to simply "f"s.
I am hoping that someone here can help me figure out how to catch the
ligatures and perhaps replaces them with the characters they represent, as
in the ligature "fl" being replaced with an actual "f" and a "l".
I ran some tests on the output from the PDFTextExtractor and attempted to
replace the ligature unicode characters with the actual characters, but
discovered that the unicode characters for those ligatures do not exist in
the value it returns.
It seems that it must be something in iText itself that is not reading
those ligatures correctly. I am hopeful that someone knows how to work
around that.
Thank you for any help you can give!
TLDR: Converting PDF to text with iText, had missing characters,
discovered they were ligatures, now I need to capture those ligatures, not
sure how to go about doing that.

Call to undefined method stdClass::count() in drupal 7

Call to undefined method stdClass::count() in drupal 7

I have an issue with a count function in drupal 7.
Code is :
$sql = "select count(Status) from TB_Aanmeldingen where (Status= 'Ja'
or Status='Ja, met kleine') and ID_Wedstrijd = :match";
$args = array(':match' => $match);
$row = db_query($sql, $args)->fetchObject();
$aantal = $row->count(Status);
Error message:
Call to undefined method stdClass::count()
Any help is very much appreciated!

Confusion about include_once in php

Confusion about include_once in php

Let's say I have the following files:
class/
|-- A.Class.php
|-- FactoryA.php
|-- Database.php
|-- Log.php
index.php
Which FactoryA.php is a Factory Class that creates obj A and can
create/read/update/delete A from database. While log.php is a class that
can simply creates log in a text file (ie output debug statement in
log.txt)
So, obviously FactoryA will require A.Class (to create the instance) and
Database (to interact with the mySQL database)
All classes need to access Log.php (for debugging purpose) and last but
not least index.php will create FactoryA instance.
So how am I going to include all files? should I:
do it in class? or
I should simply include files ONLY in index.php?

PHP trim entire words

PHP trim entire words

How to trim entire words from php string
like I dont want "foo", "bar", "mouse" words on left and "killed" on the
end of string.
So "fo awesome illed" would not be trimmed
But "foo awesome killed" => " awesome "
"killed awesome foo" not trimmed (killed trimmed from right, rest from left)
When I'm using ltrim($str, "foo"); it will trim any letter from "foo" -
"f" or "o"

Wednesday, 11 September 2013

Fetch User Details from Facebook and Twitter API using asp.net or javascript

Fetch User Details from Facebook and Twitter API using asp.net or javascript

I am trying to fetch all the user present inside a area(area means:Los
Angeles).
I want all the user facebook and twitter user present at Los Angeles.
I searched in Google found a link for facebook
https://graph.facebook.com/search?type=place&center=37.76,-122.427&distance=1000
this is showing all the places present inside that lag and lat with 1000m
displace from that area.
This is not showing all the user present inside that area.
Please help.
Thanks in advance.

wild card pattern matching algorithm

wild card pattern matching algorithm

i was trying to write code which does a validation for below wildcards:
'?' ------> The question mark indicates there is zero or one of the
preceding element. For example, colou?r matches both "color" and "colour".
'*' ------> The asterisk indicates there is zero or more of the preceding
element. For example, ab*c matches "ac", "abc", "abbc", "abbbc", and so
on.
'+' ------> The plus sign indicates there is one or more of the preceding
element. For example, ab+c matches "abc", "abbc", "abbbc", and so on, but
not "ac".
Can somebody please suggest a better algorithm in terms of time complexity
or innovative (DFA) for this. I know that java does provide pattern
matching with wild cards out of box but this is more of a exercise to
understand the crux by not using libraries. Thanks in advance.
Bug in the code is also welcome. Please find code below:
static boolean matches(String pattern, String text) {
if (text == null && pattern == null) {
return true;
}
if (text == null || pattern == null) {
return false;
}
if (text.equals(EMPTY_STRING) && pattern.equals(EMPTY_STRING)) {
return true;
}
if (text.equals(EMPTY_STRING) || pattern.equals(EMPTY_STRING)) {
return false;
}
char[] p = pattern.toCharArray();
char[] t = text.toCharArray();
int indexP1 = 0, indexP2 = 1, indexT = 0;
while (true) {
if (indexP1 == p.length && indexT == t.length){
return true;
} else if (indexP1 == p.length || indexT == t.length){
return false;
} else {
if (indexP2 < p.length && p[indexP2] == '*'){//case: a*
while (t[indexT] == p[indexP1]) {
indexT++;
if(indexT==t.length)break;
}
indexP1 = indexP1 + 2;
indexP2 = indexP2 + 2;
}
else if (indexP2 < p.length && p[indexP2] == '+') {//case: a+
if(t[indexT] != p[indexP1]){
return false;
}
while (t[indexT] == p[indexP1]) {
indexT++;
if(indexT==t.length)break;
}
indexP1 = indexP1 + 2;
indexP2 = indexP2 + 2;
}
else if (indexP2 < p.length && p[indexP2] == '?') {//case: a?
if (t[indexT] == p[indexP1]) {
indexT++;
}
indexP1 += 2;
indexP2 += 2;
} else {//case: a
if (t[indexT] != p[indexP1]) {
return false;
}
indexP1++;
indexP2++;
indexT++;
}
}
}
}

How to loop over files in different directories [R]

How to loop over files in different directories [R]

So, I've set up a loop... however, my files that I want to loop over (say
10) are all in different directories, but the pathway pattern is similar
except the number changes according to what family its up to.
For example, I have code written as this:
for(i in 1:numfiles) {
olddata <-
read.table(paste("/home/smith/Family",i,"/Family",i,".txt",sep="\t"),header=T)
Some code
write.table(newdata,(paste("/home/smith/Family",i,"/Family",i,"test.txt",sep=",",quote=F,row.names=F)
}
The only problem I have is that the family numbers don't go in numeric
order. Some are labeled just with a number (say, 2) and others have a
letter appended to that number (say, 1a)
First, it doesn't like "numfiles" and also I'm being told there is a extra
squiggly bracket at the end of my code. I have written a function in my
"some code" so not sure whether this could be the problem.
I'm relative new to R so any help will be greatly appreciated

Using phpunit in laravel 4 without /vendor/bin/

Using phpunit in laravel 4 without /vendor/bin/

I have installed phpunit in this instance of laravel using composer. The
files are present in the laravel/vendor/bin folder. when I run
vendor/bin/phpunit the example test runs. In all the tutorials I am
watching on unit testing in laravel the tutors simply run phpunit and it
runs the test.
In the laravel documentation it says that I should be able to simply run
phpunit to initiate the tests.
Is the documentation refering to phpunit being installed system wide and
do the tutors in the video simply have it installed system wide or am I
missing something?

delphi : How to do this without declaring 200 variables?

delphi : How to do this without declaring 200 variables?

I think that is a solve for my problem but I didn't find it, so...Can you
help me?
I want to do something like this:
var
a, b, c: string;
d: integer;
begin
a := stringgrid1.Cells[1,1];
b := stringgrid1.Cells[2,1];
c := stringgrid1.Cells[3,1];
d := strtoint(a) + strtoint(b) + strtoint(c);
stringgrid1.Cells[4,1] := inttostr(d);
end;
But what i need is to declare 200 string variables like in this example.
Is there anyway a 'shortcut' for this?

C - Changing the value of a variable outside of a function by passing pointers

C - Changing the value of a variable outside of a function by passing
pointers

I have an assignment in C to implement a abstract data type STACK. The
nature of the data type requires key structure that needs to have memory
allocated. My problem is that my instructor insists, for now, for the
initialization function to take in a pointer to the key structure. The
init() function will do nothing more than allocate the memory necessary
for the structure and set a field to zero, but the pointer that is passed
in needs to be assigned that memory location.
I can't think of a way to do this without either having the function
return a pointer, or to pass in a 2-star pointer - both of which are not
allowed. I know The function prototype must be (where stackT* is a pointer
to the key STACK data structure):
void init(stackT* stack);
I came up with this and it works fine:
void init(stackT** stack){
*stack = (stackT*) malloc(sizeof(stack));
(*stack)->count = 0;
return;
}
But it does not abide by the restrictions of the assignment.



So basically, how can I pass in the address of my original pointer to the
STACK data structure (&stackPtr) into a function that takes one-star
pointers as arguments and not get a pointer-type warning? Further, once
you change the arguments to (stackT* stack) the below code does not work,
even though I am passing the same thing either way - this is where my
problem is.
I thought it is REQUIRED to have the argument as a 2-star pointer if you
intend to pass in a pointer to a pointer .. the compiler must know what it
is dealing with when you dereference a pointer.
At any rate, I am not sure how to do this given the restrictions. In my
opinion this is only making it necessarily more difficult.

Can core.autocrlf be pushed to remote repository?

Can core.autocrlf be pushed to remote repository?

We have a centralized git repository that has a project only for Windows.
So we expect autocrlf be false.
However, somebody also works on cross platform project and set
git config --global core.autocrlf true
If they forget to change the setting for this windows git repository, then
they will commit unix ending file to it which is not expected by us.
So what i want is that: Regardless of how to set "git config --global
core.autocrlf", autocrlf are always false when clone that repo and no need
additional step to set it.
I know we can set core.autocrlf for local repo, but how it can be done for
the remote repository?

Tuesday, 10 September 2013

How to use one of many DATABASES setting in Django

How to use one of many DATABASES setting in Django

I have many identical database instances
localhost
test.server.com
test2.server.com
www.server.com
I want my Django settings to be able to chose any one of these with
minimal efforts. I don't want to keep multiple setting files.
I know I can configure them like this but how to switch to anyone other
than the default.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'HOST': 'localhost'
},
'test': {
'ENGINE': 'django.db.backends.sqlite3',
'HOST': 'test.server.com'
},
'test2': {
'ENGINE': 'django.db.backends.sqlite3',
'HOST': 'test2.server.com'
},
'production': {
'ENGINE': 'django.db.backends.sqlite3',
'HOST': 'www.server.com'
}
}

How to make the footer at the bottom of page?

How to make the footer at the bottom of page?

There's are some pages in my website which content is little,
the content height + footer height < one screen height
See the picture below:

So my question is how can I make the footer at the bottom of the page when
my content's height is not enough to cover the full page?
PS: I don't want the footer page fixed at the bottom.

format of bash script

format of bash script

I am getting errors when running this bash script. I have checked in all
manuals, it looks okay to me?
Help appreciated.
#!/bin/sh
HOME=/var/www
sleep 20
echo 'running' > $HOME/script-1-output.txt
if (-f $HOME/script-2-output.txt )
echo 'script-2 has run' >> $HOME/script-1-output.txt
else
echo 'script-2 has not run' >> $HOME/script-1-output.txt
fi
if (-f $HOME/script-3-output.txt)
echo 'script-3 has run' >> $HOME/script-1-output.txt
else
echo 'script-3 has not run' >> $HOME/script-1-output.txt
fi

MySQL Trigger on after insert

MySQL Trigger on after insert

I am new to MySQL. I have two tables total_loaner and available_loaner. I
am trying to create a trigger for every new row added in total_loaner, I
would to add that new row to available_loaner.
Here how my tables look like: CREATE TABLE total_loaner ( Kind varchar(10)
NOT NULL, Type varchar(10) NOT NULL, Sno varchar(10) NOT NULL, PRIMARY KEY
(Sno) )
CREATE TABLE available_loaner ( Kind varchar(10) NOT NULL, Type
varchar(10) NOT NULL, Sno varchar(10) NOT NULL, Status char(10) NOT NULL
DEFAULT '', PRIMARY KEY (Sno) )
My trigger does not seem to work. CREATE TRIGGER new_loaner_added AFTER
INSERT ON 'total_loaner' for each row begin INSERT INTO available_loaner
(Kind, Type, Sno, Status) Values (new.Kind, new.Type, new.Sno,
'Available'); END;

how to extract model object from form in template using django

how to extract model object from form in template using django

I have a formset. I want to extract out the id of the model object that
each form in the set represents.
This is because I plan to use a template tag to pass this id to a function
and return a related object.
How can I do this?

PHP code that worked on WAMP localhost but do not work on WebServer

PHP code that worked on WAMP localhost but do not work on WebServer

So, I built a website from scracth in PHP and used WAMP server for testing.
Everything is working on localhost, but after uploading the code to the
server everything that uses connection to database doesn't work.
I've checked if the POST in php is working on server, and it is working, I
changed some php.ini configurations after googling and I've done this:
register_globals = off; (was default)
allow_url_fopen = on; (was default)
magic_quotes_gpc = off; (was default)
Form Code
http://i.stack.imgur.com/Zrswb.png
The login function inside class
http://i.stack.imgur.com/Iz9wR.png
So, the problem is this, the function always returns the text highlighted
in the login function.
I write the login data, push the button Login, the post is working I've
tested with the same form and echo the post from the form on another page,
but the function never goes trough that first if.
Any help would be very appreciated because I don't think that is from the
function, I have another one that only does insert on the database and
does exactly the same thing. And whats weird is the data is passing trough
the pages correctly.
If anything on this is confuse please ask me so I can explain better.

Uncaught TypeError: Cannot call method 'getRootNode' of undefined

Uncaught TypeError: Cannot call method 'getRootNode' of undefined

I get this error above when trying to use a tree panel in my view. Here is
the code below;
List.js
Ext.define('AM.view.main.List', {
extend: 'Ext.tree.Panel',
alias: 'widget.adminlist',
requires: [
'Ext.tree.*',
'Ext.data.*'
],
xtype: 'tree-xml',
title: 'Admin Functions',
useArrows: true,
store: 'Admin',
initComponent: function() {
this.items = [
{
title: 'Admin Functions',
useArrows: true
}
];
this.callParent(arguments);
}
});
I have tried several variations but still get the same error. Here is the
store code below;
Admin.js
Ext.define('AM.store.Admin', {
extend: 'Ext.data.TreeStore',
root: {
expanded: true,
children: [
{
text: 'app',
children: [
{ leaf:true, text: 'Application.js' }
]
},
{
text: 'button',
expanded: true,
children: [
{ leaf:true, text: 'Button.js' },
{ leaf:true, text: 'Cycle.js' },
{ leaf:true, text: 'Split.js' }
]
},
{
text: 'container',
children: [
{ leaf:true, text: 'ButtonGroup.js' },
{ leaf:true, text: 'Container.js' },
{ leaf:true, text: 'Viewport.js' }
]
},
{
text: 'core',
children: [
{
text: 'dom',
children: [
{ leaf:true, text: 'Element.form.js' },
{ leaf:true, text: 'Element.static-more.js' }
]
}
]
},
{
text: 'dd',
children: [
{ leaf:true, text: 'DD.js' },
{ leaf:true, text: 'DDProxy.js' },
{ leaf:true, text: 'DDTarget.js' },
{ leaf:true, text: 'DragDrop.js' },
{ leaf:true, text: 'DragDropManager.js' },
{ leaf:true, text: 'DragSource.js' },
{ leaf:true, text: 'DragTracker.js' },
{ leaf:true, text: 'DragZone.js' },
{ leaf:true, text: 'DragTarget.js' },
{ leaf:true, text: 'DragZone.js' },
{ leaf:true, text: 'Registry.js' },
{ leaf:true, text: 'ScrollManager.js' },
{ leaf:true, text: 'StatusProxy.js' }
]
},
{
text: 'core',
children: [
{ leaf:true, text: 'Element.alignment.js' },
{ leaf:true, text: 'Element.anim.js' },
{ leaf:true, text: 'Element.dd.js' },
{ leaf:true, text: 'Element.fx.js' },
{ leaf:true, text: 'Element.js' },
{ leaf:true, text: 'Element.position.js' },
{ leaf:true, text: 'Element.scroll.js' },
{ leaf:true, text: 'Element.style.js' },
{ leaf:true, text: 'Element.traversal.js' },
{ leaf:true, text: 'Helper.js' },
{ leaf:true, text: 'Query.js' }
]
},
{ leaf:true, text: 'Action.js' },
{ leaf:true, text: 'Component.js' },
{ leaf:true, text: 'Editor.js' },
{ leaf:true, text: 'Img.js' },
{ leaf:true, text: 'Layer.js' },
{ leaf:true, text: 'LoadMask.js' },
{ leaf:true, text: 'ProgressBar.js' },
{ leaf:true, text: 'Shadow.js' },
{ leaf:true, text: 'ShadowPool.js' },
{ leaf:true, text: 'ZIndexManager.js' }
]
}
});
The controller code is also shown below;
Users.js
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
stores: [
'Users'
],
models: ['User'],
views: [
'main.Body',
'main.List',
'user.List',
'user.Edit'
],
init: function() {
this.control({
'mainbody > userlist': {
itemdblclick: this.editUser
},
'useredit button[action=save]': {
click: this.updateUser
}
});
},
editUser: function(grid, record) {
var view = Ext.widget('useredit');
view.down('form').loadRecord(record);
},
updateUser: function(button) {
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();
record.set(values);
win.close();
// synchronize the store after editing the record
this.getUsersStore().sync();
}
});
Also see the view where it is referenced below;
Body.js
Ext.define('AM.view.main.Body' ,{
extend: 'Ext.panel.Panel',
alias: 'widget.mainbody',
layout: 'border',
title: 'Administrator Profile',
width: 500,
height: 300,
store: ['Users', 'Admin'],
items: [{
title: 'South Region is resizable',
region: 'south', // position for region
xtype: 'panel',
height: 100,
split: true, // enable resizing
margins: '0 5 5 5'
},{
// xtype: 'panel' implied by default
region:'west',
xtype: 'adminlist',
margins: '5 0 0 5',
width: 200,
collapsible: true, // make collapsible
id: 'west-region-container',
layout: 'fit'
},{
title: 'Center Region',
region: 'center', // center region is required, no width/height
specified
xtype: 'userlist', //this is displaying the gridview
layout: 'fit',
margins: '5 5 0 0'
}]
});
Can someone please help me quick I am running out of ideas. Thank you.

spring2.5 javamailsender locked in javax.mail.service.connect

spring2.5 javamailsender locked in javax.mail.service.connect

I used spring 2.5 JavaMailSenderImpl to send mails. When I sent more than
10,000 mails, my program got blocked. This was the thread information
showed by jstack: "pool-4-thread-6" prio=10 tid=0x000000001b94d800
nid=0x44fb runnable [0x0000000041901000] java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method) at
java.net.SocketInputStream.read(SocketInputStream.java:150) at
java.net.SocketInputStream.read(SocketInputStream.java:121) at
com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97) at
java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at
java.io.BufferedInputStream.read(BufferedInputStream.java:254) - locked
<0x00000000e6e2d170> (a java.io.BufferedInputStream) at
com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75) at
com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260) at
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370) at
javax.mail.Service.connect(Service.java:275) at
org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.ja
va:389) at
org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java
:342) at
org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java
:338)
perhaps this program was blocked beceuse of the mail connectionCbut I
deployed out-time in the spring config file: 25000
25000 program should throw an exception when time exceed.but it still gets
blocked!! Is anyone who knows the reasons?