Posts

Showing posts from September, 2012

jquery - Submit a form inside iframe and result to outside -

how can submit form iframe , result outside? $('iframe#paymentframe form').attr('target', '_top'); i tried code , doesn't work. can jquery or other way this? can't use target="_top" directly loading form of payment gateway inside iframe.

struct - C typedef confliction -

so attempting construct b-tree, using 2 types of nodes, individual key nodes (knode) , super node containing number of knodes based on order size (sibnode). problem keep running set work need knode pointers in sibnode (ex. pkey , smallestpnt) sibnode pointers in knode (ex. nxtkey , child). whichever typedef put first returns error unknown type pointers (example in order returns: error: unknown type name 'knode'). if give me advice on how avoid error appreciated. typedef int keyt; //b-tree node typdef typedef struct { int size; int cursor; knode* pkey; knode* smallestpnt; }sibnode; //key node typedef typedef struct { keyt* key; sibnode* nxtkey; sibnode* child; }knode; when sibnode type defined, type knode hasn't been defined yet. use forward declaration this: struct knode; //this forward declaration typedef struct { int size; int cursor; struct knode* pkey; //here struct knode* smallestpnt; //here }sibnode; typedef s

git - How can I "splice" two (or more) completely unrelated linear branch ancestries into a new one? -

i'm trying combine 2 branches each different root commit new, empty branch. not usual merge thing don't want have branches combined in last commit (in case, new branch have merge commit , 'below' still 2 seperate histories. new branch still have 2 root commits.). one important fact in scenario both branches unrelated. none commit of either branch affects pathes of other branches' commits => there no conflicts. let's assume following branches: a---b-----c-d x---y-z this looking for: a-x-b-y-z-c-d the main point want have commits in chronological order. how achieve? you write: one important fact in scenario both branches unrelated. no commit of either branch affects patches of other branches' commits => there no conflicts. of course, "splicing" operation suggest bad idea if anticipate many conflicts arise. let's assume that, indeed, nothing bad happen. if, @ beginning, repo looks this a---b------c--d

r - pheatmap: Color for NA -

using r package pheatmap draw heatmaps. there way assign color nas in input matrix? seems na gets colored in white default. e.g.: library(pheatmap) m<- matrix(c(1:100), nrow= 10) m[1,1]<- na m[10,10]<- na pheatmap(m, cluster_rows=false, cluster_cols=false) thanks it possible, requires hacking. first of let's see how pheatmap draws heatmap. can check typing pheatmap in console , scrolling through output, or alternatively using edit(pheatmap) . you find colours mapped using mat = scale_colours(mat, col = color, breaks = breaks) the scale_colours function seems internal function of pheatmap package, can check source code using getanywhere(scale_colours) which gives function (mat, col = rainbow(10), breaks = na) { mat = as.matrix(mat) return(matrix(scale_vec_colours(as.vector(mat), col = col, breaks = breaks), nrow(mat), ncol(mat), dimnames = list(rownames(mat), colnames(mat)))) } now need check scale_vec_colours

Connection setting between two SQL server to access a different database -

i have question. in sql server, can access table or view in different database using dot notation in table name, believe in sql server, if 'tablename' refer table name in current active db, if 'dbname'.'tablename' can access table in different db on same server, , if 'servername'.'dbname'.'tablename' can access table in remote db dbname defined in connection setting. believe can define connection setting between 2 sql server access different database. so, instead of copying data 1 db other , duplicate same, might better define view. can please me if can , how? using linked server can access 2 different servers. use below link add linked server. http://sqlserverplanet.com/dba/how-to-add-a-linked-server

javascript - Complex jQuery if statements including operators -

i show different div depending on class 3 span elems contain. if span hasclass up or up1 code show div class allup . if hasclass up up1 , down show div class twoup . i wrote following, of course doesn't work. var $line1 = $(".line1") var $line2 = $(".line2") var $line3 = $(".line3") if($line1.hasclass("up") || $line1.hasclass("up1") && $line2.hasclass("up") || $line2.hasclass("up1") && $line3.hasclass("up") || $line3.hasclass("up1")) { $(".allup").show(); } else if ($line1.hasclass("up") || $line1.hasclass("up1") && $line2.hasclass("up") || $line2.hasclass("up1") && $line3.hasclass("down") || $line3.hasclass("down1")) { $(".twoup").show(); } else if ($line1.hasclass("up") || $line1.hasclass("up1") && $line2.hasclass("down&

how to show/hide div according to user permission/role using angularjs in sharepoint 2010 -

i have create form using content editor web part in sharepoint 2010. have hide item or div based on group permission (example: admin,user) using angularjs. there have 2 ways solve problem: you receive data , display or not based on current role, helped display function. jsfiddle1 javascript code: var demoapp = angular.module('demoapp', []); demoapp.controller('permissionsform', function ($scope) { // mock data. must receive server $scope.mockdata = { field1: { value: 'field1 value', roles: ['admin','user'] }, field2: { value: 'field2 value', roles: ['admin'] }, field3: { value: 'field3 value', roles: ['admin','user'] }, role: 'user' }; $scope.displayfield = function(fieldname){ var foundrole = false; angular.foreach($scope.m

Using 'case' in ORDER BY (MySQL) -

i'm working in procedure returns huge select wan't define how order. wan't choose 1 of 3 fields , if ascending or descending, if none of 3 options define, returns default first field in descending this way order case option1 when 0 case option2 when 0 firstfield desc when 1 firstfield asc end when 1 case option2 when 0 secondfield desc when 1 secondfield asc end when 2 case option2 when 0 thirdfield desc when 1 thirdfield asc end else firstfield desc end end; of course, didn't work... mysql acuses errors in words 'desc' , 'asc', how can make works?? in order this, have move desc/asc outside case come after expression. you should separate fields. in case statement if fields have different datatypes, converted 1 fits (usua

ios - Data from API call and jsonobject is not carrying over when called -

i'm calling api , it's jsonobject in segue, , trying push view controller, it's not carrying data. in below code prints fine in call, other 2 prints come null. is there i'm missing make data persistent? - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"showchangedetail"]) { nsindexpath *indexpath = nil; bnritem *item = nil; //bditemchangedetailapi *itemapi = nil; nsarray *items = [[bnritemstore sharedstore] allitems]; if (self.searchdisplaycontroller.active) { indexpath = [self.searchdisplaycontroller.searchresultstableview indexpathforselectedrow]; item = [searchresults objectatindex:indexpath.row]; } else { indexpath = [self.tableview indexpathforselectedrow]; //item = items[indexpath.row]; item = [items objectatindex:indexpath.row]; } nslog(@"111111%@", self.apiitem); [self fetchfeedapichangedetail];

google spreadsheet - How can I copy a conditional formatting from one document to another? -

google spreadsheets can copy cell format destination cell, seems "conditional formatting" information didn't copied. can copy "conditional formatting" 1 document another? i know can recreate "conditional formatting" dialog it's time consuming, whereas if can copy , paste, it's fantastic. if want copy conditional formatting document can use "copy to..." feature worksheet (click tab name of worksheet @ bottom) , copy worksheet other document. then can copy want worksheet , right-click select "paste special" -> "paste conditional formatting only", described earlier.

r - Splitting Dataframe into Confirmatory and Exploratory Samples -

i have large dataframe (n = 107,251), wish split relatively equal halves (~53,625). however, split done such 3 variables kept in equal proportion in 2 sets (pertaining gender, age category 6 levels, , region 5 levels). i can generate proportions variables independently (e.g., via prop.table(xtabs(~dat$gender)) ) or in combination (e.g., via prop.table(xtabs(~dat$gender + dat$region + dat$age) ), i'm not sure how utilise information sampling. sample dataset: set.seed(42) gender <- sample(c("m", "f"), 1000, replace = true) region <- sample(c("1","2","3","4","5"), 1000, replace = true) age <- sample(c("1","2","3","4","5","6"), 1000, replace = true) x1 <- rnorm(1000) dat <- data.frame(gender, region, age, x1) probabilities: round(prop.table(xtabs(~dat$gender)), 3) # 48.5% female; 51.5% male round(prop.table(xtabs(~dat$age)), 3)

GITHUB allow someone to view my private repository -

i allow view work i've done in private repository. how should this? i looked @ https://help.github.com/articles/making-a-private-repository-public ; however, settings tab doesnt show up. it does, however, when viewing fork. why this? see having private branch of public repo on github? inverse of you're asking for. github public/private permissions apply repositories, , not granular individual branches.

doctrine2 - How can I implement a OneToMany association with a separate link table? -

i'm implementing new application on top of existing database. existing database being used mobile application , because mobile app being developed different team not allowed change structure of existing tables. the existing database has user table , own application's users created own table , doctrine entity called portaluser (table portal_user). the portaluser entity going have onetomany association called $children refers existing user entity. in other words each portaluser has 0 or more child user entities. the natural way implement have (simplified): user (the existing entity): class user { /** * @var integer * * @orm\column(name="id", type="integer", nullable=false) * @orm\id * @orm\generatedvalue(strategy="identity") */ private $id; /** * @var portaluser * * @orm\manytoone(targetentity="portaluser", inversedby="children") * @orm\joincolumn(name=&q

ios - Adding debit or credit card programmatically into ApplePay -

if have credit or debit card information, add credit or debit card programmatically apple pay either ios app or server code? no, there no api allow application manipulate stored payment cards in current passkit framework.

php - How does the Symfony Response Object set http headers? -

i'm using sliex framework. had problem redirection when use \silex\application::redirect method. found when i'm trying redirect http-headers, instead of symfony "send" response seemed call __tostring method. this curl output: bash-4.2$ curl -v http://127.0.0.1:8082/ * connect() 127.0.0.1 port 8082 (#0) * trying 127.0.0.1... * adding handle: conn: 0x1ea0970 * adding handle: send: 0 * adding handle: recv: 0 * curl_addhandletopipeline: length: 1 * - conn 0 (0x1ea0970) send_pipe: 1, recv_pipe: 0 * connected 127.0.0.1 (127.0.0.1) port 8082 (#0) > / http/1.1 > user-agent: curl/7.32.0 > host: 127.0.0.1:8082 > accept: */* > < http/1.1 200 ok < date: sat, 20 sep 2014 08:02:52 gmt * server apache/2.4.10 (fedora) php/5.5.15 not blacklisted < server: apache/2.4.10 (fedora) php/5.5.15 < x-powered-by: php/5.5.15 < set-cookie: phpsessid=*****; path=/ < content-length: 116 < content-type: text/html; charset=utf-8 < http/1.0 302 foun

java - openjdk: how to add site to exception list -

i run applet on server , being blocked java security. on development machine able open control panel , add site exception list on production server don't have connected display. is there conf file use? i don't mind moving different java vendor. thanks you can add sites @ file; ${user.home}/.java/deployment/security/exception.sites every url should in separate line. to log/trace should add deployment properties ${user.home}/.java/deployment/deployment.properties deployment.log=true deployment.trace=true deployment.trace.level=all log/trace appear in ${user.home}/.java/deployment/log

asp.net - Web Deployment tools for Visual Studio 2013 -

Image
i responsible supporting relatively complex website project written .net 3.5. previously using web deployment project visual studio 2010 deploy website @ moment have access visual studio 2013. as far know, there no longer such tool used deployment in visual studio 2013 , want compile code before deploying production server. mentioned earlier, project bit complex , not easy converted web application. any idea? unless missed it, unsure issue - in vs2013, publish looking (either website or application). what mean "none of (vs 2013 publish) options worked" ? is/was issue? in 1 of comments, state want "pre-compile" (aka "don't want upload .cs source files) , that's setting in publish . you can publish local file system: "custom" -> file system:

javascript - How to Add Rows/ Columns of Divs -

code here: http://jsfiddle.net/jaredasch1/6dhc240q/5/ i know i've asked question before, wasn't able working answer that. i'm working on game starts out 4 4 grid, , when click on 1 of divs, toggles color of divs above, below, , next 2 1 being clicked on. part working fine, , when other color, switch original color. however, i'm trying has presented more of challenge. once second color, want add column , row , reset them original color. this have run trouble. reason, grid isn't recreated. guys come in. need hep writing function or edits original script make happen. have on jsfiddle here i'll post of code here. <!doctype html> <body> <div id="button" class="on hover"></div> <br> <div class="block hover"></div> <div class="block hover"></div> <div class="block hover"></div> <div class="block hover"></

python - ImportError: No module named config on Travis-CI build -

i'm having import error on travis builds , error related configuration of flask: from flask import flask app = flask(__name__) app.config.from_object('config') on local machine, flask app run correctly. on travis here error trace $ nosetests --with-coverage --cover-package=core e......................... ====================================================================== error: failure: importstringerror (import_string() failed 'config'. possible reasons are: - missing __init__.py in package; - package or module path not included in sys.path; - duplicated package or module name taking precedence in sys.path; - missing module, class, function or variable; debugged import: - 'config' not found. original exception: importerror: no module named config) ---------------------------------------------------------------------- traceback (most recent call last): file "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/

Django execute block tag inside 'if' statement in template only if 'if' statement is true -

i want execute block tag if if statement true. here mean. template: {% extends "homepagebase.html" %} {% if not blogpage %} {% block isblogfalse %} notblogpage {% endblock %} {% else %} {% block isblogtrue %} blogpage {% endblock %} {% endif %} but both block tags executed. there way block tags executed if if / else statements true? way around issue or way of accomplishing task? one answer problem can found @ https://stackoverflow.com/a/18638131/573392 . modify situation, like: {% extends blogpage|yesno:"blogpage.html,notblogpage.html" %} this solution allow load template dependent on blogpage variable, achieving outcome of if statement.

I Can't open SQL Server Compact 3.5 on Visual studio 2008 -

i want open sql compact database v3.5 visual studio 2008. i have downloaded ssceruntime , installed it. then followed approach: server explorer > connect database > change in small window haven't sql server compact 3.5 . how can add required sdk? you must install sql compact tooling support installer, included vs 2008 sp 1, sscevstools-enu.msi

java - Exporting Eclipse Project to Runnable Jar -

so, have read on internet how extract projects runnable jar file. i have been able extract them fine, when try running it, nothing. when run in command prompt java -jar moddingforscrubs.jar , following output: http://imgur.com/fojkpma that specific line pointing is: int numofbackgrounds = new file("resources/background").listfiles().length; it producing null pointer exception. when run project in eclipse, fine. when export jar, gets npe, believe caused fact can't find file. here project workspace: http://imgur.com/034pbw8 any appreciated. things consider. you should not using hard coded values, when using file . once application "jarred", file system location no longer the same when running ide. if want read jar resource, should read resource via url, getclass().getresource("...") or 1 of variants. also looks (with path using "resources/background"), "resource" on same level src , , no

r - Spread with data.frame/tibble with duplicate identifiers -

the documentation tidyr suggests gather , spread transitive, following example "iris" data shows not, not clear why. clarification appreciated iris.df = as.data.frame(iris) long.iris.df = iris.df %>% gather(key = feature.measure, value = size, -species) w.iris.df = long.iris.df %>% spread(key = feature.measure, value = size, -species) i expected data frame "w.iris.df" same "iris.df" received following error instead: "error: duplicate identifiers rows (1, 2, 3, 4, 5, 6, 7, 8, 9..." my general question how reverse application of "gather" on sort of dataset. hadley's intervention unsurprisingly perfect... ended mucking syntax bit after that... it's worth, post operational code (sorry syntax bit different above): library(tidyr) library(dplyr) wide <- iris %>% mutate(row = row_number()) %>% gather(vars, val, -species, -row) %>% spread(vars, val) head(wide) # species row petal

android - Dynamic "where" in custom ParseQueryAdapter -

i'm using parse.com framework populate listview. adapter looks this: public itemsqueryadapter(context context) { super(context, new parsequeryadapter.queryfactory<parseobject>() { public parsequery create() { parsequery query = parsequery.getquery("item"); latlngbounds latlngbounds = new latlngbounds.builder(). include(sphericalutil.computeoffset(currentlatlng, currentradius, 0)). include(sphericalutil.computeoffset(currentlatlng, currentradius, 90)). include(sphericalutil.computeoffset(currentlatlng, currentradius, 180)). include(sphericalutil.computeoffset(currentlatlng, currentradius, 270)).build(); itemsquery.wherewithingeobox("location", new parsegeopoint(latlngbounds.southwest.latitude, latlngbounds.southwest.longitude), new parsegeopoint(latlngbounds.northeast.latitude, latlngbounds.northeast.longitude));

Reading specific characters from a file in Python -

suppose want read file in format: 2 300 234 2 3 23444 if use readline() iterates on entire line. want read numbers nothing else. how should this?? you can use re module. import re numbers = re.findall('[0-9]+', readline()) it return numbers list.

c# - GridView client side paging not working -

work data other program (for example in code use random number array - query data other program). query datatable , bind gridview + adds rows delete button. on delete button click - button inactive (use button.enabled = false; , updatepanel on buttons click have "old" array works great). when use paging - have "new" array each time. how fix it? need - in first page click button - became inactive, choose second page, return in first page , see "old" array inactive button. aspx <%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="webapplication1.webform1" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body>

ios - How to correctly include .ASPXAUTH and ASP.NET_SessionId cookies with NSMutableURLRequest -

i've been @ problem few days. app needs login asp.net (version: 4.0.30319, mvc version: 3.0) server , post via nsmutableurlrequest restricted page (a page requires logged in access). currently can, successfully, login website. login use code: nsstring *post =[[nsstring alloc] initwithformat:@"loginemail=%@&password=%@",@"username@website.com",@"password"]; nsurl *url=[nsurl urlwithstring:@"http://www.website.com/login"]; nsdata *postdata = [post datausingencoding:nsasciistringencoding allowlossyconversion:yes]; nsstring *postlength = [nsstring stringwithformat:@"%d", [postdata length]]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request seturl:url]; [request sethttpmethod:@"post"]; [request setvalue:postlength forhttpheaderfield:@"content-length"]; [request setvalue:@"application/x-www-form-urlencoded" forhttpheaderfield:@"content-type"]; [request sethttp

JavaScript Regex: accept only space and letters from all languages -

i create regex match space , letters must include letters languages such chinese, japanese, korean, arabic, etc. guides direct me http://www.regular-expressions.info/unicode.html haven't found way make work. xregexp : in comments, raina77ow , suggested xregexp , unicode plugin it. package , plugin appear robust, , significant addition regular expressions in javascript. need categories 1.2.0 . stand alone definitions of unicode character types : i adapted version net use in project. within unicode object, want unicode.letterandspaceregex : /* from: http://difnet.com.br/opensource/unicode_hack.js has been modified. modifications copyright 2014 makyen , released under mpl 2.0. source code form subject terms of mozilla public license, v. 2.0. if copy of mpl not distributed file, can obtain 1 @ http://mozilla.org/mpl/2.0/. */ /*! unicode_hack.js copyright (c) 2010-2012 marcelo gibson de castro gonçalves. rights reserved.

How Can Upload fingure print (Bio Matric) data to mysql server realtime -

i want upload fingerprint machine generated data mysql database real time or specific time without user action (human action). there way this. search on google found 1 touch data update on mysql database device. want know there api transfer data mysql database without (human action) corn tab.. why want this. when registered user on fingerprint machine registration id generated can store on server further processing....

merge - git rebase after merging published branch? -

i want use rebase remove meaningless merge-commits. @ same time, want preserve branch history when branched off develop feature. basically, git rebase when pull remote develop branch local develop branch. (by using git config branch.develop.rebase true ) git merge when merging in feature branch local develop branch. i've read 'do not rebase published commits' , afraid if use case violates it. suppose following scenario. origin/develop: a - b - c develop: a - b \ d - e - f featurea (published): a - b \ d \ g - h now, merge featurea onto develop. a - b \ d - e - f - \ / g - h - then, rebase develop (i guess d here d', not sure e ~ e' ~ i') a - b - c \ d - e - f - \ / g - h - now puzzling part, happens has worked on published featurea? a - b \ d \ g - h \

java - Using Singleton Design with Inheritance in a multithreaded Application -

i having application code written this public interface superclass{ //....to methods } public class baseclass1 implements superclass{ //....to methods } public class baseclass2 implements superclass{ //....to methods } now in application 1 object can instantiated superclass reference, i.e synchronized singleton. now, can include public static synchronized superclass getinstance(){ //initialise } in of base classes, cannot include declaration in superclass interface due cannot instance of base class using reference of super class. e.g. want this(its vague example) baseclass1 bc1 = baseclass1.getinstance(); superclass sc = bc1.getinstance(); now somewhere later in code bc1=sc.getinstance(); how can achieved? note: several threads accessing these objects hence synchronisation mandatory instead of using singletons why dont use dependency injection eg: google guice. guice create instance of super class , can access via injector.getinstance() method.

Libgdx problems frame rate (FPS) -

i having problems frame rate in libgdx, alguin enlighten me if i'm doing wrong, because not think normal, problem in question load tilemap , simple , if put highest resolution of 320 x 320, 800 x 600 drops 12 fps or so, hope explain pue groin not native language thanks. public class mygdxgame extends applicationadapter { spritebatch batch; texture img; private orthogonaltiledmaprenderer bachtilemaprender; private orthographiccamera camera; private tiledmap map; private int[] background = new int[] {0}, foreground = new int[] {1}; @override public void create () { batch = new spritebatch(); img = new texture("badlogic.jpg"); map = new tmxmaploader().load("maps/untitled.tmx"); bachtilemaprender = new orthogonaltiledmaprenderer(map, 1/32f);//asignar mapa camera = new orthographiccamera(gdx.graphics.getwidth(),gdx.graphics.getheight()); camera.settoortho(false, 32, 32); //virtual dimensiones } @override public void render ()

java - JAR - extracting specific files -

i have .class , .java files in jar archive. there way extract .java files it? i've tried command doesn't work: jar xf jar-file.jar *.java you can use unzip command accepts wildcards in arguments (which not case of jar command). should trick ( disclaimer : not tested) unzip youfile.jar "*.java"

Displaying a fibonacci series[PYTHON] -

n=input('enter number of terms') a=1 print b=1 print b in range(1,n+1): c=a+b print c b=c a=b this code learnt in school displaying fibonacci sequence. reason im getting wrong output-- output enter number of terms5 1 1 2 can please tell me wrong? indentation critical in python : n=input('enter number of terms') a=1 print b=1 print b in range(1,n-1): c=a+b print c a=b b=c your last 3 lines weren't part of loop, , last 2 of them wrong way round. edit : range adjusted print requested number of items.

c# - Regular expression with conditional repeat -

i have following regular expression: ^((_[a-za-z0-9]|[a-za-z])+((?<bracket>\[)[0-9]+(?<-bracket>\])(?(bracket)(?!)))?)$ i want repeat if there dot ( . ) i know can repeat expression adding dot ( . ) ^((_[a-za-z0-9]|[a-za-z])+((?<bracket>\[)[0-9]+(?<-bracket>\])(?(bracket)(?!)))?)(\.((_[a-za-z0-9]|[a-za-z])+((?<bracket>\[)[0-9]+(?<-bracket>\])(?(bracket)(?!)))?))*$ but want know if there better way, without copying initial part. background: i need access machine micrologix 5000 uses tag based addressing. in c# application, want validate user input address. allowed: dog.tail dogs[0].tail.ismoving not allowed: dog. dogs[0]. you can use recursion. see this: ^((_[a-za-z0-9]|[a-za-z])+((?<bracket>\[)[0-9]+(?<-bracket>\])(?(bracket)(?!)))?)(\.\1)*$ ^^ \1 recurses first sub-pattern within first capturing group ( ) .