Posts

Showing posts from July, 2010

javascript - Create room socket io -

i'm trying create simple node app if user press button called 'create room', room created, creator of room joins , make room available other players join limit of users. got far (i'm beginner sockets..) ///server side const app = require('express')(); const io = require('socket.io')(); app.get('/', (req, res) => res.sendfile(__dirname + '/index.html')) io.on('connection', socket => { socket.on('create', room => socket.join(room) ) }) app.listen(3000, (req, res) => console.log('server up!')) ///client side <!doctype html> <html> <head> <title>flip</title> <script src="https://cdn.socket.io/socket.io-1.4.5.js"></script> <script src="http://code.jquery.com/jquery-1.11.1.js"></script> </head> <body> <button>create room!</button> </body> <script type="text/javascript">

Softlayer instance type -

do have idea data center supports largest virtual machine size? understand largest public virtual instance can go 56 cpu cores , 242gb memory, not data centers support that. however, in softlayer autoscale console, can see instance can selected in data centers, when create autoscale group, fail data centers saying size not available. i suggest submit ticket softlayer , ask them softlayer's sales guys.

continuous integration of docker image by running locally with its own IP? -

i trying out google container engine or kubernetes , have deployed simple mean stack on it. doing following below steps in local machine deploy new changes. docker push commands takes lot of time (and network speeds not great) docker build --no-cache -t gcr.io/$project_id/my-app:v7 . # below command takes lot of time push gcloud docker push gcr.io/$project_id/my-app:v7 kubectl set image deployment/my-app-pod my-app-pod=gcr.io/$project_id/my-app:v7 question in 2 parts: how can optimise continuous integration here - docker push command taking hour ? how can run docker image own ip on local machine - doing small changes , testing behaviour(session,cookies) reproducible external-ip , not on http://localhost . answer first part of question. for second part: just start using minkube - local development version of kubernetes. you can deploy app actual local kubernetes instance, , once satisfied, can push gcloud.

angularjs - Protractor test not executing -

i have protractor test. want provide data test can generate tests automatically. my function below. problem can console log after opening of describe. is'nt case after function. the code: bigtestfunction = function(testelements) { testelements = json.parse(testelements); (i = 0; < testelements.length; i++) { var title = testelements[i].title; var shouldtext = testelements[i].should var url = testelements[i].url; var actions = testelements[i].action; describe(title, function() { it(shouldtext, function() { gotourl(url); (x = 0; x < actions.length; x++) { var action = actions[x].action; var value = actions[x].value; var element = actions[x].element; var notempty = actions[x].notempty; var nested = actions[x].nested; if (action === 'sendkeys') { sendkey(element, value); }

Howto import Eclipse gradle projects and run / launch configurations from command line -

i provisioning dev environment vm using vagrant , chef. works great provisioning eclipse , needed plugins leaves developer tasks of importing gradle project, run configurations jboss server run configuration. there way import gradle projects , run configurations using command line? if so, these steps automated part of creating vm. tia help. run configuration: if store them in project folder, picked eclipse automatically. see also: https://stackoverflow.com/a/8625088/1861362 eclipse project: can generate eclipse files using gradle eclipse plugin, yet i'm not aware of means have them automatically imported in eclipse..

ruby - I can't figure out why I'm getting this error in rails app: First argument in form cannot contain nil or be empty error -

ok i've been trying figure out awhile... wan´t render partial in views/users/show.html.erb this form code in partial want rendered <%= form_for @addon, :html => {:class => "form-horizontal center"} |f| %> <div class="form-group"> <%= f.label :addon_1, "1.addon:", class: "col-md-4 control-label" %> <div class="col-md-8"> <%= f.text_field :addon_1, class: "form-control" %> </div> </div> <div class="form-group"> <%= f.label :addon_2, "2.addon:", class: "col-md-4 control-label" %> <div class="col-md-8"> <%= f.text_field :addon_2, class: "form-control" %> </div> </div> <div class="form-group"> <%= f.label :addon_3, "3.addon:", class: "col-md-4 control-label" %> <div class="col-md-8&qu

haskell - Getting my bearings on state-monadic "uncurrying" -

the curry-uncurry isomorphisms can expressed invertible maps between various kinds of "higher-order" programs in reader monad (ignoring wrappers keep things concise): type r r = r -> uncurryr :: r r (r s a) -> r (r, s) uncurryr m (r, s) = m r s curryr :: r (r, s) -> r r (r s a) curryr m r s = m (r, s) i have become interested in state-monadic version of uncurrys , follows: type s r = r -> (a, r) uncurrys :: s r (s s a) -> s (r, s) uncurrys m (r, s) = (v, (t, u)) (n, t) = m r (v, u) = n s of course, unlike uncurryr , uncurrys isn't isomorphism: s (r, s) a in general "larger" type s r (s s a) . i'm academic linguist, , without going too detail, difference between r , s respect "uncurrying" operations -- i.e., whether they're isomorphisms -- turns out consequential thinking various problems in formal semantics of natural language (believe or not!). in general, when construct looks relevant natural l

python - Making a random coordinate generator -

this code meant user input, want randomly create polygon rather manually selecting points myself. i'll make loop, rather while loop don't need mention that. import pygame pygame.locals import * sys import exit import random random import * pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) points = [] while true: event in pygame.event.get(): if event.type == quit: pygame.quit() exit() point1 = randint(0,639) point2 = randint(0,479) points = (str(randint(0,639)), str(randint(0,479))) screen.fill((255,255,255)) if len(points) >= 3: pygame.draw.polygon(screen, (0,255,0), points) point in points: pygame.draw.circle(screen, (0,0,255), point, 5) pygame.display.update() what attempting make coordinate point randomizer. however, isn't compatible code reason. tried other things well, , remnants of attempts may visible. segment change

node.js - Mongoose Updating Certain Fields of a Document -

i'm trying implement update method our api , i'm kinda new node didn't know best practice carry out task of updating fields of document. let me elaborate, have user model keeps basic info of user name, age, sex, school, bio, birthday etc. our update method should work this, request of method includes new values of fields provided such {bio:'newbio'} or {school:'newschool', name:'newname'} must update provided fields provided data , leave rest are. wondering best approach problem @ hand be. in advance the easiest approach can think of use $set perform update operations. an example : var updatedusers= function(db, callback) { db.collection('users').updatemany( { "_id": "value"}, { $set: { bio: "new bio" } } , function(err, results) { console.log(results); callback(); }); }; and invoke above function : mongoclien

c# - Change TableAdapter XSD to use Web.config Connection String Instead of App.config -

i given asp.net/c# web form application support. has website project, business layer, , data layer. data layer has many xsd files tableadapters. these table adapters point data layer's app.config/settings file database connection string. i'd have xsd files use connection string in website project's web.config file instead can have database connection in 1 single configuration file instead of 2 different ones. how can go doing this? when go connection properties of tableadapter see app.config connection strings. i believe figured out. problem while connections in web.config , app.config had same name, xsd files using full name, added connections web.config file along lines of "datalayer.properties.settings.connectionname" , removed app config , cleared connections settings.

angular - How can I highlight an element when its clicked, but then also unhighlight other elements? -

i have component contains several children components. this: <div class="maincomponent"> <child-component-1 *ngfor="let childa of childrena"></child-component-1> <child-component-2 *ngfor="let childb of childrenb"> </child-component-2> <child-component-3 *ngfor="let childc of childrenc"></child-component-3> </div> if user clicks child-component-1, want apply special styling it's highlighted. simple enough, add (mousedown)="foo()" (and check if user holding 'ctrl' can highlight multiple). i'm not sure how though unhighlight other child components highlighted. the thing can think of have child-component-x's emit event when highlighted. in maincomponent can iterate through children components , set each unhighlight. involve iterating through components every time though, , there lot. is there better way handle this, or idea correct way? t

javascript - 2 bars stacked and 1 unstacked in the same x axis CHARTJS -

Image
i'm trying combined chart title says. mean when have 3q15 in x axis want 2 bars 1 after other, first 1 stacked other , second 1 unstacked. here have picture of want chartjs: <script> var randomscalingfactor = function() { return math.round(math.random() * 10000); }; </script> <h3 style="text-align:center;font-weight:900">online</h3> <canvas id="mychart6" ></canvas> <div id="js-legend" class="chart-legend"></div> <script> var barchartdata = { labels: ["ene-16", "feb-16", "mar-16", "abr-16", "may-16", "jun-16", "jul-16", "ago-16", "set-16", "oct-16", "nov-16", "dic-16"], datasets: [{ type: 'bar', label: 'logística', backgroundcolor: "rgba(0,255,0,0.6)", data: [randomscali

C++ Temperature Converting -

i have problem in while loop. program reads quit (-999) line after reading fahrenheit temperature. in beginning didn't have problem until trying make print correct answer average , ruined everything. here code: #include<iostream> #include<iomanip> #include<fstream> using namespace std; void main() { float fahr =0 , cent = 0, fsum = 0, csum = 0; float favg = 0; float cavg = 0; int temp_cnt = 0; ofstream fout; fout.open("temps.dat"); fout << setw(25) << "fahrenheit" << setw(20) << "centigrade" << endl; fout.setf(ios::fixed); fout.setf(ios::showpoint); fout.precision(1); while (fahr != -999) { cout << "enter fahrenheit temperature enter. -999 toquit"<< endl; temp_cnt++; cin >> fahr; fsum += fahr; csum += cent; cent = float((5.0 / 9.0))*float((fahr - 32)); fout << setw(25) << fa

c# - How to declare string with value from other form -

what trying value of uid mainform , declare level in form1. mainform using system; using system.collections.generic; using system.drawing; using system.windows.forms; namespace sof_op_center { public partial class mainform : form { public mainform() { initializecomponent(); error.visible = false; } void loginclick(object sender, eventargs e) { if (agent.text == "user" && aid.text == "pass") { this.hide(); form1 frm = new form1(); frm.show(); } else if (agent.text == "user2" && aid.text == "pass2") { this.hide(); form1 frm = new form1(); frm.show(); } else { error.visible = true; } } } } form1 using system; using sys

bash - is there a linux program to continuously run another program without flicker? -

Image
i run command line program again , again inside infinite loop. program output different data. whenever new data output, previous data overwritten. example: following program output time of day. #include <stdio.h> #include <time.h> int main (){ time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); printf ( "current local time , date: %s", asctime (timeinfo) ); } the naive approach following: while true; ./main; clear; done of course, clear screen every run, , cause flicker. i pipe custom program refreshes output on change, hoping find solution using standard linux commands (or bash language features). the program output multi-line, returning(/r) , re-writting not option. if have command watch available, use that. type watch ls

windows 10 universal - Unit testing in Visual Studio 2015 has stopped working -

i have c++ uwp unit testing project uwp c++ static library, in c++ windows 10 uwp app, in visual studio 2015 solution. i'm using unit testing built-in vs 2015. worked months , 1 day, message when tried run tests test explorer: dep3000 : attempts stop application failed. may cause deployment fail. exception hresult: 0x92330047 after that, unit testing stopped working in visual studio. have attempted remedy situation far: manually delete old deployed unit testing app. manually deploy unit testing app. run "repair" option on vs 2015 installer. uninstall , reinstall vs 2015. use visualstudiouninstaller github , reinstall vs 2015. a mvp on msdn forums looked @ installer logs , said installed correctly according logs. made new solution new unit testing project. the unit testing app launches, test app window comes minute or two, , app closes. however, test explorer window left busy bar rotating waiting response test app (i assume). i have 3 developmen

php - Slow site...understanding google chrome network results -

Image
im experiencing slow site. takes lot of time before images on frontpage shows , have high load time. image results loading frontpage network tab open. should mention problem not occur on localhost (identical duplicate of site). can give me pointers on look? can server issue or wrong backend logic? deeply appreciate help! 1) can create image style reduce image size 2) can use boots module speed site 3) or please check server response time if there issue persent

javascript - Accessing objects between components/controllers in Angularjs -

i need share objects between controllers in angularjs , have made works, feels bit clumsy me. i'm wondering if have acceptable, or if there's preferred way so. in componenta have object want access componentb. app.component("componenta", { controller: function ($scope, $rootscope, $compile) { //the object contents want $scope.objecttoaccess = {name: 'object', value: 3}; //receives broadcast componentb, returns object $rootscope.$on("getobject", function () { $rootscope.$broadcast('receiveobject', $scope.objecttoaccess); }); } } app.component("componentb", { controller: function ($scope, $rootscope, $compile) { $scope.object = {name : null, value: null}; //receives broadcast of object , sets value $rootscope.$on("receiveobject", function (event,object) { console.log(object); $scope.object = object;

http - Using "Content-Encoding":"GZIP" -

i want send large amount of json on http sever. if use "content-encoding":"gzip" in httpclient, automatically convert request body compressed format? if automatically this, 100% dependent on http client using , if implemented way. setting header not automatically encode it, @ least in clients regularly use.

objective c - NSMutableDictionary objectForKey returns null with correct key -

im having weird problem nsdictionary, take @ code , console output , see yourself. for (int y = 0; y < self.tileproperties.allkeys.count; ++y) { //i go on keys in nsdictionary,self.tileproperties. nsstring *string = [self.tileproperties.allkeys objectatindex:y]; nslog(@"keys %@",string); nslog(@"objects in array %@",[self.tileproperties objectforkey:string]); } nslog(@"object in array 2 %@",[self.tileproperties objectforkey:@"496"]); this console outputs. 2016-09-12 17:23:00.822 greatgrimbeta[1043:130572] keys 496 2016-09-12 17:23:00.822 greatgrimbeta[1043:130572] objects in array { fire = 7; } 2016-09-12 17:23:00.823 greatgrimbeta[1043:130572] object in array 2 (null) why getting null same key used in loop? thank help! the answer of joshcaswell nsnumber *num = [nsnumber numberwithint:496]; nslog(@"object in array 2 %@",[self.tileproperties objectforkey:num]); 2016-09-12 18

jquery - Javascript tab menu loading after Google Ads -

i utilized tab menu written in html , css , running javascript. tab menu can seen working here dd tab menu . works great except 1 issue: when add google ads, not load until google ads loaded. google ads set 'async' supposed load last. usually 1 doesn't notice, times when there problem google ads network, tab menu not load. not figure out why. javascript tab menu is: var tabmenu={ disabletablinks: true, snap2original: [false, 300], currentpageurl: window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, ""), definemenu:function(tabid, dselected){ this[tabid+"-menuitems"]=null this[tabid+"-dselected"]=-1 this.addevent(window, function(){tabmenu.init(tabid, dselected)}, "load") }, showsubmenu:function(tabid, targetitem){ var menuitems=this[tabid+"-menuitems"] this.clearrevert2default(tabid) (i=0; i<menuitems.length; i++){

mysql - How can I exclude posts whose total votes are less than 1? -

here query: select count(1) qanda question join qanda answer on question.id = answer.related answer.related not null , answer.author_id = ? , question.amount null , answer.date_time >= unix_timestamp(now() - interval 1 year) , unix_timestamp(now() - interval 1 hour) , answer.id not in ( select post_id votes table_code = 15 group post_id having sum(value) < 0 ) my query returns number of user's answers have either 0 or positive total votes (total votes: 0, 1, 2, ...) . need exclude answers have 0 total votes. therefore replace: ... having sum(value) < 0 with ... having sum(value) < 1 but doesn't work expected. mean still counts answers have 0 total votes. what's wrong? , how can fix it? the problem inner query doesn't select posts have no votes, aren't excluded. there couple of ways of solving this, easiest reverse logic exclusion inclusion , ie "show posts have total votes >

audio - Proper format for a file name in python -

i'm importing mp3 file using ipython (more specifically, ipython.display.display(ipython.display.audio() command) , wanted know if there specific way supposed format file path. the documentation says takes file path assumed (perhaps incorrectly) should \home\downloads\randomfile.mp3 used online converter convert unicode. put in (using, of course, filename=u'unicode here' didn't work, instead giving bunch of errors. tried reformatting in different ways (just \downloads\randomfile.mp3, etc) none of them worked. curious, here unicode characters: \u005c\u0044\u006f\u0077\u006e\u006c\u006f\u0061\u0064\u0073\u005c\u0062\u0064\u0061\u0079\u0069\u006e\u0073\u0074\u0072\u0075\u006d\u0065\u006e\u0074\u002e\u006d\u0070\u0033 translates \home\downloads\bdayinstrument.mp3, believe. so, doing wrong? correct way format "file path"? thanks!

c# - How to pass variable (Alias) into where condition SQL -

goodday all, i want pass 'coalesce(mdt.deptname,dd5.name) departname ' condition. error shows invalid column. possibilties ? below code: select op_id, dd.name unit, dd1.name freq, dd2.name calc, coalesce(mdt.deptname, dd5.name) departname, coalesce(co.yearlytarget + ' ' + dd3.name, co.yearlytarget)as yearlytarget, co.pastyearresult, co.weight, co.project, co.description, co.datecreated, mdt.weightvalue [mbo].[dbo].[m_newcaloprt] co left join [mbo].[dbo].[m_ddl] dd on co.unit_ddl = dd.d_id left join [mbo].[dbo].[m_ddl] dd1 on co.freq_ddl = dd1.d_id left join [mbo].[dbo].[m_ddl] dd2 on co.calc_ddl = dd2.d_id left join

Taking command line options in C -

i have hash table program , i'm trying implement command line option inputs. default action create hash table , read in text file, done after checking options. options alter properties of hash table before creation, e.g -f option specifies table size. e.g ./program < words.txt -f 400 i'm handling them this: int main(int argc, char*argv[]){ const char *optstring = "e:f:"; char option; int tablesize = 100; int unknown_words, i; char word[256]; htable h; default = 1; while((option = getopt(argc, argv, optstring)) != eof){ switch (option){ case 'e': default = 0; h = htable_new(tablesize); copy_in(h); unknown_words = find_words(h, optarg); printf("%d", unknown_words); break; case 'f': if(optarg && atoi(optarg)>0){ ta

java - How to retrieve variable from a method -

i made text adventure turns card game based on anime enjoy, moved long winded text private static voids in order 'clean up' main method. firstly best way go it? second, , main question, in public static string jojifunai ask user name. want use variable throughout rest of code, how can go this? sorry mouthful, don't know go. import java.util.scanner; import java.util.random; public class ecard { public static void main(string[] args) { scanner intkeyboard = new scanner(system.in); boolean emperor = false; boolean slave = false; // player 1 deck int emperorplayer1 = 1; final int citizenplayer1 = 4; // player 2 deck // opening options // activates deck player chooses // boolean emperor= false, slave= false; int deckchoice; wakeup(); jojifunai(); system.out.println(name); gamerules(); deckchoice(); //this portion turned cl

c# - How to use c#7 with Visual Studio 2015? -

Image
i´ve heard lastest preview of visual studio 15 can configured play features of c#7 , visual studio 2015 ? how can use c#7 it? you can replace compiler shipped visual studio c# 7-enabled version installing nuget package microsoft.net.compilers : referencing package cause project built using specific version of c# , visual basic compilers contained in package, opposed system installed version. there no indication can see on package page whether officially supported in visual studio 2015. not-thorough tests far indicate works not painlessly - c# 7 code compiles, underlined red squiggly line indicates syntax error: note need install nuget package system.valuetuple use new c# 7 value tuples features.

java - How to make Spring Cloud Consul register with external IP? -

how make spring cloud consul register external ip? i run spring boot applications spring cloud consul in docker. application running inside docker network on docker swarm. this means if spring consul registers hostname or ip address hostname or ip address internal docker swarm. consul server outside docker swarm. you can set spring.cloud.consul.discovery.ipaddress externally , set property spring.cloud.consul.discovery.preferipaddress=true . alternatively, can control network interfaces derive ip address from. in brixton can ignore interfaces: spring: cloud: inetutils: ignoredinterfaces: - docker0 - veth.* in camden (currently rc1) can whitelist networks: spring: cloud: inetutils: preferrednetworks: - 192.168 - 10.0

android - How to control a Service from both remote and local? -

i have situation: app has local service(used pool slave devices), app able start or stop pool. however, other authorized apps have ability start or stop pool, , when so, alse passes values service(such slave address). how can control service both remote , local, have conflicts? if have 2 functions perform start , stop operations in app, like: public startpool(string address){} public stoppool(string address) {} then there high chances of conflict if called multiple threads. conflict can handled 2 approach : synchronization using looper queue request, happens in serial fashion.

PHP array values not being changed -

i trying make program synthetic division requires factoring wrote function factor integer works, never changes values of php array $factors . any appreciated . $factors=array(); $i; function factor($x){ if($x==0){ echo "(0,0)"; } else { $n=false; if($x<0) { $x=abs($x); $n=true; } for($i=2; $i<=$x; $i++) { if($x%$i==0){ if($n){ $factors[(count($factors))]=(-1*($x/$i)); $factors[(count($factors))]=($i); $factors[(count($factors))]=($x/$i); $factors[(count($factors))]=(-1*$i); } else { $factors[(count($factors))]=($x/$i); $factors[(count($factors))]=($i); } } } } } factor(-4); try this function factor(

php - Create a mysql trigger to insert data when a column updated -

create trigger `update_2` after update on `itm_master` each row begin if new.transfer_status='yes' insert activity_tbl (`evnt_date`,`con_type`,`username`,`item_serial`,`item_model`,`item_type`,`to_status`) values (now(),'update',new.user,new.item_serial,new.master_item_model,new.master_item_type,new.item_status); end if; end i'd create trigger insert data activity_tbl whenever transfer_status field updated in item_master table. use query receiving mysql error create trigger `update_2` after update on `itm_master` each row begin if new.transfer_status='yes' insert activity_tbl (`evnt_date`,`con_type`,`username`,`item_serial`,`item_model`,`item_type`,`to_status`) values (now(),'update',new.user,new.item_serial,new.master_item_model,new.master_item_type,new.item_status); mysql said: documentation 1064 - erreur de syntaxe près de '' à la ligne 7 i got work. out of creative

Pascal error: until expected else found -

fatal error while trying compile "until" expected found "else", cant seem how fix it ...... begin divisor:= 2; cont:= 0; write(i,':'); repeat if (i mod divisor = 0) begin write(' divisor '); divisor:=succ(divisor); cont:=succ(cont); end; else divisor:=succ(divisor); until (cont = 6) or (divisor>i div 2) writeln(); end; end; end. the issue have semicolon after end; before else . terminates if statement else becomes else repeat (which isn't valid). fix remove semicolon after end; see reference: http://wiki.freepascal.org/else fix: if (i mod divisor = 0) begin write(' divisor '); cont:=succ(cont); end else divisor:=succ(divisor);

r - How to create vector of multiple model objects through loop -

i have large data-set multiple target variables. currently, having issues in writing code/loop 1 of part of model i.e mod <- list(ah=ah,bn=bn). #detailed code follows: jk<- data.frame(y=runif(40), l=runif(40), m=runif(40), p=runif(40)) ah <- lm(l ~ p, jk) bn <- lm(m ~ y, jk) mod <- list(ah=ah,bn=bn) (i in names(mod)) { jk[[i]] <- predict(mod[[i]], jk) } problem if there 200 models cumbersome task write ah=ah, bn=bn 200 times. therefore, need loop run same use in below predict function. if concerned getting 'mod' in list , create objects within new environment , values using mget after listing objects ( ls() ) environment e1 <- new.env() e1$ah <- lm(l ~ p, jk) e1$bn <- lm(m ~ y, jk) mod <- mget(ls(envir=e1), envir = e1) mod #$ah #call: #lm(formula = l ~ p, data = jk) #coefficients: #(intercept) p # 0.4800 0.0145 #$bn #call: #lm(formula = m ~ y, data = jk) #coefficients: #(intercept)

javascript - How to Drag and Drop multiple table cells in same table? -

i want drag , drop multiple cells table, code referring limited single cell operations. want perform same operation multiple cells. code using below: table th,table td{ height: 30px; width: 200px; } table span{ display:block; background-color: #09c; height: 100%; width: 100%; } <table id="#our_table" border="1"> <tr> <th>head1</th> <th>head1</th> <th>head1</th> </tr> <tr> <td><span class="event" id="a" draggable="true">aaa</span></td> <td></td> <td></td> </tr> </table> $(document).ready(function(){ $('.event').on("dragstart", function (event) { var dt = event.originalevent.datatransfer; dt.setdata('text', $(this).attr('id')); }); $('table td').on("

How to convert String to ASCII using Scala -

i convert every single word decimal ascii. for example "resep" : r = 82, e = 69, s = 83, e = 69, p = 80 my code is: val list_keyword = list("resep", "daging sapi", "daging kambing") val rubah_byte = list_keyword.map(_.split(",")).map { baris => ( baris(0).getbytes ) } and then, stuck , don't know supposed next. scala> "resep".map(_.tobyte) res1: scala.collection.immutable.indexedseq[byte] = vector(82, 69, 83, 69, 80) scala> "resep".map(x => x -> x.tobyte) res2: scala.collection.immutable.indexedseq[(char, byte)] = vector((r,82), (e,69), (s,83), (e,69), (p,80)) scala> val list_keyword = list("resep", | "daging sapi", | "daging kambing") list_keyword: list[string] = list(resep, daging sapi, daging kambing) scala> list_keyword.map(_.map(_.tobyte)) res3: list[scala.collection.immutable.indexedseq[byte]] = list(v

Selecting nested record on PHP MySQL -

i have table in database sql below, , want display based on id , how many record (generation) +-------------------------------+ | id | parent_id | +-------------------------------+ | 1 | 0 | +-------------------------------+ | 2 | 1 | +-------------------------------+ | 3 | 1 | +-------------------------------+ | 4 | 2 | +-------------------------------+ | 5 | 2 | +-------------------------------+ | 6 | 2 | +-------------------------------+ | 7 | 2 | +-------------------------------+ | 8 | 3 | +-------------------------------+ | 9 | 5 | +-------------------------------+ | 10 | 7 | +-------------------------------+ | 11 | 10 | +-------------------------------+ | 12 | 10 | ...........

Reading Data from Serial Port RS232 in Visual Basic 2013 (Visual Studio .NET) -

we trying getting weight weighing machine. while reading in hyper-terminal in windows xp using com1 getting right values. reading data in visual basic 2013 (in windows 10 pro) on laptop using usb com port convertor cable getting different values x, ?, 3, &, etc. kindly suggest solution can right data through code. our code is: me.mvserialport .portname = "com11" ' shown in device manager .baudrate = 2400 .parity = parity.none .stopbits = stopbits.one .databits = 8 .handshake = handshake.none .dtrenable = true .rtsenable = true .newline = vbcrlf .readtimeout = 1000 .writetimeout = 1000 end 'function code private function readcom() string if me.mvthread_stop = true exit try try if me.mvserialport.isopen me.mvserialport.close()

linux - What does shell command ls [abc]*e*? search for? -

what files linux shell command ls [abc]*e*? going for? first, aware that, while many other commands use regular expressions , ls uses globs . let's break down glob [abc]*e*? matches: [abc] matches 1 character chosen set a, b ,or c. * matches number of character e matches e . * matches number of character. ? matches 1 character. for example, consider directory these files: $ ls a1w2e3z41 ae1 af1 de1 the matches among these glob are: $ ls [abc]*e*? a1w2e3z41 ae1

etl - how to read a csv file which have comma in between the values in Informatica or talend tools? -

i have input file have values "bengaluru","new,delhi","new,york" , want read data bengaluru,new delhi,new york : commas inside double quotes should not evaluated separator : "new,delhi" evaluated "new delhi" , not separated in 2 items ("new" , "delhi") in informatica can specify text qualifier double quotes in source definition. give expected values.

mysql - How to store Emoji Character in My SQL Database -

i using emoji character in project. characters saved (??) mysql database. had used database default collation in utf8mb4_general_ci . show 1366 incorrect string value: '\xf0\x9f\x98\x83\xf0\x9f...' column 'comment' @ row 1 1) database: change database default collation utf8mb4 . 2) table: change table collation character set utf8mb4 collate utf8mb4_bin . query: alter table tablename convert character set utf8mb4 collate utf8mb4_bin 3) code: insert tablename (column1, column2, column3, column4, column5, column6, column7) values ('273', '3', 'hdhdhdh😜😀😊😃hzhzhzzhjzj 我爱你 ❌', 49, 1, '2016-09-13 08:02:29', '2016-09-13 08:02:29') 4) set utf8mb4 in database connection: $database_connection = new mysqli($server, $user, $password, $database_name); $database_connection->set_charset('utf8mb4');

java - Convert String representation to minimal Number Object -

having string representation of number(no decimals), what's best way convert either 1 of java.lang.integer or java.lang.long or java.math.biginteger ? condition converted type should of minimal datatype required hold number. i've current implementation works fine, know if there's better code without exception handling. package com.stackoverflow.programmer; import java.math.biginteger; public class test { public static void main(string[] args) { string number = "-12121111111111111"; number numberobject = null; try { numberobject = integer.valueof(number); } catch (numberformatexception nfe) { system.out.println("number not fit integer type. trying long..."); try { numberobject = long.valueof(number); } catch (numberformatexception nfeb) { system.out.println("number not fit long type. trying biginteger...");

git - Possible Ways to refer a commit -

would find different ways can refer commit in git. please let me know different ways can refer commit in git? here ways git refer commit : 1) commits referred relative 1 another. instance head~1 refer commit parent of head. 2) refspecs can used refer commits reside on remote branches using local git environment. 3) every tags created in repository become ref, git maintain commits alias's. 4) git's commit hash can used refer corresponding commits.

android - How to change camera direction in osmdroid? -

i know if there way change camera direction perspective mapview? (z-axis) it looks this . there's few examples in sample app setting map rotation. here's code mmapview.setmaporientation(90f); and link source https://github.com/osmdroid/osmdroid/blob/master/osmdroid-android/src/main/java/org/osmdroid/views/mapview.java#l575

javascript - Opacity change icons on scrolls -

new user here. i'm having issue javascript command i've written in html. page set in 3 sections. sections represented 3 icons on fixed nav bar. i'm trying have other 2 icons opacity decrease depending on section scroll to. wrote if-else statement work , first section, when write new if-else statement next section next opacity change isn't recognized. my code: $(document).ready(function() { var nav = $(".work1"); var banner = $("#logobio"); var pos = nav.position(); var icon1 = $("#graphics"); var icon2 = $("#animations"); var icon3 = $("#handart"); var section1 = $("#ill4"); var section2 = $("#anides"); $(window).scroll(function(){ var windowpos = $(window).scrolltop(); if (windowpos>=banner.outerheight()){ nav.addclass('fixedtop'); } else { nav.removeclass('fixedtop');

how to provide a external (Serverside)search box to our Kendo UI grid? -

how provide external search box our kendo ui grid search in sever side? function onsearch() { var q = $("#txtsearchstring").val(); var grid = $("#kgrid").data("kendogrid"); grid.datasource.query({ page:1, pagesize:20, filter:{ logic:"or", filters:[ {field:"id", operator:"contains",value:q}, {field:"title", operator:"contains",value:q}, ] } }); } $("#btnsearch").kendobutton({ click:onsearch }) $("#kgrid").kendogrid({ datasource:{ type:"odata", transport:{ read:"contacttype/getcontacttypes" }, schema:{ data:function(data){ return data.d

How To Create CheckBox in Dropdownlist in asp.net with code pls no links -

Image
i want implement checkbox in dropdownlist using c# code , if possible want use checkbox in dropdownlist usercontrol please me guys. you can create multiple checkbox inside dropdown using jquery bootstrap multi-select plugin in order implement multiple select (multiselect) dropdownlist checkboxes in asp.net need make use of listbox control , apply jquery bootstrap multi-select plugin it. download bootstrap , jquery bootstrap multi-select plugin download locations follows. bootstrap http://getbootstrap.com/ jquery bootstrap multi-select plugin need download plugin files following location. https://github.com/davidstutz/bootstrap-multiselect/ complete documentation can read on following page. http://davidstutz.github.io/bootstrap-multiselect/ html markup - html markup consists of asp.net listbox , button control. <asp:listbox id="lstfruits" runat="server" selectionmode="multiple"> <asp:listitem text="mango" valu