samedi 28 juin 2014

Google Map's doesn't animate camera with new boundries


Vote count:

0




I've got GoogleMap in my android app and what I want to do is to animate camera to be exacly above items in my cluster. It works when the map is first lunched but never again in this session. This is how I want to update my map view:



List<LatLng> pointsList = new ArrayList<LatLng>();

for(MyObject myObject: ObjectsList) {
pointsList.add(new LatLng(myObject.getLatitude(), myObject
.getLongitude()));
}

LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (LatLng latLng : pointsList) {
builder.include(latLng);
}

LatLngBounds bounds = builder.build();
int padding = 100;


mCameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, padding);
mGoogleMap.animateCamera(mCameraUpdate);


I call this whenever I've got new ObjectList to set new boundries. But except first time it never works. I also can show how i put my objects into cluster:



mClusterManager = new ClusterManager<MyClusterItem>(mActivity, mGoogleMap);
mGoogleMap.setOnCameraChangeListener(mClusterManager);
mGoogleMap.setOnMarkerClickListener(mClusterManager);
mClusterManager.setRenderer(new MyClusterRenderer(mActivity, mGoogleMap, mClusterManager));

for (MyObject p : ObjectsList) {
MyClusterItem myClusterItem = new MyClusterItem(p);
mClusterManager.addItem(myClusterItem);

}


Can anybody explain me how to set camera to fit my objects and nothing else every time my objects list has changed?



asked 33 secs ago






Developing a Java based Web Service Client such that unwanted nodes from the WSDL are not considered


Vote count:

0




I want to query data using API exposed by Web Services. The WSDL has around 1000 nodes exposed. But I need only 20 nodes in my request. When invoking the web service via code I know couple of ways to cut down the number of nodes and trigger the service:




  1. Remove the unwanted nodes from the WSDL and input the modified WSDL to wsimport such that stub is generated with the required fields only.




  2. Invoke Web Service without generating stub by forming the request as a string and triggering http request to the end point.




Unfortunately I cannot adopt any of the above. Any alternative suggestions?



asked 52 secs ago






CodeMirror using Jqyery .keyup on editor textarea


Vote count:

0




I want to getValue of Codemirror editor on keyup but it did not work. Here's the fiddle



var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor = CodeMirror.fromTextArea(document.getElementById("HTML"), {mode: mixedMode, lineNumbers: true });

$(document).ready(function(){
$("#HTML").keyup(function(){
html = editor.getValue();
alert(html);
});
});


asked 25 secs ago






Adding and subtracting values in the table with PHP


Vote count:

0




I have a table where I am trying to figure out the profit from each entry.


`" type="text" class="nnbtext" value="" size="7">


" type="text" class="nnbtext" value="" size="7">


" type="text" class="nnbtext" value="" size="7">


" type="text" class="nnbtext" value="" size="7">


" type="text" class="nnbtext" value="" size="7">


" type="text" class="nnbtext" value="" size="7">


" type="text" class="nnbtext" value="" size="7">`


Basically I will put a new for the last column, but want to echo the vehicles + Hotels + Guide - Discount a



asked 27 secs ago






jquery mobile slider doesn't display on second section


Vote count:

0




I want to add a slide show using Jquery to my App. i'm using sections in my html code, and my problem is that: When i place the relevant slider code () on the first section everything work as acpected.


but when I place the code on the second section I don't see the images slides..



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>??-?? ??"?</title>
<link rel="stylesheet" href="includes/reset.css">
<link rel="stylesheet" href="includes/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet" href="includes/style.css">
<script src="http://ift.tt/ZnjyAz"></script>
<script src="includes/jquery.mobile-1.4.2.min.js"></script>
<script src="js/jquery.slides.min.js"></script>

<!-- SlidesJS Required (if responsive): Sets the page width to the device width. -->
<meta name="viewport" content="width=device-width">
<!-- End SlidesJS Required -->

<!-- CSS for slidesjs.com example -->
<link rel="stylesheet" href="css/example.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<!-- End CSS for slidesjs.com example -->

<!-- SlidesJS Optional: If you'd like to use this design -->
<style>
body {
-webkit-font-smoothing: antialiased;
font: normal 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #232525;
padding-top:70px;
}

#slides {
display: none
}

#slides .slidesjs-navigation {
margin-top:3px;
}

#slides .slidesjs-previous {
margin-right: 5px;
float: left;
}

#slides .slidesjs-next {
margin-right: 5px;
float: left;
}

.slidesjs-pagination {
margin: 6px 0 0;
float: right;
list-style: none;
}

.slidesjs-pagination li {
float: left;
margin: 0 1px;
}

.slidesjs-pagination li a {
display: block;
width: 13px;
height: 0;
padding-top: 13px;
background-image: url(img/pagination.png);
background-position: 0 0;
float: left;
overflow: hidden;
}

.slidesjs-pagination li a.active,
.slidesjs-pagination li a:hover.active {
background-position: 0 -13px
}

.slidesjs-pagination li a:hover {
background-position: 0 -26px
}

#slides a:link,
#slides a:visited {
color: #333
}

#slides a:hover,
#slides a:active {
color: #9e2020
}

.navbar {
overflow: hidden
}
</style>
<!-- End SlidesJS Optional-->

<!-- SlidesJS Required: These styles are required if you'd like a responsive slideshow -->
<style>
#slides {
display: none
}

.container {
margin: 0 auto
}

/* For tablets & smart phones */
@media (max-width: 767px) {
body {
padding-left: 20px;
padding-right: 20px;
}
.container {
width: auto
}
}

/* For smartphones */
@media (max-width: 480px) {
.container {
width: auto
}
}

/* For smaller displays like laptops */
@media (min-width: 768px) and (max-width: 979px) {
.container {
width: 724px
}
}

/* For larger displays */
@media (min-width: 1200px) {
.container {
width: 1170px
}
}
</style>
<!-- SlidesJS Required: -->
<script>
$(function() {
$('#slides').slidesjs({
width: 940,
height: 528,
navigation: false
});
});
</script>
</head>
<body>

<section data-role="page" id="hp">
<header data-role="header">My First App</header>
<article role="main" class="ui-content">
<h1>Welcome Aboard</h1>
<p>First Sectionn</p>




<a href="#about">about</a>
</article>
<footer data-role="footer">credits</footer>
</section>


<section data-role="page" id="about">
<header data-role="header">About My First App</header>
<article role="main" class="ui-content">
<h1>Who are we</h1>
<p>Second Sectionn</p>

<div class="container">
<div id="slides">
<img src="img/example-slide-1.jpg" alt="Photo by: Missy S Link: http://ift.tt/1prNHL6">
<img src="img/example-slide-2.jpg" alt="Photo by: Daniel Parks Link: http://ift.tt/1prNJ5z">
<img src="img/example-slide-3.jpg" alt="Photo by: Mike Ranweiler Link: http://ift.tt/1mQFgFV">
<img src="img/example-slide-4.jpg" alt="Photo by: Stuart SeegerLink: http://ift.tt/1prNHLc">
<a href="#" class="slidesjs-previous slidesjs-navigation"><i class="icon-chevron-left icon-large"></i></a>
<a href="#" class="slidesjs-next slidesjs-navigation"><i class="icon-chevron-right icon-large"></i></a>
</div>
</div>
<a href="#hp">home page</a>
</article>
<footer data-role="footer">credits</footer>
</section>


</body>
</html>


asked 37 secs ago






Memoized to DP solution - Making Change


Vote count:

0




Recently I read a problem to practice DP. I wasn't able to come up with one, so I tried a recursive solution which I later modified to use memoization. The problem statement is as follows :-



Making Change. You are given n types of coin denominations of values v(1) < v(2) < ... < v(n) (all integers). Assume v(1) = 1, so you can always make change for any amount of money C. Give an algorithm which makes change for an amount of money C with as few coins as possible. [on problem set 4]



I got the question from here


My solution was as follows :-



def memoized_make_change(L, index, cost, d):
if index == 0:
return cost

if (index, cost) in d:
return d[(index, cost)]

count = cost / L[index]
val1 = memoized_make_change(L, index-1, cost%L[index], d) + count
val2 = memoized_make_change(L, index-1, cost, d)

x = min(val1, val2)
d[(index, cost)] = x
return x


This is how I've understood my solution to the problem. Assume that the denominations are stored in L in ascending order. As I iterate from the end to the beginning, I have a choice to either choose a denomination or not choose it. If I choose it, I then recurse to satisfy the remaining amount with lower denominations. If I do not choose it, I recurse to satisfy the current amount with lower denominations.


Either way, at a given function call, I find the best(lowest count) to satisfy a given amount.


Could I have some help in bridging the thought process from here onward to reach a DP solution? I'm not doing this as any HW, this is just for fun and practice. I don't really need any code either, just some help in explaining the thought process would be perfect.



asked 2 mins ago

uki

3,110





PHP replace wildcards (%s, %d) in string with vars


Vote count:

0




I have translate function t($var);



function t($word) {
return $this->words[$word];
}


where $this->words is array



$this->words = array(
'word1' => 'word',
'word2' => 'something'
);


I am using functions as <?php echo t('word1'); ?> and output is : word


My goal is to use wildcards %s, %d, %f to replace them with variables. Example:



$this->words = array(
'word1' => 'word',
'word2' => 'something',
'sentence' => 'Hello, my name is %s. I am %d years old.'
);


Then parse variables into t() function.



<?php echo t('sentence', array('Mike', 99));


So output will be: Hello, my name is Mike. I am 99 years old.


My Work so far:



function t($word, $vars = array()) {
foreach ($vars as $key) {
if(is_string($key)){
$this->words[$word] = str_replace ('%s', $key, $this->words[$word]);
}
if(is_int($key)) {
$this->words[$word] = str_replace ('%d', $key, $this->words[$word]);
}
if(is_float($key)){
$this->words[$word] = str_replace ('%f', $key, $this->words[$word]);
}
}
return $this->words[$word];
}


But this function doesn't work with more than one of each type of variable.



asked 29 secs ago






Template variable leads to warning


Vote count:

0




This code gives me the following warning in Clang and I am not sure why or if this is a problem. warning: variable 'M_PI<int>' has internal linkage but is not defined [-Wundefined-internal]



template <typename T>
constexpr T M_PI = T(3.1415926535897932);

template <typename T>
constexpr T CalcCircumference(T d)
{
return d * M_PI<T>;
}

int main()
{
return CalcCircumference(42);
}


asked 38 secs ago






jQuery: making a dynamic list sortable


Vote count:

1




I've got a simple list-maker using jQuery, but would like to make the created list sortable. I've tried applying the .sortable() function to various elements at various stages in the code, but it either does not work or breaks the code that comes after it. I assume this has something to do with the function execution order, which I know little about - any links to tutorials on that would also be appreciated. Code below and on jsfiddle at http://ift.tt/1vghDbF.


JS:



$(document).ready(myEnter);

function myEnter(){
$("input[name='checkListItem']").focus();

$("input[name='checkListItem']").keydown(function( key ) {
if ( key.which == 13 ) {
event.preventDefault();
myAdd();
}
});

$('.mainlist').on('click', '.item', myMove);
$('.checkedlist').on('click', '.item', myRemove);
$(document).click(function() {$("input[name='checkListItem']").focus();});
}

function myRemove(){
$(this).remove();
$("input[name='checkListItem']").focus();
}

function myMove(){
$('.checkedlist').append($(this));
$("input[name='checkListItem']").focus();
}

function myAdd(){
var toAdd = $('input[name=checkListItem]').val();
$('.mainlist').append('<li class="item">' + toAdd + '</li>');
$("form[name='checkListForm']").find("input[name=checkListItem], textarea").val("");
$("input[name='checkListItem']").focus();
}


HTML:



<!DOCTYPE html>

<html>

<head>
<title>//Testing grounds</title>
<link type="text/css" rel="stylesheet" href="style.css"/>
<script src="http://ift.tt/183v7Lz"></script>
<script type="text/javascript" src="basiclist.js"></script>
</head>

<body>
<div class="center">
<h3>Testing grounds</h3>
<form name="checkListForm" id="listAddForm">
<input type="text" name="checkListItem"/>
</form>
</div>
<div class="center"><ol class="mainlist"><h3>My list</h3></ol></div>
<div class="center"><ol class="checkedlist"><h3>Checked off</h3></ol></div>
</body>

</html>


asked 2 mins ago






How can I apply a matrix transformations to a path programatically?


Vote count:

0




Is that possible to apply a transformation to a path? for example this svg file with a matrix transformation is ok to view it in any bowser but when I want to animate the path it doesn't apply the transformation and only animates the original svg:



<svg xmlns="http://ift.tt/nvqhV5" width="744.094" height="1052.362">
<desc>Created with Snap</desc>
<defs></defs>
<g transform="matrix(-0.0484,-0.6546,0.6546,-0.0484,-128.0688,464.2113)">
<path d="M214.04 312.141c4.326-8.386 ... 4.459 4.459" stroke="#000" fill="none">
</path>
</g>


How can I in apply the transformations to the path programatically and solve this problem?



asked 1 min ago






vendredi 27 juin 2014

The nested query is not supported. Operation1='Case' Operation2='Collect' in Linq or Lamda Expression


Vote count:

0




I'm trying to get my Roles on the basis of ID ,


I am specifying one bool variable and check the Id and id having comma(,) separated values Like


ids = "2,3"


bool flag = false;



if (ids!= null)
{
flag = true;
}


and my nested query



var Product = db.Products.Where(x => x.EmailID == id).Select(
x => new
{
Roles = flag == true ? x.Product.task.Where(a => a.ProjectTalentRelations.Any(p => p.AgencySelection > agencyselection && (ids.Contains(a.ProjectRoleID)))).Select(r => new
{
r.ProductID,
r.Name
}):
x.Product.task.Where(a => a.ProjectTalentRelations.Any(p => p.AgencySelection > agencyselection)).Select(r => new
{
r.ProductID,
r.Name
})

)};


asked 1 min ago






Is it possiable to use script elements inside the tpl attiribute


Vote count:

0




Is it possiable to use script elements inside the tpl attiribute.What I wanna do in my senario is add some script elements inside the tpl.how can I do that.(I have buttons inside it and wanna add soem events those buttons via javascript)


here is the my code but it gives the error.



.Tpl(
Html.X().XTemplate()
.Html(


@<text

<tpl for="."> <p></p>
<script>alert("bumm");</script>


<div class="thumb-wrap" id="{Ad}">
<div class="item col-xs-4 col-lg-4">

<div class="thumbnail">
<img class="group list-group-image" src="http://ift.tt/1obVhqI" alt="" />
<div class="caption">
<h4 class="group inner list-group-item-heading">
{Ad}</h4>
<p class="group inner list-group-item-text">
{Aciklama}</p>
<div class="row">
<div class="col-xs-12 col-md-6">
<p class="lead">
{Fiyat} TL</p>
<p class="lead urunkodu" id="urunkodu" >
{UrunKodu}</p>
</div>
<div class="col-xs-12 col-md-6">
<input type="button" class="btn btn-success" id="sepeteEkle_{ID}" value="Sepete ekle"></input>
</div>
</div>
</div>
</div>
</div>

</div>
</tpl>
<div class="x-clear"></div>
</text>
)
)


asked 1 min ago

sakir

684





Sockets to read file?


Vote count:

0




This was prompted by this question: OS.File check last modified date before OS.read


I read that it might be wiser to use sockets to read files?


In my addon, every time the user clicks the PanelUI-popup button at top right, the new one in Australis, my add-on does a OS.File.read on the profiles.ini file to look for any changes. I do not even do OS.File.stat like in topic I linked above. And there is absolutely no performance issues from what I'm seeing. I have a computer from 2k4, Pentium 4, I notice any performance issues visually.


But I was waiting for a file watcher service, which is in the works right now at bugzilla. But I thought what is sockets? I searched SO but it didn't yield anything I understood they all seem to open to internet not to local file. (http://ift.tt/1pZo7vZ)


Can sockets be used to watch a file for changes?



asked 1 min ago

Noitidart

2,671





How to add rows with different layouts files in Array List?


Vote count:

0




i am using a list view and want to add rows to it, i know how to add simple rows with Array adapter but this time i want to add Custom rows with different layout files.


how could i achieve it??


here are my 3 XML files that i want to add



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<Button
android:id="@+id/creditBestValuePurchase"
android:layout_width="85dp"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:background="@drawable/btn_save_normal"
android:gravity="center_vertical|center_horizontal"
android:text="$ 14.99" />

<TextView
android:id="@+id/creditBestValueNoOfCredits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/creditBestValuePurchase"
android:layout_alignBottom="@+id/creditBestValuePurchase"
android:layout_alignParentLeft="true"
android:layout_marginRight="15dp"
android:layout_marginLeft="16dp"
android:text="5000 credits" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/creditBestValueNoOfCredits"
android:layout_alignBottom="@+id/creditBestValueNoOfCredits"
android:layout_centerHorizontal="true"
android:background="@drawable/yellow"
android:gravity="center_vertical|center_horizontal"
android:text="BEST VALUE" />

</RelativeLayout>


similarly i have 2 other layouts


so how would i add these to list view?


help would be greatly appreciated.



asked 1 min ago

Dude

26





Using newest 2013 MS cc compiler into older visual studio 2010 interface?


Vote count:

1




I wanted to know if anybody had the experience of configuring this : http://ift.tt/1qkSYov into visual studio 2010 ?


I have only Windows Vista on some of my machines; and I'd like to code using a 2012 or 2013 compiler. I know visual studio is greatly configurable and can plug various compilers (like sony for PS Vita is providing a configuration for gcc based compiler in visual studio).


VS 2012 and 2013 express cannot be installed on Vista. But I see no reason why the compiler; a purely command line tool, wouldn't work on Vista. (because it wouldn't dare to need that darn K32GetModuleInformation thingie. I bet MS called this function for purely phony purposes of forcing people to upgrade their OS)


thanks !


ps : of course a trick to make vs 2013 express (for desktop) installable on vista would also be appreciated.



asked 3 mins ago






How to format [url=][/url] code or shortcode on a custom built website?


Vote count:

0




Well i need to make some kind of function or shortcode to format those type of links.


I am working on some website and parsing data from json format and inside that data there are link codes like this as a text.


So what i get inside json file is this:



[url=http://ift.tt/1lz8CK6 IV: Complete Edition[/url] includes Grand Theft Auto IV and Episodes from Liberty City.


So how do i get these url links to format on my website as normal links? some kind of shortcode or what ?



asked 28 secs ago






Ocaml Optimization Techniques


Vote count:

0




I am new to Ocaml (with some prior knowledge in Haskell). And I want to persuade myself to adopt Ocaml. Therefore I tried to compare the performance between C and Ocaml. I wrote the following naïve Monte Carlo Pi-finder:


C Version



#include <stdio.h>
#include <stdlib.h>

int main(int argc, const char * argv[]) {

const int N = 10000000;
const int M = 10000000;

int count = 0;
for (int i = 0; i < N; i++) {
double x = (double)(random() % (2 * M + 1) - M) / (double)(M);
double y = (double)(random() % (2 * M + 1) - M) / (double)(M);
if (x * x + y * y <= 1) {
count++;
}
}

double pi_approx = 4.0 * (double)(count) / (double)(N);
printf("pi .= %f", pi_approx);
return 0;
}


Ocaml Version



let findPi m n =
let rec countPi count = function
| 0 -> count
| n ->
let x = float_of_int (Random.int (2 * m + 1) - m) /. (float_of_int m) in
let y = float_of_int (Random.int (2 * m + 1) - m) /. (float_of_int m) in
if x *. x +. y *. y <= 1. then
countPi (count + 1) (n - 1)
else
countPi count (n - 1) in
4.0 *. (float_of_int (countPi 0 n)) /. (float_of_int n);;

let n = 10000000 in
let m = 10000000 in

let pi_approx = findPi m n in
Printf.printf "pi .= %f" pi_approx


I compiled the C with Clang (Apple LLVM version 5.1) and the Ocaml with OCamlopt v4.01.0.


The running time of C is 0.105s. The Ocaml one is 0.945s, which is 9 times slower. My target is to reduce the running time of Ocaml by 3 times, so that the program can finish within 0.315s.


As I am so new to Ocaml, I want to learn some Ocaml optimization techniques. Please leave me some suggestions! (Tail-resursion is already applied)



asked 29 secs ago






Send Two Images to web server


Vote count:

0




I've successfully one image to web server. Now I need to modify the code to send two images with Two different urls . The code i've used to send singe image is



NSString *url=[NSString stringWithFormat:@"http://ift.tt/1m3nzz3",requestString];
NSLog(@"url1%@",url);
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ;
[request setURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"POST"];

// Create 'POST' MutableRequest with Data and Other Image Attachment.

NSString *boundary = @"---------------------------14737809831466499882746641449";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request setValue:contentType forHTTPHeaderField:@"Content-Type"];

NSData *data = UIImageJPEGRepresentation(chosenImage1, 0.2f);
[request addValue:@"image/JPEG" forHTTPHeaderField:@"Content-Type"];
NSMutableData *body = [NSMutableData data];
[body appendData:[NSData dataWithData:data]];
[request setHTTPBody:body];


Help me, Thanks in advance for everyone.



asked 14 secs ago






Send mail in phpmailer usign DKIM Keys


Vote count:

0




Currents i am using phpmailer to send mail's. now how its possible to send email in phpmailer with DKIM keys


i search in phpmailer Class file and i found the below code



/**
* DKIM selector.
* @type string
*/
public $DKIM_selector = '';

/**
* DKIM Identity.
* Usually the email address used as the source of the email
* @type string
*/
public $DKIM_identity = '';

/**
* DKIM passphrase.
* Used if your key is encrypted.
* @type string
*/
public $DKIM_passphrase = '';

/**
* DKIM signing domain name.
* @example 'example.com'
* @type string
*/
public $DKIM_domain = '';

/**
* DKIM private key file path.
* @type string
*/
public $DKIM_private = '';


Can i know how its possible. pls help me



asked 20 secs ago

S.Varun

1,332





why first query return 1 less record from 2nd


Vote count:

0




my database is - Product(maker, model, type) PC(code, model, speed, ram, hd, cd, price) Laptop(code, model, speed, ram, hd, screen, price) Printer(code, model, color, type, price)


and my queries are 1) SELECT maker FROM Product WHERE model IN( SELECT model FROM PC WHERE ram=(select min(ram) from pc )

AND speed = (SELECT MAX(speed) FROM (SELECT speed FROM PC WHERE ram=(SELECT MIN(ram) FROM PC ) ) as z ) ) and maker in (select maker from product where type = 'printer')


2) SELECT DISTINCT maker FROM Product WHERE type = 'printer' AND maker IN(SELECT maker FROM Product WHERE model IN(SELECT model FROM PC WHERE ram=(select min(ram) from pc ) and speed = (SELECT MAX(speed) FROM (SELECT speed FROM PC WHERE ram=(SELECT MIN(ram) FROM PC ) ) as z )))



asked 30 secs ago






I get a Force Close whenever I tap the start button on my app on my phone?


Vote count:

0




Every time I click on the Start Button in my Android App, I consistently get a force close. There are zero errors in my code, so I'm confused as to why this is happening.


fragment_main_menu.xml:



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.app.whosesloganisthat.MainMenu$PlaceholderFragment" >

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

<Button
android:id="@+id/buttonStart"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="37dp"
android:text="@string/start"
android:onClick="sendMessage" />


</RelativeLayout>


fragment_easy_level_info.xml:



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.app.whosesloganisthat.EasyLevelInfo$PlaceholderFragment" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

</RelativeLayout>


MainMenu.java:



package com.app.whosesloganisthat;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.os.Build;

public class MainMenu extends ActionBarActivity {
public final static String EXTRA_MESSAGE = "com.app.whosesloganisthat.MESSAGE";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);

if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}

/** Called when the user clicks the Send button */
public void sendMessage(View view) {
Intent intent = new Intent(this, EasyLevelInfo.class);
EditText editText = (EditText) findViewById(R.id.container);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
// Do something in response to button
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main_menu,
container, false);
return rootView;
}
}

}


EasyLevelInfo.java:



package com.app.whosesloganisthat;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.os.Build;

public class EasyLevelInfo extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_easy_level_info);
Intent intent = getIntent();
String message = intent.getStringExtra(MainMenu.EXTRA_MESSAGE);
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);

// Set the text view as the activity layout
setContentView(textView);

if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.easy_level_info, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}

/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_easy_level_info,
container, false);
return rootView;
}
}

}


AndroidManifest.xml:



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://ift.tt/nIICcg"
package="com.app.whosesloganisthat"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.app.whosesloganisthat.MainMenu"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>


</activity>
<activity
android:name="com.app.whosesloganisthat.EasyLevelInfo"
android:label="@string/title_activity_easy_level_info" >
</activity>
<activity
android:name=".ToActivity"
android:label="@string/app_name">
</activity>
</application>

</manifest>


Logcat:



06-27 18:31:12.307: E/AndroidRuntime(16299): FATAL EXCEPTION: main
06-27 18:31:12.307: E/AndroidRuntime(16299): Process: com.app.whosesloganisthat, PID: 16299
06-27 18:31:12.307: E/AndroidRuntime(16299): java.lang.IllegalStateException: Could not execute method of the activity
06-27 18:31:12.307: E/AndroidRuntime(16299): at android.view.View$1.onClick(View.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at android.view.View.performClick(View.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at android.view.View$PerformClick.run(View.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at android.os.Handler.handleCallback(Handler.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at android.os.Handler.dispatchMessage(Handler.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at android.os.Looper.loop(Looper.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at android.app.ActivityThread.main(ActivityThread.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at java.lang.reflect.Method.invokeNative(Native Method)
06-27 18:31:12.307: E/AndroidRuntime(16299): at java.lang.reflect.Method.invoke(Method.java:515)
06-27 18:31:12.307: E/AndroidRuntime(16299): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
06-27 18:31:12.307: E/AndroidRuntime(16299): at dalvik.system.NativeStart.main(Native Method)
06-27 18:31:12.307: E/AndroidRuntime(16299): Caused by: java.lang.reflect.InvocationTargetException
06-27 18:31:12.307: E/AndroidRuntime(16299): at java.lang.reflect.Method.invokeNative(Native Method)
06-27 18:31:12.307: E/AndroidRuntime(16299): at java.lang.reflect.Method.invoke(Method.java:515)
06-27 18:31:12.307: E/AndroidRuntime(16299): ... 12 more
06-27 18:31:12.307: E/AndroidRuntime(16299): Caused by: java.lang.NullPointerException
06-27 18:31:12.307: E/AndroidRuntime(16299): at com.app.whosesloganisthat.MainMenu.sendMessage(MainMenu.java:51)
06-27 18:31:12.307: E/AndroidRuntime(16299): ... 14 more


Also, let me know if you think I forgot to add in other code for you to view. Thanks so much for your help!



asked 44 secs ago






How to add triples by using Jena API to a created Ontoglogy by Protoge


Vote count:

0




I have a data set in XML format and I transform that xml into Turtle format ( set of triples). I designed my OWL ontology using Protégé to be used as an ontology schema for the transformed triples. I want to use this OWL ontology to add the transferred xml (RDF format) data to be fit on my ontology design by using Jena. How could i do that?


one resource of the transformed xml data (int turtle format):



@prefix rdf: <http://ift.tt/1cmhbSZ;.
@prefix contact: <http://ift.tt/1iE5IV7;.

<http://ift.tt/1nOtFWN;
rdf:type contact:Person;
contact:fullName "Eric Miller";
contact:mailbox <mailto:em@w3.org>;
contact:personalTitle "Dr.".

...


Would you please help



asked 23 secs ago






Enviroment variable not defined


Vote count:

0




I'm using Win7 64 bit. I'm getting this despite the path exist on my machine.


Environment variable C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin not defined



asked 51 secs ago






How to get destination uid in sectionIndex menu in TYPO3?


Vote count:

0




I need to generate a sectionIndex with the following structure:



<div data-magellan-expedition="fixed">
<dl class="sub-nav">
<dd data-magellan-arrival="c123"><a href="#c123">Build with HTML</a></dd>
<dd data-magellan-arrival="c124"><a href="#c124">Arrival 2</a></dd>
</dl>
</div>


My problem is that I do not know how to set the correct value for the data-magellan-arrival property. How can I retrieve the uid of the current item in the menu?


My TypoScript currently looks like this:



lib.cb_foundation.magellan = HMENU
lib.cb_foundation.magellan {
1 = TMENU
1 {
sectionIndex = 1
sectionIndex.type = header
sectionIndex.useColPos = 0
wrap = <div data-magellan-expedition="fixed"><dl class="sub-nav"> | </dl></div>
NO {
allWrap = <dd data-magellan-arrival="c{field:uid}"> | </dd>
allWrap.insertData = 1
}
}
special = list
special.value.data = page:uid
}


However, {field:uid} gives me the uid of the content element that uses this TypoScript, not the uid of the destination section element.



asked 1 min ago






How to convert HTML to Text to cells Microsoft Excel


Vote count:

0




I had the same problem with this one below:


HTML Text with tags to formatted text in an Excel cell


I entered the code as the given answer:



Sub Sample()
Dim Ie As Object

Set Ie = CreateObject("InternetExplorer.Application")

With Ie
.Visible = False

.Navigate "about:blank"

.document.body.InnerHTML = Sheets("Sheet1").Range("A1").Value

.document.body.createtextrange.execCommand "Copy"
ActiveSheet.Paste Destination:=Sheets("Sheet1").Range("A1")

.Quit
End With
End Sub


but I got this message:



"Run-time error '438':


Object doesn't support this property method"



I am new at using VBA on excel and I don't know what to do


I appreciate any help



asked 1 min ago






How can we run Autoprefixer after "compass watch" using Gulp?


Vote count:

0




I want to take advantage of running autoprefixer after compass watches for changes to my scss files and update the css file with the autoprefixed code, but I'm stuck. I created a gulp.task in gulpfile.js for compass and autoprefixer. When I run "gulp server" using the gulpfile.js below everything works but no autoprefixing; the scss files are run through compass and output as a css file and browserSync live-reloads the page in the browser. Any help would be greatly appreciated.



'use strict';

var gulp = require('gulp');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var paths = require('compass-options').paths();
var rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync');
var shell = require('gulp-shell');

//////////////////////////////
// Begin Gulp Tasks
//////////////////////////////
gulp.task('lint', function () {
return gulp.src([
paths.js + '/**/*.js',
'!' + paths.js + '/**/*.js'
])
.pipe(jshint())
.pipe(jshint.reporter(stylish))
});

//////////////////////////////
// Compass Task
//////////////////////////////
gulp.task('compass', function () {
return gulp.src(paths.sass + '/**/*')
.pipe(shell([
'bundle exec compass watch --time'
]));
});

//////////////////////////////
// Autoprefixer
//////////////////////////////
gulp.task('prefix', function() {
return gulp.src('css/style.css')
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('css'));
});

//////////////////////////////
// Watch
//////////////////////////////
gulp.task('watch', function () {
gulp.watch(paths.js + '/**/*.js', ['lint']);
});

//////////////////////////////
// BrowserSync Task
//////////////////////////////
gulp.task('browserSync', function () {
browserSync.init([
paths.css + '/**/*.css',
paths.js + '/**/*.js',
paths.img + '/**/*',
paths.fonts + '/**/*',
paths.html + '/**/*.html',
]);
});

//////////////////////////////
// Server Tasks
//////////////////////////////
gulp.task('server', ['watch', 'compass', 'browserSync']);


asked 39 secs ago






Redirect to relative django path


Vote count:

0




See these examples:


http://ift.tt/1wSJLEg



def my_view(request):
...
return redirect('some-view-name', foo='bar') #view name with optional arguments

def my_view(request):
...
return redirect('/some/url/')


There is no identification to tell Django if the first argument is a view or a URL. I wanted to specify 'login', a relative path, but it looks for the view. On my local host, I had it working with '/login' since I was working in the root directory, but now after I deployed my project to my web server, I put it in a folder. Is specifying '/myfolder/login' (absolute path) the only way to use the redirect shortcut?



asked 47 secs ago






How can i trigger connect event with jquery


Vote count:

0




$(document).ready(function () { $('#login_dialog').dialog({ autoOpen: true, draggable: false, modal: true, title: 'Connect to XMPP', buttons: { "Connect": function () { $(document).trigger('connect', { jid: $('#jid').val(), password: $('#password').val() });



$('#password').val('');
$(this).dialog('close');
}
}
});


});


How to trigger connect event? Even the button is clicked, I am not seeing anything.



asked 28 secs ago






Polling New Message Alert/Notification


Vote count:

0




I am currently developing a web app that makes constant ajax calls (polls) to php to pull new 'tasks' from the database, sort of like how gmail/facebook checks for new email and messages. The current javascript code looks something like this:



doPoll();

function doPoll(){
$.post('ajax/tasks.php').done(function(data){
/* Append Tasks to HTML DOM */
}).always(function(){
setTimeout(doPoll, 5000);
});
}


see example:jQuery, simple polling example


I have gotten this to work well, my only problem now is that I would like to alert the user that they have a new 'task' if they are in a different tab. I know facebook and google do this by changing the Tab Heading from 'Facebook' to Something Like 'Facebook(2)' indicating 2 new messages. This seems like the norm, as I've seen other websites do this yahoo, trello, etc. This is sufficient for what I need to do and I was wondering if anyone knew how to do this, specifically only notify when the user is in a different tab.



asked 40 secs ago






How to position submit button, HTML


Vote count:

0




I am new to HTML and I am having some trouble with positioning a button. At the top of my webpage, in the navigation bar I have a couple of icons and I would like to also add a button. I want the button to be at the end of the icons. Can anyone assist me with that? Here is how I have my code set up.



<!-- icon 1 -->
<li class="customer">
{% if customer %}
<a href="/account"><i class="icon-user"></i></a>
{% else %}
<a href="/account/login"><i class="icon-user"></i></a>
{% endif %}
</li>

<!-- icon 2 -->
<li class="cart-overview"><a href="/cart"><i class="icon-shopping-cart"></i><span id="item_count">{{ cart.item_count }}</span></a>
<div id="crt">
{% include 'shopping-cart' %}
{% if cart.item_count != 0 %}
<a class="checkout-link" href="/cart">checkout</a>
{% endif %}
</div>
</li>

<!-- BUTTON icon -->
<li class="toolbar_btn">
<div id="btn">
<form method="post" action="/cart/add" data-money-format="$ {{amount}}" id="product-form-288451297">
<input type="hidden" id name="id" value="680177761">
<div id="product-add">
<input type="submit" name="button" value="Buy Now" style="height: 40px; width: 100px">
<p id="add-to-cart-msg"></p>
</div>
</form>
</div>
</li>


The style looks how I want it, I just need the button to be moved. Here is a screenshot. Thanks in advance!!


enter image description here



asked 54 secs ago






413 - Request Entity Too Large


Vote count:

0




I can upload small drafts OK using the metadata endpoint (http://ift.tt/1iDAMUM), e.g.:



{"message":{"raw":"TUlNRS1WZXJzaW9uOiAxLjANClgtTWFpbGVyOiBNYWlsQmVlLk5FVCA3LjAuNC4zMjgNClRvOiBjaHJpcy53b29kQG5vdGFibHlnb29kLmNvbQ0KU3ViamVjdDogdGVzdCENCkNvbnRlbnQtVHlwZTogbXVsdGlwYXJ0L21peGVkOw0KCWJvdW5kYXJ5PSItLS0tPV9OZXh0UGFydF8wMDBfQUFEQV9FOUMzOEZCNy5BMjRFQjI2OSINCg0KDQotLS0tLS09X05leHRQYXJ0XzAwMF9BQURBX0U5QzM4RkI3LkEyNEVCMjY5DQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4NCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IHF1b3RlZC1wcmludGFibGUNCg0KVGVzdCBjb250ZW50DQotLS0tLS09X05leHRQYXJ0XzAwMF9BQURBX0U5QzM4RkI3LkEyNEVCMjY5DQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTsNCgluYW1lPSJUcmFjZS5sb2ciDQpDb250ZW50LURpc3Bvc2l0aW9uOiBhdHRhY2htZW50Ow0KCWZpbGVuYW1lPSJUcmFjZS5sb2ciDQpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBiYXNlNjQNCg0KVTNWdUlESTVJRXBoYmlBeU1ERXlJREV5T2pJek9qTTBMalkzTmlBNklDTXhNREExTXpvZ1YxTkJSVU5QVGs1QlFrOVNWRVZFT2lCVA0KYjJaMGQyRnlaU0JqWVhWelpXUWdZMjl1Ym1WamRHbHZiaUJoWW05eWRDNGdJRWc2TURVMU9USWdSam9uU0VOVFRsUlRiMk5yWlhSZg0KVTJWdVpDY2dRVG9uYzJWdVpDY2dWRG9uVTI5amEyVjBQVFUwTUM0Z1JtbHVhWE5vWldRZ2NtVjBjbmxwYm1jdUp5QU5DbE4xYmlBeQ0KT1NCS1lXNGdNakF4TWlBeE1qb3lNem96TkM0Mk9UQWdPaUFqTVRBd09Eb2dSWEp5YjNJNklDQklPakExTlRreUlFWTZKMU5sYm1SVg0KYzJWeVJHVm1hVzVsWkVoVVZGQk5aWE56WVdkbFFtOWtlU2NnVkRvblJYSnliM0lnYzJWdVpHbHVaeUIxYzJWeUlHUmxabWx1WldRZw0KWm1sc1pTQmpiMjUwWlc1MGN5QjBieUJqYkdsbGJuUWdLRUp2WkhrcExpQlNaWFIxY200OUxURXVKeUFOQ2xOMWJpQXlPU0JLWVc0Zw0KTWpBeE1pQXhNam95TXpvek5DNDJPVElnT2lBak1UQXdOVE02SUZkVFFVVkRUMDVPUVVKUFVsUkZSRG9nVTI5bWRIZGhjbVVnWTJGMQ0KYzJWa0lHTnZibTVsWTNScGIyNGdZV0p2Y25RdUlDQklPakExTlRreUlFWTZKMGhEVTA1VVUyOWphMlYwWDFObGJtUW5JRUU2SjNObA0KYm1RbklGUTZKMU52WTJ0bGREMDFOREF1SUVacGJtbHphR1ZrSUhKbGRISjVhVzVuTGljZ0RRcFRkVzRnTWprZ1NtRnVJREl3TVRJZw0KTVRJNk1qTTZNelF1TmprMElEb2dJekV3TURnNklFVnljbTl5T2lBZ1JYSnliM0lnY21WeGRXVnpkR2x1WnlCQ1lYTnBZeUJCZFhSbw0KWlc1MGFXTmhkR2x2Ymk0TkNsTjFiaUF5T1NCS1lXNGdNakF4TWlBeE1qb3lOVG96TVM0NE1EWWdPaUFqTVRBeE5Ub2dVMmgxZEdSdg0KZDI0NklDQkdjbVZsSUZCeWIzaDVJRk5sY25acFkyVWdjM1J2Y0hCbFpDNE5DZz09DQotLS0tLS09X05leHRQYXJ0XzAwMF9BQURBX0U5QzM4RkI3LkEyNEVCMjY5LS0NCg"}}


However, when I try a larger file that's still within the 35MB limit (e.g. an 11MB file), I get the following HTTP WebException:



The remote server returned an error: (413) Request Entity Too Large.


Is this a bug in the new API, or is this down to the fact I should be using the media endpoint instead for this kind of thing? If so, can anybody provide an example of how to do this using the .NET Client?



asked 36 secs ago






Class HttpDateFormat found but method "getPreferedDateFormat" NOT found


Vote count:

0




While executing POST request using Jersey 2.9 on Eclipse, I can see Class HttpDateFormat but one of it's method "getPreferedDateFormat" is not found ! Any idea ?


I see following error during runtime:



NoSuchMethodError: org.glassfish.jersey.message.internal.HttpDateFormat.getPreferedDateFormat()


asked 1 min ago






How can I change a PHP variable with an input form?


Vote count:

0




I have sets of arrays that each have a value attributed to them. This value goes through a function to find a percentage then it is displayed on the page. Here's a snippet of that code:



<?php
$balls = array(
'blue' => 4,
'red' => 13,
'green' => 5
);

function percent($array, $element)
{
$total = array_sum($array);
$elementValue = $array[$element];
return ($elementValue / $total) * 100;
}
?>

<html>
<body>
Blue balls per set:<?php echo $balls["blue"]; ?>.
Percentage of blue balls:<?php echo percent($balls, 'blue'); ?>%.
</body>
</html>


How do I add an input form that could change this equation around. Specifically, I want to be able to add a variable ($sets) that would multiply the values of the array items before they are summed up.


The closest thing I can think of is something like this:



$sets = value from input form, if no value entered, default as 1

$balls = array(
'blue' => 4 * $sets,
'red' => 13 * $sets,
'green' => 5 * $sets
);


The rest of the equation would work as usual, but be updated with the new value from $sets as submitted in the input form. Also, would such a thing update the numbers displayed on the webpage instantly?



asked 24 secs ago






NodeJS Async: Callback already called?


Vote count:

0




I'm using Async module in Node.JS to keep track of my asynchronous calls. However, I'm getting an error - "Callback already called." Can someone help me out here?



async.each(data['results'], function(result, done) {
if (result['twitter_id'] !== null) { //Isolate twitter handle
var param = { "user.screen_name": result['twitter_id']}
db.test4.find( param, function(err, users) {
if( err ) {
return done(err);
} else if (!users) {
res.send("No user found");
} else {
users.forEach( function(Result) {
twitter_ids.push(Result);
//console.log(Result);
done();
});
}
});
}
}, function(err) {
if (err) {
throw err
}
res.send(twitter_ids);
});


asked 24 secs ago






pandas rolling_apply cumprod


Vote count:

0




I am trying to get a rolling cumulative product to a series in pandas. My in input series is,



s
0 1
1 2
2 3
3 4
4 5
5 6


I would like to get a resulting series that gives me the cumulative product of the previous 'n' values. So if 'n' were 3, I would like to get,



s
0 n/a
1 n/a
2 6
3 24
4 60
5 120


The code I have come up with uses rolling_apply and a lambda function and produces an TypeError



import pandas as pnd
df = pnd.DataFrame()
df['s'] = [1,2,3,4]
print (df)
print (pnd.rolling_apply(df.s,2,lambda x : x.cumprod()))

TypeError: only length-1 arrays can be converted to Python scalars


Does anyone know how to do this?



asked 40 secs ago

nitin

973





Best way to play videos in Android?


Vote count:

0




I have deve loped an app to watch embed videos. I play them with a webview but is not efficent for this...


I have hardwareAccelerated = true in mi AndroidManisfest file but it keeps 'lagging'.


I can't use YouTube API (I know is a good API to watch videos) because my videos are not in Youtube and i cannot upload it due to copyright therms.


So, is any other good API to play videos in an Android app? I'm using a WebChromeClient... or some suggestions to improve the WebView efficiency?


This is my webView



webViewPlayer = (WebView) findViewById(R.id.youtubeplayerview);
webViewPlayer.getSettings().setJavaScriptEnabled(true);
webViewPlayer.getSettings().setAppCacheEnabled(true);
webViewPlayer.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webViewPlayer.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webViewPlayer.getSettings().setDomStorageEnabled(true);
webViewPlayer.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// This line right here is what you're missing.
// Use the url provided in the method. It will match the member URL!
webViewPlayer.loadUrl(url);
return true;
}

@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
Toast.makeText(cntx, getString(R.string.toast_loaded), Toast.LENGTH_SHORT).show();
super.onPageFinished(view, url);
}


});
mClient = new MyChromeClient();
webViewPlayer.setWebChromeClient(mClient);


P.D. Launch the browser with an embed video is not a solution for me because my webView is a part of the activity, isn't fullscreen.


Thanks in advance.



asked 1 min ago






Daatabase with unknown type


Vote count:

0




I have a database which is attached, I do not know what type is this database. I tried to open it with notepad++, RazorSQL, Paradox table editor, Progress OpenEdge but nothing is useful. Database files has an extension ".db" and size of 10Mb for first one, the second has 688Mb, they comes with ".lg" and ".bi" files.It is an old database (since 1999) and was worked with MS-DOS. Some programs deal with this db as Paradox tables, another deals with it as Progress DB, I got confused of this db type. I have used such programs, a message appear : "External tables has an unexpected form", anotherb programs such as Progress OpenEdge tells "Corrupt table/index header". I tried to use converters (e.g: fullconverter, SQLWays 4.0) bot nothing worked. What is this database type ? what is the suitable software to be used to deal with this kind of db ? and how can I transfer data to excel sheet ot a modern database? Noting that it contains arabic data in rows.



asked 2 mins ago






Get touch location using onTouch and then programmatically touch this place


Vote count:

0




I made an app that gets the touch location and now I want to make it tap this place..


here is the code:



public boolean onTouch(View v, MotionEvent event) {
int x = (int) event.getX();
int y = (int) event.getY();
return true;
}


I only want it to programmatically touch this place..


how can I do it ?


ty :)



asked 1 min ago






Expert help needed - XmlReader Error in reading RSS Feed


Vote count:

0




I am trying to read an RSS feed from http://ift.tt/1oFJfqx with the following code:



//Different RSS Links
string deviant_rsslink = @"http://ift.tt/1oFJfqx";
string blogspot_rsslink = @"http://ift.tt/1pxHawk";

//Reading the links
XmlReader reader = XmlReader.Create(deviant_rsslink); //LINE WHERE ERROR OCCURS
SyndicationFeed feed = SyndicationFeed.Load(reader);
reader.Close();
foreach (SyndicationItem item in feed.Items)
{
String subject = item.Title.Text;
Console.WriteLine("Subjext is: " + subject + "\n");
}


...and I get the error:



"The underlying connection was closed: The connection was closed unexpectedly."


At first I thought deviantart might be blocking my IP so I tried this from different computers with differing IPs however the error persists, so it seems that is not the issue. To make things more difficult to track, the code works with no error at http://ift.tt/1pxHawk.


I'm still a n00b at this, and I have been trying to fix this for a two weeks now with no success. If anyone could point me in the right direction, offer any hint, or help it would be hugely appreciated.


Thank you kindly!!



asked 30 secs ago






Failed to find username/password in MySQL Database


Vote count:

0




I have just started out with PHP, and am finding it an odd programming language so far. I've 'borrowed' code from this PHP login script tutorial, and the code worked find before I modified it.


The specific problem is that it doesn't seem to be finding the username & password that exist in the database. I have verified that I am in fact inputting the correct username and password.


I'm new to PHP, so what exactly am I doing wrong? To the best of my (current) PHP knowlege, there are no syntax errors, nor are there basic programming errors such as leaving a quote.


Code (no, I don't mind that my database details are here, I plan to change them once this problem has been fixed):



<?php

$host="localhost"; // Host name
$username="crysisor_tstuser"; // Mysql username
$password="Password1234"; // Mysql password
$db_name="crysisor_test"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// Define $myusername and $mypassword
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){

// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION['session']="mypassword";
$_SESSION['session']="myusername";
$authorized = true;
$uname = $myusername;
header("Location: http://ift.tt/1llmeUl"); /* Redirect browser */
exit();
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>


HTML (if relevant):



<html xmlns="http://ift.tt/lH0Osb" xml:lang="en">
<html>
<head>
<title>Server Portal | Login</title>
<link href="./css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="navbar">
</div>
<div class="loginui">
<div class="loginfield">
<form id="login" name="form1" method="post" action="checklogin.php">
<input name="myusername" type="text" id="myusername" />
<input name="mypassword" type="text" id="mypassword" />
<input type="submit" name="Submit" value="" />
</form>
</div>
</div>
</body>
</html>


asked 18 secs ago






$(item).load() script breaking (only in IE11), works in developer tools


Vote count:

0




I have function that looks like this:



function foo(item) {
var url = $(item).attr("data-url");
if (url && url.length > 0) {
$(item).load(url);
}
}


This function is triggered by a drop downs .change() event. The load() calls out to an MVC4 Partial View, which returns the html. This all works fine and dandy in Chrome and Firefox, but it doesn't work in IE11 (I haven't tested in older versions of IE since I don't support those in this circumstance). However, as soon as I open the Developer Tools in IE, everything works perfectly; I don't have to do anything besides hit F12 for it to work.


I do not have any "console" code in my js files, the server is pushing back valid HTML, and I can't find any other issues to look into.


I hate to make such an open ended question, but can you give me some advice on what to look for? The only things I could find online were to pull out any "console" code (which I didn't have in the first place).


Any suggestions/guidance is greatly appreciated.



asked 42 secs ago

Sabe

152





Quartz.net high availability?


Vote count:

0




I am looking to implement an instance of Quartz.net, probably as a windows service. We plan to use SQL server as the back end storage of job data.


Long story short, high availability is paramount in our project. The quartz.net site talks about load balancing, but is a little lite on details. Does anyone know of some good methods to provide high availability to a Quartz.net implementation like this?


Suggestions or links to articles would be appreciated.



asked 1 min ago






Navigation menu not working in admin panel of Wordpress


Vote count:

0




My Wordpress menu bar is not working. i am creating a new menu but when i add some pages or categories into the menu it does not get reorder. Please help to sort it out I am using the woo-commerce in which it has given me inbuilt menus that is not getting reorder.



asked 3 mins ago






Swagger is showing _ebean_intercept with everymodel in my play application


Vote count:

0




I am integrating swagger into my play application. It works fine. ( Play 2.2 + swagger 1.3.3 )


Although for every model it adds a field which I need to hide


Classification { id (integer, optional), type (string, optional), shortCode (string, optional), active (boolean, optional), _ebean_intercept (EntityBeanIntercept, optional) }


I created a custom converter in Scala ( My app is written in Java by the way )



class IgnoreConverter extends SwaggerSchemaConverter {
override def skippedClasses: Set[String] = Set("com.avaje.ebean.bean.EntityBeanIntercept")
override def ignoredClasses: Set[String] = Set("com.avaje.ebean.bean.EntityBeanIntercept")
override def ignoredPackages: Set[String] = Set("com.avaje.ebean")
}


I am adding this converter when the Play app is loaded via Globals.java



@Override
public void onStart(Application application) {
Logger.info("Registering custom converter");
//HideModelConverter converter = new HideModelConverter();
IgnoreConverter converter = new IgnoreConverter();

ModelConverters.addConverter(converter, true);


Still no luck.


Can someone give me some ideas where I should look ?


How can I hide fields, classes, packages from Swagger's from introspection ? Why is Swagger ignoring my converter ?


Thanks for any help



asked 32 secs ago






Android app USB communication with PC


Vote count:

0




I would like to create an app in android that communicate via USB with a program in the computer. I search on internet and I got very confused about if it's possible or not.


So is there is any way to have a bidirectional communication with the computer and an app on the phone?


Thanks



asked 30 secs ago