Posts

Showing posts from January, 2012

android - Multiline AutoCompleteTextView not accepting scrolling touch -

i created multiline autocompletetextview component inside activity main root scrollview (because activity contains lots of controls), , set max , min lines 4. loads text properly, when try scroll inside autocompletetextview, whole activity scrolls. here code of autocompletetextview: <autocompletetextview android:id="@+id/txtdata" android:inputtype="textmultiline" android:lines="4" android:minlines="4" android:maxlines="4" android:gravity="top|left" android:textcolor="#000000" android:layout_below="@id/lbladdress" android:layout_height="wrap_content" android:layout_width="fill_parent" android:scrollbars="vertical" android:textsize="16sp" /> any idea should set keep scroll focus inside autocompletetextview? try change dropdown height android:dropdownheight this work when inside scrollview ...

jasper reports - How to change the "Map server" for the Map component in iReport -

i used map component in ireport . default behavior gets map google possible change map server url? (for example, geoserver, bing, or openstreet server can used that) for image expression java.net.url shuold used , source request below <image> <reportelement x="0" y="0" width="104" height="40"/> <imageexpression class="java.net.url"> <![cdata["http://localhost:8080/geoserver/wms?request=getmap&service=wms&version=1.1.1&layers=topp%3astates&styles=&srs=epsg%3a4326&bbox=-14.15104058007,21.731919794922,-57.154894212888,58.961058642578&&width=780&height=330&format=image%2fpng"]]> </imageexpression> </image>

json - 'Cannot read property '' of undefined' EJS doesn't render variable , allthough it is defined -

Image
this driving me nuts , please assist me: i'm using latest v of node.js express , mongo , ejs interesting fact website still works fine after following error in console: cannot read property 'parent_category_id' of undefined @ eval (eval @ <anonymous> (e:\bitbucket repos\demo nodejs\node_modules\ejs\lib\ejs.js:485:12), <anonymous>:20:27) @ returnedfn (e:\bitbucket repos\demo nodejs\node_modules\ejs\lib\ejs.js:514:17) @ view.exports.renderfile [as engine] (e:\bitbucket repos\demo nodejs\node_modules\ejs\lib\ejs.js:358:31) @ view.render (e:\bitbucket repos\demo nodejs\node_modules\express\lib\view.js:126:8) @ tryrender (e:\bitbucket repos\demo nodejs\node_modules\express\lib\application.js:639:10) @ eventemitter.render (e:\bitbucket repos\demo nodejs\node_modules\express\lib\application.js:591:3) @ serverresponse.render (e:\bitbucket repos\demo nodejs\node_modules\express\lib\response.js:961:7) @ e:\bitbucket repos\demo andreiradulescu nodejs\router.js:1...

How to call it on my main.java (android) -

public boolean updatecredential(credentials credentials){ boolean issuccessful = true; sqlitedatabase db=null; string wherestatement = constants.login_item + "="; string[] bindvalues = new string[] {credentials.getloginitem().trim()}; contentvalues values = new contentvalues(); try{ db=helper.getwritabledatabase(); db.update(constants.table_name, values, wherestatement, bindvalues); db.close(); issuccessful=true; }finally{ db.close(); } return issuccessful; } for example have addcredential() method call in form public void addrecord(view v){ credentials.setloginitem(loginitemtext.gettext().tostring()); db=new passworkeeper(this); if(db.addcredential(credentials)){ loginitemtext.settext(""); toast.maketext(this, "record added",toast.length_short).show(); } } public boolean addcredential(credentials credential){ boolean issuccessful= fa...

apache - how to deploy java web application on tomcat without displaying 8080 port? -

i want deploy java web application on 8080 port of tomcat server want url not contain port no domain name. i can't change port 8080 80 because have other application running on different server port 80. you make alias here go host name aliases , configure name of choice. way can skip localhost:port/path/to/project , have project_name.loc or whatever come with.

php - HMVC CodeIgniter view igniter type="date" not working on html -

am making form input in hmvc project. want have input type="date" but happens output normal textbox. other ways can or error? add_view.php <link rel="stylesheet" href="<?php echo base_url(); ?>assets/bootstrap/css/inputfield.css"> <html> <div> <fieldset> <?php echo form_open('clients/create'); ?> <p> <label class="field" for=""><span>*</span>name:</label> <input type = "text" name="" class ="textbox-300"> </p> <p> <label class="field" for=""><span>*</span>details:</label> <textarea name=""></textarea> </p> </br></br></br> <p> ...

android - LoginManager.getInstance().logOut(); Doesn't seem to work. Please check my codes -

i trying make logout button app , doesn't seem work. please check code? thank you! using fb sdk 4.0 facebooksdk.sdkinitialize(getapplicationcontext()); callbackmanager = callbackmanager.factory.create(); setcontentview(r.layout.activity_main); logout= (imageview) findviewbyid(r.id.logout); here's logout onclick logout.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub loginmanager.getinstance().logout(); hideall(); reset(); } }); here's fb share udf public void sharefbsure() { list<string> permissionneeds = arrays.aslist("publish_actions"); manager = loginmanager.getinstance(); manager.loginwithpublishpermissions(this, permissionneeds); manager.registercallback(callbackmanager, new facebookcallback<loginresult>() { @override ...

java - Deploying a web project in Tomcat server -

i trying run web application in tomcat server 7.0_68. when run startup.bat no errors shown in tomcat console. after deploy web project in tomcat manager shows following errors. severe: exception fixing docbase context [/alinguist] java.util.zip.zipexception: error in opening zip file @ java.util.zip.zipfile.open(native method) @ java.util.zip.zipfile.<init>(zipfile.java:220) @ java.util.zip.zipfile.<init>(zipfile.java:150) @ java.util.jar.jarfile.<init>(jarfile.java:166) @ java.util.jar.jarfile.<init>(jarfile.java:103) @ sun.net.www.protocol.jar.urljarfile.<init>(urljarfile.java:93) @ sun.net.www.protocol.jar.urljarfile.getjarfile(urljarfile.java:69) @ sun.net.www.protocol.jar.jarfilefactory.get(jarfilefactory.java:109) @ sun.net.www.protocol.jar.jarurlconnection.connect(jarurlconnection.ja va:122) @ sun.net.www.protocol.jar.jarurlconnection.getjarfile(jarurlconnection .j...

javascript - How to create a 2D drawing board via Three.js -

i want create interactive whiteboard altspacevr . i'm brand new three.js , wondering how create 2d canvas i'm able draw on. thank the question not clear. three.js 3d scenes, want create 2d dashboard inside 3d scene? can have single canvas @ time, either 2d or 3d, overlay absolutely positioned div 3d scene contain 2d canvas dashboard. you can use css3dobject embed 2d objects transformed in 3d scene, here example

hibernate - Junit with spring boot application -

i have application designed spring boot , hibernate completed. want use junit unit testing. should included in application.properties , need separate java file testing? working example or docs me getting started include following dependency , spring boot configure testing. <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> after should able run tests src/test/java. @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = application.class) @webappconfiguration public class applicationtests { @test public void contextloads() { } } for data layer tests use @transactional on method or class. may create separate test class extending main test class. see below more options @transactional public class datalayertest extends applicationtests{ @autowired private leavedaoimpl da...

php - Redirection in cakephp 2.7.5 not working properly -

recently install cakephp 2.7.5 in system , develop admin backend.i face problem in it,when add faq in admin section not shown in faq section when refresh page shown redirection code here:- $this->redirect(array('controller'=>'firmcategory','action' => 'index')); the same problem delete section when delete item set code delete , redirect index page of admin redirect change not shown when refresh page shown flash message , delete please missed in installation. could prove this? return $this->redirect(array('controller'=>'firmcategories','action' => 'index'));

c - Linked List Function? -

so i'm writing function makes smallest node @ end of linked list. far works except last element. if linked list created nodes containing items 0~9, list after function {1,2,3,4,5,6,7,8,0,9} , 0 not become @ end. any ideas why? my function; int connecting(linkk a) { linkk l = a; (int = 0; i<sizeof(l);i++) { if (l->item < l->next->item) { int = l->item; l->item = l->next->item; l->next->item = a; l = l->next; } else{l=l->next;} } return 0; } let's start think should doing differently: the name of function connecting . given description of you'd function do, not name. i can infer usage linkk typedef'ed pointer. hiding pointers way not idea, of time. your function returns int . it's 0 . why? not make sense. because linkk pointer node, , pass head pointer value (i.e. copy of it) function, you're unable ...

javascript - Event on one element to trigger event on another -

i'll use specific example apply any event on 1 element triggering any event on another. suppose want focus <input> when click <span> . can using directive like: <div ng-controller="ctrl"> <span ng-focus-other>focus</span><input> <div> app.directive("ngfocusother", function () { return function (scope, element) { element.bind("click", function () { this.nextsibling.focus(); }); }; }); however not seem angular . not work there changes dom (e.g. if <input> moved before <span> ). nice if same code work on multiple groups of <span> - <input> combinations perhaps each different dom layout. what angular way of using 1 event trigger event on element? why not have clicking span set boolean called "inputfocused" true , let input pay attention scope variable. i.e. <span ng-click="inputfocused = true"...

python - scikit-learn grid search on multi-processor environment -

i able run scikit-learn function gridsearchcv in parallel locally on quad-core processor. wondering if straightforward scale multi-processor environments using module mpi such mpi4py. i'm new this, appreciate relevant information too. i'm going through documentation mpi4py right now. thanks! you can have @ gridsearchcv implementation inspiration implement own variant on top of mpi. mpi might not offer natural way avoid transfering input training set data on network on , over. an alternative use ipython.parallel explained in tutorial . code of pyrallel helper lib used in tutorial available on github .

android - AndEngine. DetachChild in BaseLiveWallpaperService -

i try create wallpaper , use andenginelivewallpaper . so, catch indexoutofboundsexception , when try detach child sprite scene. now, must use runonupdatethread , useful on basegameactivity . how can fix in baselivewallpaperservice ? call engine runonupdatethread method: mengine.runonupdatethread(new detachchildrunnable())

java - No getter method available for property for bean under name -

struts (1.38) noob, , i'm getting following error: no getter method available property hs.hasrelationshiptoteam bean under name hsform. told create geths , seths method in hsdivform, problem? or how do then? my bean: public class hs extends entry implements serializable,cloneable { private boolean hasrelationshiptoteam = false; public boolean ishasrelationshiptoteam() { return hasrelationshiptoteam; } public void sethasrelationshiptoteam(boolean hasrelationshiptoteam) { this.hasrelationshiptoteam = hasrelationshiptoteam; } } my form: import my.bean.hs; public class hsform extends actionform { private hs hs = new hs(); public hsform() { super(); } } my jsp: <html:form styleid="hsdivform" action="/disclosure/hsaction" > <table> <tr id = "q-rel"> <td colspan="2" align="center"> <br /> there team relationship? <br /> yes<html:rad...

c# - How can pass values between events? -

i've dropdownlist , button inside datalist. choose number of items dropdownlist , pass button event send database. but i'm unable so. problem variable selectedvalue gets assigned inside dditem_change , although i've declared globally. how can access value in datalist1_itemcommand(object source, datalistcommandeventargs e) . here code dropdown list change public void dditem_change(object sender, eventargs e) { var ddllist = (dropdownlist)sender; selectedvalue = ((dropdownlist)ddllist.namingcontainer.findcontrol("drplist")).selectedvalue; } this code public void datalist1_itemcommand public void datalist1_itemcommand(object source, datalistcommandeventargs e) { if(e.commandname == "add") { if (session["user"] == null) { response.write("<script>alert('login first!!!');</script>"); } else { string[] ar = ...

internet explorer - Touch screen pull down white space above page -

when web page loads on touch screen device possible scroll (by pulling finger down) when scroll bar @ top of page. when user removes finger screen page scrolls default position. seems used add 'refresh' type functionality in iphone apps 'pull down refresh' feature. this 'feature' causing annoying things happen in flex application building , stop happening. know: the name of feature; how turn off? strangely, boundary effect occurs once. after occurs doesn't happen again , flex app fine. i using microsoft surface rt comes internet explorer 10 assume common touch screen devices , browsers. i tried following suggested in basic html page didn't have effect: <script type="text/javascript"> window.addeventlistener('load', function() { document.body.addeventlistener('touchmove', function(e) { e.preventdefault(); }, false); }, false); </script> ...

android - How to position a login box centered on application start? -

Image
i new android , trying build login box, , experience troubles. created 2 textes (username, password) , 2 text-boxes next them, style login box area. but unfortunately elements jump , down in correlation upper , lower bars, shown when user touches screen. how can realize centered login box? link: maximize image here code: <framelayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <linearlayout android:id="@+id/fullscreen_content_controls" style="?buttonbarstyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:background="@color/black_overlay" android:orientation="horizontal" tools:ignore="uselessparent"> <button android:id="...

algorithm - Constrained Set -

developing parts of project needed implement data set structure should allow me subsets depending on minimun-maximun key value: constainedset <- set((key,value)*) subset <- constainedset.match(constraint = "val1 <= key < val2") then subset should containt elements constainedset matching "val1 <= key < val2" restriction. is, elements key greater or equal val1 lesser val2 . for example, if had subset one: constrainedset <- {(1,hand),(2,eye),(3,nose)} then operation like: subset <- constainedset.match(constraint = "1 <= key < 3") ought result generate subset: subset <- {(1,hand),(2,eye)} i developed solution each element stored in vector of triplets like (minkey,maxkey+1,value) i keep vector sorted minkey , maxkey having minkey order higher priority maxkey order. each call "match" performs binary search on vector. if not wrong worst case time complexities are: o(n) each call ...

How to get number of occurrences in R for Naive Bayes Classification -

i pretty new r , trying analyse example dataset started naive bayes classification. day outlook temperature humidity wind play 1 sunny hot high weak no 2 sunny hot high strong no 3 overcast hot high weak yes 4 rain mild high weak yes 5 rain cool normal weak yes 6 rain cool normal strong no 7 overcast cool normal strong yes 8 sunny mild high weak no 9 sunny cool normal weak yes 10 rain mild normal weak yes 11 sunny mild normal strong yes 12 overcast mild high strong yes 13 overcast hot normal weak yes 14 rain mild high strong no i have been able use table() function numbe...

java - Implementing cache using Guava -

i want implement cache using guava's caching mechanism. i have db query returns map, want cache entire map let expire after amount of time. i realize guava caches works per-item bases. provide key, cache either returns corresponding value cache or it. is there way use guava everything, cache timeout after time period of time , again. many thanks you can create instance of supplier<map<k,v>> fetches entire map database, , use suppliers.memoizewithexpiration cache it. related: google guava supplier example http://google.github.io/guava/releases/snapshot/api/docs/com/google/common/base/supplier.html http://google.github.io/guava/releases/snapshot/api/docs/com/google/common/base/suppliers.html

sql - Joining model objects in titanium alloy -

suppose have model follows. represents gym. i have exercise , have exercise type. have many-to-many relationship exercise { exercise_id name } exercise_type { exercise_type_id name } type_exercise { exercise_id exercise_type_id } i want display table information exercise name | exercise type i know how raw sql query i'm not sure how execute raw sql alloy. , once have proper data, how return collection. tutorials have found show how via xml in situation table columns displayed , match model columns. thanks, mike i can recommend reading this: simple integration of supermodel , appcelerator titanium alloy aaron saunders. supermodel can handle relationships of models.

Bash Shell Script Loop not processing more than one command -

here's loop: #!/bin/bash count=3 in $(seq $count) echo $i killall midori midori http://www.test.com/test.html?id=$i & done but won't kill midori , launch 1 in background continue loop. ideas? it works want to, except you're killing midori within millisecond of starting it, before gets chance open window or anything. try adding sleep give chance start , before kill it: #!/bin/bash count=3 in $(seq $count) echo $i killall midori midori http://www.test.com/test.html?id=$i & sleep 10 done

java ee - 32-bit to 64-bit jvm migration - jboss web application & linux server -

we migrating our java ee / jboss web application running on 32-bit linux box & 32-bit jvm 64-bit linux box & 64-bit jvm. we analyzed & changed jvm heap, permgen, stack etc., sizes appropriately. enough or should consider other parameters/ make other changes part of 64bit migration? we using "jboss-eap-4.3" / "jboss-4.0.5.ga". need install / upgrade jboss server? also, can point me if other mandatory change missing on 32-bit 64-bit migration? should check if jar files use in our application compatible 64-bit jvm? define tests cover use cases , , run these against both installations define load test scenario, , run against both installations well management should approve both suites/procedures. there should no need check .jars 64-bit compatibility, unless use jni. anyway problems should revealed tests mentioned before. use newest stable jboss version . otherwise run problems while trying support older version. keep old ins...

javascript - List declared directives/controllers in AngularJS module -

is there way list of directives , controllers have been defined given angular module? example, imagine define 3 controllers in 'main' module (i.e. angular.module('main').controller('mainctrl',function() {...}). there way list of 3 controllers? hmm hard , not thing think : var app = angular.module('myapp', []); console.log(app._invokequeue[0][2][1]); _invokequeue array if each entry getting [0][2][1] you'll see name of each provider in module. if lok _invokequeue alone you'll see lot of things you'll name of provider below type (directive, controller, ...); but feel tricky thing not thing bad practice anyway fun. don't use in production !

javascript - Accepting only integers and floating point numbers in angular js on each key stroke -

how can angular js monitor key strokes in such way input field in html not accept non numerical values? , accept integers , floating point numbers on each key stroke? <form name="myform"> <input ng-pattern="/^(?=.+)(?:[1-9]\d*|0)?(?:\.\d+)?$/" ng-model="value" name="number"/> valid? {{myform.number.$valid}} </form> if asking correct "float/integers" regex pattern try 1 : /^\-?\d+((\.|\,)\d+)?$/

image - PHP failing to check conditions -

im working on script shows minecraft faces based on url, got problem, everytime invalid username inputed, saves skins folder, thing should when when username valid. full script: sorry, problem has been solved, i'm not going give script away. it's quite long know, it's full script. remind, problem script saves invalid usernames too, thing should if username vaild. try add exit of wrap other code in else{ } statement if(!$src){ $src = imagecreatefrompng("http://s3.amazonaws.com/minecraftskins/char.png"); //here's problem, trying display image on screen if not found, reason saves skins folder imagepng($final); **exit();** }

c++ - Any way to use class typedef but not include that class's header file? -

say have such header file (foo.h): class foo { public: typedef int tag; // other stuff } as far know, if want use foo::tag in other headers, must #include "foo.h" . there way avoid including foo.h file? p.s. don't want move typedef out of class's scope. no. if want use foo::tag not type same name/type, have include header file.

asp.net - many - to many relationship handling issue in entity framework -

i've got table tourists tourist_id 2.name extra_charges extra_charge_id description toutist_extra_charges tourist_extra_charge_id - primary key tourist_id - foreign key extra_charge_id - foreign key i try make sql query using entity framework ent "select tourist.name, extra_charges.extra_charge_description, tourist left join tourist_extra_charges on tourist.tourist_id = tourist_extra_charges.tourist_id left join extra_charges on tourist_extra_charges.extra_charge_id = extra_charges.extra_charge_id tourist.tourist_id=86 i want name of tourist id=86(event if doesn't have extra_charges) , if have extra_charges - description of extra_charge as i'm new entity framework tried following foreach (var tourist in db2.tourist.include("tourist_extra_charges").include("extra_charges").where(x=>x.tourist_id==86)) { lblproba.text+="name" + tourist.name_kir+...

java - Retrieving next N records in mongo db -

i need scheduler job execute every 5 mins , process next 100 records mongodb collection. should start document inserted first. so, in first run, can sort data in ascending order , first 100 documents. consecutive runs, how can retrieve next 100 records giving last processed document's object id? (i'm not sure how use object id here generating string different parameters... don't have other id defined.) if not way retrieve records mongodb large data set, please suggest better way. each document looks below: { "_id" : { "$oid" : "51ff17c8e4b02969f18e72bb"} , "source_of_info" : "somesource" , "entityinfo" : [ { "user" : "alfredo vela zancada" , "social_network_entity_id" : 364221775325822977 , "text" : "blah blah blah" , "created_at" : { "$date" : "2013-08- 05t03:10:12.000z"}}] , "relatedurls" : [ { "url" ...

java - Previously detached fragment stays visible behind the current, after tab changed (using support library) -

here tablistener: public class tablistener<t extends fragment> implements android.support.v7.app.actionbar.tablistener { private fragment mfragment; private final activity mactivity; private final string mtag; private final class<t> mclass; public tablistener(activity activity, string tag, class<t> cl) { mactivity = activity; mtag = tag; mclass = cl; } @override public void ontabreselected(tab arg0, fragmenttransaction arg1) { // todo auto-generated method stub } @override public void ontabselected(tab tab, fragmenttransaction ft) { mfragment = ((fragmentactivity) mactivity).getsupportfragmentmanager().findfragmentbytag(mtag); // add if (mfragment == null){ mfragment = android.support.v4.app.fragment.instantiate(mactivity, mclass.getname()); ft.add(android.r.id.content,mfragment,mtag); } else { ft.attach(...

javascript - Get random data from firebase -

i'd random data firebase tree firebase data structure grabbit active category (womenclothes, womenbags, womenshoes etc) how grab , random dataset http://gamerholic.firebaseio.com/grabbit/active/ if doesn't matter category is, want pick 1 get me data i'd rand() in php

How to get css of multicolumn css3 by javascript -

<div id="multicolum"> <p>content</p> </div> css: #multicolumn { text-align: justify; -webkit-column-count: 2; -moz-column-count: 2; column-count: 2; height: 100%; width: 100%; -moz-column-gap: 40px; /* firefox */ -webkit-column-gap: 40px; /* safari , chrome */ column-gap: 40px; position: relative; top: 0px; left: 0px; float: left; font-size: 30px; } how can attribute "column-gap" of muticomlum javascript not jquery. can me! change id of div multicolumn , then: document.getelementbyid("multicolumn").style.columngap return column-gap css property

c# - Using an overflow for modulus with a signed integer -

i'm implementing bunch of different kinds of pseudo random number generators play around with. noticed linear congruential generators can have periods size of int, , thought use overflow instead of modulus , see if it's faster. the snag overflows overflow sign bit, , need them positive values. edit: cloudy on couple concepts, i'm cleaning question makes more sense. boils down me trying lop off sign bit of integer. i've found xoring number int.minvalue trick. when has overflowed, if hasn't opposite. i'd avoid if statement though. if show me nifty trick snag first 31 bits , stuff them integer, delightful. or way set sign bit 0 better? if want overflow start @ zero, should mask off sign bit. unchecked { int x = int.maxvalue + 5; int y = x & 0x7fffffff; } console.writeline(y); this outputs number 4. i don't think absolute value of overflowed value give want (you go maxint, , descend down, plus, you'll have specially handl...

function - Analagous operations to achieve os.path.split in Python? -

i have been using automator on osx [according previous questions] , my os.path.split not working reason though same code runs fine in coderunner , terminal... is there other way achieve function: import os input = '/users/opus_magnum/desktop/list.txt' output = 'test_output.txt' dir,file = os.path.split(input) temp_out= os.path.join(dir,output) out_file=open(temp_out,'w') print dir print file print temp_out >> /users/opus_magnum/desktop >> list.txt >> /users/opus_magnum/desktop/test_output.txt i'm trying create new file in same directory input file i prefer know causing os.path.split function not work if analogous available guess can work . you can use os.path.dirname() obtain directory of input file. input = '/users/opus_magnum/desktop/list.txt' input_dir = os.path.dirname(input) output = 'test_output.txt' temp_out = os.path.join(input_dir, output)

Authentication and authorization in Spring Data REST -

i implementing spring data rest based app , know if there elegant way implement authentication , authorization rules using framework or related frameworks. all http requests rest server must carry authentication headers, need check them , decide authorize or not based on http method , association of authenticated user resource being requested. example, (the app rest server of e-learning system), instructors can access own course sections, students can access courses sections subscribed, etc. i know if there default way implement authorization in spring data rest. if answer no, make suggestion issue? thinking about: servlet filters spring security spring data rest handlers (how access http headers?) the best bet spring security. achieve authorization simpler manner. spring security require implementation looks @ request headers , performs log-in operation programmatically. refer accepted answer here.. had followed same , implemented security layer in front o...

php - Succes messages after form posts on another page -

i making succes-message-page when user created. in matter curious security. if make page @ domain.com/register/success is there security matters, should aware of? problem is, want following: /register = form /register/perform = form has been posted, if error show error messages, if succes redirect /register/success = page succes message. but in setup able access /register/success, because can't check if form has been posted or that. the reason want because want track each visit /register/success goal in google analytics. is there way can achieve not possible success-message shown if you've not been trying create user? my own solutions 1) ajax call - if succes javascript-redirect /register/success 2) php header() /register/success if no error on /register/perform but doesn't fit problem user not being able access page if has not been trying create user. thanks in advance! if understand question use sessions flag mess...

How to use Sublime text editor to resolve git merge conflicts? -

i have installed "submerge", can care revision. git changed file "need merge" status. know there other tools can that, wondering if can using sublime, thanks! regarding how use sublimerge: i'm not sure how it, i'm getting closer. first, need handy path sublime binary: mkdir ~/bin ln -s "/applications/sublime text 2.app/contents/sharedsupport/bin/subl" ~/bin/subl then, in git gui or git command line, configure ~/bin/subl merge tool. i use source tree, , haven't figured how best use sublimerge, managed open both versions, merge them, , have bit of manual work. still not smooth, better nothing!

javascript - Android put ImageButtons in ArrayAdapter with unique onclick events -

i making list products in it. in each row of list there has button add product shoppinglist. doesn't work buttonlayout.addview i'm stuck whole day. hope can me. this code arraylist protected void onpostexecute(void v) { // ambil data dari json database try { jsonarray jarray = new jsonarray(result); arrayadapter<string> adapter = new arrayadapter<string>(displayproductlist.this, r.layout.list_item); /*string productname = null; string productprice = null; */ relativelayout buttonlayout = (relativelayout) findviewbyid(r.id.listitem); hashmap<string,string> map = new hashmap<string,string>(); for(int i=0;i<jarray.length();i++) { ...

javascript - Form validation and Analytics event tracking -

i using javascript validate form fields. if passes want send event google analytics. isn't sending event ga. in form have: <form role="form" name="submit" method="post" onsubmit="return validateform();"> and validation code is: function validateform() { // validate form , update section if there error var spamcheck = document.submit.inputspamcheck.value; if( document.submit.inputname.value == '' ){ document.submit.inputname.focus(); $( "#name-section" ).addclass( "has-error" ); return false; } else if( document.submit.inputemail.value == '' ){ document.submit.inputemail.focus(); $( "#email-section" ).addclass( "has-error" ); return false; } else if( document.submit.inputspam.value != spamcheck ){ document.submit.inputspam.focus(); $( "#spam-section" ).addclass( "has-erro...

python - Count occurrences of a letter in a string -

i'm trying count occurrences of letters in sting. got part python that, however, want doesn't count letter twice if occurs twice. so, "my name", should give string '21111', instead of '211121' (so not counting both of m's twice). the code far is: for char in tested_str2: if char in 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz': x = tested_str2.count(char) percentage = percentage + str(x) you can use collections.counter , set : >>> collections import counter >>> strs = ''.join(x x in "my name" if x.isalpha()).lower() >>> c = counter(strs) >>> seen = set() >>> ''.join(str(c[item]) item in strs if item not in seen , not seen.add(item)) '21111' as suggested @dsm, instead of using set can use collections.ordereddict : >>> collections import ordereddict >>...

c# - LinkedIn send a message -

i want send message linkedin user connections. try following code: string s = @"<?xml version='1.0' encoding='utf-8'?> <mailbox-item> <recipients> <recipient> <person path='/people/1234567' /> </recipient> </recipients> <subject>congratulations on test.</subject> <body>test here</body> </mailbox-item>"; string url = "https://api.linkedin.com/v1/people/~/mailbox?oauth2_access_token=xxxxxxxxxxxx"; httpwebrequest webrequest = webrequest.create(url) httpwebrequest; webrequest.timeout = 10000; webrequest.contenttype = "text/xml"; webrequest.method = "post"; using (var writer = new streamwriter(webrequest.getrequeststream())) { writer.write(s); } webresponse response = webrequest.getresponse();...

opengl - How to position an object in model / view / world space? -

i have cube defined centre @ 0,0,0 , edges reaching out -1/+1 (i.e. cube has width, height, depth of 2). i setup following matrices: glm::mat4 modelmat4; modelmat4 = glm::translate(modelmat4, 0.0f, 0.0f, 200.f); modelmat4 = glm::scale(modelmat4, 200.0f, 200.0f, 200.0f); glm::mat4 viewmat4; viewmat4 = glm::lookat(glm::vec3(0.0f, 0.0f, znear), glm::vec3(0.0f, 0.0f, zfar), glm::vec3(0.0f, 1.0f, 0.0f)); // initialwidth = window width // initialheight = window height // znear = 1.0f // zfar = 1000.0f glm::mat4 projectionmat4; projectionmat4 = glm::frustum(-initialwidth / 2.0f, initialwidth / 2.0f, -initialheight / 2.0f, initialheight / 2.0f, znear, zfar); but middle of object appears @ near z-plane (i.e. can see half of cube, inside). if adjust model transform be: glm::translate(modelmat4, 0.0f, 0.0f, 204.f); then can see front side of cube well. if change model transform be: glm::translate(modelmat4, 0.0f, 0.0f, 250.f); then cube rasterises @...

c# - For loop skips straight to the end -

i started studying c# , encountered problem 1 of assignments. assignment create pyramid made of stars. height designated user input. for reason first for loop skips end. while debugging, noticed variable height receives bar 's value, after skips end. have no clue why, code seems fine me. the do - while loop there ask user new value, in case value entered 0 or lower. using system; namespace viope { class vioppe { static void main() { int bar; { console.write("anna korkeus: "); string foo = console.readline(); bar = int.parse(foo); } while (bar <= 0); (int height = bar; height == 0; height--) { (int spaces = height; spaces == height - 1; spaces--) { console.write(" "); } (int stars = 1; stars >= height; s...

android - Google Play Game Services error: Unable to Sign in - Application does not have a registered client id? Other fixes did not work -

any minor information may relevant: using c# in unity3d game engine app requires use of google obb downloader , googleiab (both working correctly) using prime31 plugins access following: using both achievements , leaderboards (authentication issues think?) app connects , posts facebook (working correctly) unable sign in - application not have registered client id previously had issues connection google play game services. seemed sha1 code certificate fingerprint in application not same 1 had in game services linked app (the default sha1 places there). unfortunately had published, had unpublish app, unpublish game services, , re-create them all. used brand new keystore generated (the alias name same though), , made sure sha1 code generated keystore , placed linked app. this worked! tested on device of achievements , leaderboards, going perfectly. after couple quick code/data changes (text updates, commenting code, etc) rebuilt project , uploaded new apk , obb. then, af...

c# - WebBrowser does not change -

i'm making application in c# which, depending of variable, shows 1 web page or another. when push button, program load username , webbrowser should show different web page. here source code: private void button1_click(object sender, eventargs e) { string url = "http://www.url.com/" + username; webbrowser1.navigate(url); webbrowser1.refresh(); } the problem that, when push button second time different variable, web browser reloads same web page. i think it's because of webbrowser1.refresh(); don't need , think pushing button 2 consecutive times different values , gives impression it's loading page isn't. try remove line , add event navigated method of webbrowser object in order obtain feedback when browser done loading page.

sql - selecting a row using MIN or ROWNUM -

i have oracle table similar 1 below stores people's lastname firstname , age. if last name same people belong same family. lastname firstname age =========================== 1 miller charls 20 2 miller john 30 3 anderson peter 45 4 bates andy 50 5 anderson gary 60 6 williams mark 15 i need write oracle sql query select youngest person each family. output shd select rows 1,3,4 , 6 how do ? dense_rank() ranking function generates sequential number , ties number generated same. prefer use dense_rank() here considering family can have twins, etc. select lastname, firstname, age ( select lastname, firstname, age, dense_rank() on (partition lastname order age) rn tablename ) a.rn = 1 sqlfiddle demo

build - Xcode cannot run using the selected device after upgrade to Xcode 5.0 -

Image
i upgraded xcode 5.0 today. pressed play run project in ios simulator. worked. decided wanted run profiler. when did that, got message: xcode cannot run using selected device. choose destination supported architecture in order run on device. i looked @ couple past posts on problem , decided clean , build. can no longer run in profiler or simulator. consistently message: xcode cannot run using selected device. choose destination supported architecture in order run on device. how can resolve this? here various settings: my deployment target 6.1 i have tried changing deployment target 7.0, did not work either it appears problem not related architecture in build settings error might suggest. rather, found problem seems related build options compiler c/c++/objective c. using gcc compiler (com.apple.compilers.llvmgcc42) , xcode 5 has marked unsupported. if change compiler apple's default apple llvm 5.0, project builds , can run in simulator. downside have...

javascript - How to link Bootstrap Tabs Dropdown list to URL -

my dropdown list within twitter bootstrap tab not doing when click it. have searched possible solutions on stackoverflow still did not work me. removed data-toggle='tab' already. fyi - i'm using twitter bootstrap 3.0 see code below: <ul class="nav nav-tabs case-detail-nav" id="mytab"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-target="#">text files<b class="caret"></b></a> <ul class="dropdown-menu" role="menu"> <li><a href='http://www.google.com/'>google</a></li> </ul> </li> <li class="active"><a href="#general">general</a></li> </ul> see javascript: <script> $(function () { $('#mytab a:last').tab('show') }) $('#mytab a')...

Launch Modelsim from Cygwin? -

i trying launch modelsim simulator cygwin. able compile using vcom in cygwin, when type ./vsim see following: reading c:/modeltech_pe_10.2a/tcl/vsim/pref.tcl #10.2a and nothing happens. able launch vsim correctly via windows command prompt. additionally, pretty sure cygwin environment set correctly, because can launch windows calculator cygwin. when try break hung process (ctrl + c) following error: ** fatal: vish lost connection vsim process. ** fatal: exiting vsim license process. i found answer might have problem in future. launch vsim -i switch. launches in interactive mode. sets display environment correctly within cygwin. tells modelsim use windows display environment instead of linux display environment. ./vsim -i

android - app's shortcut icon not updated after upgrading the app in samsung galaxy S3 -

i updated app's icon picture. shortcut icon in samsung galaxy s3 phones not updated accordingly. other models work fine updated icons. here how updated icon in project (kinda trivial): - replaced old ic_launcher.png in drawable-* directories new pictures; - ran app through ide; the codes in project trivial: <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > ... </application> it looks model-specific bug samsung galaxy s3. spec phone: model: sph-l710. android version: 4.1.2(api 16). carrier: sprint. my question is: there anyway update shortcut icon in specific model? if no, there way remove icon old icon grammatically? thanks in advance !

wavelet - using dwt2 and idwt2 in matlab -

i had theory of wavelets complete , decided test using matlab. however, not able interpret result of dwt2 , idwt2. when used imshow display results, did not image. [ca,ch,cv,cd] = dwt2(i_gray,'haar'); i_regray = idwt2(ca,ch,cv,cd,'haar'); figure(1); imshow(i_regray); figure(2); imshow(ca); both figures blank. not able view downscaled image well. please tell me right way view it? matlab speaks way of plotting. not getting clear though. please me. apologies if question rudimentary. in advance. you should read image , convert double. call dwt2 . the results of dwt2 in double, check range of results. if have outside of [0,1] range you'll need convert uint8.

javascript - AngularJs share $scope between controller and controller -

i can't understand why can't access $scope properties directive, documentation says directives doesn't create new scopes, why can't acess $scope properties? at app.js 'use strict'; var climbingapp = angular.module('climbingapp', []); climbingapp.controller('ctrl', function($scope) { $scope.initlocation = { lat: -54.798112, lng: -68.303375 }; at google-map.js 'use strict'; climbingapp.directive('gmap', function() { return { restrict: 'e', replace: true, template: '<div id="map-canvas"></div>', link: function(scope, ielement, attrs) { console.log(scope.initlocation); }, } }) at index.html <html ng-app="climbingapp"> <body> <gmap></gmap> </body> </html> <script src="//code.angularjs.o...

regex - Mod_rewrite cross domain extensions -

have multiple domain extensions , have therefore written mod_rewrite takes rewrites url .com setting original extension query parameter: rewritecond %{http_host} ^api\.example\.(co\.)?(.*)$ rewritecond %{http_host} !^api\.example\.com$ rewriterule ^(.*)$ http://api.example.com/$1?l=%2 [qsa,r] this works fine, problem need internal redirect api.example.com/index.php instance: api.example.fr/v1/users => (ext) api.example.com/v1/users/?l=fr (int) api.example.com/index.php i've been messing time , appreciate on matter... many regards assuming document_root api.example.fr , api.example.com same. you can have code this: rewritecond %{http_host} ^api\.example\.(co\.)?(.*)$ rewritecond %{http_host} !^api\.example\.com$ rewriterule ^(.*)$ http://api.example.com/$1?l=%2 [qsa,r,l] # add missing /v1/ if needed rewritecond $1 !=index.php rewriterule ^((?!v1/).*)$ /v1/$1 [r,l,nc] rewritecond %{http_host} ^api\.example\.com$ rewriterule ^(?!...

jsf - Primefaces template - south position doesn/t work -

i've got following problem. when set works fine. want have margins top, left , right set fullpage false. layoutunit id 'south' (and south position well) displayed @ top of page. tried fix it, without effects. here's code of template: <!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" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"> <f:view contenttype="text/html" id="fview"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>#{msg['title']}</title> <f:metadata> <ui:insert name="metadata" /> </f:metadata> <h:head> <h:he...