Posts

Showing posts from May, 2011

dependency injection - angular 4 ngModule inject provider/services conditionally -

in app.module.ts @ngmodule({ ... providers: [myservice, // providers used create fake backend fakebackendprovider, mockbackend, baserequestoptions ], bootstrap: [appcomponent] }) fakebackendprovider, mockbackend , baserequestoptions mock end. there way inject these services variable in environment.ts file? you can use this. created plunker //route environment file import { environment } '../../environments/environment'; providers: [myservice, // providers used create fake backend { provide: someserivce, usefactory: authheadersfactory }, ], export function authheadersfactory() { if (environment.prod) { return new mock(); } return new fakebackend(); }

Cannot enter something in Database MYSQL PHP -

i'm trying put information automatically in database works first time. if reload page doesn't put in again. this code: <?php require '../overig/connect.php'; require '../overig/secure.php'; $userr = $_session['email']; $user = md5($userr); $friend2 = $_server['request_uri']; $friend = substr($friend2, 6, 25); $q = 1; $a = 0; if((isset($user)) || isset($friend)) { $add = "insert `friends` (p1,p2,q,a) values ('$user','$friend','$q','$a')"; $result = mysqli_query($con, $add); } else { echo 'hello'; } ?> i hope can me :) lets convert this: "insert friends (p1,p2,q,a) values ('$user','$friend','$q','$a')";" into generated sql , this: insert friends (p1,p2,q,a) values ('john','jim','this','that'); what happen if tried run twice? suspect see 1 row this: |john|jim |this|that

javascript - getElementById is not a function on an HTMLElement -

this question has answer here: why getelementbyid not work on elements inside document element? [duplicate] 1 answer “getelementbyid not function” when trying parse ajax response? 3 answers document.body.getelementbyid not function 3 answers i trying parse data using javascript dom. for debugging have been using var prod = prodheader.parentelement.innerhtml; . this results in: <img src="/content/images/pdf.png" style="width:30px;height:30px;" onclick="getpdf(this);"><label id="currentpd" style="display:none">pd-14-0012</label><label id="currentpl" style="display:none">1</label> whi

javascript - Why is the title not being set properly after the instance variable has been created? -

i trying setup basic example can expand upon main program. question here why title not equal "heybark"? made book part of booktitles class shouldn't title being set automatically add bark? after done need reference capitalization method created in original assignment. idea once book title set in snippet below, pass value method , set equal return result. how access title modified since setter method take in entire object? class booktitle { constructor(title){ this.title = title + "bark"; } // in comments part of second paragraph in // question, psuedo code // getter object here access title // use setter call capitalization method capitalize // words in title // title creator method returns modified value, called in setter // cap method purely caps correct words, called within // title creator } var book = new booktitle(); console.log(book); //title undefinedbark expected book.title = "hey"; console.log(book); // returns hey, not h

java - how to show data from firebase into a textview -

hi i'm new @ programming , want show data firebase database textview. have written code doesn't work. hope can me thank you this code public void gotoanotheractivity19(view view) { firebaseuser user = firebaseauth.getinstance().getcurrentuser(); assert user != null; final string log_uid = user.getuid(); final string eintrag = eintragtagebuch.gettext().tostring().trim(); intent intent = new intent(this, tagebuch.class); firebasedatabase database = firebasedatabase.getinstance(); databasereference myref = database.getreference("user" + log_uid); myref.child("tagebuch").push().setvalue("ihr eintrag: " + eintrag ); startactivity(intent); eingabeausgeben(); } public void eingabeausgeben() { tagebuchtext = (textview) findviewbyid(r.id.tagebuch_text2); databasereference rootref = firebasedatabase.getinstance().getreference(); firebaseuser user = firebaseauth.getinstance().ge

symfony - Cannot acces jQuery from Webpack Encore build file -

i developping website using symfony, , (simplified) version of webpack : webpack encore. my website using 1 javascript file, template.js , uses jquery , begins classic $(document).ready(function(){ ... })(jquery); i prefer load jquery cdn, , doing. if load js/template.js script html file without using webpack, works fine. but, if tell webpack compile , output js/template.js file content build/app.js , include in html file, happens : uncaught typeerror: $ not function @ template.js:12 @ object.<anonymous> (template.js:11) @ object../assets/js/template.js (app.js:1898) @ __webpack_require__ (bootstrap 405ca97655117f294089:19) @ object.0 (jquery.js:10253) @ __webpack_require__ (bootstrap 405ca97655117f294089:19) @ bootstrap 405ca97655117f294089:62 @ bootstrap 405ca97655117f294089:62 note: think webpack finds way tell browser console actual code provides js/template.js , don't worry using build/app.js . so problem now, code ca

java.util.scanner - java scanner output strange if else logic errors -

hey people greetings m new coder wanted know problem in code kindly tell logic unable print else statement there after when entering age high 20 output still same of if statement code import java.util.*; public class shivam { int age; void function() { if (age<=10) { system.out.println("chutiye chota h tu"); } else { system.out.println("bada ho gya saale"); } } public static void main(string[] args) { scanner sc= new scanner(system.in); int age=sc.nextint(); shivam s1=new shivam(); s1.function(); sc.close(); } } the reason create instance of custom class function() method. shivam s1=new shivam(); the int age; sets value of age default primitive i.e 0 . now when call s1.function(); the condition if (age<=10) //evaluates true now, fix should accept age parameter function() instead of bei

laravel - React JS Fetch Returns Empty Response but Postman Does Not -

Image
i have react js application trying log in token-based api (that developing, using laravel 5.5 , laravel passport). i'm trying implement basic login (login using username , password, receive token server once verified, use token future queries). the code i'm using fetch below: function loginapi(username, password) { return fetch(loginurl, { method: 'post', headers: { 'content-type': 'application/json', }, body: json.stringify({ grant_type: 'password', client_id: clientid, client_secret: clientsecret, username: username, password: password }) }).then(handleapierrors) .then(response => response.json) } it's worth noting it's not entirely complete, i'm trying determine response i'm getting back. i've solved normal issues 1 encounters, cors problems, issue i'm encountering response api jus

How does the JavaScript Import work under the hood? -

how import statement work in javascript? read documentation , says places exported code within scope of file. mean code copied on file type import? for example - in library.js have: export {export function getusefulcontents(url, callback) { getjson(url, data => callback(json.parse(data))); } in main.js have: import { getusefulcontents} 'library.js'; getusefulcontents('http://www.example.com', data => { dosomethinguseful(data); }); this allows me call getusefulcontents() in main.js. question is, main.js have contents exported library.js? is using import same having physically defined getusefulcontents() in main.js? function getusefulcontents(url, callback) { getjson(url, data => callback(json.parse(data))); } getusefulcontents('http://www.example.com', data => { dosomethinguseful(data); }); the main reason why ask because want know if using import have effect on main.js file size? or else going on under hoo

php - Laravel Dependency Injection and bindings -

can please clear air me! why need implement interface repository class , bind them in service provider?? what's use of interface if binded specific class?? , if so, why can't inject repository in controller? last thing, dependency anyway? thanks. the service provider binds service/repository application. should bind either interface (which can used property type dependency injection) or alias (such 'foo.bar'). the disadvantage of using alias dependency must class itself, singleton kept within application. advantage of using contract (interface) that, following ioc pattern, can have registered repository implementing given interface, allowing changes in vendor code, such if change main storage repository replacing service provider, injection still work if singleton registered main interface. so if intend use vendor (or own code) replace laravel core feature, dependencies injection wil still work, providing vendor repository implements same contract la

javascript - jquery how to hide-sidebar and remove class when clicked somewhere on the page -

ihave jquery code works show offcanvas sidebar , makes page opacity lower toggling class acive main-wrapper class. code $(document).ready(function () { $('.nav-icon').on('click', function(){ $('.offcanvas').toggleclass('is-open'); $('.main-wrapper').toggleclass('active'); }); // end of on click }); // end of ready what want how remove 2 toggled classes when clicked on page except .nav-icon class. , html code. <div id="wrapper" class="main-wrapper"> <div class="off-canvas-wrapper"> <div id="offcanvasleft" class="offcanvas" aria-hidden="true"> <ul class="nav menus flex-column"> <li class="nav-item"> <a class="nav-link active" href="#">artists</a> </li> <li class=

php - WordPress Settings field: Saving multiple <select> options -

in wordpress options page have settings field has html select attribute of multiple . select 's options dynamically populated custom post types, fine there. can save 1 value array, not more. current var_dump : array(1) { ["awc_cpt"]=> string(12) "board_member" } ideally i'd array return: array( "board_member" => "board_member", "another_cpt" => "another_cpt", // , on many custom post types needed ) i beginner @ php, may missing fundamentals. question: how save multiple selected options array wordpress setting? <?php class awc_redirect { private $awc_redirect_options; public $non_archived_posts = array(); public function __construct() { if( is_admin() ){ add_action( 'admin_menu', array( $this, 'awc_redirect_add_plugin_page' ) ); add_action( 'admin_init', array( $this, 'awc_redirect_page_init' ) );

Swift OSX NSOpenPanel not changing selection -

i calling nsopenpanel user can select file, after first selection done panel doesn't allow me change file when click mouse on file. changes when use keyboard arrows doesn't when click mouse. @ibaction func selecionarimagembuttonclicked(_ sender: nsbutton) { let panel = nsopenpanel() panel.allowsmultipleselection = false panel.canchoosedirectories = false panel.canchoosefiles = true panel.cancreatedirectories = false //panel.allowedfiletypes = ["jpg","png","pct","bmp", "tiff"] panel.allowedfiletypes = nsimage.imagetypes() panel.beginsheetmodal(for: view.window!) { (result) in if result == nsfilehandlingpanelokbutton { self.logofornecedorimageview.image = nsimage(byreferencing: panel.url!) self.logofornecedorselecionada = true } } }

c - Segmentation fault: 11 (caused by strncpy()) -

here code. struggling @ why strncpy() cant copy string struct , since works in previous assignment. also, have second question: suppose have struct contains struct, how assign value inside struct: struct _field { char fieldname[50]; char fieldtype[50]; int fieldlength; }; struct _table { char *tablefilename; int reclen; int fieldcount; struct _field fields[100]; }; typedef enum { false, true } bool; bool loadschema(struct _table *table) { printf("%s\n", "*** log: loading table fields..."); file *fp = null; char lines[1000]; char s[2] = " "; fp = fopen("in.txt", "r+"); while (fgets(lines, sizeof(lines), fp) != null) { char *token; token = strtok(lines, s); if (token != null) { if (strcmp(token, "createtable") == 0) { token = strtok(null, s); if (token != null) { token[strlen(

How to redirect https requests with nginx? -

i have locally running script. send request local nginx, proxying remote server api, use way limit requests per second. server requires https requests. send https script, how can deal https inside nginx? how configure it? in need generate new ssl keys?

amazon web services - Detect Country of IP address using AWS EC2 and cloudFront only on certain pages -

i using aws ec2 server website. content of website dynamic , of visitors coming specific number of countries. i'm trying detect country of website visitors through ip addresses. needs performed when visitors reach specific page on website ( https://example.com/abc ). i know aws cloudfront offers need through cloudfront-viewer-country header. however, not intend serve whole website behind cloundfront. think problem solved if there way serve single page ( https://example.com/abc ) through cloudfront. possible achieve ? if so, how ? what other options have ? you can have pixel image of cloudfront endpoint on domain pages. everytime user visits, referred pixel called http referrer. (tells page being called) https://skillcrush.com/2012/07/19/tracking-pixel/ alternatively can add analytics tools google analytics capture lot more information visitors.

c# - How to access TempData in my own utility class? Or TempData is null in constructor -

i use tempdata in of views/actions i'd extract class. problem if try create class in controller's constructor, tempdate there null. better yet, i'd have class injectable controller. need access tempdata when class created. so how can tempdata constructed in separate class? this asp.net core 2.0 web app. you can access temp data anywhere injecting itempdatadictionaryfactory need it. can call gettempdata returns itempdatadictionary can use access (read or write) temp data current http context: public class exampleservice { private readonly ihttpcontextaccessor _httpcontextaccessor; private readonly itempdatadictionaryfactory _tempdatadirectionaryfactory; public exampleservice(ihttpcontextaccessor httpcontextaccessor, itempdatadictionaryfactory tempdatadictionaryfactory) { _httpcontextaccessor = httpcontextaccessor; _tempdatadictionaryfactory = tempdatadictionaryfactory; } public void dosomething() {

c++ - Why my D3D9 Font is poor quality -

Image
i have question. i'm trying draw on screen directx 9, reason all fonts (which use rounded edges) try use in poor quality, includes fonts downloaded internet, not know if i'm doing wrong, or if i'm paranoid it. images: with 500x zoom: my create font code: d3dxcreatefont(pdevice, 30, 0, fw_bold, 1, 0, default_charset, out_default_precis, default_quality, default_pitch | ff_dontcare, "roboto", &pfont); i've tried many things, like: fw_bold fw_semibold default_quality antialiased_quality but nothing has shown result. my drawstring function: void d3d9draw::string(int x, int y, dword flag, int fontid, d3dcolor color, std::string string, ...) { char buffer[256]; va_list args; va_start(args, string); vsprintf_s(buffer, string.c_str(), args); va_end(args); if (fontid >= (int)m_font.size()) fontid = 0; rect rect = { x, y, x, y }; m_font[fontid]->drawtext(null, buffer, -1, &rect, flag | dt_

What's wrong with this JavaScript Code (Arrays)? -

below code snippet finds out "how many times each element of array repeated". working expected except doesn't give me "ebay repetition count" var strarr = ["google","ebay","yahoo","google","ebay","facebook","facebook","google"]; var output= {}; strarr.foreach(function(element) { var count = 0; try{ while(strarr.indexof(element) !== -1){ strarr.splice(strarr.indexof(element),1); count++; } }catch(e){ console.log(e); } output[element] = count; }); console.log(output); i tried debugging debugger; , figured out second element of array being skipped. expected output: google:3 ebay:2 yahoo:1 facebook:2 actual output: google:3 yahoo:1 facebook:2 foreach take google index 0: you removed google list including zero foreach moves index 1 has yahoo ebay moved index 0 sorry bad english

google chrome extension - Injecting javascript variable before content script -

using background script background.js, need inject dynamic variable content script before injecting file inject.js content script. inject.js need have access variable , run it's code before scripts on page run. having difficulties accessing dynamic variable inject.js content script. manifest.json { "name": "shape shifter", "version": "1.0", "description": "anti browser fingerprinting web extension. generates randomised values http request headers, javascript property values , javascript method return types.", "manifest_version": 2, "icons": { "32": "icons/person-32.png", "48": "icons/person-48.png" }, "background": { "persistent": true, "scripts": ["js/ua.js", "js/words.js", "js/lib/seedrandom.min.js", "js/random.js", "js/background.js"] }, "browser_action&

python - Printing all tf.Tensors of a model in a loop -

i have list of tensors in model had float32 type: import os import os.path import tensorflow tf tensorflow.python.platform import gfile import numpy numpy.set_printoptions(threshold=numpy.nan) tf.session() sess: model_filename = 'my_pb_file.pb' gfile.fastgfile(model_filename, 'rb') f: graph_def = tf.graphdef() graph_def.parsefromstring(f.read()) _= tf.import_graph_def(graph_def,name='') pprint import pprint pprint([out op in tf.get_default_graph().get_operations() if op.type != 'placeholder' out in op.values() if out.dtype == tf.float32]) which gives me list: <tf.tensor 'mobilenetv1/mobilenetv1/conv2d_1_pointwise/batchnorm/batchnorm/add:0' shape=(16,) dtype=float32>, <tf.tensor 'mobilenetv1/mobilenetv1/conv2d_1_pointwise/batchnorm/batchnorm/rsqrt:0' shape=(16,) dtype=float32>, &

How to get the name from a nixpkgs derivation in a nix expression to be used by nix-shell? -

i'm writing .nix expression used nix-shell . i'm not sure how that. note not on nixos, don't think relevant. the particular example i'm looking @ want this version-dependent name looks like: idea-ultimate = buildidea rec { name = "idea-ultimate-${version}"; version = "2017.2.2"; /* updated script */ description = "integrated development environment (ide) jetbrains, requires paid license"; license = stdenv.lib.licenses.unfree; src = fetchurl { url = "https://download.jetbrains.com/idea/ideaiu-${version}-no-jdk.tar.gz"; sha256 = "b8eb9d612800cc896eb6b6fbefbf9f49d92d2350ae1c3c4598e5e12bf93be401"; /* updated script */ }; wmclass = "jetbrains-idea"; update-channel = "idea_release"; }; my nix expression following: let pkgs = import <nixpkgs> {}; stdenv = pkgs.stdenv; # idea_name = assert pkgs.jetbrains.idea-ultimate.name != ""

git - ssh-add will not accept passphrase -

i attempting setup ssh connection github on windows 10 latest version of git windows. have created ssh key , added github on website. issue following commands in git-bash: eval `ssh-agent` ssh-add /c/users/someone/ssh/id_rsa ssh-add prompts me passphrase rejects every attempt enter it, either typing or pasting it. there limitations on special characters can used passphrase, or else problem? according ssh-keygen man page (emphasis mine) the passphrase may empty indicate no passphrase (host keys must have empty passphrase), or may string of arbitrary length. passphrase similar password, except can phrase series of words, punctuation, numbers, whitespace, or any string of characters want . passphrases 10-30 characters long, not simple sentences or otherwise guessable (english prose has 1-2 bits of entropy per character, , provides bad passphrases), , contain mix of upper , lowercase letters, numbers, , non-alphanumeric characters. that being sa

apache - Auto reloading python Flask app upon code changes -

i'm investigating how develop decent web app python. since don't want high-order structures in way, choice fell on lightweight flask framework . time tell if right choice. so, i've set apache server mod_wsgi, , test site running fine. however, i'd speed development routine making site automatically reload upon changes in py or template files make. see changes in site's .wsgi file causes reloading (even without wsgiscriptreloading on in apache config file), still have prod manually (ie, insert linebreak, save). there way how cause reload when edit of app's py files? or, expected use ide refreshes .wsgi file me? the current recommended way (flask >= 0.11) flask command line utility. http://flask.pocoo.org/docs/0.11/server/ example: $ export flask_app=main.py $ export flask_debug=1 $ python -m flask run or in 1 command: $ flask_app=main.py flask_debug=1 python -m flask run i prefer python -m flask run rather flask run because former

amazon web services - How can I deploy a new cloudfront s3 version without a small period of unavailability? -

i utilizing aws cloudfront s3 origin. i'm using webpack plugin cache-bust using chunked hash file names of static files excluding index.html, invalidate using cloudfront feature upon each new release. i plan on using jenkins build run aws s3 sync ./dist s3://bucket-name/dist --recursive --delete swap out new chunked files necessary. overwrite index.html file use new chunked reference. during few seconds (max) takes swap out old files new, possible user make request website region in cloudfront has not cached resources, @ point they'll unavailable because have deleted them. i not find information avoiding edge case. yes, can happen person near different edge location experience missing files. solve this, need change approach of doing new deployments since cache busting , time unpredictable @ request-response level. 1 commonly used pattern keep different directories(paths) each new deployment in s3 follows. for release v1.0 /dist/v1.0/js/* /dist/v1.0/c

javascript - how can we embed google maps in our website and add our own locations? -

i not wish add map site add local locations on own tke map site 1 here . google describes need here: https://developers.google.com/maps/ look @ google maps javascript api various ways add own content embedded map. google calls custom locations 'markers' so, page describes those. https://developers.google.com/maps/documentation/javascript/ to add own custom markers (with custom icons , such), follow guide. https://developers.google.com/maps/documentation/javascript/custom-markers

python - Django - Sending email works in shell, but not on localhost - ConnectionRefusedError -

i'm new django, have read on order of 50 pages (mostly , django documentation) , haven't found quite works situation. i'm merely trying send email via send_mail function in django; although i'm hoping working through smtp on gmail, right doesn't work via localhost. when run test_email.py file i'm testing send_mail function, following error: connectionrefusederror : [winerror 10061] no connection made because target machine actively refused it when run same send_mail call in shell (via python manage.py shell), it's fine , displays email expect. it's once try run in django error pops up. note above error no matter permutation of following 2 sets of settings put in settings.py file: email_backend = 'django.core.mail.backends.console.emailbackend' email_host = 'localhost' email_port = 1025 email_host_user = 'myemail@gmail.com' email_host_password = '' email_use_tls = false i've played around following in

javascript - Hot to save html file only from R and htmlwidgets? -

i using r draw heatmap. heatmaply , htmlwidget installed. fox example exec following code: library("htmlwidgets") library("heatmaply") heatmaply(mtcars) %>% savewidget(file="test.html") this generate test.html file , test_files folder, want test.html only. try savewidget(file="test.html",,selfcontained=true) . place js library in test.html, making test.html big. use self-contained=false create plain html , seperate folder, use system remove folder: heatmaply(mtcars) %>% savewidget(file="test.html", selfcontained = false) system('rm -r test_files') just careful don't have folder named x_files, x name of plot output!

mysql - Edit form load. Error: "There is no row at position 0." [VB.net] -

im having problem on thesis. keeps showing message "there no row @ position 0.". though there data in mysql database. please help, i'm newbie. thanks! private sub frmaccountedit_load(sender object, e eventargs) handles mybase.load txtuserid.text = frmaccountlist.accountcaller da = new mysqldataadapter("select * tbl_account userid = '" & txtuserid.text & "'", con) ds.reset() da.fill(ds) try cmbacctype.selectedindex = ds.tables(0).rows(0)(1).tostring txtusername.text = ds.tables(0).rows(0)(2).tostring txtpassword.text = ds.tables(0).rows(0)(3).tostring txtfirst.text = ds.tables(0).rows(0)(4).tostring txtlast.text = ds.tables(0).rows(0)(5).tostring catch ex exception messagebox.show(ex.message, "error!", messageboxbuttons.ok, messageboxicon.error) end try end sub run m

c++ - How to dispatch to templated call operator using SFINAE -

i have function takes templated callable argument, , passes index it. in situations, index passed statically (i'm working tuples). thought should possible passing callable object templated call operator , using sfinae. at first, looks like: struct { template< size_t > void operator()( int x ) { cout << "a " << x << " " << << endl; } }; struct b { void operator()( int x, int ) { cout << "b " << x << " " << << endl; } }; template< typename f, size_t = 0 > inline void call( int x, f & fn ) { fn( x, ); } int main() { a; b b; call( 2, b ); call< b, 3 >( 2, b ); call( 1, ); // no match call '(a) (int&, long unsigned int)' return 0; } so try overload call function , select right invocation using sfinae: template< typename f, size_t = 0 >

SQL: Find all rows in a table when the rows are a foreign key in another table -

the caveat here must complete following tools: the basic sql construct: select .. where.. . distinct ok. set operators: union, intersect, except create temporary relations: create view... ... arithmetic operators <, >, <=, == etc. subquery can used in context of not in or subtraction operation. i.e. ( select ... from... not in (select.. .) i can not use join, limit, max, min, count, sum, having, group by, not exists, exists, count, aggregate functions or else not listed in 1-5 above. schema : people (id, name, age, address) courses (cid, name, department) grades (pid, cid, grade) i satisfied query used not exists (which can't use). sql below shows people took every class in courses table: select people.name people not exists (select courses.cid courses not exists (select grades.cid grades grades.cid = courses.cid , grades.pid = people.id)) is there way solve using not in or other method allowed use? i've struggled hours. if can goofy obst

Floating label not aligned with input in Ionic 2 -

Image
this question exact duplicate of: icon not displayed inside input line in ionic 3 1 answer in ionic2 project when using floating label, not correctly aligned input box. how can fix this? following code: <ion-item> <ion-label floating><ion-icon name="person" item-start></ion-icon>email</ion-label> <ion-input type="email" name="email" [(ngmodel)]="registercredentials.email"></ion-input> </ion-item> this not duplicate question. 1 compared keeping label floating , icon fixed. alignment related question. could please share code? if use ion-item , ion-label this, text correctly aligned: <ion-item> <ion-label floating>username</ion-label> <ion-input></ion-input> </ion-item> input no selected input selected

c# - Nuget configuration -

i've configured in nuget package manager, doesn't work, , when build new project, i'll download dll old configuration. shown in following figure. the package servicestack.interfaces.4.5.14 cannot found on source https://www.nuget.org/api/v2/ this address configured https://api.nuget.org/v3/index.json

Android Php Server Connection -

i trying make android app php in backend. in login page trying send login credentials php file can echo , store value in variables. , php file stored on server of www.myurl.com/myfolder/login.php. know lot more web development first experiment android app. referred several online tutorials this. see using json , json_encode in php not solving problem. think making other mistake or not able locate error.

networking - How to properly throttle the message size in a RPC call -

i have 2 servers, , b. have defined rpc call between them transfer messages b in interval. each message contains fixed size of strings, e.g [str1, str2, str3, ..., str50]. avoid theses messages take network bandwidth, think need throttle number of messages send in each interval, don't know how decide what proper size , suggestion?

How to change the datatype of a column in HBase shell or by using pheonix -

i'm stuck below issue, relatively new hbase . i created below table all_india_crore_test in hbase. in pheonix, 0: jdbc:phoenix:> ! describe all_india_crore_test we below result. table_name | column_name | data_type | type_name | +------------+--------------+-----------------------+----------------+ | all_india_crore_test | sequence_no | 12 | varchar | | all_india_crore_test | owner_name | 12 | varchar | | all_india_crore_test | owner_address | 12 | varchar | 1) how change datatype varchar integer sequence_no column in apache pheonix. 2) possible same using hbase shell. looking forward answers. lot help.

static analysis - How to exclude particular method in java? -

we evaluate jtest static code analysis tool using java juliet test suite. downloaded juliet_test_suite_v1.2_for_java.zip from https://samate.nist.gov/srd/testsuite.php juliet_test_suite_v1.2_for_java.zip file contains java files https://samate.nist.gov/srd/resources/juliet_test_suite_v1.2_for_java_-_user_guide.pdf has method , bad method in java file.to find false positive, false negative, true positive , true negative, run method of java file excluding bad method , bad methods excluding method. how can achieve this? ex: public class ex{ public void bad(){ bad code here // error public void good(){ code here } approach available in java achieve this? in c++, have macros concept achieve above scenario. please let me know if need more information.

javascript - html5 canvas, image as background for arch or circle -

hello stackoverflow people, first post here. i have circle on canvas, , circle divided sky , ground portion, , (analog) clock looking, imagine hands of clock extended edge of circle, making 2 'pie slices'. , hands moving. have different (background) images 2 portions. have gradiant fill, change gradiant appropriate images. images must fill whole portion of 'pie slice'. code far: // ground portion of circle var lingrad=ctx.createlineargradient(center.x, center.y,center.x,main_radius*2); lingrad.addcolorstop(0,'green'); lingrad.addcolorstop(1,'brown'); ctx.fillstyle=lingrad; ctx.beginpath(); ctx.moveto(center.x, center.y); ctx.lineto(x2, y2); ctx.arc(center.x, center.y, radius, d2r(z1 + 90), d2r(v1 + 90), false); ctx.moveto(center.x, center.y); ctx.lineto(x1, y1); ctx.closepath(); ctx.fill(); // sky portion of circle var lingrad1=ctx.createlineargradient(center.x,0,center.x,center.y); lingrad1.addcolorstop(0,'y

Android mms carrier handling -

i try create app handle sms , mms functionality , act default app. in order send mms use klinker's api https://github.com/klinker41/android-smsmms and store sent mms phone using content provider (create dummy sms, create mms mms part , @ end delete dummy sms) when receive mms through broadcaster service , store mms @ inbox should send carrier? because phone receive again after day or 2 same mms.

Using piwik analytics with coldfusion -

i had asked question in cfml slack channel too. but asking here better answer not have #cfml slack channel joined. see mura plugin using plain coldfusion code, appreciated: https://github.com/lagaffe/murapiwik

php - MySQL: Help to search each word in multiple columns as case insensitive -

i have table contains: product, cost, comment. id product cost comment 1 tires rex 10 fast movement quality 2 bone maxx centri 110 clean , soft movement 3 engine damaged 20 damaged the outcome want: user can searches multiple words , query has find items words case insensitive. for example, user searches: buy clean tires cars the query output has show products id 1 , 2. why? because word clean matches comment in product id 2 because word tires matches product id 1 i tried with: select * `inventory` match (product) against ('buy* clean* tires* for* cars*' in boolean mode); but works 1 column , case-sensitive. i want searches in multiples columns case-insensitive. any appreciated! use following query, it's tested , returns first 2 rows: select * `inventory` match (product, comment) against ('buy* clean* tires* for* cars*' in boolean mode);

perl - Conditional string replacement based on matched column -

i'd match string present in columnx , replace fixed string in columny. example how match strings based on column3 in file1 file2 in below example , selectively replace column2 of file1 fixed string "au" whenever match found. if no match found, rows in file1 should printed output. both file1 & file2 contains more 100k such lines. file1: 0,ds,"c_3363/y" 1,ds,"c_3363/y" 0,uu,"c_3364/y" 1,uu,"c_3364/y" file2 0, "c_3364/y" 1, "c_3364/y" desired output: 0,ds,"c_3363/y" 1,ds,"c_3363/y" 0,au,"c_3364/y" 1,au,"c_3364/y" another gnu awk solution single fs: $ cat tst.awk begin {fs=","} nr==fnr && sub(/ /, "", $2) {a[$2]++; next} ($3 in a){ printf "%s,au,%s\n", $1,$3; next}1 same, commandline : awk -f, 'nr==fnr && sub(/[[:space:]]/,"",$2){a[$2]++; next} ($3 in a){ printf "%s,au,%s\n"

php - Can we get details of Facebook page like Page Likes and other -

i trying following details facebook page website. can it. how? page likes total page reach page followers reactions/comment/share gender male/female) (percentage or number) country (major likes country) city ( major city likes) language (audience language) i must havn't researched before asking question .still can refer this , facebook api: best way like, share, comment count page/group post?

css - Grid-Media IN vs OUT -

me , coworker went eternal discussion best way use neat grid-medias. consider following approuch: approuch a: .mydiv { font-size: 14px; @include grid-media($somegridvar) { font-size: 18px; } } then, consider this: approuch b: .mydiv { font-size: 14px; } @include grid-media($somegridvar) { .mydiv { font-size: 18px; } } testing on neat, both approuchs renders same result, not put here because obvious. my question is: prefer? there "better" approach suggested thoughtbot? there "better" approach suggested someone? there reason use 1 instead of other? matter of style? have use both provide enriched life statement? what deduced till now: in approuch a, have several includes of grid media on our pages, making code harder read , more bloated. @ other side, grid media centered in 1 single rule, , same rule not repeated on document each grid media. in approuch b, have single block of each grid-media each breakpoint, resulting in

python - Useragent showing 302 in code on browser it gives result -

Image
i trying page result search on google. target amp results in page. tried android kitkat user-agent in browser results in listing amp pages in search result. trying search same keyword same user agent using socket methods in python gives 302 status code. user-agent : mozilla/5.0 (linux; android 4.4.2; nexus 4 build/kot49h) applewebkit/537.36 (khtml, gecko) chrome/34.0.1847.114 mobile safari/537.36 if see bottom of page shows amp page result axisbank , can see user agent. when try replace code user agent same gives me 302. if use useragent results listed not amp pages. self.opened_url = self.buildurl() print self.opened_url html="" s = socket.socket(socket.af_inet, socket.sock_stream) s.setsockopt(socket.sol_socket, socket.so_reuseaddr, 1) s.setsockopt(socket.sol_socket, 25 , "eth0") s.connect((self.domain, 80)) request = b"get " +self.opened_url +" http/1.1\nhost: " + se

ios - App crashes on only iPhone 5 when adding GMSMarker to the map: EXC_BAD_ACCESS -

the app i'm working on plots lot of gmsmarkers on google map. works fine in other devices, except iphone 5. have subclassed gmsmarker , set object id subclass. done can add markers nsset , ensure there distinct markers plotted , no duplicates. subclass is: @implementation byomarker -(bool)isequal:(id)object { byomarker *othermarker = (byomarker *)object; if (self.objectid.intvalue == othermarker.objectid.intvalue) { return yes; } return no; } -(nsuinteger)hash { return [self.objectid hash]; } @end the .h file #import <googlemaps/googlemaps.h> @interface byomarker : gmsmarker @property (assign, nonatomic) nsnumber *objectid; @end the app crashing @ return of hash function exc_bad_access exception. enabled zombie objects , tried print po marker.objectid when i'm setting map object marker , following error: *** -[cfnumber respondstoselector:]: message sent deallocated instance 0x80416470 0x80416470 any help?! tia you ha

SugarCRM 6.5 How to print php template? -

i newly sugarcrm 6.5 developer, have write view.detail.php file , controller file. how print template controller action json data php template. please me. have create controller , view.details code below. controller protected function action_printinvoice(){ global $current_user, $db, $region; $db = dbmanagerfactory::getinstance(); $id = $_post['record']; $sql = "select gn.client_name, gn.client_address, gn.client_address_city, gn.client_address_state, gn.client_address_country, gn.client_address_postalcode, gn.id, gn.recipient_name, gn.recipient_address_city, gn.recipient_address_state, gn.recipient_address_country, gn.recipient_address_postalcode, gn.recipient_address, gn.recipient_vat_id, gn.recipient_tax_no, gn.recipient_name, gn.invoice_number ginvo_client_invoice_id, " . " gcstm.* " . "from ginvo_client_invoice gn " . " inner join ginvo_client_invoice_cstm gcstm on gn.id=gcstm.id_c "

android - Facing java.lang.RuntimeException: Failure delivering result ResultInfo on getActivity().getContentResolver().query() -

i using implicit intent select contact , call it, facing following exception, happens when invoking getactivity().getcontactresolver().query() . separately checked invocation individually , ensure none of them null. here code recover info selected contact: public void onactivityresult(int requestcode, int resultcode, intent data) { if (resultcode != activity.result_ok) return; else if (requestcode == request_date_code) { gregoriancalendar date = (gregoriancalendar) data.getserializableextra(datepickerfragment.extera_date); mcrime.setdate(date); updatedate(); } else if (requestcode == request_contact && data != null) { uri contacturi = data.getdata(); string[] queryfields = new string[]{contactscontract.contacts.display_name, contactscontract.contacts._id}; cursor c = getactivity().getcontentresolver().query(contacturi, queryfields, null, null, null); try { if