Posts

Showing posts from January, 2011

website - what is the range of public ip address ipv4? -

i looping through ips on internet.i inserting ips in database. i have looped 0.0.0.0 255.255.255.255 as know of ips private. so want know range of public ip addresses on websites running. let me know if thinking wrong. thanks. private ip addresses are: 10.x.x.x and 172.16.x.x 172.31.x.x and 192.168.x.x also refer to: http://tools.ietf.org/html/rfc5735 everything else can public ip address. basically 2^32 - ranges above. quite lot. less 2^128 used ipv6 there other ip addresses cannot used. broadcasts , multicast , possibly other uses. don't forget not available public ip addresses may in use @ moment in time. in days of internet many not be.

android - pictures are in the same size in all the phones -

i got bitmaps in app (the resource images in different drawable folders) - , yet, on 5.5 inch screen , on friend 5 inch screen - bitmaps in same size. first of try these steps - refresh project dir ide. - clean project. - built again (rerun). if doesn't check bitmaps in right folders(ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi) according size or not. finally if there no result of above steps, should check dpi of both mobile phones. might case in both mobile phone lie in same dpi range, bitmaps pulled on screen of same size.

java - Android MediaRecorder Crashes -

updated: ok, after few days of testing , debugging... got work, not way want. the reason crashed because of "reorientation" of camera during lockscreen, apparently, crashes often. once forced use landscape mode, works. however, don't want use landscape mode; want work in portrait mode. the code taken directly android studio's sample (media -> mediarecorder). sample had code working in landscape mode, , can't figure how use portrait mode can avoid re-orientation , avoid crashes? there's nothing in onpause, onresume code , stacktrace pointed toward method being called. easy reproduce: 1) use android studio mediarecord sample app 2) in manifest, change, android:screenorientation="landscape"> portrait. 3) app won't launch now. i added mcamera.setdisplayorientation(90), same issue. code: @targetapi(build.version_codes.honeycomb) private boolean preparevideorecorder(){ // begin_include (configure_preview) mcamera ...

html - Positioned spans being clipped in Chrome -

Image
i'm trying position label above inline sections containing set of spans, i'm finding chrome appears clipping labels weirdly. take @ these 2 screenshots: in firefox: in chrome: if @ screenshot chrome, can see labels being clipped based on start point of next label. desired result same firefox screenshot, labels go way end of line. here code used these 2 examples: .section { position: relative; border-right: solid 1px #000; } .section-title { display: inline-block; position: absolute; top: -10px; left: 5px; right: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: sans-serif; font-size: 0.8em; } .pieces { font-family: monospace; } .pieces span { display: inline-block; padding: 10px 5px 0 5px; } <span class="section"> <span class="section-title">really long title long</span> <span class="pieces"> <span...

gruntjs - Yeoman webapp grunt file modification -

i try used yeoman webapp generator compass next project. in app folder structure follows. app |-scripts |-styles |---global |-----components |---layout |---pages |---themes so want build exact same structure after executing grunt build command. no need concatenate of minify css , js file. modified grundfile is: // generated on 2015-06-19 using // generator-webapp 0.5.1 'use strict'; // # globbing // performance reasons we're matching 1 level down: // 'test/spec/{,*/}*.js' // if want recursively match subfolders, use: // 'test/spec/**/*.js' module.exports = function (grunt) { // time how long tasks take. can when optimizing build times require('time-grunt')(grunt); // load grunt tasks automatically require('load-grunt-tasks')(grunt); // configurable paths var config = { app: 'app', dist: 'dist' }; // define configuration tasks grunt.initconfig({ // project settings config: config, ...

Numpy set range where less than -

def updatemap(depthmap, p1, p2, value): maps = depthmap[0:580,p1[0]:p2[0]] maps[maps < value] = value depthmap[0:580,p1[0]:p2[0]] = maps this current way it. requires make copy of range, set range value less than, copy back. copying make slow. there syntax can use? assuming depthmap numpy array, part: maps = depthmap[0:580,p1[0]:p2[0]] doesn't make copy. unlike lists , tuples, numpy slicing creates view of original array. thus, next line: maps[maps < value] = value modifies original depthmap array, , line after that: depthmap[0:580,p1[0]:p2[0]] = maps is superfluous. can remove it: def updatemap(depthmap, p1, p2, value): maps = depthmap[0:580,p1[0]:p2[0]] maps[maps < value] = value

Can I have a local php.ini for WordPress only? -

i have wordpress set on linux in directory: /var/www/html/myblog there 3 lines need add php.ini , when made these php.ini in directory works expected: /etc is there way can have php.ini in blog directory , have wordpress use values rather having change /etc/php.ini ? note did try creating 3 line php.ini changes need in /var/www/html/myblog did not seem recognize changes. seem recognize changes when add them end of php.ini in /etc you can take @ using php .user.ini files . following php documentation: .user.ini files since php 5.3.0, php includes support configuration ini files on per-directory basis. these files processed cgi/fastcgi sapi. functionality obsoletes pecl htscanner extension. if using apache, use .htaccess files same effect. in addition main php.ini file, php scans ini files in each directory, starting directory of requested php file, , working way current document root (as set in $_server['document_root']). in case php file...

python - Cleaner regex for removing characters before dot or slash -

is there cleaner regex following? know can search 2 different regex @ same time combining them | . i'm removing before first occurrence of . or - following regex , space after these. re.sub("^[^-]*- |^[^.]*. ", "", string) re.sub(r"^[^.-]*[.-]\s*","",some_string) you can try this.

c - I am getting error in this code as "invalid indirection" -

i trying dynamically allocate contiguous block of memory, store integer value , display it. #include<stdio.h> #include<conio.h> void main() { int i; int *ptr; ptr=(void *)malloc(sizeof(int)*5); //allocation of memory for(i=0;i<5;i++) { scanf("%d",&ptr[i]); } for(i=0;i<5;i++) { printf("%d",*ptr[i]); //error found here`` } } } ptr[i] means value @ address (ptr+i) *ptr[i] meaningless.you should remove * your corrected code should : #include<stdio.h> #include<stdlib.h> #include<conio.h> int main() { int i; int *ptr; ptr=malloc(sizeof(int)*5); //allocation of memory for(i=0;i<5;i++) { scanf("%d",&ptr[i]); } for(i=0;i<5;i++) { printf("%d",ptr[i]); //loose * } return 0; } //loose }

Merging Multiple Arrays Evenly/Alternating with Javascript and Google AppScript -

Image
i'm trying merge multiple arrays evenly/alternating in javascript/google appscript. there several arrays (5 or 6). i've tried 2 different methods, neither worked. don't work lot javascript , i've managed code point, can't merge properly; , of them said merging 2 arrays 1 (might problem). i've seen plenty on php examples on how , pretty straight forward in logic reading , understand them better, javascript methods i've looked @ , tried far have failed produce results want. i'm not sure if it's way appscript formatting arrays or they're no made handle more 2. my data looks similar @ moment: var title = ["sometitle1","sometitle2","sometitle3"]; var link = ["somelink1","somelink2","somelink3"]; var date = ["somedate1","somedate2","somedate3"]; var data = ["somedata1","somedata2","somedata3"]; var = [title,link,date,data]; ...

c# - given a Task instance, can I tell if ContinueWith has been called on it? -

given task instance, how can tell if continuewith has been called on it? want know if i'm last task executing in chain. task task = task.fromresult(); void somemethod(var x) { task = task.continuewith(previous => { if (task.continuewith called) return; // x... } } if meant multiple continuations. possible solution may this. class program { public class taskstate { public bool ended { get; set; } } static void main(string[] args) { var task = task.fromresult("stackoverflow"); var state = new taskstate(); task.continuewith((result, continuationstate) => { console.writeline("in first"); }, state).continuewith((result, continuationstate) => { if (!state.ended) console.writeline("in second"); state.ended = true; ...

javascript - How can I run multiple NPM scripts in parallel? -

in package.json have these 2 scripts: "scripts": { "start-watch": "nodemon run-babel index.js", "wp-server": "webpack-dev-server", } i have run these 2 scripts in parallel everytime start developing in node.js. first thing thought of adding third script this: "dev": "npm run start-watch && npm run wp-server" ... wait start-watch finish before running wp-server . how can run these in parallel? please keep in mind need see output of these commands. also, if solution involves build tool, i'd rather use gulp instead of grunt because use in project. use package called concurrently . npm concurrently --save-dev then setup npm run dev task so: "dev": "concurrently --kill-others \"npm run start-watch\" \"npm run wp-server\""

parallel processing - Spark - Add Worker from Local Machine (standalone spark cluster manager)? -

when running spark 1.4.0 in single machine, can add worker using command "./bin/spark-class org.apache.spark.deploy.worker.worker myhostname:7077". official documentation points out way adding "myhostname:7077" "conf/slaves" file followed executing command "sbin/start-all.sh" invoke master , workers listed in conf/slaves file. however, later method doesn't work me (with time-out error). can me this? here conf/slaves file (assume master url myhostname:700): myhostname:700 the conf.slaves file should list of hostnames, don't need include port # spark runs on (i think if try , ssh on port timeout comes from).

Rails token authentication and testing it -

i'm trying pass token rails , validate it, getting strange "render" error. additionally, i'm not sure how pass "authentication: token token=" header through rspec controller test. here's relevant code: /app/controllers/api_base_controller.rb # authentication method in i'm trying set @current_user class apibasecontroller < rocketpants::base private def authenticate_social ## line 7 of error below authenticate_or_request_with_http_token |token, options| @current_customer = customer.where(token: token).first end end end /app/controllers/api/v1/customers_controller.rb # simple method "expose" (rocketpants' way of respond_with) @current_customer above class api::v1::customerscontroller < apibasecontroller before_action :authenticate_social def fetch expose @current_customer end end /spec/controllers/api/v1/customers_controller_spec.rb rspe...

php - Query MySQL To Show Counting from the table relation -

i have 3 tables. 2 reference table , 1 table transactions. table puskesmas mysql> select id,nama puskesmas; +----+----------------------+ | id | nama | +----+----------------------+ | 1 | bambanglipuro | | 2 | banguntapan | | 3 | bantul | | 4 | dlingo | | 5 | imogiri | | 6 | jetis | | 7 | kasihan | | 8 | kretek | | 9 | pajangan | | 10 | pandak | +----+----------------------+ table poli mysql> select * poli; +----+---------------+ | id | nama | +----+---------------+ | 1 | bp | | 2 | kia | | 3 | gigi | | 4 | jiwa | +----+---------------+ table loket mysql> select pasien_id,poli_id,puskesmas_id loket limit 10; +-----------+---------+--------------+ | pasien_id | poli_id | puskesmas_id | +-----------+---------+--------------+ | 1 | 1 | ...

sql - Update a column in table only if a condition is met for number of values for a field in other table -

i trying figure out how achieve following. (this simplified version ignores/ stripped off non-relevant columns.) i have table item columns item_id product i have table order columns order_id product item_id here problem statement. for given item_id in item table, find orders have 1 distinct product associated in order table. mind you, one distinct product mean 1 or more rows unique combination of product , item_id . in case, need take product derived order table , update item table value. so if order table has values scenario i order table order_id product item_id 1 apple 12 2 apple 12 then need update product in item table "apple" scenario ii however, if order table has values order_id product item_id 1 apple 12 2 orange 12 nothing needs done. product in item table needs no update. (it null default.) . 1 time data fix. going forward relationship between order , item...

php - How to pass option when creating form -

i'm working on form , want pass form array content projects form have select of project option. i reed alot of answer, can't figure thing out. know i'm suppose like: $formulaire=$this->createform(new modifiersupprimerprojet(), null, $myarray); but, i'm suppose add content of array getdefaultoptions()... do that? other thing, suppose second parameters of createform method? here post that came closest solve probleme: accessing variable through $options in buildform() the best way populate select form element project entities use entity form field . don't have pass options form type class. $builder ->add('project', 'entity', [ 'label' => 'form.project', 'class' => 'appbundle\entity\project', 'property' => 'name', 'required' => true, 'empty_value' => 'form.select_empty_va...

Android with Groovy - where to place activity.java files that use Groovy classes -

Image
in android have mainactivity class located in standard java src folder. i'd mainactivity class access groovy class have created. groovy class in groovy folder created under main. inorder mainactivity utilize groovy class have make sure in same package. here issue, after move mainactivity.java file groovy folder under main project cant find launcher program anymore. check manifest , guessing wrong path. can tell me can place android activities such both manifest , groovy stuff can see them ? and here manifest if needed: <?xml version="1.0" encoding="utf-8"?> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="mainactivity" android:label="@string/app_name" > <intent-filter> <action android:na...

javascript - Number only input box with range restriction -

i know can use <input type="number"> restrict text box integer input. however, wondering if there possibility of range restricting well? limiting factor being without using javascript function check on every keyup . seems little heavy , unnecessary. think html5 have built in take care of edge-case, haven't been able find anything. for example, have input box deduplication ratio want restrict user inputting numbers (integer or float) between 3 , 7. i have option-select dropdown whole , half numbers, not provide level of detail i'm looking for. as mentioned in comments earlier... there isn't html here (you'd think there should be). but... since did include javascript , jquery in question, i'll propose simple , light solution. assuming html... <form> <input type="number" min="3" max="7" step="0.5"></input> </form> then can use script handle our requiremen...

encryption - MySQL AES_DECRYPT wrong/strange result -

under development machine wamp, aes_encrypt , aes_decrypt not working required, tested encode , decode , same happen... i'm not understading why... select aes_encrypt('text', sha1('my secret passphrase')) enc, aes_decrypt(aes_encrypt('text', sha1('my secret passphrase')), sha1('my secret passphrase')) denc result: enc : 3278167d9d630327c74d83067964c9b6 denc: 74657874 text after encryption doesn't , decryption wrong too. any suggestions? it working on side blob data seeing. denc: 74 65 78 74 74=t 65=e 78=x 74=t, add them 'text' ascii table here: http://www.asciitable.com/ try cast make more obvious: select cast(aes_encrypt('text', sha1('my secret passphrase')) char(100)) enc, cast(aes_decrypt(aes_encrypt('text', sha1('my secret passphrase')), sha1('my secret passphrase')) char(100)) denc

mysql - How to make the code continue the process if the file upload section is empty PHP MYSQLi -

i have problem 1 part of upload section, how make code continue process if upload section empty? make code, everytime skip file button, show echo 'error: ekstensi file tidak di izinkan!' here code: insert_form <form name="pegawai" action="insert-proses.php" method="post" enctype="multipart/form-data"> <table width="700px" align="left" cellpadding="2" cellspacing="0"> <tr> <td><b>nokom</b></td> <td><b>:</b></td> <td><input type="text" name="nokom" size="40" required /></td> </tr> <tr> <td><b>nip</b></td> <td><b>:</b></td> <td><input type="text" name="nip" size="40" required /></td> </tr> <tr> <td><b>nama</b></td> <td...

Meteor pagination: cursor fetch limit with getmore -

i have infinite scroll page i'm not using meteor templates draw items. reason belongs in whole other thread. i'm trying figure out how paginate data without fetching items @ once. have idea using limit on cursor, can't find real samples online of proper way this. should server call return cursor or find limited data set? if server doesn't return cursor itself, won't lose position when try fetch next set of results? also, want make sure retrieve data same cursor. if there 100 items , fetch 20, expect next 4 fetches 20-40, 40-60, 60-80, , 80-100. if in interim items got inserted or deleted, don't want mess fetches. handling reactivity separately , letting users decide when update items (which should reset cursor). help/advice appreciated! what this: var cursor = collection.find({},{limit:100+20*page}); the first {} selector! docs: http://docs.meteor.com/#/basic/mongo-collection-find you don't have worry returning values 100-120 , 1...

getting typescript to work with visual studio 2015 rc? -

trying code angularjs in typescript in vs 2015 rc after install web essential, there not side side typescript , javascript pane anymore after adding angularjs definite type nu-get package, can't intellisense 'angular' anything wrong? to intellisense 'angular' need include reference definitelytyped package in file: /// <reference path="angular.d.ts" />' check readme came package, or link further reading: https://github.com/borisyankov/definitelytyped/tree/master/angularjs

javascript - Extjs 5.1 Dynamic addition of container to panel -

what trying dynamically add container panel on click of button. 1st instance of container gets added , can seen in panel.items.length 2nd instance onwards panel.items.length doesn't change. panel can seen in dom , on screen. just wanted know why panel.items.length not increasing. bug? fiddler link https://fiddle.sencha.com/#fiddle/p3u check line : console.log(qitems); below debugger; set questionsblock.items.length talking about. remove itemid questiontemplate , remove renderto new instance. your click handler should this: listeners: { 'click': function(button) { var questionpanel = button.up('form').down('#questionsblock'), qitems = questionpanel.items.length, questiontemplate = ext.create('questiontemplate', { qid: qitems, questiontype: 'text' }); console.log(qitems); questionpanel.add(questiontemplate); questionpan...

hadoop - Storm-jms Spout collecting Avro messages and sending down stream? -

i new avro format. trying collect avro messages jms queue using storm-jms spout , send them hdfs using hdfs bolt. queue sending avro not able them in avro format using hdfs bolt. how collect avro message , send them downstream without encoding errors in hdfs. the existing hdfs bolt not support writing avro files need overcome making following changes. in sample code using getting jms messages spout , converting jms bytes message avro , emmiting them hdfs. this code can serve sample modifying methods in abstracthdfsbolt. public void execute(tuple tuple) { try { long length = bytesmessage.getbodylength(); byte[] bytes = new byte[(int)length]; /////////////////////////////////////// bytesmessage.readbytes(bytes); string replymessage = new string(bytes, "utf-8"); datumreader = new specificdatumreader<indexedrecord>(schema); decoder = dec...

c# - string.Replace() searching for string + ANY CHAR + string -

i'm searching giant .json file, , trying replace text. here exact situation i'm working with. string json = (a json file string of text) string result = null; result = json.replace("\"$id\":\"7\",\"questionnumber", "replacment text"); i want search whole json file , replace every occurance replacment text. however, want search whole file "\"$id\":\"7\",\"questionnumber" where, instead of number "7", can number. know need use regex i'm new regex , i'm not sure how go passing regex stuff string.replace parameters. also major caveat here, need add "7", whatever number happens per replacement, "replacement text" string. use regex.replace() . //using system.text.regularexpressions; regex regex = new regex("\"\\$id\":\"(\\d+)\",\"questionnumber"); string result = regex.replace(json, "replacement text $1...

javascript - AngularJS template reload and page disappears -

on website, if load template , refresh page, "page not found" error. there way prevent this? i can post code, i'm not quite sure piece of code valuable. here home page (where templates pulled in): <!doctype html> <html data-ng-app="mainapp"> <head > <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" type="image/x-icon" href="img/computer.ico" /> <title>erica peharda</title> <!--angular uses base element path use when gets front end resource- root b/c of "/"--> <base href='/'> </head> <body> <div class='container1'> <div class='page-header'> <nav class="navbar navbar-default"> <div class="container"> ...

javascript - jQuery get a change of div height after load -

when scroll, need #sidebar fixed between header , footer, have code works works well. the problem when in #content there div display:none showed activating radio buttons, in case #content height change, code followed doesn't change. $(document).ready(function () { var length = $('#content').height() - $('#sidebar').height() + $('#content').offset().top; $(window).scroll(function () { var scroller = $(this).scrolltop(); var height = $('#sidebar').height() + 'px'; if (scroller < $('#content').offset().top) { $('#sidebar').css({ 'position': 'absolute', 'top': '0' }); } else if (scroller > length) { $('#sidebar').css({ 'position': 'absolute', 'bottom': '0', 'top': ...

c++ - Compiler throws an exception when trying to compile code containing binary ifstream -

i running problem accessing binary file via input file stream class (ifstream). my approach starts following calling function: void readfile(vector<string>& argv, ostream& oss){ string filename = argv.at(2) + "input" ; ifstream binfile ; openbinaryfile(filename, binfile) ; return ; } the called function looks this: void openbinaryfile(string& filename, ifstream& binfile){ using namespace std ; binfile(filename.c_str(),ifstream::binary | ifstream::in) ; } when try compile simple scheme using gcc version 4.9.2 following error: error: no match call ‘(std::ifstream {aka std::basic_ifstream<char>}) (const char*, std::_ios_openmode)’ binfile(filename.c_str(),ifstream::binary | ifstream::in) ; ^ i've tried caret ("^") placed compiler did. what's going on here? baffled. thanks! there 2 ways of opening stream. during construction, ...

python 3.x - Python3.x - counting occurences of all substrings using dictionaries -

given string s, code count number of occurrences of possible substrings of string s. #count[i]=no of different substrings in string occurs times count=[0]*(100001) a=input() dic={} n=len(a) in range(n): temp="" j in range(i,n,1): temp+=a[j] if temp in dic: dic[temp]+=1 else: dic[temp]=1 k,v in dic.items(): count[v]+=1 for example, string "ababa", array be: cnt[1]=4 {"ababa", "abab", "baba", "bab"} occur once cnt[2]=4 {"aba", "ab", "ba", "b"} occur twice cnt[3]=1 {"a"} occur thrice cnt[4]=0 cnt[5]=0 i interested in knowing runtime of code there 2 parts of code consider separately: the nested loop build `dic`. the loop build `count`. for 1. there 2 loops consider. loop run n times , j loop run n-i times each time. this means j loop run n times first time, n-1 times second time , o...

php - Jquery variable returns null -

i working on wordpress shop right , trying implement currency converter. in cart table dropdown list of available currencies. when clicked price should show in currency. simple enough... here part of php list: <section class="currency-converter-form" style="display:none;"> <p class="form-row form-row-wide" id="convert_to_field"> <select name="currency" id="currency" class="currency_to" rel="convert_currency_to" > <option value="gbp" >gbp - british pound sterling</option> <option value="usd" >usd - dollar</option> <option value="aud" >aud - australian dollar</option> <option value="cad" >cad - canadian dollar</option> <option value="jpy" >jpy - japanese yen</option> <option value=...

Kendo serverPaging using javascript and web API -

i have been having issues getting serverpaging option work on kendogrid. have searched several hours , can't seem work way expect to. here have: api call: [httpget] [route("getitemsbypage", name = "getitemsbypage"] public ienumerable<iitem> getbypage(int id, int page, int pagesize) { return foo.getbypage(id, page, pagesize); } js: var shareddatasource = new kendo.data.datasource({ transport: { read: { url: "localhost:2222/api/product/items/getbypage/?id=38&page=1&pagesize=100" datatype: "json" } }, schema: { total: // function return total // // rest of schema info // }, page: 1, pagesize: 100, serverpaging: true }); i have datasource attached grid div (all shows fine). server paging have issue with. can use api call items, , allow local paging, dont want data @ once. you should setup transport.parametermap option on da...

sql server - self joining sql without aggregation -

i have table below structure: id employeetype name 1 contract john, baxter 2 contract will, smith 3 full josh, stevens 4 full sitar, zhang all need pivot below output: contract_employee fulltime_employee john, baxter josh, stevens will,smith sitar, zhang any idea how can in 1 query? that's kind of funny request. here's how it: (basically, deriving fake key "join" on 2 derived tables, on contractors, 1 employees) create table #table1 ([id] int, [employeetype] varchar(8), [name] varchar(13)) ; insert #table1 ([id], [employeetype], [name]) values (1, 'contract', 'john, baxter'), (2, 'contract', 'will, smith'), (3, 'full', 'josh, stevens'), (4, 'full', 'sitar, zhang'), (5, 'full','bob, bob'), ...

c++ - Reuse istream_iterator variable -

i using 2 iterators read text file vector : std::ifstream input_file("~/blahblah.txt"); std::istream_iterator<float> start(input_file),end; std::vector<float> testframefloat(start,end); input_file.close();input_file.clear(); and then, use same ifstream read text file. possible reuse same istream_iterators instead of creating new ones? getting compilation errors if try so: input_file.open("~/anothertext.txt"); start(input_file); //this compilation error std::vector<float> readvalues(start,end);

regex - Count Unique Occurrences In Text String In R -

this question has answer here: finding indexes of multiple/overlapping matching substrings 1 answer i using r , have dataframe containing strings of 4 unique letters (dna). interested in counting times unique combinations of letters occur in these strings. 1 of possible scenarios detect how many times see same letter back. i have come across several possible ways achieve using regex , packages stringr still have 1 problem. these methods not seem iterate through substring (letter letter) , consider next letter in line count observance. problem same letter repeated more 2x. example (where want count times "cc" occurs , true_count column desired output): sequence stringr_count true_count acctacgt 1 1 cccccccc 4 7 acccgcct 2 3 i recommend using stringi::stri_count_fixed follows: > libr...

jboss7.x - JBoss out of memory error -

i tried terminate current jboss session using control + c on command line. now when try start server, error: transport error 202: bind failed: address in use error: jdwp transport dt_socket failed initialize, transport_init(510) jdwp exit error agent_error_transport_init(197): no transports initialized [../../../src/share/back/debuginit.c:750] fatal error in native method: jdwp no transports initialized, jvmtierror=agent_error_transport_init(197) control-c didn't terminate previous process cleanly. if you're running on windows use task manager find old jboss process , kill it. process listed java.exe or javaw.exe if linux use ps -ef | grep standalone.sh find process id , kill it.

reflection - Typescript looping trough class type properties -

how can 1 loop through properties of class in typescript? take following class example: export class task implements itask { id : number = 0; name: string; description: string; completed: boolean = false; tasktype: tasktype; } im want retrieve properties, hence: ["id", name", "description", "completed", "tasktype"] tried gettaskheaders = () => { var _self = this; var thead = $('<thead />').append('<tr />'); for(var i=0; typeof todoapp.task.arguments; i++){ var th = $('<th />'); th.append(todoapp.task.arguments[i]); thead.append(th); } console.log(thead); return thead; } unfortunately without success, know using "todoapp.task.arguments" incorrect. however, can show me right way please? let's consider "not defined" pro...

mongodb shell is written in JavaScript. Why UNIX binary then? -

is true, mongodb shell written in javascript? if yes why it's unix binary? not webapp browser? > less /usr/local/bin/mongo "/usr/local/bin/mongo" may binary file. see anyway? > file /usr/local/bin/mongo /usr/local/bin/mongo: mach-o 64-bit executable x86_64 the mongo shell, mongod database process implemented in c++. can source code , build here: https://github.com/mongodb/mongo

Mysql Producing changes/tuning ONLY in a Master -

is possible tune mysql slave server without applying same changes on master? example innodb buffer running? enabling multi-threading? thanks! the answer yes. normal practise when upgrading mysql databases. upgrade slave , promote master, work on old master..(for example)

html - Remove indent on ul tag inside a td -

basically, trying align bullets in same line above td tag content inside table.but ul tag default adds indent. i tried adding margin:0, padding:0, removes bullets together.i want align sentences in same line out removing bullets. basically in below jsfiddle example : heading2 column should aligned right, meaning content , bullets should start same point html : <table class='table_css'> <th>heading1</th> <th>heading2</th> <tr><td>row1</td><td>content in row 1</td></tr> <tr> <td>some heading</td> <td> <ul> <li>some text long</li> <li>some text long text long</li> <li>some text long text long text long</li> </ul> </td> </tr> </table> css: ul{ margin:0; } .table_css{ border:1px solid;border-collapse: collapse;table-layout:fixed; } jsfid...

php - How can we display dynamic grid layout like the attached screenshot also order by number with the help of bootstrap -

Image
i want make layout attached image.blocks render on page in same order number. for example :- block(1) show first after block (2) , on... ah! 1 below works perfectly. check bootply did . <div class="col-sm-3"> <div class="col-sm-12">1</div> <div class="col-sm-12">5</div> </div> <div class="col-sm-3"> <div class="col-sm-12">2</div> <div class="col-sm-12">6</div> </div> <div class="col-sm-3"> <div class="col-sm-12">3</div> <div class="col-sm-12">7</div> </div> <div class="col-sm-3"> <div class="col-sm-12">4</div> <div class="col-sm-12">8</div> </div> i know want push , pull once want rearrange order of div in small screen link push , pull answered on stack overflow .

javascript - Store data from image in a cookie -

i trying store image in cookie, don't know if best way keep registers user when refreshes page. well, using ngcookies module that. received image server in base64 string format, contenttype , data , store in cookies: $cookies.contenttype = value.image.contenttype; $cookies.data = value.image.data; to make url this: vm.url = "data:"+vm.value.image.contenttype+";base64,"+vm.value.image.data; and url insert in page, using img html: <img src={{ctrl.url}} style="width:200px;height:200px"> my problem is: when refreshed page, $cookies.contenttype remains, value.data doesn't stay stored in $cookies.data anymore. think value big store in cookie. using cookies correctly? there other way that? i appreciate if can me. using cookies client side storage considered less ideal . cookies automatically sent every request (if matches domain/path/security restrictions). if cookie storage limit handle can't imagine want sen...

swift - Adding integers from a dictionary together -

looking add integers dictionary. example: var dictionary = ["one": 1, "two": 2, "three": 3, "four": 4, "five": 5] i want sum of 1+2+3+4+5 = 15 i understand need loop like (n, i) in dictionary { *some math function* } any appreciated maybe i'm on thinking one? you can use reduce:combine: sum. with swift 2.0, reduce:combine: added protocol extension of sequencetype. so, available sequencetype array, set or dictionary. dictionary.reduce(0) { sum, item in return sum + item.1 } item inside closure tuple representing each (key, value) pair. so, item.0 key item.1 value.the initial value of sum 0, , each time iteration takes place, sum added value extracted dictionary. you write in short as, dictionary.reduce(0) { return $0 + $1.1 } while older version of swift, has reduce method array only. so, first array , apply reduce:combine sum as, let = dictionary.values.array.reduce(0) { return...

Keeping Socket.IO connection alive after Android Crosswalk Embedded Webview onStop -

i have crosswalk embedded webview implementing socket.io , when activity stopped connection dropped after 20 seconds. how can keep connection alive? crosswalk v12.41.296.9 socket.io v1.3.5 android sdk v22 if want keep connection alive have keep socket.io connection alive. socket.io connection keep alive have use service (not activity). service carry socket.io connection. when activity start service start, service run background of application , when activity stop service not stop, until tell him stop. can more knowledge service here .

ios - Add view to a cell in a Table View Programatically -

Image
i have table view dynamic prototypes displaying 4 elements programmatically. assign cell names through array (see code below), want add small view right half of each cell in order show small graph next each label. can drop in view in storyboard, doesn't extend dynamically. need find way modify code add view inside of each cell , assign class have created views. override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("linecell", forindexpath: indexpath) as! uitableviewcell cell.textlabel?.text = oneline.linenames[indexpath.row] return cell } this want views: also, how can make more space between carrier, time, , battery , table view? you can create view want , add subview of cell's contentview: var newview = uiview(frame: cgrectmake(200, 10, 100, 50)) cell.contentview.addsubview(newview)