Posts

Showing posts from April, 2014

Maven configuration in Anypoint studio /ESB Mule -

Image
i new maven. tried install maven in existing anypoint studio (version 6.0) following below steps. 1) -> install new software -> select site -> lookfor maven -> click next -> install 2) restarted anypoint studio. now have try create mule project enabling "use maven". disabled after maven add on installation. have clicked "configure maven" , asked me maven installation directory. dont know maven installatin directory. windows -> preference -> anypoint studio->maven->entered path in installation directory-> error : value must point root of maven installation . here have attached error screenshot. kindly me in this. you need download maven website . extract in folder want , reference anypoint in field like this

python - PyQt5 Weird window position issue -

the codes above, weirdly have issue. don't understand why if set y size of window more 923 , window not placed @ middle of screen. goes top-left corner of screen. from pyqt5.qtwidgets import qapplication,qdesktopwidget,qmainwindow pyqt5 import qtcore import sys class cssden(qmainwindow): def __init__(self): super().__init__() self.mwidget = qmainwindow(self) self.setwindowflags(qtcore.qt.framelesswindowhint) #size self.setfixedsize(1100,923) # <--- set 924 , more self.center # <-- function set window middle of screen self.show() def center(self): # <-- center function qr = self.framegeometry() cp = qdesktopwidget().availablegeometry().center() qr.movecenter(cp) self.move(qr.topleft()) app = qapplication(sys.argv) app.setstylesheet("qmainwindow{background-color: rgb(30,30,30);border: 1px solid black}") ex = cssden() sys.exit(app.exec_()) why? resolutio

php - insert query store 0 in all fields -

when create api , image name consist projectid , user_id , category can't save image in database because image project_id , image_id , image not getting post method.please in advance <?php error_reporting(e_all); require_once('confi.php'); //destination of images define('img_destination',dirname(__file__).'/images/'); define('db_name','chat_neeraj'); //saving data image table function saveimagedata($data,$imgfile){ $project_id = isset($_post['project_id']) ? mysql_real_escape_string($_post['project_id']) : ""; $image_id = isset($_post['image_id']) ? mysql_real_escape_string($_post['image_id']) : ""; //$user_id = isset($_post['user_id']) ? mysql_real_escape_string($_post['user_id']) : ""; $image_name = isset($_post['image_name']) ? mysql_real_escape_strin

c# - Changing TextBox colour in a method -

i've got mvvm c# project has button on form processing. takes few seconds processing , thats fine. there associated textbox want change background colour of during processing. i've been trying no success. i have background colour textbox bound property change @ beginning of method called button (via command binding). method work, , sets background colour default colour. no change occurs on screen when button clicked. i've tried putting color change code inside dispatcher happen on gui thread, still doesn't work. i'm confused. how colour change properly? private void switchruns() { try { // bound property (set notification correctly) // curruntextboxcolor = colors.red; uiservices.setbusystate(true); // sets cursor wait ... processing code ... curruntextboxcolor = colors.lightgreen; } catch (exception exp) {

c# - How i can generate a date field in Razor based on metadata validation -

i have such code going validate in view using system; using system.collections.generic; using system.componentmodel.dataannotations; using system.linq; using system.web; using validationproject.models; namespace validationproject.models { public class class1 { [required(errormessage="this field required")] public int one; [required(errormessage = "this field required")] public string two; [datatype(datatype.date)] public datetime date; } } when try generate datetime field in razor textbox instead of date field. razor code given below: @using validationproject.models; @model class1 @{ <script src="@url.content("~/scripts/jquery-3.0.0.js")"></script> <script src="@url.content("~/scripts/jquery.validate.js")"></script> <script src="@url.content("~/scripts/jquery.validate.unobtrusive.js")"></sc

Do Rust macros work inside trait definitions? -

i can build structs , enums using macros not traits. bug or how traits work missing? here simple example fails build: macro_rules! fun{ () => { fn hello(); } } macro_rules! full_fun{ () => { fn hello(){} } } // fails with: // <anon>:13:8: 13:11 error: expected 1 of `const`, `extern`, `fn`, `type`, or `unsafe`, found `fun` // <anon>:13 fun!(); macro_rules! trait_macro{ ($name:ident) => { pub trait $name { fun!(); } }; } macro_rules! struct_macro{ ($name:ident) => { pub struct $name; impl $name { full_fun!(); } }; } // can add functions impl struct_macro!{monster} // cannot add functions trait trait_macro!{monster} fn main() { } according the rust documentation on macros , macro can expanded as: zero or more items zero or more methods, an expression, a statement, or a pattern. your full_fun becomes method, think declaration inside trait doesn't count. (i haven't fou

webpack - How to use ContextReplacementPlugin on a require wrapped in a loop -

i'm trying use contextreplacementplugin resolve dynamic requires occurring in loop: https://github.com/mongodb/js-bson/blob/master/lib/bson/index.js#l7-l24 here's code: [ './binary_parser' , './binary' , './code' , './map' , './db_ref' , './double' , './max_key' , './min_key' , './objectid' , './regexp' , './symbol' , './timestamp' , './long'].foreach(function (path) { var module = require(path); (var in module) { exports[i] = module[i]; } }); i'm having trouble constructing source regex match this. path being matched against source seems ".". moreover, context plugin seems called once when there 13 files being required in loop. can contextreplacementplugin used resolve issue or should try else?

internet explorer - JAVASCRIPT : create dynamic key in IE -

this question has answer here: using variable key in javascript object literal 6 answers var jsonuiid = "sdfsdf"; a={ [jsonuiid] : { "heading":"title" } }; tried directly in developer tools. above code works in browsers. fails in internet explorer. please help. if don't square bracket[], directly gets "jsonuiid" rather actual value defined above. computed property names part of es6 not supported browsers. can set object property old-style bracket notation : var jsonuiid = "sdfsdf"; var = {}; a[jsonuiid] = { "heading": "title" };

mysql - Count entries from different tables per day -

i have 2 tables: reports: date, uuid warns: date, uuid, active where date timestamp (2016-05-16 16:06:58) , uuid user-identifier string , active boolean. i want display how many reports , warns entries there per day. have query: select date(date) date, count(*) reports reports group date(date) order date(date) desc which displays table this: date | reports -----------+--------- 2016-07-05 | 192 2016-07-04 | 230 2016-07-03 | 227 but want join in how many warns entries occurred day if it's active column true , want query return table this: date | reports | warns -----------+---------+------- 2016-07-05 | 192 | 47 2016-07-04 | 230 | 59 2016-07-03 | 227 | 56 i newbie @ mysql haven't been able figure out how yet. searched bit on joins , unions didn't know if/how applied case. appreciated. you can use correlated query: select date(reports.date) date, count(*) reports, (select count(*) w

To retrieve data as xml without header using SIMPLEXMLELEMENT in php -

i trying output this- <start> <sub1> <one>sam</one> </sub1> </start> for tried code- <?php include('db.php'); $xml = new simplexmlelement(); $abc = $xml->addchild('start'); $s = $abc->addchild('sub1'); $s->addchild('one','sam'); echo $xml->asxml(); ?> but not giving me output.instead giving me error. error follows- fatal error: uncaught exception 'exception' message 'simplexmlelement::__construct() expects @ least 1 parameter, 0 given' in d:\xamppnew\htdocs\_acct\trialxml.php:5 stack trace: #0 d:\xamppnew\htdocs\_acct\trialxml.php(5): simplexmlelement->__construct() #1 {main} thrown in d:\xamppnew\htdocs\_acct\trialxml.php on line 5 can guide me how retrieve xml without header using simplexmlelement in php or please let me know went wrong. in advance. simplexml can not work empty document. need load document document element. $start = new si

matlab - Strange behavior of LibSVM -

i test classifiers classifying 2 identical normals (or more precise: 2 datasamples drawn same underlying distribution) or 2 normals separable. seems when using simple libsvm code , rbf kernel, result high classification accuracy when trying classify 2 identical normals: clear all; close all; clc gamma = 100; % dummy data = 15; b = 50; x = zeros(200,2); x(1:100,1) = a.*randn(100,1) + b; x(101:200,1) = a.*randn(100,1) + b; % labels y(1:100,1) = 1; y(101:200) = 2; % libsvm options % -s 0 : classification % -t 2 : rbf kernel % -g : gamma in rbf kernel model = svmtrain(y, x, sprintf('-s 0 -t 2 -g %g', gamma)); % display training accuracy [predicted_label, accuracy, decision_values] = svmpredict(y, x, model); why that? matlab's svmtrain chance level accuracy (around 50%), no matter kernel use. furthermore libsvm gives me extremly different results own dataset, , high accuracies when swap labels of dataset randomly.. thanks

For BIOS, Does Intel support both BIOS Reference Design and Firmware Support Package? -

when doing bios development, see references both intel bios reference design , intel firmware support package (fsp). intel actively support both, or reference design being phased out in favor of fsp. to create fsp work reference code moved pei phase. of work done in dxe phase, , there still work done there platforms boot uefi way, work required make platform operational done in pei. these peim packaged fsp, such os knowledgeable fsp can continue boot. way uefi fw passes control os different uefi or fsp boot, different interfaces; initialization code same. it done way there 1 reference code support either fsp or uefi boot. some details may depend on actual platform, not platforms support fsp, although trend platforms add support fsp. so, in long term looks both available platforms, tread statement, not representation of company position.

hadoop - Error while using FROM_UNIXTIME(UNIX_TIMESTAMP() in Hive -

i trying run function current date in hive getting following error: error while compiling statement: failed: semanticexception no valid privileges required privileges query: server=server1->db=_dummy_database->table=_dummy_table->action=select; i have searched online , being suggested following functions current date in hive giving same error: select from_unixtime(unix_timestamp()); --/selecting current time stamp/ select current_date; --/selecting current date/ select current_timestamp; --/selecting current time stamp/ but showing error if run them given. right answers: 1. select from_unixtime(unix_timestamp()); - works impala select from_unixtime(unix_timestamp()) any_table_name; - works in hive note: must use clause any_table_name present in database hive

arrays - How to dynamically access textfields in Java? -

we have little problem accessing textfield -s. we have list of 81 (yes 81) textfields private textfield textfield1 = new textfield(); private textfield textfield2 = new textfield(); private textfield textfield3 = new textfield(); ... now want text these fields , store them in array. for loop data[i] = textfield???.gettext(); how incorporate changing number i field name? would appreciate or ideas. the easiest way add textfield objects arraylist , loop through list calling gettext() on each field.

laravel - Phpunit acceptance test not finding redirect url -

i trying write functional acceptance test facebook login integration in laravel using socalite. this works manually. if try following code public function test_facebook_login() { $this->visit('/')->click('login facebook'); } then error(ihave removed api key , secret) 1) authenticationtest::test_facebook_login request [ https://www.facebook.com/v2.6/dialog/oauth?client_id=[clientid]&redirect_uri=https%3a%2f%2fcore-domain%2ffacebook%2fcallback&scope=email&response_type=code&state=code] failed. received status code [404]. if copy url , go manually in browser works , can log in fb

Openlayers bbox strategy -

i have bbox strategy 1 source of data. code looks this: bbox: function newbboxfeaturesource(url, typename) { return new ol.source.vector({ loader: function (extent) { let u = `${url}&typename=${typename}&bbox=${extent.join(",")}`; $.ajax(u).then((response) => { this.addfeatures( geojsonformat.readfeatures(response) ); }); }, strategy: ol.loadingstrategy.bbox }); }, i works fine but... when pan/move map loader calling again , add features fit new box. there lot of duplicates because of new features same old. wanted first clear features using this.clear() before add new features when add command loader running time , have "infinitive loop". know why? how can disable loading new features after calling this.clear() ? edit: my response features looks this: { "type": "featurecollection", "crs"

java - How to disable RabbitMQ prefetch count with SimpleMessageListenerContainer -

rabbitmq offers ability optionally set prefetch count. using spring-amqp's simplemessagelistenercontainer , i've noticed prefetch count set. cannot set prefetch count 0, because simplemessagelistenercontainer sets @ least txsize must greater 0 (even when there no transactions involved). there way disable prefetch count, i.e. make unlimited? here relevant code spring-amqp: simplemessagelistenercontainer.createblockingqueueconsumer() this: int actualprefetchcount = prefetchcount > txsize ? prefetchcount : txsize; and blockingqueueconsumer.start() this: if (!acknowledgemode.isautoack()) { // set basicqos before calling basicconsume (otherwise if not acking broker // send blocks of 100 messages) try { channel.basicqos(prefetchcount); } what reasoning behind calling basicqos() in springs's blockingqueueconsumer ? isn't there use case disabling prefetch count? (except auto-ack obviously). the rabbi

d3.js - Why is the third variable in d3 anonymous function undefined when transitioning? -

say have test data var testdata1 = [ [ {x: 1, y: 40}, {x: 2, y: 43}, {x: 3, y: 12}, {x: 4, y: 60}, {x: 5, y: 63}, {x: 6, y: 23} ], [ {x: 1, y: 12}, {x: 2, y: 5}, {x: 3, y: 23}, {x: 4, y: 18}, {x: 5, y: 73}, {x: 6, y: 27} ], [ {x: 1, y: 60}, {x: 2, y: 49}, {x: 3, y: 16}, {x: 4, y: 20}, {x: 5, y: 92}, {x: 6, y: 20} ] ]; and bind data nested objects, var circles = svg.select("circle") .data(testdata1) .enter() .append("circle") var subsel = circles.selectall("rect") .data(function(d) {return d}) .enter() .append("rect") the third variable in d3 anonymous function holds index of parent data element (as discussed more in third variable in d3 anonymous function ). before adding transition, j variable behaves expected (gives 0,1,2 each group of 6 elements). after transitioning, however, j variable becomes undefined: subsel.attr("foobar", function(d,i,j) {console.lo

regex - Matching multiline text using regular expression in java -

my input sample is: <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/tr/rec-html40"> <head> <meta http-equiv=content-type content="text/html; charset=windows-1252"> <meta name=progid content=word.document> <meta name=generator content="microsoft word 15"> <meta name=originator content="microsoft word 15"> <link rel=file-list href="detailedfoot_files/filelist.xml"> what want want select whole html tag , replace something. using regular expression <html.*> if use regular expression in mather.dotall manner, whole text input replaced. i cant figure out how it. kind of appreciated. this regex seems capture you're looking for. pattern = "\<htm

How to get active tab position in android material -

how active tab position in material tabs? 1 me. try tablayout tablayout = (tablayout) findviewbyid(r.id.tabs); tablayout.getselectedtabposition();

android - Can I safely block Dalvik browser agent requests? -

i've noticed when users on android-os devices visit site, there's 2 requests happening on each page. first normal browser, , second "dalvik". example: "get / http/1.1" 200 2126 "-" "mozilla/5.0 (linux; android 5.0.2; samsung sm-g925f/g925fxxu1aod8 build/lrx22g) applewebkit/537.36 (khtml, gecko) samsungbrowser/3.0 chrome/38.0.2125.102 mobile safari/537.36" 1229 2802 "get / http/1.1" 200 2117 "-" "dalvik/2.1.0 (linux; u; android 5.0.2; sm-g925f build/lrx22g)" 546 8729 from understanding of this, first request actual browser, , other virtual machine (dalvik) running browser. problem dalvik request doesn't use same cookies, and/or post data, , triggers errors server side. example when user registers account. normal browser sends through post data, dalvik request on action url. similarly, if user logged in, dalvik try on permission based page, may redirect somewhere else because there's no sessio

c# - Developing ms crm 2011 plugin on vs 2015 -

how can develop custom plugin ms crm 2011 using ms visual studio 2015? problem plugin development requires crm sdk installed on vs, impossible install crm sdk 2011 on vs 2015 (it errors 'you should install visual studio first'), can understand looks vs 2010. also, haven't found way install crm sdk 2015 on vs 2015, figured out microsoft separated out these 2 things. i don't want buy vs 2010 additionally, , can't change company politics of using ms crm 2011. download microsoft dynamics crm 2011 software development kit (sdk) . then run executable, extract files folder directory (not sure visual studio link comes in here). you can find crm assemblies in sdk\bin folder, can add references directly project. alternatively try nuget references.

c# - Document DB query -

i'm trying query 1 of documents documentdb doesn't appear working, how set up: nosqlservice: private inosqlprovider client; private static icontainer container; public nosqlservice(inosqlprovider provider) { client = provider; } public static dynamic querydocument<t>(uri reference, feedoptions queryoptions) { var documentdb = container.resolve<inosqlprovider>(); return documentdb.querydocumentasync(reference, queryoptions); } inosqlprovider: iorderedqueryable<document> querydocumentasync(uri reference, feedoptions queryoptions); azuredocumentdbservice azuredocumentdbservice inherits inosqlprovider private readonly idocumentclient client; public iorderedqueryable<document> querydocumentasync (uri reference, feedoptions queryoptions) { return client.createdocumentquery(reference, queryoptions); } azuredocumentdbtest feedoptions queryoptions = new feedoptions(); documents document = new documents(); document.id =

const correctness - How much initialization can/should be in C++ Initialization lists -

this first post. believe aware of best practices on stackoverflow not 100%. believe there no specific post addresses interrogation; hope it's not vague. i trying figure out practices writing c++ constructors medium-to-heavy-duty work. pushing (all?) init work initialization lists seems idea 2 reasons cross mind, namely: resource acquisition initialization as far know, simplest way of guaranteeing members initialized correctly @ resource acquisition make sure what's inside parentheses of initialization list correct when evaluated . class { public: a(const b & b, const c & c) : _c(c) { /* _c allocated , defined @ same time */ /* _b allocated content undefined */ _b = b; } private: b _b; c _c; } const class members using initialization lists correct way of using const members can hold actual content. class { public: a(int m, int n, int p) : _m(m) /* correct, _m initialized m */ {

php and mySQL database concurrency update -

lets wanted increment counter in database every time visits webpage. the database called 'example' looks this: |name.....| value..........| id | =================== |count......| 5................| 1 | <---- 1st row and code on webpage looks this: $db = mysqli_connect("localhost", ....); $q = "select value example id = '1'"; $r=mysqli_query($db, $q); $result = mysqli_fetch_array($r); $increment = $result[0] + 1; $q = "update example set value = '$increment' id = '1'"; mysqli_query($db,$q); if 2 people access webpage @ same time, person fetch value of 5 , after that, person b fetch same value. both increment 6 , both perform update 1 after other entering 6 counter value when should 7 since 2 people visited page. how can prevent this? you can in 1 statement: "update example set value = value + 1 id = '1'"; so no other task can change between read , update. here script $d

r - how to create a new variable based on a condition -

data file name: toys lets have following dataframe id name 1 green ball 2 red ball 3 blue bat 4 green bat 5 blue ball 6 ball 7 bat i add new variable "color" searching color in name. id name color 1 green ball green 2 red ball red 3 blue bat blue 4 green bat green 5 blue ball blue 6 ball other 7 bat other i have never used r , not sure how go doing this. tried no luck. toys$color <- ( if toys$name = "green", color "green" else if toys$name = "red", color "red" else if toys$name = "blue, color "blue" else toys$name = "other" ) i appreciate assistance this. thanks we can use str_extract . create vector of colors ('col1'), use str_extract substrings in 'name' match elements in 'col1' paste ing the 'col1' single string separated by |

install - upgrade version using WIX -

i've made installer using wix toolset (3.10). i'd enable upgrades can't make work. every time run msi installs version. can't figure out what's wrong. can advise? <product id="*" name="$(var.productname)" language="1033" version="$(var.productversion)" manufacturer="manufacturer" upgradecode="upgrade_code" > <package installerversion="200" compressed="yes" installscope="permachine" /> <majorupgrade schedule="afterinstallinitialize" allowdowngrades="no" allowsameversionupgrades="no" downgradeerrormessage="a newer version of [productname] installed." /> <mediatemplate embedcab="yes" /> allowsameversionupgrades="yes" fix this. when test upgrades need either update version (one of fi

c# - In what time interval is the conditions in a while clause checked? -

how wait specified time while showing remaining time wait? i solved feel bad way it: //this running in backgroundworker: stopwatch watch = new stopwatch(); watch.start(); while(watch.elapsedmilliseconds != secondstowait * 1000) { timetonextrefresh = ((secondstowait * 1000) - watch.elapsedmilliseconds) / 1000; thread.sleep(1); } watch.stop(); so here guessing condition ( watch.elapsedmilliseconds != secondstowait * 1000 ) checked every millisecond. so main question is; in period condition of while checked and/or how improve code i've written? it depends on what's code inside while loop! for example, if write long/time-consuming code in while loop, each iteration of while loop, or course, longer while loop has short/fast code. compare these 2 while loops: while (true) { console.writeline("hello"); } and while (true) { console.beep(5000); } each iteration of first while loop faster of second 1 because

Creating a function handle for each element in a vector (Matlab) -

i have following issue. trying create function handle, vector. in particular, have this eq0 = @(w) m1.^2*(exp(w))-m2.^2 where m1 , m2 vectors of same dimension. so, each m1(i) , m2(i) want have handle w(i). need in order find w(i)'s in next step using fsolve in looking this n=size(m1) x0 = zeros(n); wbar = fsolve(eq0,x0) i have tried using arrayfun, received following error eq0 = arrayfun( @(w) m1.^2*(exp(w))-m2.^2, m1=m1e, m2=m2e) error: expression left of equals sign not valid target assignment. another attempt in using arrayfun resulted in (here used m1 , m2 vectors directly, not inputs in previous case) eq0 = arrayfun( @(w) m1.^2*(exp(w))-m2.^2,:) undefined variable arrayfun. i missing something. have looked on feeds on arrayfun looks problem different. any advice appreciated. so if understood right want have each m1(i) or m2(i) seperate function handle eq0(i) can operate vector w in following way eq0(i) = @(w

PHP Check if date is past in the format 10-08-2015 -

i'm trying check if specific given date past or not php, cannot change date format there thousands of records in database. $actdate = '10-08-2015'; the format day-month-year thank you edit: working, aruna warnasooriya. $actdate = "10-08-2015"; $yourdate = date_create(date($actdate)); $mydate = $yourdate->format("y-m-d"); $date = new datetime($mydate); $now = new datetime(); if($date < $now) {echo 'date in past';} else {echo 'date not in past'; } php : $today = date("d-m-y"); you can create date using date_create function.this create data object. $actdate = "10-08-2015"; $yourdate = date_create(date($actdate)); format date wish.like this; echo $yourdate->format("d-m-y");

c# - Click event not working on dynamically added button or Panel -

i using following code in c# add button button textlabel = new button(); //local variable textlabel.location = new point(0, 0); textlabel.visible = true; textlabel.enabled = true; textlabel.autosize = true; textlabel.click += click; this.controls.add(textlabel); and click handler is protected void click(object o, eventargs e) { messagebox.show("hello"); } though button visible , responding mouse hover, nothing happening on click. wrong or missing? if write same code in independent project, works!!!!! strange. why???? form properties: (if required) 1. show in taskbar: false 2. borderless 3. 50% opaque today realised registering click event control not make event work unless parent (in case form) on control still active. parent control receive event notification earlier child controls. simple , obvious observation, if not paid attention make undesirable effects. that's mistake did, made form active on form activated event, hence control in d

html - Calling a php function after onclick event -

i need help. this php code shows me table names of people mysql database: if ($numrows>=1) { echo<<<end <td align="center" bgcolor="e5e5e5">nazwisko</td> </tr><tr> end; } ($i = 1; $i <= $numrows; $i++) { $row = mysqli_fetch_assoc($result); $nazwisko = $row['nazwisko']; echo<<<end <td align="center">$nazwisko</td> </tr><tr> end; } i want table showed after click on button. html code looks this: <form class="form-horizontal" role="form" method="post" action="index.php"> <input id="button" name="submit" type="submit" value="szukaj" class="btn btn-info"> my efforts in vain. grateful help. your browser can't interpret php. you'll have make ajax call. request = $.ajax({ url: "/index.php", type: "post" }); request.done

c - How do I insert data into mysql table? -

i trying insert data mysql database. connection , displaying of data works. but don't know how use insert table command in c code. i've tried reading strings scanf / getchar values in mysql command, didn't work. how insert data mysql table after read data in program? i'm working in linux. this source code: #include <stdio.h> #include <stdlib.h> #include <mysql/mysql.h> static char *host = "localhost"; static char *user = "root"; static char *pass = "password"; static char *dbname = "tutorial"; unsigned int port = 3306; static char *unix_socket = null; unsigned int flag = 0; int main() { mysql *conn; mysql_res * res; mysql_row row; conn = mysql_init(null); if(!(mysql_real_connect(conn, host, user, pass, dbname, port, unix_socket, flag))) { fprintf(stderr, "error: %s[%d]", mysql_error(conn), mysql_errno(conn)); exit(1); } mysql_query(conn, "select * users"); res =

python - Searching bing results with a script results in an encoding issue -

i've written following in order number of search results per word in wordlist : with open ("c:\wordslist.txt") f: lines = f.readlines() def bingsearch(word): r = requests.get('http://www.bing.com/search', params={'q':'"'+word+'"'} ) soup = beautifulsoup(r.text, "html.parser") return (soup.find('span',{'class':'sb_count'})) matches = [re.search(regex,line).groups() line in lines] match in matches: searchword = match[0] found = bingsearch(searchword) print (found.text) it works , accurate results, except words containing special characters, example word: "número" . if call bingsearch("número") accurate result. if call bingsearch(match[0]) (where printing match[0] yields "número" ) inaccurate result. i've tried stuff str(match[0]) , match[0].encode(encoding="utf-8") , n

Verifying PM Installation Step in i2b2 not working -

i have followed steps mentioned in chapter 5 of documentation pm installation can found here .i @ step 5.7 verify pm installation step . , when run following url mentioned in documentation http://localhost:9090/i2b2/services/listservices , see blank page. it's 404 not found message saw in developer tools console window of chrome. not sure why webservice not running. can see jboss running when used url localhost:9990 redirects me url http://localhost:9990/error/index_win.html . the following commands shows build successful , went fine until deployment step 5.5 c:\program files\opt\i2b2 softwares\i2b2core-src-1707\edu.harvard.i2b2.pm>"%ant_home%"\bin\ant.bat -f master_build.xml clean build-all depl oy buildfile: c:\program files\opt\i2b2 softwares\i2b2core-src-1707\edu.harvard.i2b2.pm\master_build.xml common_init: [mkdir] created dir: c:\program files\opt\i2b2 softwares\i2b2core-src-1707\edu.harvard.i2b2.pm\test-reports [mkdir] created dir: c:\program

c# - Parallel.For not giving consistent results -

this question has answer here: is floating point math broken? 20 answers parallel.for() interlocked.compareexchange(): poorer performance , different results serial version 2 answers when run code below result different when comes 5th , 6th digit: public void testparallel() { object locker = new object(); double grandtotal = 0; parallel.for( 1, 1000000, () => 0.0, // initialize local value. ( i, state, localtotal ) => // body delegate. notice { return localtotal + math.sqrt( ); // returns new local total. }, localtotal => // add local value { lock( locker ) grandtotal += localtotal; // master value. } );

javascript - smoothState.js conflicting with other plugins -

i have managed implement smoothstate.js plugin on website , works nicely, other simple jquery plugin not work, wich starts with: $(document).ready() i need refresh page in order work again. i've read smoothstate documentation , says should wrap plugin initializations in function call on both $.fn.ready() , onafter — i'm farely new programming, i'm asking help. how can make jquery plugins work smoothstate? you need wrap scripts initiated $(document).ready() in function, , call function when need it. for example, let’s current script: $(document).ready(function() { $('.btn--homepage').click(function(e) { e.preventdefault(); var goto = $(this).attr('href'); $('#page').addclass('is-exiting'); $(this).addclass('exit-btn'); settimeout(function() { window.location = goto; }, 260); }); }); it’ll work fine when page loads it’s wrapped in $(document).ready(function()) , page won

unity3d - How can I fix my chasing/attacking code? -

so how code works is, enemy find player , move towards him. when finds him, stop , start attacking. if player moves away though, enemy stop attacking , sit there until player comes range. how can fix when player moves out of range, enemy starts chasing again , attacks normal? float movespeed = 3f; float rotationspeed = 3f; float attackthreshold = 3f; //distance within attack float chasethreshold = 10f; //distance within start chasing float giveupthreshold = 20f; //distance beyond ai gives float attackrepeattime = 1f; //time between attacks bool attacking = false; bool chasing = false; float attacktime; transform target; //the enemy's target transform mytransform; //current transform data of enemy void update() { //rotate @ player float distance = (target.position - mytransform.position).magnitude; if (chasing) { mytransform.rotation = quaternion.slerp(mytransform.rotation, quaternion.lookrotation(target.position - mytrans

angular - Angular2 SPA with WSO2IS -

is familiar angular2-seed or project works wso2is-5.x.0 authentication? what similar seed auth0: https://github.com/auth0/auth0-angular2/ but instead of authentication towards simple express server in backend, authenticate towards wso2is. alternatives wso2is, e.g. openam, of course of interest if there angular2-seeds/samples available those... auth0 has lot of examples here: https://auth0.com/authenticate/angular2/ explore other alternatives well.

postgresql - Use 4D only as front end application -

i want develop application using 4d front end , postgres backend. possible? don't want traces of database in front end i.e @ 4d end. but here problem while opening/running compiled 4d application (exe) or opening structure file in 4d, requires datafile. question can suppress dialog use 4d front end completely. thanks in advance. so question can suppress dialog use 4d front end completely. you need have data file or 4d prompt user asking create or open one, if there no tables in application. if using v15 or higher can take advantage of default data folder in suppressing "select data file" dialog. quote the docs opening data file when user launches new or updated merged application (single-user or client-server) first time, 4d tries select valid data file. several locations examined application successively. the opening sequence launching merged application is: 1) 4d tries open last data file opened (not applicable during

jsf - Primefaces carousel next() and prev() methods are not working in version 5.3 and 6.0 -

i using primefaces 5.2 jsf 2.2. there not problem using of primefaces carousel next() , prev() navigation methods until upgrading new version 5.3 (or 6.0) of primefaces. there idea solution of problem. i had problem too. solution found use setpage . example: function carouselnext() { var currentpage = pf('wcarouseldistro').page; var totalpages = pf('wcarouseldistro').totalpages - 1; var c = (currentpage === (totalpages)); if (!c) { pf('wcarouseldistro').setpage(currentpage + 1); } } function carouselprev() { var currentpage = pf('wcarouseldistro').page; if (currentpage !== 0) { pf('wcarouseldistro').setpage(currentpage - 1) } } my components. <p:graphicimage id="s1" library="images" name="prev-icon.png" style="display: inline-block;

'vagrant up' gives 'An error occurred while downloading' -

i use vagrant on linux , os x machines without problem. on windows 10 (the preview bash windows) fails while downloading box, without specifying proper error message: bringing machine 'default' 'virtualbox' provider... ==> default: box 'trusty' not found. attempting find , install... default: box provider: virtualbox default: box version: >= 0 ==> default: box file not detected metadata. adding directly... ==> default: adding box 'trusty' (v0) provider: virtualbox default: downloading: http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box default: error occurred while downloading remote file. error message, if any, reproduced below. please fix error , try again. i tried downloading box (so url correct!) , adding manually results in same: c:\> vagrant box add ubuntu/trusty64 c:\users\michi\boxes\trusty-server-cloudimg-amd64-vagrant-disk1.box ==> box: box file not de

python - argparse - Different mandatory / available parameters per action -

i'm looking create argument parser following structure: options [ 'backup', 'consistency_check', 'backup_and_consistency_check'] --database [ required ] --action [ required choice list options ] --where_to_backup_to [ required if --action 'backup' ] --what_file_to_consistency_check [ required if --action 'consistency_check'] --clean [ optional ] --force [ optional if --clean in arguments ] how can implement optional arguments using argumentparser module, depending on choice made command line argument. i'm looking make argparse fail if example command line arguments are --d database_name --a backup --what_file_to_consistency_check /var/tmp/file.bak this i've gotten far (i know it's little don't want go in complete wrong direction subparsers if haven't gotten right start) actions = ['backup', 'consistency_check', 'backup_and_consistency_check'] def create_parser(): parser =

serialization - XmlSerializer: The type of the argument object is not primitive -

system.invalidoperationexception: type of argument object 'si_foodware.model.localisationcollection' not primitive. system.invalidoperationexception: there error generating xml document. localisationcollection.cs using system.xml.serialization; namespace si_foodware.model { [xmlroot("localisationcollection")] public class localisationcollection { [xmlarray("localisationitems")] [xmlarrayitem("localisationitem", typeof(localisationitem))] public localisationitem[] localisationitem { get; set; } } } localisationitem.cs using system.xml.serialization; using sqlite.net.attributes; namespace si_foodware.model { public class localisationitem { [primarykey, autoincrement] [xmlignore] public int id { get; set; } [xmlelement("page")] public string page { get; set; } [xmlelement("field")] public string field { get; set;

android - Move to Next Activity on Button click -

i have 2 buttons in fragment , on button click, displays toast want move activity. here's code... public class homefragment extends fragment implements view.onclicklistener { button btn,btn2; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment_home, container, false); btn = (button) view.findviewbyid(r.id.btn); btn2 = (button) view.findviewbyid(r.id.btn2); btn.setonclicklistener(this); btn2.setonclicklistener(this); return view; } @override public void onclick(view v) { switch (v.getid()){ case r.id.btn: toast.maketext(this.getactivity(), "button 1!",

osx - Android ID, IMEI and MAC tracking from Analytics SDK -

we releasing our android app in google , non google play store. does firebase analytics supports tracking of android id, imei , mac? if use analytics sdk, support both google advertising identifier , android id alongwith imei/mac tracking, our app banned release? , how should integrate firebase or other sdk if non-google play store not support google advertising identifier? thanks, praveen firebase analytics captures advertising identifier on google play devices, not primary user key. instead, unique id generated each instance of app on device, , behavior consistent across google play , non-google play devices.

python - Look for a string object from a list in another list -

i doing little project in program unscrambles string , finds every possible combination of it. i have 2 lists; combolist , wordlist . combolist holds every combination of word; example, combolist 'abc' is: ['abc','acb','bac','bca','cab','cba'] (only 'cab' real word) wordlist holds 56,000 words imported text file. these found in english dictionary , sorted length , alphabetically. isrealword(combolist,wordlist) function test words in combolist real checking if in wordlist . here's code: def isrealword(combolist, wordlist): print 'debug 1' combo in combolist: print 'debug 2' if combo in wordlist: print 'debug 3' print combo listofactualwords.append(combo) print 'debug 4' this output: run c:/users/uzair/documents/programming/python/unscramble.py please give string of scrambled letters unscramble: abc [