Saturday, 31 August 2013

Creating mkfifo with GNU Coreutils on Windows 7

Creating mkfifo with GNU Coreutils on Windows 7

Running GNU Coreutils on Windows 7 successfully. But cannot create a
mkfifo . From all the documentation I've seen, this should be possible.
I start with:
C:\Users\Ed>mkfifo pipe
and get:
mkfifo: cannot create fifo `pipe'
Any suggestions ?

Foreach only prints one value from array when using Ajax and onsubmitForm

Foreach only prints one value from array when using Ajax and onsubmitForm

I'm using Ajax to POST a value to another page without refreshing the
current page, but when I add the form HTML to the Foreach argument, it
will only print out one of the first of the 50 array values.
If I don't include onsubmit='return SubmitFor();' the Ajax script won't
run on click, but the Foreach will print all of the array values.
Here is my Foreach:
foreach ($Results as $arrResult) {
$IDstring = $arrResult['id_str'] ;
print("<form id='RT' onsubmit='return submitForm();'><input
type='hidden' name='id' value=$IDstring><input type='submit'
value='RT'></form></div>");
}
So I'm assuming that this onsubmit='return SubmitFor();' is the issue? Is
it not possible to include that with a PHP foreach? How can I get print to
print all the array values instead of the first result only?

Static reference to non-static method

Static reference to non-static method

We were given this specification for the PercolationStats class:
public class PercolationStats {
public PercolationStats(int N, int T) // perform T independent
computational experiments on an N-by-N grid
public double mean() // sample mean of percolation
threshold
public double stddev() // sample standard deviation
of percolation threshold
public double confidenceLo() // returns lower bound of the
95% confidence interval
public double confidenceHi() // returns upper bound of the
95% confidence interval
public static void main(String[] args) // test client, described below
}
and to implement mean() and stddev(), we had to use a special library that
has a class called StdStats:
public final class StdStats {
private StdStats() { }
/* All methods declared static. */
}
I tried to write something like
public mean() {
return StdStats.mean();
}
but I get the following error:
Cannot make a static reference to the non-static method mean() from the
type PercolationStats
Is there a way to get rid of this error without changing the
specification? I believe we're supposed to be able to make
PercolationStats objects. Thanks for any help!

Notice: Undefined index: topic_creator in

Notice: Undefined index: topic_creator in

How do i fix Notice: Undefined index: topic_creator in
C:\wamp\www\forum\view_category.php on line 313 Im getting two off this
errors. I did read on a page that putting @ infront of $topic_creator may
help, but i dident. I cant find a place that says how to fix it, so please
help me. Here is my code
include_once("connect.php");
$sql = "SELECT id FROM categories WHERE id='".$cid."' LIMIT 1";
$res = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($res) == 1) {
$sql2 = "SELECT * FROM topics WHERE category_id='".$cid."' ORDER BY
topic_reply_date DESC";
$res2 = mysql_query($sql2) or die(mysql_error());
if (mysql_num_rows($res2) > 0) {
while ($row = mysql_fetch_assoc($res)) {
**Line 313** if($row['topic_last_user']== "") { $last_user =
getusername($row['topic_creator']); } else { $last_user =
getusername($row['topic_creator']); }
$topics .="
<li class='category'><div class='left_cat'>
<a class='underline' href='view_topic.php?cid=".$cid."&tid=".$tid."'>
<div class='title'><i
class='icon-comment'></i>&nbsp;".$title."</div></a>
<div class='info'><i class='icon-comments
icon-1'></i>&nbsp;".topicreplies($cid, $tid)." Comments&nbsp;
&nbsp; &nbsp;<i class='icon-user icon-1'>
&nbsp;</i>".$last2_user."&nbsp; ".$last_user."

Data abstraction and binary methods in C++

Data abstraction and binary methods in C++

I'm new to C++, and am struggling with understanding data abstraction in
combination with binary methods such as equality. I'd like to define an
interface
class A {
public:
static A* Make(int);
virtual ~A() {};
virtual bool Eq(A*) = 0;
};
Using a factory pattern, I can hide the implementation:
class B : public A {
public:
B(int x) : x_(x) {}
bool Eq(A* a) {
return x_ == dynamic_cast<B*>(a)->x_;
}
private:
int x_;
};
A* A::Make(int x) {
return new B(x);
}
I can then use the abstraction:
A* a = A::Make(1);
A* b = A::Make(2);
if (a->Eq(b)) {
cout << "Yes!" << endl;
} else {
cout << "No!" << endl;
}
However, the dynamic cast sucks for a variety of reasons. The biggest
problem as I see it is that one can subclass A with C, and then pass an
object of type C to a->Eq, which would result in undefined behavior. I can
not figure out how to define a binary method such that the code has access
to the private members of both objects. My intuition is that this can be
done using a visitor pattern, but I wasn't able to come up with a
solution.
For those who know ML, I essentially want to do the following:
module A : sig
type t
val make: int -> t
val eq: t -> t -> bool
end = struct
type t = int
let make x = x
let eq x y = (x = y)
end

chrome is opening window.open() in full window mode.

chrome is opening window.open() in full window mode.

I am trying to open a new window in chrome,my problem is that chrome is
opening new window in full window mode. here is my code:
myWindow=window.open('http://google.com','name','toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=1,resizable=1,width=400,height=200');
it is working fine in mozilla. here is my jsfiddle ex. link:fiddle.
any answer will be recieved greatfully.

#EANF#

#EANF#

I am trying to achieve a simple rollover using image sprite. Unfortunately
i am having trouble in setting the image in the center.
the a class should be a 26px width and 21px in height. but facebook holder
should have 10px padding. It would be great if someone can look at my
codes?
HTML
<div class="holder">
<div class="facebook-holder">
<a class="ss facebook"
href="https://www.facebook.com/bendaggersdotcom" target="_blank"></a>
</div>
</div>
CSS
.holder{background:#a8a1a2; height: 50px; width:150px; padding:10px;}
.ss {display:block;height:21px;width:26px;background:
url(http://www.bendaggers.com/wp-content/uploads/2013/08/socials.png);margin-left:24px;float:left;
}
.facebook-holder { background:#FFF; max-width:46px; max-height:41px;
height:100%;vertical-align:baseline; text-align:center;}
.facebook-holder:hover {background:#3b5998;}
.facebook {width:26px;background-position: 0px center; background-repeat:
no-repeat; margin:0px; padding:10px;}
.facebook:hover {background-position:-26px; padding:10px;}
See it in action: http://jsfiddle.net/bendaggers/qQFVV/
What im trying to replicate:
http://readwrite.com/2013/08/29/it-has-been-a-bad-summer-for-apples-ios-7#_tid=popular-feed&_tact=click+%3A+A&_tval=2&_tlbl=Position%3A+2
(notice the share buttons at the right side of your screens? yeah, that's
right!)
By the way, feel free to modify everything if that would make it easier
for you.
Thank you very much!

Friday, 30 August 2013

Ruby on Rails post install error linux

Ruby on Rails post install error linux

Ok, I'm on Arch Linux and I installed, Ruby version 2.0.0, then proceeded
to install rails, I used Yaourt(I know should have used gems), but when
ever I try to run a rails command I get something like this:
rails new blog
/usr/lib/ruby/gems/2.0.0/gems/rails-
2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb:7:in
`<class:AppGenerator>': Use RbConfig instead of obsolete and deprecated
Config.
Among similar errors. Any idea what it is ?

Thursday, 29 August 2013

Chrome anda Applet not working in Chrome

Chrome anda Applet not working in Chrome

The question is, I'm trying to execute a javapplet in Chrome, but i've no
answer. The applet is executing in the browser, cause i see the popup
window "Execute this time", but after that nothing happens.
Chrome's the latest update.
Thanks and best tegards
Hernán

Greating a website on wordpress

Greating a website on wordpress

Hello i'm trying to make a simple website and i found out that wordpressis
the easiest way yo do now i already have a web hosing and a domain. now my
issue is that i want to make the website without being uploaded to
internet i wanna see it on my PC first and wait for sometime then release
it when the time comes. so i searched over the internet and all i found
that a ways on how to get a web hosting and connecting it to a wordpress i
don't need that i need to make a wordpress website keep it ready to
publish when i want>! any one have any idea?

Javscript weird logic behind

Javscript weird logic behind

I have tried some code in javascript and find out very weird/obscure logic
behind. Open chrome console for example and execute commads:
1) [] + []
2) [] +{}
3) {} + []
4) {} +{}
What you expect to see? I didn't expected something like that:
[] + []
answer: ""
[] +{}
answer: "[object Object]"
{} + []
answer: 0
{} +{}
answer: NaN
How javascript resolve those statements in such weird way?

Wednesday, 28 August 2013

Laravel seed MySQL from CSV

Laravel seed MySQL from CSV

I have several CSV files that I need to pull certain columns from to seed
MySQL table. How do I do this? Anyone have a code example to help me out.
I'm using Laravel 4.

Use mod_macro with environment variable

Use mod_macro with environment variable

Is it possible to use a macro with the value of a environment variable?
E.g.
<Macro setLog $name>
CustomLog "|cronolog -l /var/www/logs/$name/access.log
/var/www/logs/$name/%Y-%m-%d_access.log" logging
ErrorLog "|cronolog -l /var/www/logs/$name/error.log
/var/www/logs/$name/%Y-%m-%d_error.log"
</Macro>
SetEnvIf Host soup* path=soup
use setLog path
Which would 'print' the macro with path. Can I use the value for path? (in
this case soup)

Logging of commands from RunOnceEx

Logging of commands from RunOnceEx

Has anyone been able to have the windows log commands run from RunOnceEx,
as per http://support.microsoft.com/kb/310593 ?
I am referring to WinXP (+SP3) systems.

Tuesday, 27 August 2013

How to use MediaCodec API to invoke my custom decoder

How to use MediaCodec API to invoke my custom decoder

I have a video decoder which is ported to android and is successfully
working as a standalone application, however i want to integrate this code
to android multimedia framework. So, this code i have added to android's
media framework. That is i have added it to
root/media/libstagefright/codecs/myDecoder.
I have written an Android.mk under myDecoder folder that i have added and
placed the source code of my decoder and the compilation is successful and
i'm able to run it in an emulator.
Now, I have read that the new MediaCodec API in android allows us to
access and use the codecs available in android source.
My question is, now that i have integrated my decoder to android source code:
Is it possible for me to use my decoder to decode an input stream and
render it on the device screen?
My decoder has a Function that should be invoked for decoding a stream.
This function takes the path of the input stream as a parameter.
Should i modify something in my source code of the decoder to match the
requirements of the MediaCodec API.
Any help regarding the same will be really helpful to me.
-Regards.

How to make below style:

How to make below style:

I'd like to achieve something like this:

I've done this so far:

just wondering, how to make a purple area with little arrow button and
once user click it, it would invoke something.
Here is the html and css code I have:
<div class="searchy">
<input type="search" name="ttsearch" data-style="mini" data-theme="d"
placeholder="Search here..." class="fdSearch" value=""/>
</div>
CSS:
.searchy{
height: 60px;
background-color: #555;
color: #FFF;
margin-left: -15px;
margin-right: -15px;
}
.fdSearch{
background-color: white;
border-radius: 10px;
border: 5px solid #E5E4E2;
margin: 2px;
margin-left: -15px;
margin-right: -15px;
height: 40px;
vertical-align: middle;
padding: 20px;
margin-top: 15px;
width: 85%;
}

How to populate cells using VBA Vlookup

How to populate cells using VBA Vlookup

I'm trying to populate a worksheet cells with some fields from another
worksheet on the same workbook using VBA Vlookup and I'm stuck.
Worksheet users have the following data, the A1 is the Login and B1,
Number, is empty but the goal are to populate with the data from other
worksheet
Login Number
ffff
bbbb
cccc
dddd
eeee
aaaa
In the worksheet Data I've the following
Login Number
aaaa 1234
bbbb 1235
cccc 1236
dddd 1237
eeee 1238
ffff 1239
Currently I'm using this code
Sub VL()
Dim Login As Range
Set Login = Sheets("Users").Cells(2, 1)
Do Until Len(Login) = 0 'This will loop until the first empty cell
Login.Offset(0, 1).FormulaR1C1 =
Application.WorksheetFunction.VLookup(Sheets("Users").Range("$A:$A"),
[Table], 2, False)
Calculate
Login.Offset(0, 1).Value = Login.Offset(0, 1).Value
Set Login = Login.Offset(1, 0)
Loop
End Sub
and the result isn't the expected,
Login Name
ffff #N/A
bbbb
cccc
dddd
eeee
aaaa
I've search on the forum but don't find nothing to help me solving this.
thanks in advance
best regards
carlos

Limiting bandwidth with hashlimit (e.g. kb/s -- not connections!) doesn't work, though the man page says it should

Limiting bandwidth with hashlimit (e.g. kb/s -- not connections!) doesn't
work, though the man page says it should

According to the iptables-extensions man page hashlimit can do bandwidth
limiting:
"flows exceeding 512kbyte/s" =>
--hashlimit-mode srcip,dstip,srcport,dstport --hashlimit-above 512kb/s
However, when I try to specify a rule like that, 1) it doesn't limit my
bandwidth as I expect, 2) when I dump the rules with iptables-save, I get
the same entries no matter what I put after the number (kb/s, b/s, /sec,
something silly, or nothing at all):
# iptables -t filter -A it2net -s 10.5.2.43/32 -m hashlimit
--hashlimit-upto 8kb/s --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
# iptables -t filter -A it2net -s 10.5.2.44/32 -m hashlimit
--hashlimit-upto 8b/s --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
# iptables -t filter -A it2net -s 10.5.2.45/32 -m hashlimit
--hashlimit-upto 8 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
# iptables -t filter -A it2net -s 10.5.2.46/32 -m hashlimit
--hashlimit-upto 8000 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
# iptables -t filter -A it2net -s 10.5.2.47/32 -m hashlimit
--hashlimit-upto 8000b --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
# iptables -t filter -A it2net -s 10.5.2.48/32 -m hashlimit
--hashlimit-upto 8000xb --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
# iptables -t filter -A it2net -s 10.5.2.49/32 -m hashlimit
--hashlimit-upto 8000kb --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
And the relevant parts of the dump:
-A it2net -s 10.5.2.43/32 -m hashlimit --hashlimit-upto 8/sec
--hashlimit-burst 5 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
-A it2net -s 10.5.2.44/32 -m hashlimit --hashlimit-upto 8/sec
--hashlimit-burst 5 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
-A it2net -s 10.5.2.45/32 -m hashlimit --hashlimit-upto 8/sec
--hashlimit-burst 5 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
-A it2net -s 10.5.2.46/32 -m hashlimit --hashlimit-upto 10000/sec
--hashlimit-burst 5 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
-A it2net -s 10.5.2.47/32 -m hashlimit --hashlimit-upto 10000/sec
--hashlimit-burst 5 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
-A it2net -s 10.5.2.48/32 -m hashlimit --hashlimit-upto 10000/sec
--hashlimit-burst 5 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
-A it2net -s 10.5.2.49/32 -m hashlimit --hashlimit-upto 10000/sec
--hashlimit-burst 5 --hashlimit-mode dstip --hashlimit-name test
--hashlimit-htable-expire 3600000 -j ACCEPT
(let's not worry about why 8000 is rounded up to 10000 ... or, should we?)
Any ideas what I'm missing? I would need to limit the bandwidth use of
about 100 constantly changing users individually, so each would have only
a very low limit to allow basic services (especially stupid mobile apps
that can't use proxy authentication), but require signing in for
everything else.

Powershell scripting for find the values

Powershell scripting for find the values

I have the below data in a txt file with interface value
i need a powershell script for this
interface Eth101/1/1
description wwwwwwww
switchport mode trunk
switchport trunk allowed vlan 1
switchport trunk allowed vlan add 2,3,4,5
switchport fast enable
interface Eth102/1/11
description yyyyyyyy
switchport mode access
switchport access vlan 101 !
from this i need to create an output with gives interface and description
and vlan id values
to an excel sheet
output need be as below
Interface Description Vlan Id
Eth101/1/1 wwwwwwww 1,2,3,4,5 Eth102/1/11 yyyyyyyy 101
this should be the output for all the interfaces in a single excel
any help is highly appreciated
TIA

to retrieve already stored image from database in android

to retrieve already stored image from database in android

I am new to android. I would like to know how to retrieve stored images
from a database. No add or delete functionality. I want to retrieve
already stored images from a database. Please help me achieve this.

creating custom UITableViewCell?

creating custom UITableViewCell?

I Know this question is asked again and again here, but did not find any
solutions for my problem.I'm creating a Custom UITableViewCell through xib
and trying to load it.in my VC called ACSummaryVC
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"SimpleTableCell";
AcSummaryCell *cell = (AcSummaryCell *)[tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle]
loadNibNamed:@"AcSummaryCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
}
AcSummaryCell is a subclass of UITableViewCelland it has an UILabel
IBOutlate called acLabel.when i compile the project i get following error-
`Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<ACSummaryVC 0x71465c0> setValue:forUndefinedKey:]: this class
is not key value coding-compliant for the key acLabel.'`
i have created connection of acLabel in AcSummayCell class, but i'm
getting error from ACSummaryVC? What i'm doing wrong?
Edit:- according to Mani's answer bellow i'm connecting outlate to file
owner and it is wrong instead i've to connect outlate to custom cell.but
when i try this i did not get my outlate to connect with instead i'm
getting like this image -
Now question is How to connect my outlate with custom cell?

Monday, 26 August 2013

Issue making post request to Facebook open graph API

Issue making post request to Facebook open graph API

I'm trying to post on an Event wall on a user's behalf. I have the
publish_stream permission but am having trouble making a post request.
This doesn't work:
$http.post("#{url}/#{id}/feed", {message: message, access_token: token})
But these do:
1)
$http.get("#{url}/#{id}/feed?method=POST&message=#{message}&access_token=#{token}")
2)
$http.post "#{url}/#{id}/feed?access_token=#{token}&message=#{message}"
Any idea why the Facebook API would accept the latter but reject the post
method (like the API requires)? The error I get with the $http.post is
"this method requires an access_token"

@@Watch@@ Manchester United vs Chelsea Live Football Stream

@@Watch@@ Manchester United vs Chelsea Live Football Stream

Watch Manchester United vs Chelsea Live stream EPL
http://sportshdtv.dimitapapers.com/2013/08/26/watch-manchester-united-vs-chelsea-live-stream-epl/
http://sportshdtv.dimitapapers.com/2013/08/26/watch-manchester-united-vs-chelsea-live-stream-epl/
Match Schedule<<< Competition: England – Premier League Matches-2013 Team:
Manchester United vs Chelsea live Date : Today Live, Kick Off Time :
01:00(GMT +6)
The Following TV are Broadcast Bwin, Canal Plus France, ESPN Caribbean,
ESPN Deportes, ESPN HD Brasil, ESPN2, ESPN3 USA, Fox Sports Basico, Fox
Sports Premium, Sky 3D, Sky Sport 1 Germany, Sky Sports 2, Sky Sports HD
2, Sport.TV1, SuperSport 3, SuperSport HD 3, SuperSport Maximo many tv are
broadcast Manchester United vs Chelsea live soccer Game Video tv channel
on pc CLICK HERE TO WATCH
Manchester United vs Chelsea live, Manchester United vs Chelsea live
online, Manchester United vs Chelsea live online on pc, Manchester United
vs Chelsea live online on your pc or laptop, Manchester United vs Chelsea
live stream. this live play just click here. watch and enjoy Manchester
United vs Chelsea live streaming live online boroadcast here, You can
enjoy the action live streaming on your PC via Internet tv channels.
Manchester United vs Chelsea live match live video.

I would like to repeat two sets of characters to achieve a form

I would like to repeat two sets of characters to achieve a form

I would like to achieve this form:
---*---
--***--
-*****-
*******
So far, i've tried it like this:
$linii = 7;
for($i=0; $i<=$linii; $i+=2) {
echo str_repeat("*", $i)."<br/>";
}
?>
I don't really know where to go from here.

onYouTubePlayerReady not working in Safari

onYouTubePlayerReady not working in Safari

var ytplayer = [];
function onYouTubePlayerReady(playerId) {
ytplayer[playerId] = document.getElementById("myytplayer" + playerId);
ytplayer[playerId].addEventListener("onStateChange", "onStateChange" +
playerId);
$('.ytwrapper').eq(0).css('z-index', 25);
}
...
$.browser.device =
(/android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent.toLowerCase()));
if (!$.browser.device) {
var params = {allowScriptAccess: "always", wmode: "opaque"};
swfobject.embedSWF("http://www.youtube.com/v/pIz2K3ArrWk?enablejsapi=1&playerapiid=0",
"ytapiplayer", "978", "248", "8", null, null, params, { id:
"myytplayer0" });
swfobject.embedSWF("http://www.youtube.com/v/1_uMQTw7v2g?enablejsapi=1&playerapiid=1",
"ytapiplayer2", "978", "248", "8", null, null, params, { id:
"myytplayer1" });
swfobject.embedSWF("http://www.youtube.com/v/QN6LSyqihSY?enablejsapi=1&playerapiid=2",
"ytapiplayer3", "978", "248", "8", null, null, params, { id:
"myytplayer2" });
}
Please help me with this issue. The swfobject is v. 2.2. Now the event
fires everywhere in desktop browsers except Safari.
Can anyone help me pinpoint the problem?

Pedagogy question: How do you convincingly explain the role of variable conventions in math=?iso-8859-1?Q?=3F_=96_mathoverflow.net?=

Pedagogy question: How do you convincingly explain the role of variable
conventions in math? – mathoverflow.net

I will be beginning a freshman calculus course tomorrow. Here is a common
problem, illustrated by example. I plan to make the following definition:
If you start at $(1, 0)$ on the unit circle, …

java- JFileChooser- Get the type of selected file by JFileChooser

java- JFileChooser- Get the type of selected file by JFileChooser

I am writing a program to select file from the JFileChooser. How can i get
the file type (e.g. is that file is ".txt" or ".html" of ".dat", etc.. ) i
have the following code. what should i have to add extra lines?
JFileChooser choice = new JFileChooser();
int option = choice.showOpenDialog(this);
if (option == JFileChooser.APPROVE_OPTION)
{
String path=choice.getSelectedFile().getAbsolutePath();
String filename=choice.getSelectedFile().getName();
System.out.println(path);
listModel.addElement(path);
System.out.println(filename);
}

Sunday, 25 August 2013

were + past tense verb versus are + past tense verb?

were + past tense verb versus are + past tense verb?

Which is correct?
a. The Justice Secretary said prosecutors were allowed to join the event.
b. The Justice Secretary said prosecutors are allowed to join the event.
Given that this news was posted on 11am of that day, while the event was
from 9am to 2pm.
http://newsinfo.inquirer.net/474633/prosecutors-allowed-to-join-million-people-march-de-lima
So when is it proper to use 'are + past tense verb' and 'were + past tense
verb'?

can't authenticate using FOSUserBundle when using FOSOAuthServerBundle

can't authenticate using FOSUserBundle when using FOSOAuthServerBundle

I've had the following in my config.yml:
oauth_authorize:
pattern: ^/oauth/v2/auth
form_login:
provider: fos_userbundle
check_path: /oauth/v2/auth_login_check
login_path: /oauth/v2/auth_login
anonymous: true
however when ever I try to login to:
http://local.acme/oauth/v2/auth?client_id=3_5ph2tuyxay048ksksgko4ocs4ss8kssws8k8osgk8o08go0goc&response_type=code&redirect_uri=http%3A%2F%2Fwww.google.com
it doesn't prompt me/redirect me to the /oauth/v2/auth_login first instead
it directly asks me for permission to grant to the client. What am I
possibly doing wrong?

Bounded Context in EntityFramework CodeFirst

Bounded Context in EntityFramework CodeFirst

I have searched a lot about bounded context and I know it is a pattern in
Domain Driven Design, and it is for dividing our application into smaller
models using database context but it makes me a little bit confuse. in
fact I don't know what exactly it does? and what are benefits of using
this pattern
please help me to understand this pattern.
Thanks in Advanced

[ Singles & Dating ] Open Question : Why is my GF so hard to deal with?

[ Singles & Dating ] Open Question : Why is my GF so hard to deal with?

She puts value on education. She tries too hard to be everything. She
focuses everything more on her critical thinking skills rather than
feeling/emotion. So when dealing with her, she's always over-thinking.
analytical, objective, intolerant, harsh, sarcastic, avoidant, etc. I try
to reason with her/communicate and express myself and she says I'm trying
to cause arguments. But she wont listen to my points, and she'll come with
her own points and expect me to understand them, and then gets mad at me
when I don't and she tries to make me feel bad for it - is it because she
wants to be in control? She'll blame me for everything and try to play me
back at my own "game" but I have NO games to play. She does this to avoid
everything instead of facing what I have to say to her. Then she
constantly tries to tell me her character is bad and she's very uncaring
and selfish. When I met her, I loved her sense of humor and her
intelligence. I understood her from the start. She wanted me to help her
before our relationship because she was emotionally broken, damaged, etc -
supposedly. I put in so much to care and support her and she went to a
psychologist twice but quit. She told me lastnight that I have a wonderful
character and she's envious of my qualities. She said I can draw, I have
talent, I'm craft, perserverant, I care about people, I'm a good man, I
remind her of her brother in alot of ways, I'm sweet and kind, I can read
people so well, I'm patient and understanding, I accept people and I am
nurturing, I'm sweet with my family, I have a great sense of humor, that
I'm sensitive and sometimes a big wimp, and that I touch her deeply
emotionally and she's been so emotional since being with me. She said I
was very intelligent and loved that about me. She said that the only thing
that was bad but she still liked was how I can be very craft and cunning,
and that it takes brains to flip people around and it takes skill. She
see's me with my friends doing this, and she's scared of being played so
she turns into a huge bossy controlling *****, bug shes already this by
nature - it's in her personality. She comes from a broken home and moved
around alot as a kid because of instability. She lives outside of her
native country and hasnt seen her father in 6 years he emotionally
abandoned her. She has no social skills and doesn't have any friends. I
tried and tried helping every aspect of her personality and it just caused
complications all throughout the entire process. She would try to be
strong-minded, and she would negate all my help and make me feel useless.
She wouldn't be honest with herself and she still is this way.She NEVER
admits things to herself. She can be so critical though, and she doesn't
realize that it just causes anxiety for her and creates misery. Everything
has a meaning to her... EVERYTHING. She needs to relax but wont listen to
me.... she makes excuses and says she likes being that way.... and how
important it is to be that way. She seems to be over-compensating for
something she has lacked. She has absolutely no knowledge of people
problems... she has no understanding of human behavior. She can be so
naive and gullible. She can be impulsive and alot of times talks from her
*** but says things with so much conviction. A few months ago, she
hitch-hiked a ride to class from some stranger - that's how naive she is.

Tetris-like wall-kicking not working

Tetris-like wall-kicking not working

So I'm making a falling-block puzzle game. It's not a Tetris clone, but
the block clusters move in a similar fashion. I want to make it so that if
you rotate against a wall, or against another piece, it pushes you back
and rotates the cluster if it's possible, or does nothing if not. This is
called wall-kicking in Tetris, I think. Problem is, I can't seem to get it
to work. The simplest algorithm I've heard of is to check if it's possible
to move left or right. If you can do either, then rotate the block. But
then I can't rotate at the edge of the grid.
I have the rotation itself working (both on-screen and the grid position
representation), and I can stop a cluster from moving if it's at the edge
of the grid. It's rotating at the edges that gets me.
These are the assumptions my game makes;
There are many types of individual blocks, so hard-coding anything
probably isn't an option.
Each block cluster has exactly three connected blocks, with two possible
configurations (assuming rotations are considered equal); I-like and
J-like.
For each block cluster, there is one block in the center that the other
two rotate around. Assuming no wall-kicking, this one never moves when the
cluster is rotated.
The playing field is eight blocks wide and thirteen blocks tall.
After the cluster lands, the blocks will fall down Puyo-Puyo style, i.e.
you won't have to navigate around hanging pieces like in Tetris.
This is my code, written in Haxe;
class BlockMovementSystem extends System {
private var cluster : BlockCluster;
private var delay : TimeDelay;
private var grid : EntityGrid;
private var nextAction : NextAction;
public function new(grid:EntityGrid, cluster:Entity) {
super();
this.cluster = cluster.get(BlockCluster);
this.delay = cluster.get(TimeDelay);
this.grid = grid;
this.nextAction = NextAction.None;
}
public override function update(time:Float) : Void {
var center : Entity = this.cluster.blocks[1];
var blockSize : GridMotion = center.get(GridMotion);
switch (this.nextAction) {
case MoveLeft:
if (this.canMoveLeft()) {
for (i in this.cluster.blocks) {
var gpos : GridPosition = i.get(GridPosition);
var block_left : Entity = {
if (gpos.x > 0)
this.grid.entities.get(gpos.x - 1, gpos.y)
else
null;
};
if (gpos.x > 0 || block_left != null) {
var pos : Positionable = i.get(Positionable);
pos.position.x -= blockSize.cell_size.x;
gpos.x -= 1;
}
}
}
case MoveRight:
if (this.canMoveRight()) {
for (i in this.cluster.blocks) {
var gpos : GridPosition = i.get(GridPosition);
var block_right : Entity = {
if (gpos.x < Constants.GRID_WIDTH - 1)
this.grid.entities.get(gpos.x + 1, gpos.y)
else
null;
};
if (gpos.x < Constants.GRID_WIDTH - 1 &&
block_right == null) {
var pos : Positionable = i.get(Positionable);
pos.position.x += blockSize.cell_size.x;
gpos.x += 1;
}
}
}
case Rotate:
if (this.canMoveRight() || this.canMoveLeft()) {
var origin : Vector = center.get(Positionable).position;
var origincell : GridPosition = center.get(GridPosition);
for (i in this.cluster.blocks) {
if (i != center) {
var p : Vector = i.get(Positionable).position;
var x : Float = origin.x - (origin.y - p.y);
var y : Float = origin.y - (p.x - origin.x);
p.x = x;
p.y = y;
var g : GridPosition = i.get(GridPosition);
var gx : Int = origincell.x - (origincell.y -
g.y);
var gy : Int = origincell.y - (g.x -
origincell.x);
g.x = gx;
g.y = gy;
}
}
}
}
}
private function canMoveLeft() : Bool {
for (i in this.cluster.blocks) {
var gpos : GridPosition = i.get(GridPosition);
var block_left: Entity = {
if (gpos.x > 0)
this.grid.entities.get(gpos.x - 1, gpos.y)
else
null;
};
if (gpos.x <= 0 || block_left != null) {
//If the edge of the grid or another block is to the left of
this block...
return false;
}
}
return true;
}
private function canMoveRight() : Bool {
for (i in this.cluster.blocks) {
var gpos : GridPosition = i.get(GridPosition);
var block_right : Entity = {
if (gpos.x < Constants.GRID_WIDTH - 1)
this.grid.entities.get(gpos.x + 1, gpos.y)
else
null;
};
if (gpos.x >= Constants.GRID_WIDTH - 1 || block_right != null) {
//If the edge of the grid or another block is to the right of
this block...
return false;
}
}
return true;
}
}
Any tips?

Saturday, 24 August 2013

Can't fix MediaController.show() exception

Can't fix MediaController.show() exception

I have an audio file playing in a foreground Service using MediaPlayer.
When a user taps the notification associated with the foreground Service,
I launch an Activity using the Intent like so:
Android 3.0+
Intent audioPlayIntent = new Intent(context, AudioPlayActivity.class);
audioPlayIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
audioPlayIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
audioPlayIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
audioPlayIntent, PendingIntent.FLAG_CANCEL_CURRENT);
Android 2.1 - 3.0
Intent audioPlayIntent = new Intent(context, AudioPlayActivity.class);
audioPlayIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
audioPlayIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
audioPlayIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
audioPlayIntent, 0);
This Activity then binds to the service to show a MediaController to the
user.
Here is the binding code in the Service:
public class AudioPlayerServiceBinder extends Binder{
public AudioPlayerService getAudioService(){
return AudioPlayerService.this; //this class is declared in
AudioPlayerService.java, so it has access to the Service instance.
}
}
..and in the Activity's onStart I have a call to this method:
private void bindAudioService()
{
mediaController = new MediaController(this);
Intent i = new Intent(this, AudioPlayerService.class);
serviceConnection = new AudioServiceConnection();
bindService(i, serviceConnection, 0);
}
I'm getting a lot of reports of exceptions from the Android Developer
Console that report an error here on the mediaController.show() line:
private class AudioServiceConnection implements ServiceConnection{
AudioPlayerServiceBinder audioServiceBinder;
@Override
public void onServiceConnected(ComponentName name, IBinder
serviceBinder)
{
serviceConnected = true;
Log.i(TAG, "Connected to audio player service.");
AudioPlayActivity.this.audioService =
((AudioPlayerServiceBinder)serviceBinder).getAudioService();
audioServiceBinder = ((AudioPlayerServiceBinder) serviceBinder);
handler.post(new Runnable(){
@Override
public void run()
{
mediaController.setMediaPlayer(AudioPlayActivity.this);
mediaController.setAnchorView(AudioPlayActivity.this.findViewById(R.id.audioplay_container));
mediaController.setEnabled(true);
mediaController.show(5000); // THIS CAUSES AN
EXCEPTION ON SOME DEVICES, BUT NOT MINE
}
});
}
The exception being:
android.view.WindowManager$BadTokenException: Unable to add window --
token null is not valid; is your activity running?
at android.view.ViewRoot.setView(ViewRoot.java:448)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:181)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
at android.view.Window$LocalWindowManager.addView(Window.java:526)
at android.widget.MediaController.show(MediaController.java:305)
at
com.jukaku.masjidnowlib.AudioPlayActivity$AudioServiceConnection$1.run(AudioPlayActivity.java:293)
The reason I put it in a Handler.post is because I was trying to fix this
issue, and thought that maybe the onServiceConnected is running in a
different thread than the UI thread and so couldn't touch the UI. This has
not stopped the exceptions, however.
I used to be able to recreate the same exception by:
Clicking the notification to open the Activity >> pressing back to close
the activity (and remove it from the Activity stack, since it has
FLAG_NO_HISTORY set) >> Clicking the notification again.
Once I put the mediaController.show() in the Handler, I would no longer
get the exception and I cannot recreate them. However, like I said, the
exceptions have not stopped being reported.
Any help would really be appreciated! I've gone through 10 releases trying
to fix this issue but still can't nail it down. It's especially hard
because I can't recreate it!

Tumblr - pulling the first picture from a page and thumnailing it

Tumblr - pulling the first picture from a page and thumnailing it

I'm trying to get a Tumblr Link Post to automatically pull the first (and
hopefully most relevant) picture from a URL, thumbnail it, and display it
in the link area - exactly like the new dashboard does. jQuery's img:first
is the ticket, but I can't get it to work.
Any ideas?

How to handle "not all code paths return a value" when the logic of the function does ensure a return

How to handle "not all code paths return a value" when the logic of the
function does ensure a return

I suppose the easiest way to explain is by a contrived example:
public static int Fail() {
var b = true;
if (b) {
return 0;
}
}
This code will not compile, and gives the error "not all code paths return
a value," while we humans can clearly see that it does. I DO understand
why. My question is what should be done to remedy the situation. It could
be something like this:
public static int Fail() {
var b = true;
if (b) {
return 0;
}
throw new ApplicationException("This code is unreachable... but here
we are.");
}
But it all just seems rather silly. Is there a better way? Again, this
code is a contrived example (and can be reduced to return 0). My actual
code is massive and complex, but does logically (by mathematical proof)
return a value before trying to exit.

Communicate a button click event with sockets

Communicate a button click event with sockets

Desire: I have a device or micro-controller i'll call it a mc that I need
to communicate to when a web page button is clicked using sockets.
MC1
<button id ='on1' name='mc1'>On</button>
<button id ='off1' name='mc1'>off</button>
Details: What I am trying to accomplish is when a button is clicked pass
the info to the mc.
What I Tried: Currently I can listens to a port and can write data to the
mc as well as receive data. To do this im starting a file though the
server php cli. The file contains these basic socket functions.
$socket = @socket_create_listen("port#");
$client = socket_accept($socket);
socket_write($client, $msg);
socket_read ($client, 256);
the mc then connect to the server at the port#
Problems: Im having difficulties understanding how to bridge the gap
between my php web page with the button and passing the data that the
button has been clicked to the mc.
Attempt at a Solution: Can i have the file that listens to the port run
and then in a seperate file write to the client?
additional notes: The MC LAN I would like to avoid setting up port
forwarding and the external ip sometimes changes. For these reason I had
choose to have the MC establish the connection to the server thus allowing
the server to write to the MC without needing port forwarding and a non
changing ip address.
Thanks JT

Where can I read that heading h1... h6 does not allow a width

Where can I read that heading h1... h6 does not allow a width

I just wonder can anybody give me a website where they say that width is
not allowed for heading tag
//Tony

Vagrant up on aws causes 400 bad request

Vagrant up on aws causes 400 bad request

When following the docker aws instructions vagrant up returns with:
Expected(200) <=> Actual(400 Bad Request) (Excon::Errors::BadRequest)

Socket Message Framing - Length-prefixing vs Delimiter

Socket Message Framing - Length-prefixing vs Delimiter

What are advantages/disadvantages of each method? Currently I'm using
Length-prefixing and want to know if there's a better way to do message
framing.

Friday, 23 August 2013

Assign a class to a child if condition is true

Assign a class to a child if condition is true

How would I go about giving a child element a class if the parent element
contained style="display: none;" and a certain class?
For example, I want:
<div style="display: none;" class="hidden">
<a href="#">Hidden</a>
</div>
to be:
<div style="display: none;" class="hidden">
<a href="#" class="new-class">Hidden</a>
</div>

Vector of reduction

Vector of reduction

Let $f:\mathbb{R}^2\rightarrow \mathbb{R}$ be a locally Lipschitz
continuous and $\bar{x}\in\mathbb{R}^2$. Put $$
S(x):=\left\{x^*\in\mathbb{R}^2: \liminf_{u\rightarrow
x}\frac{f(u)-f(x)-\langle x^*,u-x \rangle}{\|u-x\|}\geq 0\right\} $$ 1.
Suppose that $S(\bar{x})\ne\emptyset$ and $0\notin S(\bar{x})$. I would
like to know whether we can find a vector $d\in \mathbb{R}^2$ such that $$
f(\bar{x}+td)<f(\bar{x}) \quad {\rm for\; all\; t>0\; sufficiently\;
small.} $$ 2. Let $$ P(\bar{x}):=\limsup_{x\rightarrow
\bar{x}}S(x):=\left\{x^*\in \mathbb{R}^2: \exists\; x_k\rightarrow
\bar{x}, \; x^*_k\rightarrow x^*, \; x^*_k\in S(x_k), \;
k=1,2,\ldots\right\}. $$ Suppose that $P(\bar{x})\ne \emptyset$ and
$0\notin P(\bar{x})$. I would like to know whether we can find a vector
$d\in \mathbb{R}^2$ such that $$ f(\bar{x}+td)<f(\bar{x}) \quad {\rm for\;
all\; t>0\; sufficiently\; small.} $$ Note: If $f$ is differentiable at
$\bar{x}$, we can choose $d=\nabla f(\bar{x})$.
I would like to thank to all comments and construction.

Can someone explain this angular code?

Can someone explain this angular code?

app = angular.module('app', []);
app.controller('MainCtrl', function($scope) {
$scope.updated = 0;
$scope.stop = function() {
textWatch();
};
var textWatch = $scope.$watch('text', function(newVal, oldVal) {
if (newVal === oldVal) { return; }
$scope.updated++;
});
});
<body ng-controller="MainCtrl">
<input type="text" ng-model="text" /> {{updated}} times updated.
<button ng-click="stop()">Stop count</button>
</body>
and http://jsbin.com/emenuf/3/edit
and i have a question,why after i click the button and type {{updated}}
doesnt update?

populating HTML template from an external source

populating HTML template from an external source

I've done a lot of searching on this but it's a bit tricky when you're not
quite sure what you're searching for.
I've produced an HTML email template that is designed to include a list of
events that my company runs. Each list item includes the event title, the
date and then a short description. Currently I have the list set out as a
table. The reason being is that this HTML document has to be filled in by
others who aren't as well versed in HTML and this was the easiest way I
could find for them to be able to fill it in, adding new table rows etc
without messing up the template (we used to use lists and we'd end up with
extra list items popping up everywhere, list items not getting closed
etc.)
Anyway long story short; is there a way for me to populate these table
cells (or list items) from another source? One method I thought would work
is inputting the data into an excel spreadsheet/database, then running
something that puts that data into the HTML template and outputs a new
HTML document that we can use in an email (ie would have to be static and
not sourcing it's info externally). I'm sure it's possible but this is way
beyond my own abilities, so I just wanted some advice.
Sorry for the long post!

How do I use nested For loops to print array values within an array on new lines?

How do I use nested For loops to print array values within an array on new
lines?

I'm trying to get the numbers from these arrays within an array to print
on new lines, but can't figure out how to refer to them in order to print
them to the console. What am I missing here?
var numbers = [
[1,2,3,4,5,6,7],
[8,9,10,11,12,13,14,15,16],
[17,18,19],
[20],
[21,22,23,24,25,26],
[27,28,29,30]
];
for (i=0; i<numbers.length; i++) {
for (j=0; j<numbers[i].length; j++) {
console.log(numbers[i].j); //The problem is with this j here I
suspect...
}
}

PHPMailer error loading page

PHPMailer error loading page

<!DOCTYPE html>
<head>
<title>Form submission</title>
</head>
<body>
<?php
require("PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "mygmail@gmail.com"; // SMTP username
$mail->Password = "MY_PASSWORD_GOES_HERE"; // SMTP password
$webmaster_email = "username@doamin.com"; //Reply to this email ID
$email="some1@mail.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->Subject = "This is the subject";
$mail->Body = "Hi"
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
else{
echo "Message has been sent";
}
?>
This is my php script to send an email. It is pretty straightforward and
taken from the PHPMailer homepage. I am trying to serve this from an
Apache server that serves my webpage. When I try to access the script I
get the error: failed to load page.
Is there anything wrong with the php code here? I have modified my php.ini
file also, so everything seems to be like it has to, but it does not work.

Thursday, 22 August 2013

what if I lost the keystore which generate the CSR

what if I lost the keystore which generate the CSR

Sorry I am a beginner about ssl cert.
according to
http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Create_a_local_Certificate_Signing_Request_(CSR)
it will gen a keystore and CSR.
we generate the CSR and send to Certificate Authority.
What if I lost the keystore ? should I regen the CSR again to reapply the
ssl cert?
Refer to
https://search.thawte.com/support/ssl-digital-certificates/index?page=content&id=SO832
It will generate a new keystore file.
is it the file store the private key? which stated in
https://search.thawte.com/support/ssl-digital-certificates/index?page=content&id=SO750
, which say
1. Private Key file loss.
2. Private Key pass phrase loss.
3. Private Key file has been compromised due to the server being hacked.
......
......

Integer getting default value 0 where it required to be NULL in Java

Integer getting default value 0 where it required to be NULL in Java

My requirement looks simple, but I feel I'm doing something wrong in code.
All I need is to insert "null" in Oracle Database when nothing is passed
from InputText field of UI.
PaymantSpecFormPage.xhtml
<h:inputText id="startWeek" value="#{flowScope.paymentSpecVO.paymStartWk}"
styleClass="inputTypeForm" maxlength="4"/>
PaymentSpecVO.java
public class PaymentSpecVO extends BaseVO<PaymentSpec> {
private Integer paymStartWk;
public Integer getPaymStartWk() {
return paymStartWk;
}
public void setPaymStartWk(Integer paymStartWk) {
this.paymStartWk = paymStartWk;
}
}
And in my DB Table
COLUMN_NAME DATA_TYPE NULLABLE DEFAULT_VALUE
------------ --------- -------- -------------
PAYM_START_WK NUMBER(4,0) Yes null
And when I enter nothing in inputText, then instead of null, 0 is getting
entered in Table, which has different meaning in my business logic, please
help me to do necessary code changes.

Remote Session: Switching from Desktop to Metro Mode Windows Server 2012

Remote Session: Switching from Desktop to Metro Mode Windows Server 2012

I'm having a terrible time switching back/forth between the desktop and
metro mode in remote desktop windows accessing a Windows 2012 server.
I know of two ways--one doesn't work in remote session windows and the
other works very, very, poorly:
Using the "hot zones" at the very right edge of the screen--hard to hit
when the right edge of the "screen" is just the edge of a remote session
window with nothing to "stop" the mouse against.
Press the "Start" button--brings up my PC startmenu rather than the remote
session start menu.
Are there any other ways?

Creating a dropdown menu in overflow with appcompat

Creating a dropdown menu in overflow with appcompat

How can I achieve this effect using the action bar and appcompat. I want
to have a dropdown menu appear when I click the overflow icon. Like so:

Then upon clicking the overflow I get the dropdown to appear:

Metric Space (Elementary Analysis)

Metric Space (Elementary Analysis)

Let $X \subseteq \mathbb{R}^{n}$ be given by
$$ X = \left\{ (b_{1}, \ldots, b_{n}) \in \mathbb{R}^{n} \mid
\sum\limits_{i=1}^{n} \frac{b_{i}}{i} = 0 \right\}$$
Then prove that $X$ is closed in $\mathbb{R}^{n}$.

Set values ​​always customized to gridview in asp.net c #

Set values &#8203;&#8203;always customized to gridview in asp.net c #

need to fill a gridview via code (C #) and want to know how I define the
values &#8203;&#8203;for components declared inside of it, like labels,
buttons and linkbuttons. Below is an example of a component that would
fill and I'm not getting:
<asp:Label ID="lbCodigo" CssClass="label label-inverse" runat="server"
Text='<%#Eval("CODIGO") %>'></asp:Label>



Below is the complete gridview:
<asp:GridView ID="gridContatos" runat="server" AutoGenerateColumns="False"
Width="100%" OnRowCommand="gridContatos_RowCommand"
OnRowDataBound="gridContatos_RowDataBound" CssClass="table
table-condensed" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
<AlternatingRowStyle BackColor="#c0c0c0" />
<Columns>
<asp:TemplateField HeaderText="CAIXA DE ENTRADA - FALE CONOSCO">
<ItemTemplate>
<div class="container">
<div class="row-fluid">
<div class="span2">
<div class="">
<div class="alert label-inverse">
<asp:Label ID="lblbAutor"
CssClass="label label-info"
runat="server"
Text='<%#Eval("NOME")
%>'></asp:Label>
</div>
</div>
</div>
<div class="span7">
<div class="">
<div class="alert label-inverse">
<asp:Label ID="lbAssunto"
CssClass="label label-success"
runat="server"
Text='<%#Eval("ASSUNTO")
%>'></asp:Label>
</div>
</div>
</div>
<div class="span3">
<div class="alert label-inverse">
<asp:LinkButton ID="lbVisualizar"
CssClass="label label-success"
Visible="true" runat="server"
Text="VER" ToolTip="Responder"
CommandName="Visualizar"
CommandArgument='<%#
Container.DataItemIndex%>' />
<%--<asp:ImageButton
ID="imgVisualizar" runat="server"
ImageUrl="~/Images/zomin_128x128.png"
Width="20px" Height="25%"
ToolTip="Responder"
CommandName="Visualizar"
CommandArgument='<%#
Container.DataItemIndex%>' />--%>
<asp:LinkButton ID="lbResponder"
runat="server" CssClass="label
label-inverse" ToolTip="Responder"
Visible="true" Text="RESPONDER"
CommandName="Responder"
CommandArgument='<%#
Container.DataItemIndex%>' />
<asp:LinkButton ID="lbExcluir"
runat="server" CssClass="label
label-warning" Visible="true"
Text="EXCLUIR" ToolTip="Excluir"
CommandName="Excluir"
CommandArgument='<%#
Container.DataItemIndex%>' />
</div>
</div>
</div>
</div>
<br />
<asp:Panel ID="pnMensagem" runat="server"
CommandArgument='<%# Container.DataItemIndex%>'
Visible=" false">
<hr />
<div class="container">
<div class="row">
<div class="span4">
<div class="caption">
<asp:Label ID="lbCodigo"
CssClass="label label-inverse"
runat="server"
Text='<%#Eval("CODIGO")
%>'></asp:Label>
<br />
<asp:Label ID="lbData"
CssClass="label label-inverse"
runat="server"
Text='<%#Eval("DATAENVIO")
%>'></asp:Label>
<br />
<asp:Label ID="lbEmail"
CssClass="label label-inverse"
runat="server"
Text='<%#Eval("EMAIL")
%>'></asp:Label>
<br />
<asp:Label ID="lbTelefone"
CssClass="label label-success"
runat="server"
Text='<%#Eval("TELEFONE")
%>'></asp:Label>
<br />
<asp:Label ID="lbEndereco"
CssClass="label label-success"
runat="server"
Text='<%#Eval("ENDERECO")
%>'></asp:Label>
<br />
<asp:Label ID="lbCidade"
CssClass="label label-success"
runat="server"
Text='<%#Eval("CIDADE")
%>'></asp:Label>
<%-- <br />
<asp:Label ID="lbCelular"
CssClass="label label-inverse"
runat="server"
Text='<%#Eval("celular")
%>'></asp:Label>--%>
</div>
</div>
<div class="span8">
<div class="caption">
<asp:TextBox Width="95%"
ID="txtMensagem" runat="server"
Text='<%#Eval("MENSAGEM") %>'
Enabled="false"
TextMode="MultiLine"
Rows="5"></asp:TextBox>
</div>
</div>
</div>
</div>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle />
<HeaderStyle />
<PagerStyle HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True"
ForeColor="White" />
<SortedAscendingCellStyle />
<SortedAscendingHeaderStyle />
<SortedDescendingCellStyle />
<SortedDescendingHeaderStyle />
</asp:GridView>

How to browse and select a file from sdcard using Phonegap 3.0?

How to browse and select a file from sdcard using Phonegap 3.0?

Gone through API of Phonegap 3.0 I want to browse files from SD card when
i click on link or button
For example:
<p onclick="browseFile()">Upload</p>
Or
<input type="file">
But when i use input type=file it is browsing file from Gallery and Music
Tracks but not from SD card.
I want that i should be able to select file from SD by using UI when i
click on link or button
Can anyone suggest the link for same which give Java Script code along
with UI for browsing file from SD card?

Wednesday, 21 August 2013

Twitter API doesn't seem to have any language support

Twitter API doesn't seem to have any language support

How do you set a specific locale/language when using the PHP API for
Twitter, as there doesn't seem to be an option?
I can set a language for the plugins/buttons when using HTML/JavaScript,
but I can't see anywhere for a PHP API call. There's nothing in the docs.
E.g. I've looked on https://dev.twitter.com/docs/api/1.1 but there's
nothing about setting a language. The responses often include a language,
but that's obviously not the same thing.
As an example, when getting info of a user in a PHP API call, Facebook's
API will return 'male' or 'homme' if the user's sex is male, depending on
if the language is set to English or French (default English).
Of course sometimes you want to always return English in an API call if
your programming code relies on testing for 'male' or 'female', but if
you're just outputting the exact response of the sex field (e.g. a user
profile) then you would want to use the same language as the rest of the
site.

Rails: requiring a non-gem library

Rails: requiring a non-gem library

This has got to be a duplicate question, but I can't find the magic words
on Google.
What are the best practices when including a library that isn't a gem?
Should I require it in config/environment.rb?
Thanks.

Bootstrap datetime picker not working

Bootstrap datetime picker not working

I am using the http://www.malot.fr/bootstrap-datetimepicker/demo.php date
time picker for twitter bootsrap.
The requirement of the page that Im working on is that the users can
either use the date time picker or manually type in something and I
validate that the data is correct.
I am running into a few issues with this date time picker. First thing is
that it doesn't seem to work to date.js which would make date validation
very easy. Is there a setting or something out there that can make it work
with date.js?
Secondly, I am having a bit of trouble saving the value picked via the
date time picker.
So far I have tried 2 approaches :-
$('#dateTime').datetimepicker({
format: 'dd-M-yyyy HH:ii p',
autoclose: 1,
todayHighlight: 1,
startView: 2,
forceParse: 0,
showMeridian: 1
}).on('changeDate', function(ev) {
var date = ev.date;
//..Do stuff with the date
});
In this case I get a valid date, but the time isn't right. The date time
picker seems to assume the time is GMT. It grabs the time that was picked
and adds my time zone offset to it. (Im in EDT so it subtracts 4 hrs from
whatever I pick) Is there some sort of setting to prevent this conversion?
The second approach I tried was
var date = e.currentTarget.value;
//Do stuff with it.
In this I get the correct date time, but it cannot be saved to the
database because the format is invalid.
If I try to do
var isValid = new Date(date);
it return that the date isn't a valid date because the format that Im
using (dd-M-yyyy HH:ii p) isn't valid.
Note: I cannot change the format that is being displayed in the textbox.
I apologize if the question is confusing.

Best practices for reducing the amount of Garbage Collector work

Best practices for reducing the amount of Garbage Collector work

I have a fairly complex Javascript app, which has a main loop that is
called 60 times per second. There seems to be a lot of garbage collection
going on (based on the 'sawtooth' output from the Memory timeline in the
Chrome dev tools) - and this often impacts the performance of the
application.
So, I'm trying to research best practices for reducing the amount of work
that the garbage collector has to do. (Most of the information I've been
able to find on the web regards avoiding memory leaks, which is a slightly
different question - my memory is getting freed up, it's just that there's
too much garbage collection going on.) I'm assuming that this mostly comes
down to reusing objects as much as possible, but of course the devil is in
the details.
The app is structured in 'classes' along the lines of John Resig's Simple
JavaScript Inheritance.
I think one issue is that some functions can be called thousands of times
per second (as they are used hundreds of times during each iteration of
the main loop), and perhaps the local working variables in these functions
(strings, arrays, etc.) might be the issue.
I'm aware of object pooling for larger/heavier objects (and we use this to
a degree), but I'm looking for techniques that can be applied across the
board, especially relating to functions that are called multiple times in
tight loops.
What techniques can I use to reduce the amount of work that the garbage
collector must do?

Is this a Appropriate method to safely close a proxy on WCF-calls?

Is this a Appropriate method to safely close a proxy on WCF-calls?

In my application i discovered that sometimes the Close() for a
WCF-call/channels trowed errors. And i did a little research on the
subject and borrowed some code on the internet to get me started.
And now, I wonder is this the right way to go? or should i improve the
solution or maybe implement something totally different?
Generic-Class/Static Class:
public class SafeProxy<Service> : IDisposable where Service :
ICommunicationObject
{
private readonly Service _proxy;
public SafeProxy(Service s)
{
_proxy = s;
}
public Service Proxy
{
get { return _proxy; }
}
public void Dispose()
{
if (_proxy != null)
_proxy.SafeClose();
}
}
public static class Safeclose
{
public static void SafeClose(this ICommunicationObject proxy)
{
try
{
proxy.Close();
}
catch
{
proxy.Abort();
}
}
}
This is how i make calls to the WCF:
(The WCFReference is a Service Reference pointing to the WCF service adress)
using (var Client = new SafeProxy<WCFReference.ServiceClient>(new
WCFReference.ServiceClient()))
{
Client.Proxy.Operation(info);
}

Prove that if a normal subgroup $H$ of $ G$ has index $n$, then $g^n \in H$ for all $g \in G$

Prove that if a normal subgroup $H$ of $ G$ has index $n$, then $g^n \in
H$ for all $g \in G$

I need some help in relation to this exercise
"Prove that if a normal subgroup $H$ of $ G$ has index $n$, then $g^n \in
H$ for all $g \in G$."
I tried by induction on $n$. The case $n=1,n=2$ are obvious, but even the
case $n=3$ is giving me trouble so I give up studying the general case of
the inductive step.
My other approach was studying left or right coset of $G$. But I only
proved that if $g \in aH$ then $g^2 \notin aH$ if $a \notin H$, and I
can't find a way to demonstrate that $g^n \in H$. (my starting idea was to
prove that every power of $g$ is in a different coset but then I realize
that in this way I don't handle several case, for example $g$ has period
strictly lesser than $n$ and in conclusion it doesn't prove the exercise)
Maybe I'm missing something about indexes, and this is why I asked here
for some help,
(I can't use quotient groups because they are introduced later than this
exercise, forgot to add this info in the beginning) Thanks in advance :)

Removing Default launcher app android

Removing Default launcher app android

Am developing new project where i need to set my app as a default launcher
app. My problem is when am modifying manifest file it is asking for the
suggestion to choose any one app(i.e. Launcher and my app) But i don't
want the default launcher app into existence which means when am executing
the project it should start with my app as a launcher app. I tried of
deleting default launcher app which is not possible. Anyone help me in
this. thanks in aadvance.

Tuesday, 20 August 2013

TopoJSON: calculate scale and offset

TopoJSON: calculate scale and offset

Question:
Given the absolute coordinates, how do I calculate the ideal value for the
scale and translate for topojson topology transform?
I want to go from this:
absolute = [
[-69.9009900990099, 12.451814888520133],
[-69.9009900990099, 12.417091709170947],
[-69.97299729972997, 12.43445329884554],
[-70.00900090009, 12.486538067869319],
[-70.08100810081008, 12.538622836893097],
[-70.08100810081008, 12.590707605916876],
[-70.04500450045005, 12.608069195591469],
[-70.00900090009, 12.55598442656769],
[-69.93699369936994, 12.469176478194726],
[-69.9009900990099, 12.451814888520133],
]
To this:
scale = [0.036003600360036005, 0.017361589674592462]
translate = [-180, -89.99892578124998]
relative = [[3058, 5901], [0, -2], [-2, 1], [-1, 3], [-2, 3], [0, 3], [1, 1],
[1, -3], [2, -5], [1, -1]]
I got the relative-to-absolute conversion working:
def arc_to_coordinates(topology, arc):
scale = topology['transform']['scale']
translate = topology['transform']['translate']
x = 0
y = 0
coordinates = []
for point in arc:
x += point[0]
y += point[1]
coordinates.append([
x * scale[0] + translate[0],
y * scale[1] + translate[1]
])
return coordinates
Now I need to write the absolute-to-relative conversion. In order to to
this, it is necessary to get the values for scale and translate, where I'm
stuck.
About topojson
topojson is a format for storing geographic features much like geojson.
In order to save space (among other tricks), the format uses relative
integer offsets from the previous point. For example, this is the topojson
file for Aruba:
{
"type": "Topology",
"transform": {
"scale": [0.036003600360036005, 0.017361589674592462],
"translate": [-180, -89.99892578124998]
},
"objects": {
"aruba": {
"type": "Polygon",
"arcs": [[0]],
"id": 533
}
},
"arcs": [
[[3058, 5901], [0, -2], [-2, 1], [-1, 3], [-2, 3], [0, 3], [1, 1],
[1, -3], [2, -5], [1, -1]]
]
}
The same information as a GeoJSON feature looks like this:
{
"type" : "Feature",
"id" : 533,
"properties" : {},
"geometry" : {
"type" : "Polygon",
"coordinates" : [[
[-69.9009900990099, 12.451814888520133],
[-69.9009900990099, 12.417091709170947],
[-69.97299729972997, 12.43445329884554],
[-70.00900090009, 12.486538067869319],
[-70.08100810081008, 12.538622836893097],
[-70.08100810081008, 12.590707605916876],
[-70.04500450045005, 12.608069195591469],
[-70.00900090009, 12.55598442656769],
[-69.93699369936994, 12.469176478194726],
[-69.9009900990099, 12.451814888520133]
]]
}
}
It is easy to see how the former is more compact than the later. My
absolute to relative function is working:
>>> arc_to_coordinates(topology, topology['arcs'][0])
[[-69.9009900990099, 12.451814888520133],
[-69.9009900990099, 12.417091709170947],
[-69.97299729972997, 12.43445329884554],
[-70.00900090009, 12.486538067869319],
[-70.08100810081008, 12.538622836893097],
[-70.08100810081008, 12.590707605916876],
[-70.04500450045005, 12.608069195591469],
[-70.00900090009, 12.55598442656769],
[-69.93699369936994, 12.469176478194726],
[-69.9009900990099, 12.451814888520133]]

How to add an admin to 13.04

How to add an admin to 13.04

Through some way I have completely erased all accounts from my laptop.
When I try to add a new admin account it asks for the root password. I've
tried my password from my previous account and it didn't work. What do I
do to get an admin account back?

AngularJS module dependencies - how many times can I list them?

AngularJS module dependencies - how many times can I list them?

I scaffolded a simple Angular app using Yeoman, and I've been playing with
it ever since.
Inside the file app.js, which is the first one listed as a <script> inside
index.html, I define the main module as:
angular.module('myMod', [])
.config(...)
Note the empty array of dependencies.
Now, when I want to, say, add a filter to this module, I create a
myFilter.js file (which I load after app.js inside index.html);
myFilter.js consists of:
angular.module('myMod').filter(...)
Note there's just one parameter to the module() function. If I pass the
empty array of dependencies as a parameter to this module() function,
really nothing appears on screen.
I've been playing with a bunch of other files which extended myMod with
controllers, and passing [] as a parameter to the angular.module()
function breaks my app every time.
It seems to me like I can only call angular.module() once using the second
parameter, which may have some sense (how many times do I want to list my
dependencies? What about consistency?). Is it that way?
If it is, is there some standard place where to list dependencies for a
module?

Setting and getting html text in a qtextbrowser/qtextedit with pyqt4

Setting and getting html text in a qtextbrowser/qtextedit with pyqt4

for example if you just set
self.textedit.setHtml("<b>Bold text</b>")
htmlCheck=self.textedit.toHtml()
hmtlCheck=
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt;
font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px;
-qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bold
text</span>
</p>
</body></html>
Why can't I just only get my setted text from the first code line back?
This, what I get back, is so bad for further editing... Imagine, I write a
bigger text in this. I'd like to select text and make it bold, or make a
list, and detect hyperlinks in real time... I don't know how to deal with
it when there is so much garbage around my code that works alone, too. And
there are afaik only the .toPlainText() and .toHtml() functions... The
hyperlink-thing is really simple, I could just setText and getPlainText
and run a regex each time over all the www.'s and http's. But I also want
a dynamic list functionality or bold, maybe, and thus cannot use
toPlainText()...
Has someone a good advise for me?

UIButton size is not as set in xib

UIButton size is not as set in xib

I made UIButton with Type Custom in Interface Builder like below

and its dimensions are

But, when I run it on Ratina 4 Simulator,it show smaller

Why is it showing like this, not like as was set in xib.

Why is my second row being placed between the two opposing floats

Why is my second row being placed between the two opposing floats

Why is the second row with selector #message slipping in between the
opposing floats.
My thought, the reason for this behaviour is that when you float in this
case one to the
left and one to the right the space in between is free available space
which the second row take advantage of that's the reson according to my
knowledge. The floated element to the left and right will only take up as
much space as they need and they are considered to be block element.
If I remove the comment on clear:both; in selector #message then it works
and that is
because you clering the #message element saying this element is not
allowed to sit between an element that is floating.
I just want to confirm with you if my thought of understanding is about
right.
<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<style type="text/css" media="screen">
body
{
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
font-size: small;
text-align: center;
width:768px;
}
#register
{
margin: 0;
padding: 0;
list-style: none;
background: yellow;
}
#reg
{
float: left;
margin: 0;
padding: 8px 14px;
background:red;
}
#find
{
float: right;
margin: 0;
padding: 8px 14px;
background:blue;
}
#message
{
/*clear:both;*/
text-align: center;
background: #92B91C;
}
</style>
</head>
<body>
<div id="container">
<ul id="register">
<li id="reg">Not registered? <a href="#">Register</a>
now!</li>
<li id="find"><a href="#">Find a store</a></li>
</ul>
<div id="message">
<p><strong>Special this week:</strong> $2 shipping on all
orders! <a
href="#">LEARN MORE</a></p>
</div>
</div>
</body>
</html>
//Tony

Monday, 19 August 2013

how to use onblure javscript in php form?

how to use onblure javscript in php form?

I have a php form that i want the value of the form be inside the input
tag and when the input be clicked . the value become disappear i use this
code but i get syntax error.
'<span class="wpcf7-form-control-wrap %1$s"><input value="%1$s"
name="%1$s" onblur="if(this.value == '') {
this.value='Email'}"/>%3$s</span>'
but whe i use this code in html file it work perfectly
<input type="email" value="Email" required=""
name="email" id="cemail" onblur="if(this.value ==
'') { this.value='Email'}" onfocus="if (this.value
== 'Email') {this.value=''}">
if someone help me it will be so appreciated.
thank you.

Pass Variable (cookie) from local html to UILabel - iOS

Pass Variable (cookie) from local html to UILabel - iOS

I wanted to know how I could go about passing a Variable (cookie) in a
local HTML file in my iOS App, and pass what the cookie says onto a
UILabel. Here is what the HTML code is. I need to pass this message into a
UILabel
<script language="javascript">setCookie('Test','You Sir have succeeded.
Congratulations.', 300);
</script>
Thank You in Advance!

Prove that $ \pi_g $ is a permutation

Prove that $ \pi_g $ is a permutation

Suppose that $ G $ is group and $ g $ is any element from $ G $ ($g \in G
$). We define a function $ \pi_g : G \rightarrow G,\ \ \pi_g(x) = g \cdot
x$. Prove that $ \pi_g $ is a permutation of the set $ G $.
Could you show me how to prove this theorem? Thank for your help.

how to insert clob in DB2 using Reader setCharacterStream

how to insert clob in DB2 using Reader setCharacterStream

Reader nrd = new StringReader(infoBean.getSpecInsAfter());
Reader ord = new StringReader(infoBean.getSpecInsBefore());
psPMPDSA.setCharacterStream(1, ord, infoBean.getSpecInsBefore().length());
psPMPDSA.setCharacterStream(2, nrd, infoBean.getSpecInsAfter().length());
psPMPDSA.executeUpdate();
when I use this, this works perfect fine on my development DB2 db, but
doesn't work on my client db. error received: The value of input host
variable or parameter number "1" cannot be used because of its data type..
SQLCODE=-301, SQLSTATE=07006, DRIVER=3.53.95
Can anyone suggest why the difference, I did some research on net and
found this, http://www-01.ibm.com/support/docview.wss?uid=swg21216635
we do not wish to make any change in WAS server DS setting. so could this
be handled in code... ??

AngularJS : can I stop a callback from an interceptor?

AngularJS : can I stop a callback from an interceptor?

I have a $resource object that I am adding an interceptor to. I would like
to have the success callbacks not be called if certain conditions are met.
here is an example:
var service = $resource('/:action/:id', { id :'@id' });
service.interceptors.push(function() {
return {
response: function(response) {
if(response.data.red_flag) {
//stop execution here.
}
}
};
});
And then elsewhere in the code:
service.get({ id: 1}, function(response) {
//should not be called if response.data.red_flag is true
});

Powershell - remove members from group that have an AD attribute

Powershell - remove members from group that have an AD attribute

I would like to remove members from a group if they have any value in the
employeeNumber attribute on AD. I can return all member of a group using
Get-ADGroupMember but how do I then iterate through to remove members who
have a value?

Sunday, 18 August 2013

put increment number in SESSION variables

put increment number in SESSION variables

I am trying so make a small shopping cart but the issue is with products
when I want to add another product to the cart with other attributes then
it overwrites the existing one, I want to add the same product to the cart
again when there are different attributes.
Below is an example of a product that I added with its id = 1 from the
database.
These are the session variables:
["cart_1"]=>
string(1) "1"
["cart_att1_1"]=>
string(2) "2m"
["cart_att2_1"]=>
string(3) "Rot"
["cart_att3_1"]=>
string(1) "M"
and this is the php code I am using:
function shop() {
$action = $_GET['action'];
if($action == "add") {
$prod_id = $_GET['prod_id'];
$_SESSION['cart_'.$prod_id] = "1";
$lim_nr = $_POST['att_number_lim'];
for ($i = 1; $i < $lim_nr+1; $i++) {
$_SESSION['cart_att'.$i.'_'.$prod_id] =$_POST['att'.$i];
}
}
If you have questions please feel free to ask

Check existence of a member function in C++11

Check existence of a member function in C++11

Today, I am revisiting the problem of check existence of a member function
(several posts can be found online). One implementation which inspires me
is What is decltype with two arguments?. Personally, the problem with this
implementation is that the argument list needs to be void, otherwise some
arguments need construction first and some may or may not be default
constructible (actually some implementations do assume such).
To solve this problem, I am thinking about using member function pointer
-- if a member function can be assigned to a member function pointer with
the right signature, then the member function exists. So my implementation
is like (to test whether there exist a ::foo( int ) member function:
template< class T >
struct TestFoo {
typedef void(T::*FP)( int );
FP fp = & Foo::foo;
static auto test( T * p ) -> decltype( fp = & T::foo, std::true_type() );
static auto test( ... ) -> std::false_type;
};
This implementation works but a weird thing is that I have to move the
declaration of fp outside of decltype( ... ), otherwise the compiler (gcc
version 4.8.1) complains:
static auto test( T * p ) -> decltype( FP fp = & T::foo, std::true_type() );
^ error: expected ')' before 'fp'
I am kinda new to decltype and I am just curious whether it allows local
variables or may be other problems? I am also open to suggestions on the
member function pointer approach. Thanks in advance!

Compilation error executing basic if else statements

Compilation error executing basic if else statements

I had a similar code to this using numbers, and it worked perfectly. This
however keeps underlining the word else and I don't know why. I am just
playing around with java trying to understand a few principles.
I want to program to reply one of two statements depending on input. Also,
where it says if (input1 == "Hello");, I wanted to put if (input1 ==
"Hello" || "hello"); to accept lowercase too, but that showed errors too.
Just to be clear, if i remove the else clause, my program runs and both
statements are printed!
import java.util.Scanner;
public class Input
{
public static void main(String[] args)
{
System.out.println("Hello there!");
Scanner Scan = new Scanner (System.in);
String input1 = Scan.nextLine();
Scan.close();
if (input1 == "Hello");
{
System.out.println("How are you?");
}
else
System.out.println("How rude, you didn't even say Hello!");
break;
}
}
}

How I can exclude files into the compiled APK?

How I can exclude files into the compiled APK?

I need to exclude certain assets files into the APK (a few mp3 files).
That is, they are not included in the APK to compile. How I can do this
using eclipse?
Thanks in advance.

Access Violation, memset

Access Violation, memset

The following code throws an access violation at line L2 at runtime, which
happens during the 2nd call to setword.
Q> Where am I going wrong in L2, and why is there no problem with the 1st
memset at line L1?
Note: I have tried to isolate the problem area from a larger code, hope
this provides enough info.
void setword( char ** word )
{
if ( *word == NULL )
{
*word = (char *)malloc(30);
memset( *word, '\0', 30 ); //L1: OK
}
else
{
memset( *word, '\0', 30 );//L2: Access violation
}
*word = "Hello";
//*word shall be freed when operations are complete.
}
int main()
{
char * word = NULL;
setword( &word ); //Call 1: OK
printf( "%s\n", word );
setword( &word ); //Call 2: NOK!
printf( "%s\n", word );
}

Gigabyte GA-EP35-DS3 DDR3 support and Grahics Card problems

Gigabyte GA-EP35-DS3 DDR3 support and Grahics Card problems

I found the board specification on:
http://www.gigabyte.com/products/product-page.aspx?pid=2741&dl=1#ov but no
DDR3 memory is present in the memory support list of the board.
I have the following uncertainties:
Does the Gigabyte GA-EP35-DS3 motherboard support DDR3? If so, which type
of DDR3 and how much memory?
My computer restarts after 1-2 minutes, when i start a game that demands
high graphical processing. What might be the cause?
My system configuration is:
Intel Core 2 Quad Q9450
2xDDR2 (400 MHz, 2048 MB)
Radeon HD 4850

Saturday, 17 August 2013

How to extract the bits of larger numeric Numpy data types

How to extract the bits of larger numeric Numpy data types

Numpy has a library function, np.unpackbits, which will unpack a uint8
into a bit vector of length 8. Is there a correspondingly fast way to
unpack larger numeric types? E.g. uint16 or uint32. I am working on a
question that involves frequent translation between numbers, for array
indexing, and their bit vector representations, and the bottleneck is our
pack and unpack functions.

ruby when to eigenclasses come into existence

ruby when to eigenclasses come into existence

Do Eigenclasses exist prior to a singleton method being defined on a
Object or Class. ie Do they always exist or come in existence when a
singleton method or class method in defined?

Fundamental group of a complex algebraic curve residually finite?

Fundamental group of a complex algebraic curve residually finite?

Is the analytic fundamental group of a smooth complex algebraic curve
(considered as a Riemann surface) residually finite?

get event of child element without triggering same event for parent

get event of child element without triggering same event for parent

I have parent node and child node. They both have 'click' event listners.
Since <a> is child element, I cannot click on it without clicking on
parent <div&gt, so always event for parent <div&gt is triggered. How can I
get event for child element <a&gt without triggering one for parent
<div&gt? Here is the jsFiddle and the code:
HTML
<div id="container">
<a href="" id="link"></a>
</div>
CSS:
#container {
width:100px;
height:100px;
background:blue;
position:relative;
cursor:pointer;
}
#link {
width:20px;
height:20px;
background:green;
position:absolute;
top:10px;
left:10px;
}
JS:
$('#container').on('click', function() {
alert('container');
});
$('#link').on('click', function() {
alert('link');
});

Clouds distributed operating system

Clouds distributed operating system

I am looking for clouds distributed operating systems tutorial.need its
structure,scalability,security,computing model,global
knowledge,compatibility,naming system.
Also is it single user or multi user system.
so far I got these two papers published but they are not helping much though.
Clouds1
Clouds2
Any help would be appreciated. Thanks for stopping by!!!

Installing RVM with space in $USER

Installing RVM with space in $USER

So I've run into a bit of a problem. I've found many similar problems with
spaces in $HOME, but the fixes do not apply to spaces in $USER - so I'm
posting a question here.
Due to regulations at work my username for my workstation consists of
+space+ (cannot be changed), for instance: John Doe
This is my $USER:
$ echo $USER
john doe
When I try to install rvm I get the following error:
It looks you are one of the happy *space* users(in home dir name),
RVM is not yet fully ready for it, use this trick to fix it:
sudo ln -s "/Users/john doe/.rvm/" /john doe.rvm
echo "export rvm_path=/john doe.rvm" >> "/Users/john doe/.rvmrc"
However, when I try to run the first command I get the following error:
ln: doe.rvm: No such file or directory
And if I attempt to run
sudo ln -s "/Users/john doe/.rvm/" "/john doe.rvm"
I get:
ln: /john doe.rvm: File exists
Any help would be tremendously appreciated :-)
Edit
sudo ln -s "/Users/john doe/.rvm/" /john\ doe.rvm
yields
ln: /john doe.rvm: File exists