Posts

Showing posts from January, 2011

java - How to make ViewPager fullscreen? -

Image
i have viewpager want take full-screen, takes part of it. how can make take full-screen? here's code, notice filled many calls make layout take full-screen, no avail. walkthrough_activity.xml: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <android.support.v4.view.viewpager android:id="@+id/view_pager" android:layout_width="fill_parent" android:layout_height="fill_parent" android:minwidth="1080dp" android:minheight="1920dp"/> </relativelayout> walkthrough_single_view.xml: <?xml version="1.0" encoding="utf-8"?> <imageview xmlns:android="http://schemas.android.com/apk/res/android" android:id=&quo

javascript - How do I change the value of a key in localStorage inside JSON? -

i've got calendar. events in calendar written json , stored in localstorage following: key = events //all events object value = { "date":"31-3-2015", "event":"football match", "participants":"italy - germany", "description":"support our team friends!"}, "date":"2-4-2015", "event":"first-night play", "participants":"famous actors", "description":"going out theatre gf"} etc... i can change each line of event in calendar. need new value stored in localstorage. e.g. //old version ""date":"2-4-2015", "event":"first-night play", "participants":"famous actors", "description":"going out theatre gf"} //edited version "date":"2-4-2015", "event":"fir

flash - word alignment in actionscript -

Image
i have sentence string. internal var sentence:string = "lorem ipsum dummy text of printing , typesetting industry."; then separated every word , stored in array named wordarray , apply text field , added stage using addchild. for(var i:uint =0;x i< sentence.split(" ").length; i++){ wordarray.push(sentence.split(" ")[i]); txt = new textfield(); addchild(txt); txt.text = wordarray[i]; } alignement if(i==0) { txt.x = wordarray[i].x;} else{ txt.x = wordarray[i -1].width + wordarray[i-1].x+2}; this align first line perfectly. want multiline particular width textfield.(if word exceeds boundary limit has come next line textfield) ? firstly, i'll fix mistakes. internal var sentence:string var sentence:string the default access modifier internal. don't need write internal here. there no string class/object in as3. strings use string . for (var i:uint = 0;x i< sentence.split(" ").length

javascript - return array defined by a key/value pair -

how filter return results according key/value pair in array. say have array : .factory('dishesfactory', function (){ var factory = { dishes :[ {nameenglish: 'tapenade', namelocal: 'tapenade', description: 'xxxxxx ', region: 'provence-alpes-côte d\'azur', regioncode: 'fr.b8', itemid: 'fr002', cuisinetypeisocode: 'fr', dishcategory: 'entrée / appetizers', country: 'france', type: 'top_10'}, {nameenglish: 'greek style mushrooms ', namelocal: 'champignons à la grecque', description: 'xxxxxxx', region: 'all', regioncode: '', itemid: 'fr008', cuisinetypeisocode: 'fr', dishcategory: 'entrée / appetizers', country: 'france', type: ''} // more entries ]; and have following javascript either returns filtered-by-dishtype results user, or return whole list. want ch

git - why should I delete feature branches when merged to master -

most of git workflows i've seen suggest delete branch after it's been merged master. example, gitflow suggests following: # incorporating finished feature on develop $ git checkout develop switched branch 'develop' $ git merge --no-ff myfeature updating ea1b82a..05e9557 (summary of changes) $ git branch -d myfeature deleted branch myfeature (was 05e9557). $ git push origin develop why should delete branch? i'm curios when later bug discovered introduced feature - should create branch same name again, fix bug there, merge master , again delete branch? something important realize git branches nothing more label pointing commit. branching in git literally branching. here's repository looks if feature branched off master when master commit b. a - b - c - f - h [master] \ d - e - g - i[feature] see? actual branch. when git merge feature master, this. a - b - c - f - h - j [master] \ / d - e - g - [f

java - Which class should do the work? -

i building sales system dissertation , keep debating myself in design, class should doing work? so these 3 classes; facility class - class central class coordinator between others , gui product class - represents details of product sales class - represents sale of multiple items when comes selling products, big question is: "which class should calculate total price". facility class or sales class? whats best practice? thanks in advance my first impulse order these classes responsibility regarding model-view-controller design (because mention gui , interfacing class it). facility - according statement controller , connects gui (view) data (models). product - model class, since holds data , business logic. sale - class connected multiple products , multiple products share same sale , because product can sold more once (this assumption) , sale can include multiple products. model class. since sale class represents multiple products

jira - Combine git blame output with commit message -

is possible combine git blame output part of commit message (first word, jira ticket in case)? $ git blame file.js -l 1,5 jira-289 46fdf2b9 (john smith 2015-03-24 23:47:36 +0100 1) var line1 = 1; jira-111 69430b41 (john smith 2015-03-15 23:47:36 +0100 2) aletr("smth"); jira-111 69430b41 (john smith 2015-03-15 23:47:36 +0100 3) jira-289 46fdf2b9 (john smith 2015-03-24 23:47:36 +0100 4) var line2 = line2 + 1; jira-20 75fdf6bb (john smith 2015-02-02 22:47:36 +0100 5) console.log(line2); you cannot in example. however, can use git blame --porcelain format fit machine consumption , write script around that.

android - second fragment run in first fragment and third in second -

my requierment when click button in firstfragment load meaning database ,then screen move next screen (swipe secondfragment) automaticaly image load given url , display in image, swipe thirdfragment automatically audio load given url, , same task video. given code imagefragment(second fragment) load in meaningfragment(first fragment) , third in second, , fourth in third. ***meaning fragment( first fragment)*** string url2 = ""; string webdata = ""; int wifi = 0; int first = 1; view view; list<string> wordslist; imagebutton find; edittext word; webview data; textview urdu_meaning; listview lv; sqllitedbhelper dbhelper; getmeaning urdu ; networkinfo mwifi; connectivitymanager connmanager; wifimanager wifimanager; public static string urlword = ""; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // view fragmenttab1.xml view = inflater.inf

jdeveloper - Oracle ADF : Tabbed Pane - Showing always first tab when redirected to it -

Image
we developing web application using oracle adf. in have page tabbedpane show below in above picture have 2 tabs account payable , accounts receivable. each tab having green , red image(this commandimage). when user clicks image means red or green navigated page. in page have provided button called back . tabbedpane , page(second page) .jsff , dropped region. our problem when user clicks button in page showing first tab though clicked button in second tab. so need achieve following. if user clicks red or green image in first tab , when clicks button has redirected first tab. if user clicks red or green image in second tab , when clicks button has redirected second tab. how achieve this. please help. in advance. presuming having backing bean on session scope - mybean : <af:paneltabbed id="pt1"> <af:showdetailitem disclosurelistener="#{mybean.tabselected}" text="accounts payable" disclosed="#{mybean.selectedtab == &q

rest - What status code should I response with when there is no data found in my database -

i wondering status code response in else statement code below: if (album) { res.status(200).json({error: false, data: {channel_id: album.attributes.channel_id, id: album.id}}); } else { res.status(200).json({error: false, data: {message: 'there not album found name'}}); } i don't want leave both of them 200 want front end manage messaged thru status code, ex if returns 200 "created successfully" while in else case display "no data found". what suggestion? "no data found" should 404. "created successfully" should 201. for 201 should specify location header request can access new resource. refs: 201 http://www.w3.org/protocols/rfc2616/rfc2616-sec10.html#sec10.2.2 404 http://www.w3.org/protocols/rfc2616/rfc2616-sec10.html#sec10.4.5 update: i thought i'd expand on this, because comments below point thought processes i've battled myself. get /some/thing

java - Modifying a server to allow multiple clients to connect concurrently -

so i've created server , client previous part of assignment, have extend/modify server can handle multiple clients concurrently. know have along lines of server server1 = new server(); thread thread = new thread(server1); thread.start(); and have class server implement runnable. but lecturers notes on multi-threading not clear , have been starring @ part of question long time , have got no where. below code have written 1 client @ time connect server. appreciated. server.java public class server { arraylist<string> tokens = new arraylist<string>(); private socket s; private scanner in; private printwriter out; public static void main(string[] args) throws ioexception { serversocket server = new serversocket(1234); server serverinstance = new server(); system.out.println("server running. waiting client connect..."); while (true) { serverinstance.s = server.accept();

winforms - how to put objects of a class into a list in c# windows form -

i have created class named field. in windows form can add object of class. , in windows form, wanna show objects. should do? field class public class field { } form1 public partial class form1 : form { public form1() { initializecomponent(); field objectfield = new field(); form2 objform2 = new form2(objectfield); } } form2 public partial class form2 : form { public form2() { initializecomponent(); } public form2(object o) { // here can show field class object , want } }

javascript - Why isn't the following regex removing the ## characters? -

(var = 0; < tree.length; ++i) { if (tree[i].match(/^##/g)) { console.log(tree[i]) tree[i] = '<p><a href="#toc-' + tocindex++ + '">' + tree[i].replace('/^## /gm', '') + '</a></p>' console.log(tree[i]) tocitems.push(tree[i]) } } the first console.log(tree[i]) outputs ## chapter 1 second 1 outputs: <p><a href="#toc-1">## chapter 1</a></p> but should output instead: <p><a href="#toc-1">chapter 1</a></p> what doing wrong? you didn't use regex correctly search google on how use regex in javascript learn that. btw don't need regex that. here fix: tree[i].replace('##', '') + '</a></p>'

regex - Scala regular expression : matching a long unicode Devanagari pattern fails -

consider following script code: import scala.util.matching.regex val virama = "्" val consonantnonvowelpattern = s"(म|त|य)([^$virama])".r // val consonantnonvowelpattern = s"(थ|ठ|छ|स|ब|घ|ण|ट|ज|ग|न|ष|भ|ळ|ढ|ख|श|प|ह|ध|ङ|म|झ|ड|ल|व|र|फ|क|द|च|ञ|त|य)([^$virama])".r var output = "असय रामः " output = consonantnonvowelpattern.replaceallin(output, _ match { case consonantnonvowelpattern(consonant, followingcharacter) => consonant + virama + "a" + followingcharacter }) println("after virama addition: " + output.mkstring("-")) it produces following correct output: after virama addition: अ-स-य-्-a- -र-ा-म-्-a-ः- however, if use longer pattern (commented out above), following wrong output: after virama addition: अ-स-्-a-य- -र-्-a-ा-म-्-a-ः- is bug? doing wrong? the below lalit pant- i'm assuming correct output second case is: अ-स-्-a-य-्-a- -र-्-a-ा-म-्-a-ः- if that's case, read on. if not

node.js - Algorithm for textual context matching in Javascript -

i have implement algorithm node.js app i'll getting strings , based on context i'll have decide if match or not. take taxi service example. person asking taxi can considered string one. taxi driver willing offer service considered string2. algorithm should process these 2 strings , case return match. have lot of test data train algorithm on, if need be. so far have come across bayes document classification algorithm , think job done. i wondering if there easier way this, or existing npm module use? example strings: s1 : looking apartments in new york s2 : our website lists apartments sale in new york. outcome : match. s1 : looking restaurants in new york s2 : john sells computers. outcome : no match. you can use levenshtein distance , give number of corrections make strings match, can convert percentages, approximate match . here javascript implementation , can used nodejs module.

r - Error in "if (reached.threshold < min.reached.threshold) {" : missing value where TRUE/FALSE needed -

i following error message : error in "if (reached.threshold < min.reached.threshold) {" : missing value true/false needed it occurs when using tan hyperbolic activation function in modeling neural network architecture using neuralnet function in r mymodel24 <- neuralnet( increasescope~rsi10 + rsi14+ rsi20 + signal + roc12 + fastk + wpr + bias3 + bias5 + bias10, data=bsefinaldata, hidden=c(3,2), err.fct="sse", linear.output=true, algorithm="backprop", act.fct="tanh", # <= line threshold = 0.01, learningrate = 0.01, rep=3 ) it works when use act.fct="logistic" i had same error. following worked me: try set linear.output=f , scale output afterwards.

ios - how to access variables inside an enum? -

class detailsviewcontroller: uiviewcontroller { @iboutlet weak var summarybutton: uibarbuttonitem! @iboutlet weak var commentarybutton: uibarbuttonitem! enum viewstate: int { case summary case commentary func setvisibility() { switch (self) { case summary: summarybutton.enabled = true commentarybutton.enabled = false case commentary: summarybutton.enabled = false commentarybutton.enabled = true } } } } i not able access summarybutton , commentarybutton: gives error saying "detailsviewcontroller.type not have member named summarybutton" how access summarybutton , commentarybutton? solution: worked me enum viewstate { case summary case commentary } class detailsviewcontroller: uiviewcontroller { @iboutlet weak var summarybutton: uibarbuttonitem! @iboutlet weak var commentarybu

Google Authentication using Tornado Web Framework(Python) -

i using tornado web framework its's asynchronous call facilities, , trying setup google authentication using oauth in tornado. currently authentication goes step ask permissions access data , no data received screen comes not able exchange access token application. can update question code ?? can update answer based on error or code update. if want refer docs u can @ http://tornado.readthedocs.org/en/latest/auth.html below example code you. class googleoauth2loginhandler(tornado.web.requesthandler, tornado.auth.googleoauth2mixin): @tornado.gen.coroutine def get(self): if self.get_argument('code', false): user = yield self.get_authenticated_user( redirect_uri='http://your.site.com/auth/google', code=self.get_argument('code')) # save user e.g. set_secure_cookie else: yield self.authorize_redirect( redi

ios - SWRealViewController over UINavigationBar subview hides UINavigationItems -

when layer swrevealviewcontroller on normal uiviewcontroller's view, achieve sliding left menu effect, works intended. however, when view controller embeded on uinavigationcontroller, overlays navigation bar , hides image , left , right barbuttonitems. i'd appreciate finding workaround. this how i'm adding buttons: uibarbuttonitem *revealbuttonitem = [[uibarbuttonitem alloc] initwithimage: [uiimage imagenamed:@"icon-back"] style:uibarbuttonitemstyleplain target:self.revealviewcontroller action:@selector(revealtoggle:)]; uibarbuttonitem *saveexitbuttonitem = [[uibarbuttonitem alloc] initwithimage:[uiimage imagenamed:@"out"] style:uibarbuttonitemstyleplain target:self action

java - Reversing the array without any additional buffer -

this question has answer here: how reverse int array in java? 34 answers can please advise how reverse array without using additional buffer , best algorithm achieve example have below class consists of array , looking best algorithm not need create buffer or array while reversing array public class ardem { public static void main(string[] args) { int[] numbers = {1, 2, 3, 4, 5, 6, 7}; } } well don't want use predefined method of api want create own please advise how achieve this there exists implementation of it: arrayutils.reverse(int[] array) in commons.lang .

Python Challenge #2 Elimination -

i solver python challenge #2 microsoft word (find , replace) when used python, failed because code not work... with open("c:\\python34\\python challenge\\q2\\q2.txt") f: f = str(f) f = str.replace(f, '!','') f = str.replace(f, '@','') f = str.replace(f, '#','') f = str.replace(f, '$','') f = str.replace(f, '%','') f = str.replace(f, '^','') f = str.replace(f, '&','') f = str.replace(f, '*','') f = str.replace(f, '(','') f = str.replace(f, ')','') print(f) research: print out properties of file. why not information? , also, how can change it? tried f.open() , "f". have changed code multiple times thoughout these few hours (i think 3) code still dead. you need use f = f.read() : f = str(f) show string representation of file object, like:

ios - creating physics body for a SKSpriteNode in order to detect contact -

as title suggest, have issue creating contact between enemies sprite , hero laser(bullet). create enemies trough following method , adding them view. -(void)enemies{ //not come int goornot = [self getrandomnumberbetween:0 to:1]; if(goornot == 1){ skspritenode *enemy; int randomenemy = [self getrandomnumberbetween:0 to:1]; if(randomenemy == 0) enemy = [skspritenode spritenodewithimagenamed:@"enemy_spaceship.png"]; else enemy = [skspritenode spritenodewithimagenamed:@"spaceship15.png"]; enemy.scale = 0.4; enemy.position = cgpointmake(450, 0); enemy.hidden = no; cgpoint location = cgpointmake(450, 320); skaction *moveaction = [skaction moveto:location duration:2.5]; skaction *doneaction = [skaction runblock:(dispatch_block_t)^() { //nslog(@"animation completed"); enemy.hidden = yes; }]; skaction *moveasteroidactionwithdone = [skaction sequence:@[moveaction,doneactio

c# - The name 'ViewBag' does not exist in the current context - Visual Studio 2015 -

Image
i'm starting develop in asp.net again , ran small error within visual studio. .cshtml files show errors when using few razor functions. example "the name 'viewbag' not exist in current context". here picture: i using demo project. can find project here: https://github.com/wintellect/angular-mvc-cookbook/tree/master/basicproject i have looked through several other threads , suggest update web.config file(s). these 2 config files present , since it's pretty popular demo assume has required configuration in it. have of course looked through these config files , indeed include suggested solutions. other details: i have used clean & rebuild on solution changed nothing. when create new mvc project work my friend has same problem , both use vs 2015 , windows 10 i can still run application , work. thanks in advance. i had issue despite having correct configuration. it turned out bad files in component cache, preventing razor views r

css - angular material md-tabs and md-grid-lists -

i can not md-grid-list visibly display within md-tab. i copied md-grid-list here https://material.angularjs.org/#/demo/material.components.gridlist , embedded under set of dyanmically generated tabs. the grid list not display on tab can tell. ideally grid list aligned left , top under tab if makes sense. css not forte ... i have sample fiddle here https://jsfiddle.net/lunfort/vsqs0dzw/5/ <div> <md-tabs> <md-tab ng-repeat="tabname in tabs" label="{{tabname}}"> <md-grid-list md-cols-sm="1" md-cols-md="2" md-cols-gt-md="6" md-row-height-gt-md="1:1" md-row-height="2:2" md-gutter="12px" md-gutter-gt-sm="8px" > <md-grid-tile class="gray" md-rowspan="3" md-colspan="2"> <md-grid-tile-footer> <h3>#1: (3r x 2c)</h3> </md-grid-tile-footer> </md-gr

c - Ball Game : Project -

i'm working on project ball have random motion, score displayed on top left corner , timer function of 1 min on top right corner. purpose player click on ball , score incremented 1 , speed of ball increase. till have made random motion, score displayed i'm not able calculate position of ball in when cursor goes on ball score needs displayed otherwise not. me in detecting mouse on moving ball. here code : #include<gl/glut.h> #include<math.h> #include<stdbool.h> #include<stdio.h> #define pi 3.14159265f glfloat ballradius = 0.2; glfloat ballx = 0.0f; glfloat bally = 0.0f; glfloat ballxmax,ballxmin,ballymax,ballymin; glfloat xspeed = 0.02f; glfloat yspeed = 0.007f; int refreshmills = 30; int x1,xa,ya; int score = 0; int last_mx = 0, last_my = 0, cur_mx = 0, cur_my = 0; int arcball_on = false; int posx = -1,posy=0,posz=1; char *string; gldouble clipareaxleft,clipareaxright,clipareaybottom,clipa reaytop; void color() {

wordpress - Filtering portfolio with php -

i working on portfolio page , since don't want repeat code, have 1 database portfolio pieces. have 2 categories, work , freetime. both categories have own page. under these 2 categories, have couple subcategories. work has holland, england, germany , freetime has belgium, france , spain. how can make sure when don't select subcategories freetime, portfolio item doesn't displayed under portfolio items in work , vice versa? (i hope question clear enough) this code have atm retrieve portfolio database , use foreach loop loop through items: <div id="container-portfolio" class="containerp"> <div id="effect-2" class="effects clearfix"> <?php $portfolio_items = get_field('portfolio_items',165); if($portfolio_items): foreach($portfolio_items $index => $item)

Python Tkinter throwing Tcl error -

i learning basic gui in python, , came across sample example read file name file explorer on stack overflow . from tkinter import tk tkfiledialog import askopenfilename tk().withdraw() # don't want full gui, keep root window appearing filename = askopenfilename() # show "open" dialog box , return path selected file print(filename) this particular script working fine when trying run in idle, same not running if trying command prompt in windows 7. python version: 2.7. here output error get. >>> tkinter import tk >>> tkfiledialog import askopenfilename >>> tk().withdraw() traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\lib-tk\tkinter.py", line 1685, in __init__ self.tk = _tkinter.create(screenname, basename, classname, interactive, wantobjects, usetk, sync, use) _tkinter.tclerror: can't find usable init.tcl in following directories: c:/python27/lib/tcl8.5 d

javascript - create simple js object and store them into js array -

inside html dom have following structure <div id="mytitles"> <ul> <li> title:<title>a</title><br> second title: <sectitle>b</sectitle><br> third title: <thirdtitle>3</thirdtitle> </li> <hr> <li> title:<title>b</title><br> second title: <sectitle>c</sectitle><br> third title: <thirdtitle>9</thirdtitle> </li> </ul> </div> number of list elements inside ul of mytitles div unknown on runtime. i'm taking var nroftitles = $('#mytitles ul li').length; determine how many there. now, want create simple javascript object hold values (stored inside semantic tags ( title , sectitle , thirdtitle )) , store them inside js array. var items = $("#mytitles > ul > li"); var arr = []; items.each(function(){ arr.push([$(this).find("title&quo

Prolog add to list if element is not equal to string -

i trying create list of pairs have non-null guard element. get_only_guarded(l) :- guard \= null, findall([s,d],transition(s,d,_,guard,_),l). this ive tried doesnt seem work. correct way? use dif(guard,null) instead. handle (\=)/2 care!

Run jQuery function via php on form submit -

i using form allow file download , store number of downloads can't seem find way fadein subscribe div (#cover) on form success.. this form: <form action="<?php $_server['php_self']; ?>" method="post" name="free-download" id="free-download"> <button class="download" type="submit" name="clicks" onclick="window.open('download/imagins_._ro_free_files_format_icons.rar')">download (<span class="small"><?php echo getclickcount(); ?> times</span>)</button> </form> is there jquery way of doing this? this tried: $("#free-download").bind('ajax:complete', function() { $('#cover').fadein(600); $('body').addclass('hidescroll'); }); update by changing form action <?php echo $_server['php_self']; ?> , adding following (below) managed add echo page

qt - trouble passing parameters to console application -

i have trouble correctly launching cloc 1.62 windows command line using qprocess. here have: a qstringlist languages cloc recognizes; qstringlist languages; languages<<"\"abap\""<<"\"actionscript\""<<"\"ada\""<<"\"adso/idsm\""<<"\"ample\""<<"\"ant\""<<"\"apex trigger\""; then create qstring consisting of of list's elements separated comma, exept one, stored in lang variable; qstring langsinuse; (int i=0;i<languages.length();i++) { if (languages.at(i) != lang) { if (langsinuse.isempty()) { langsinuse=langsinuse+languages.at(i); } else

Adding a unique key to the oracle database table -

Image
trying implement friendship table .. to explain wat have done till my ddl <!-- working -- "relationship" - table used store relationship between users --> create table relationship( relation_id number(8), fromusername varchar2(30), tousername varchar2(30), statusid number, senttime timestamp, constraint relationship_pk primary key(relation_id), foreign key (fromusername) references users(username), foreign key (tousername) references users(username) ); <!--working add unique key 'relationship' table user can send request @ time user oncle --> alter table relationship add constraint relation_unique unique (fromusername, tousername); here image explain problem my problem have @ last 2 rows . .. users kamlesh1 send request jitu1 , again jitu1 sends request kamlesh1 , when kamlesh1 accepts request statusid changes 1 similar case kamlesh jitu when jitu accepts request. want prevent kind of duplication i.e on

awk usage in perl scripting -

hi writing script need grep 6th column of output using awk command getting other output. exact syntax in perl extract 6th column using awk? #!/usr/bin/perl use strict; use warnings; use diagnostics; $filesystem=`df -h |grep -i dev|grep -ve '^filesystem|proc|none|udev|tmpfs'`; print "(\"$filesystem\"|awk '{print \$6}')" output : 7831c1c4be8c% ./test.pl ("/dev/disk1 112gi 43gi 69gi 39% 11227595 18084674 38% / devfs 183ki 183ki 0bi 100% 634 0 100% /dev "|awk '{print $6}')% am trying remove % how can done ? 7831c1c4be8c% cat test.pl #!/usr/bin/perl use warnings; use strict; open $fs, q(df -h |) or die $!; while (<$fs>) { print +(split)[4], "\n" if /dev/i , not /devfs/; } 7831c1c4be8c% ./test.pl 40% you don't need awk inside perl. #!/usr/bin/perl use warnings; use

Java - Fill Array With Characters From String -

i want fill unknown length of string, split character , put array, repeating process until array full. multidimensional array i'm using. key = input user string (length unknown) int[][] fullkey = new int[128][2]; { (int ii = 0; ii < key.length(); ii++) { fullkey[i][0] = key.charat(ii); i++; } } while (fullkey[encoding][0] == null); i know int primitive can't null it's try , explain i'm attempting do thanks in advance does below code fit requirement? string key = "string"; int row = 2; int col = 128; int[][] fullkey = new int[row][col]; int counter=0; (int = 0; < col; i++) { fullkey[0][i] = key.charat(counter); counter = (counter==key.length()-1) ? 0 : (counter+1); }

github - Git clone error with beaglebone black -

i ssh beaglebone black via putty, tried download source code github repository using following steps below, no avail. git version 1.7.7. don't know if thats problem, if is, how can latest version on beagle bone. 1st attempt, cloning ssh: root@beaglebone:~# git clone git@github.com:o-botics/quickbot_bbb.git cloning quickbot_bbb... permission denied (publickey). fatal: remote end hung unexpectedly 2nd attempt, cloning https: root@beaglebone:~# git clone https://github.com/o-botics/quickbot_bbb.git cloning quickbot_bbb... error: while accessing https://github.com/obotics/quickbot_bbb.git/info/refs fatal: http request failed please, detailed response appreciated newbie @ this. github has been under constant ddos attack 3 days now. has been causing difficulties site, , root cause of issues.

How to mix strings in Python -

i trying write function mix strings in python getting stuck @ end. example, have 2 words, mix , pod. create function returns: pox mid my code returns pox mix code: def mix_up(a, b): if len(a , b)>1: b=str.replace(b,b[2],a[2:3]) a=str.replace(a,a[2],b[2]) print b,"",a return mix_up('mix','pod') i seeking multiple words. example: if used dog,dinner the output should return dig donner thanks! little play on string slicing def mix_up(first, second): new_first = second[:2] + first[2:] new_second = first[:2] + second[2:] return " ".join((new_first, new_second)) assert mix_up('mix','pod') == 'pox mid' assert mix_up('dog','dinner') == 'dig donner'

javascript - Read radio button value on button-grp toggle -

this follow question how toggle button in button-group on page load in bootstrap3 jquery i'm trying read value of radio in button group. i'm able read value on click of button, not on change trigger. <body> <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"> <input type="radio" name="environment" id="staging" value="staging" />staging </label> <label class="btn btn-default"> <input type="radio" name="environment" id="production" value="production" />production </label> </div> <button class="get-active">get active</button> <script> $(document).ready(function() { $("#production").parent().button('toggle'); }); $('.get-

nlp - Weka - Naive Bayes always gives borderline results -

i trying write text classifier in weka naive bayes. have collection of foursquare tips training data close 500 of them marked positive , approximately same marked negative in excel file. input file has 2 columns first 1 being tip text , second 1 marked polarity. using afinn-111.txt add attribute enhance output. calculates polar words in tip , gives final score of words. here entire code: public class datareader { static map<string, integer> affinmap = new hashmap<string, integer>(); public list<list<object>> createattributelist() { classloader classloader = getclass().getclassloader(); initializeaffinmap(classloader); file inputworkbook = new file(classloader .getresource("tip_dataset2.xls").getfile()); workbook w; sheet sheet = null; try { w = workbook.getworkbook(inputworkbook); // first sheet sheet = w.getsheet(0); } catch