Posts

Showing posts from July, 2013

Toolbar elements cutting due to 150% DPI - MFC C++ -

Image
the mfc application looks weird 150% dpi settings on windows 7. when display settings on windows 7 changed 150% following things happen: toolbar gets expanded lot making menu items invisible. in addition, black gap get's introduced between toolbar , application frame (as shown in new) the app used work fine while ago (as shown in old). many changes have been introduced app including integration of devexpress. nothing particularly changed in dpi settings. need in understanding why change might have occurred. , how rid of unwanted zoom effect / dpi effect.

java - How to add together elements of an Array List -

so i'm trying make cash register program takes in array of integer prices , adds them total sale price. here's snippet of code that's important do { system.out.print("enter integer price: $ "); int = in.nextint(); prices.add(i); system.out.println(); } while(in.hasnextint()); for(int i=0; i<prices.size(); i++) { int total = prices.get(i) + prices.get(i+1); } system.out.println(total); my error says "total cannot resolved variable" , earlier didn't when tried make increment in loop i+2 instead of i++. can have no idea how add these variables is right track? for(int i=0; i<prices.size(); i++) { int total = 0; int total = total + prices.get(i); } you're doing 2 things wrong here: int total = prices.get(i) + prices.get(i+1); you're declaring total inside for loop. outside default value of 0 . adding values of current iteration , next iteration. want total = total + prices.get(i); or total += prices...

emulation - emulate right click when you click -

right clicking mouse brings several choices, 1 being "open link in new window" now, enter code when left-clicks on link, emulates right click option mentioned. i've looked everywhere... is possible? thank you the attribute _target="blank" open in new tab or window. <a href="http://google.com" target="_blank">my link</a>

java - javaFX - resizing TextArea/other UI controls with main application window -

in javafx application need update handle window resizing. want when window gets bigger keep aligned same , have textarea grow proportionate window , similar when making smaller. i set min , max height fit buttons on right-hand side (decreasing spacing little gets smaller). i'm figuring out anchorpane not best option , hoping little guidance on better approach. text area using custom, extending styledtextarea (richtextfx api). last spec want text field , button under text aligned text area , think pane make distance between textfield , button cumbersome approach (i planning on not making resizable). image reference : text app image any appreciated. if makes difference, entire layout inside borderpane center. <?xml version="1.0" encoding="utf-8"?> <?import java.lang.*?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.anchorpane?> <?i...

mysql - SQL c# determining type of sql server -

does know of way, programmatically, determine if sql server mysql or mssql installation? i've got app in c# has able connect either mysql or mssql. can connect either if know is, can't tell connection settings because server name, userid, password, , database name. i can have settings file store type of server, opens avenue user error i'd avoid. try connect mysql , if fails, handle error gracefully try connect mssql. loosely similar might work ... string finddbtype(string connectionstring) { try { // try connect mysql return "mysql"; } catch() { try { // try connect mssql return "mssql"; } catch() { return "cannot determine db type" } } } you want handle errors incorrect password separately, should started.

php - Get a value from object -

my query return stdclass of objects how can value of - affected_rows - object ( [affected_rows] => 0 [connect_errno] => 0 [connect_error] => [errno] => 0 [error] => [error_list] => array ( ) [field_count] => 0 [host_info] => localhost [stat] => uptime: 261195 threads: 5 questions: 14167 slow queries: 0 opens: 2969 flush tables: 1 open tables: 191 queries per second avg: 0.054 [thread_id] => 1593 [warning_count] => 0 ) [result:protected] => mysqli i tried pass objects array dont works thanks properties of object accessed -> var_dump($object->affected_rows);

parallel processing - Is there a constant-time algorithm for generating a bandlimited sawtooth? -

Image
i'm looking feasibility of gpu synthesized audio, each thread renders sample. puts interesting restrictions on algorithms can used - algorithm refers previous set of samples cannot implemented in fashion. filtering 1 of algorithms. bandpass, lowpass, or highpass - of them require looking last few samples generated in order compute result. can't done because samples haven't been generated yet. this makes synthesizing bandlimited waveforms difficult. 1 approach additive synthesis of partials using fourier series. however, runs @ o(n) time, , slow on gpu point gain of parallelism lost. if there algorithm ran @ o(1) time, eliminate branching , 1000x faster when dealing audible range. i'm looking dsf sawtooth. i've been trying work out simplification of fourier series hand, that's really, hard. because involves harmonic numbers, aka singularity of riemann-zeta function. is constant-time algorithm achievable? if not, can proven isn't? ...

jquery - AJAX, PHP returning undefined or nothing -

i have 3 files. 1.) file displaying it <div id="tweet"> </div> this should displayed. 2.)the php file gets data database function ajaxgettweets() { $stmtselecttweets = $this->db->prepare('select * tweets'); $stmtselecttweets->setfetchmode(pdo::fetch_assoc); $stmtselecttweets->execute(); $data = $stmtselecttweets->fetchall(); print_r(json_encode($data)); } this function return result in json, got right format when use print_r 3.) js file ajax $( document ).ready(function() { $.get("homescreen/ajaxgettweets", function( o ) { for(var = 0; < o.length; i++) { $("#tweet").append("<div>"+o[i].tweet+"</div>"); } }, "json"); }); when leaving "json" @ end of $.get function got result in div undefined, when using "json", got nothing. in console got warning like: ...

javascript - Call Java method by using Ajax -

this in reference this stack overflow post . want similar: on specific event, want javascript call ajax function call java method. person answered questions said create jsp file (for java code). java code use jar files, import these jar files jsp file? better approach create servlet? (as side note, jsp file contain of java code?)

unity3d - get the mesh from a cloth and restore it in Unity 5 -

i'm converting unity 4 project unity 5. understand interactivecloth has been changed cloth rendering performance reasons. in old project, saving mesh of interactivecloth, can restore default state when level starts over // save mesh netmeshsave = net.mesh; public void resetnetmesh() { unityengine.object.destroyobject(net.mesh); net.mesh = (mesh)mesh.instantiate(netmeshsave); } is there preferred way mesh cloth , restore in unity 5? i can see cloth.mesh no longer exists in unity 5 api this best workaround i've found far. restores cloth's mesh default state, not arbitrary saved state: public void resetnetmesh() { net.getcomponent< skinnedmeshrenderer>().enabled = false; net.getcomponent< cloth>().enabled = false; net.getcomponent< cloth>().enabled = true; net.getcomponent< skinnedmeshrenderer>().enabled = true; }

php - How do you document restler api endpoints which are implemented in a base class? -

let's have base class , several derived classes. base class implements method want exposed on derived classes, want swagger docs reflect each class properly. proper way this? or have override methods provide unique documentation methods? if need documentation unique override methods , call parent::{methodname}(); inside , document overriding method

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo...

java - reference to println is ambiguous error -

i have code basic program when type system.out.println, thes error: "reference println ambiguous" , occured randomly use work , did not have erroe , cant figure error occurs, how fix ,than you. package blue.light; //name is: slash import java.util.*; public class bluelight { public static void main(string[] args) throws interruptedexception { scanner scan = new scanner(system.in); string name; int age; string a; string yes; string no; double num1; double num2; double ans; system.out.println("hello, name slash"); system.out.println("what name?"); name = scan.nextline(); system.out.println("hello " + name); thread.sleep(1000); system.out.println("how old you?"); age = scan.nextint(); if(age < 18) { system.out.println("ur young af"); } else if (age == 21) { system.ou...

cron - How to use rawCollection for aggregate in meteor? -

i need use bulk operations aggregate in order delete duplicates condition in database . tried use rawcollection() don't know how. here's code need execute cron every x hours function removedups() { var count = 0, collection = beatmaps.rawcollection(), bulk = collection.initializeunorderedbulkop(); collection.aggregate([ { '$sort': { 'difficultyrating': -1 }}, { '$group': { '_id': '$beatmapset_id', 'ids': { '$push': '$_id' }, 'count': { '$sum': 1 }}}, { '$match': { 'count': { '$gt': 1 }}} ]).foreach(function(doc) { doc.ids.shift(); bulk.find({'_id': { '$in': doc.ids }}).remove(); count++; if(count === 100) { bulk.execute(); bulk = collection.initializeunorderedbulkop(); } }); if(count !== 0) { bulk.execute(); } } but produces error: cannot call method 'foreach' of unde...

javascript - Multer not accepting files in array format gives 'Unexpected File Error' -

multer module used along node js , express upload files. using ng-file upload module on angular side. when sending multiple files 1 one works fine without errors whatsoever when sending files in 1 go in array format , making necessary changes on server side suggested multer's github, still error comes. here error error: unexpected field @ makeerror (c:\nodefiles\new\node_modules\multer\lib\make-error.js:12:13) @ wrappedfilefilter (c:\nodefiles\new\node_modules\multer\index.js:39:19) @ busboy.<anonymous> (c:\nodefiles\new\node_modules\multer\lib\make-middleware.js:109:7) @ busboy.emit (events.js:118:17) @ busboy.emit (c:\nodefiles\new\node_modules\multer\node_modules\busboy\lib\main.js:31:35) @ partstream.<anonymous> (c:\nodefiles\new\node_modules\multer\node_modules\busboy\lib\types\multipart.js:209:13) @ partstream.emit (events.js:107:17) @ headerparser.<anonymous> (c:\nodefiles\new\node_modules\multer\node_modules\busboy...

linux - Why is echo showing the command itself and not the command output -

why echo showing command , not output of command once start using in loop? example command works root@linux1 tmp]# iscsiadm -m node |awk '{print $1}' 192.168.100.88:326 but not in loop [root@linux1 tmp]# in 'iscsiadm -m node | awk '{print $1}'';do echo $i;done iscsiadm -m node | awk {print } i want command print first field can add other functionality loop. thanks edit -- not sure why got voted down on question. please advise. you're not executing iscsiadm , awk commands, because quoted it; makes literal string. substitute output of command command line, use $(...) for in $(iscsiadm -m node |awk '{print $1}'); echo $i done

c - How do I use free() properly to free memory when using malloc? -

i have been using pointers , malloc , not know how use free() properly. have program allows user add record of data when select specific option. program allows function happen once , segfault. not think using free() , hoping point out problem. have global variables: int records = 5; int access = 0; //initialize access counter 0 int count = 0; struct childrensbook *first; //initialize first pointer struct childrensbook *last; //initialize last pointer struct childrensbook *temp; //initialize temp pointer i have start of main function include predefined records: int main(void) { last = (struct childrensbook *) malloc(records * sizeof(struct childrensbook)); //allocate memory "last" pointer first = last; memcpy(last->title, "we're going on bear hunt", 27); //beginning of predefined records memcpy(last->author, "michael rosen", 14); last->price = 7....

optimization - NGINX For 100K+ R/S -

i trying tune nginx insane amounts of traffic. i have huge dedicated server , website keeps going down during times of high traffic. although when check top, see no cpu usage. how can increase amount of cpu nginx uses? here current nginx configuration user www-data; worker_processes 16; worker_rlimit_nofile 819200; pid /var/run/nginx.pid; events { worker_connections 161920; # multi_accept on; use epoll; multi_accept on; } http { # set client body size 2m # client_max_body_size 2m; ## # basic settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 15; types_hash_max_size 8096; # server_tokens off; server_names_hash_bucket_size 256; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # logging settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # gzip settings #...

sql - Why Can't I Connect to My Database Over the Internet -

i have sql database called roottesting , manage @ ip 192.168.1.121. have simple java application connects (or rather, supposed connect it) on internet user named 'user' has host of '%', know make usable computer uses it. here method in program connects database: public void addtestentry(testentry testentry) throws classnotfoundexception, sqlexception { tests.add(testentry); class.forname("com.mysql.jdbc.driver"); string url = "jdbc:mysql://192.168.1.121/roottesting"; con = drivermanager.getconnection(url, "user", "s@cajaw3a"); preparedstatement statement = con .preparestatement("insert tests values(?, ?, ?)"); statement.setstring(1, testentry.getname()); statement.setint(2, testentry.getcorrect()); statement.setint(3, testentry.getincorrect()); statement.executeupdate(); con.close(); } this work every time download program on computer on home net...

angularjs - Why is data variable undefined in resource query transform -

i new angular...so sure doing wrong. spent hours trying search solution angularjs documentation next useless...and pretty every example out there tries set @ global level. i trying pass complex javascript object query prameter. object has property array , need flatten (proper term ??) object mvc binding can correctly instantiate model. the object trying pass along lines of newrequest = { searchterms: 'error', pagesize: 25, ... facets: [ { field: 'createdby', value: 'joe' }, { field: 'createdby', value: 'mary' } ] } i declared resource follows (function () { "use strict"; angular .module('common.services') .factory('searchresource', ['$resource', 'appsettings', searchresource]); function searchresource($resource, appsettings) { return $resource(appsettings.searchpath, null, { query: { method: 'g...

(Java) Printing text letter by letter in console- ft. Lag -

so i'm making game uses nothing console in java ide, have problem using delays. goal create method when taken text passed though parameters, prints letter letter delay of 50. (kind of text in pokemon series, how scrolls though each letter). the problem have lag. i'm running amd fx-8350 cpu (4ghz, 4 cores+4 virtual cores). whenever change delay amount around , under 100 milliseconds, console prints half word, little bit of other half, half sentence, maybe character, etc. i've tried code here (it works, lag): public void scroll(string text){ int delay = 50; actionlistener action = new actionlistener() { int counter = text.length(); @override public void actionperformed(actionevent event) { if(counter == 0) { timer.stop(); } else { system.out.print(text.substring(text.length() - counter, ((text.length() - counter) + 1))); ...

javascript - cannot get html extension when using handlebars -

Image
sorry might silly question cannot figure out. using express-handlebars , want name file newpage.handlebars. keeps on saving text file. however, want html extension name newpage.handlebrs. have friends file did away can't ask him. here picture of did , doing.his file mypage.handlebars while mine in newpage.handlebars. how should fix this. lot! copy friend's file, , paste it. get content inside current .handlebars file, , paste inside new copied file remove old .handlebars file, , rename copied 1 have name yours had

ruby on rails - How to pass parameters when using JSON? -

i can't images save because of unpermitted parameter: image error . using dropzone.js , have upload form json if want have ability drag , drop images on file field. i'm trying allow 1 image uploaded model. here code: items.rb class item < activerecord::base ..... validates_inclusion_of :found, in: [true, false] has_attached_file :image, :styles => { :medium => "350x350>", :thumb => "100x100>" } validates_attachment :image, content_type: { content_type: [ "image/jpg", "image/jpeg", "image/png" ] }, size: { in: 0..1.megabytes }, matches: [/png\z/, /jpe?g\z/] end items.coffee $('#new_item').dropzone acceptedfiles: '.jpeg, .jpg, .png' maxfilesize: 1 maxfiles: 100 addremovelinks: true paramname: 'item[image]' clickable: '#image-preview' headers: "x-csrf-token" : $('meta[name="csrf-token...

swift - Export video to the size of the UIImagePickerController view -

i have app user take video using uiimagepickercontroller. then create watermark on top of recorded video , export avassetexportsession. i'm guessing need use cgaffinetransformscale , transform export right size, i'm new transforming. what kind of transform use crop video size of uiimagepickercontroller's view? func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : anyobject]) { let videopath = info[uiimagepickercontrollermediaurl] as! nsurl let stringvideopath = videopath.path //add watermark starting here let videoasset = avurlasset(url: videopath) let mixcomposition = avmutablecomposition() let compositionvideotrack = mixcomposition.addmutabletrackwithmediatype(avmediatypevideo, preferredtrackid: kcmpersistenttrackid_invalid) let clipvideotrack = videoasset.trackswithmediatype(avmediatypevideo)[0] { try compositionvideotrack.inserttime...

ios - How to get UITableViewCell subviews in iOS8? -

where can find uitableviewcelleditcontrol inside uitableviewcell . i'm running old code needs ui fix on quick deadline. don't have enough time couldn't find other way. the app should supporting ios 8.0 , above. how it? current code: for (uiview *subview in [self subviews]) { if ([subview iskindofclass:nsclassfromstring(@"uitableviewcelleditcontrol")]) { //this condition never gets true ... } } like above, i'm looking for uitableviewcellreordercontrol uitableviewcelldeleteconfirmationcontrol uitableviewcelldeleteconfirmationcontrol_legacy update : found that, shall access & uitableviewcelleditcontrol uitableviewcellreordercontrol when table view in editing mode. don't found uitableviewcelldeleteconfirmationcontrol , uitableviewcelldeleteconfirmationcontrol_legacy .

c# - Destroying stream cause destroying the bitmap -

i have like: public bitmap getbitmap() { byte[] bytearray= bring somewhere using (stream stream = new memorystream(bytearray)) { return new bitmap(stream); } } when use method outside bitmap crushed. if stepped "using" scope bitmap exists , works fine. seems disposing stream cause disposing bitmap.. question is: need deep copy? how should perform it? when dispose bitmap lost, indeed need perform deep copy. code should be: public static bitmap getbitmap() { byte[] bytearray = bring somewhere using (stream stream = new memorystream(bytearray)) { var tempbitmap = new bitmap(stream); return new bitmap(tempbitmap); // deep-copy bitmap } } by way, primitive types, byte written in small case.

multithreading - Ruby GIL of MRI 1.9 -

in understanding, here's how mri 1.9 gil works: interpreter spawns new thread calling corresponding underlying c function , ask acquire "gil". if "gil" free, happy. if not, new thread wait , invoke separate timer thread set "timeslice" when current executing thread hit boundaries such return or checking backward branches, interpreter checks timer decide if context switch should happen. however, pointed article , can guarantee atomicity pure c implementing. being said, if parts of our thread contains ruby code, still in danger of race condition. my question if thread needs acquire gil before executing, why c implementation methods guarantee atomicity? thank in advance! the gvl guarantees 1 thread can execute ruby code @ same time . of course different ruby threads can execute ruby code @ different times. besides, majority of ruby implementations doesn't have gvl anyway.

java - JSTL sessionScope attribute -

i need retrieve session attribute in .jspx file , following not work: in controller set attribute follows: request.getsession().setattribute("error", 1); then try retrieve attribute in .jspx file: <c:if test="${sessionscope.error eq 1}"> <p>retrieved</p> </c:if> i not "retrieved" message. doing wrong? if use request.setatribute , don't use sessionscope, works intended. why?

AngularJS: Filter date with sql date string format -

i need add date filter have date property date string value("2015-10-15t20:00:00.000z"). huge list can't convert every object date , filter. believe there alternative this. try filter: angular.module('yourmodule').filter('datetime', function($filter) { return function(input) { var t = input.split(/[- :]/); // apply each element date function var d = new date(t[0], t[1]-1, t[2], t[3], t[4], t[5]); console.log(d); return d; }; });

Laravel 5.1 Redis cache -

i'm trying implement basic caching mechanism laravel app. i installed redis, started via terminal (src/redis-server) , changed cache file redis in laravel's config file, takes longer (1s vs 2s) regular query when use cache. am missing here? want cache query 10 minutes. here's feedcontroller.php namespace app\http\controllers\frontend\feed; use illuminate\http\request; use auth; use app\http\requests; use app\http\controllers\controller; use app\models\company; use redis; use cache; class feedcontroller extends controller { public function index() { if (cache::has('companies')) { // cache exists. $companies = cache::get("companies"); } else { // cache doesn't exist, create new 1 $companies = cache::remember("companies",10, function() { return company::all(); }); cache::put("companies", $companies, 10); ...

c# - Using Pcap.Net with thread throws 'System.NullReferenceException' -

i have method: public void rc() { try{ using (packetcommunicator communicator = device1.open(65536, packetdeviceopenattributes.promiscuous, 1000)) { richtextbox1.appendtext("listening on " + device1.description + "... \r\n"); // start capture communicator.receivepackets(0, packethandler); communicator.break(); } } catch (exception ex) { throw ex; } } and when start programm, , call method via thread othread = new thread(new threadstart(r.rc)); othread.start(); thread.sleep(1); othread.join(); it throws @ end of line "using (packetcommunicator...." an unhandled exception of type 'system.nullreferenceexception' occurred in ... additional information: object reference not set instance of object. addition info: when don't have method "rc" , thread, , code in constructor, didn't have iss...

How to search based on local time, accounting for timezones -

i have collection of shops opening hours , want know of them open. the problem shops located on world. this find query looks (i use sql example, doesn't matter): select shops.name shops left join shops_openhours on shops_openhours.shopid=shop.id shops_openhours.day=[day of week] , shops_openhours.opentime < [now time] , shops_openhours.closetime > [now time] when store working time in local time can't search because of timezones. when store working time in utc can't search because of daylight saving time. some sample records: query: select shops.name, shops_openhours.day day_of_week, shops_openhours.opentime, shops_openhours.closetime shops left join shops_openhours on shops_openhours.shopid=shop.id result: name day_of_week opentime closetime shop1 'monday' '09:00' '18:00' shop1 'tuesday' '09:00' '18:00' shop2 'tuesday' '10:00' ...

javascript - Unable to filter some value from table using angular.js -

i using roman value( i.e-i,ii,iii,......viii ) in table when trying filter table using these value value filtration process happening , value not happening using angular.js. please check code below. subject.html: <table class="table table-bordered table-striped table-hover" id="datatable" > <colgroup> <col class="col-md-1 col-sm-1"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-2 col-sm-2"> <col class="col-md-1 col-sm-1"> </colgroup> <thead> <tr> <th>sl. no</th> <th> <select style="width:100%; border:none; font-weight:bold;" ng-options="sub.name sub in nocourse track sub.value" ng-model="search" ng-change="selectedcoursetable();" > <!-- <option va...

c# - How to write .NET Core csproj with Microsoft.Build? -

for example have .csproj below <project toolsversion="15.0" sdk="microsoft.net.sdk.web"> <propertygroup> <targetframework>netcoreapp1.1</targetframework> <typescriptcompileblocked>true</typescriptcompileblocked> <ispackable>false</ispackable> </propertygroup> <itemgroup> <packagereference include="microsoft.aspnetcore" version="1.1.0" /> <packagereference include="microsoft.aspnetcore.mvc" version="1.1.1" /> <packagereference include="microsoft.aspnetcore.spaservices" version="1.1.1" /> <packagereference include="microsoft.aspnetcore.staticfiles" version="1.1.0" /> <packagereference include="microsoft.extensions.logging.debug" version="1.1.0" /> </itemgroup> <itemgroup> <!-- files not show in ide --> <n...

Python MySQL update statement does not work -

i try perform simple update statement in python 2.7 won't work @ all. hope can show me mistake: import mysqldb import datetime db = mysqldb.connect(host="localhost", # host, localhost user="root", # username passwd="", # password db="******") # name of data base cur = db.cursor() cur.execute("select * data") row in cur.fetchall(): id_row = str(row[0]) date = str(row[1]) new_date = date[:-2] new_date += "00" cur.execute("update data set date={0} id={1}".format(new_date, id_row)) db.close() the script should take date unix timestamp database cut off last 2 numbers, replace them 00 , update row in database. code replace numbers works update process not. show no error message , exits code 0. i have no idea made mistake. can help? thanks lot! shame on me! the error missing db.commit()....

c++ - Transforming a plane with DirectXTK / DirectXMath -

i have 3d plane defined 3 points , want transform 4x4 matrix using directxtk. i tried 2 ways this: transform plane plane::transform() method - gives strange result. transform 3 points , create plane transformed points - works fine. i tried transpose matrix before calling plane::transform() , got plane normal right, constant wrong (plus transposing matrix makes no sense me). void testplanetransform() { vector3 p1(-2.4f, -2.0f, -0.2f); vector3 p2(p1.x, p1.y + 1, p1.z); vector3 p3(p1.x, p1.y, p1.z + 1); plane plane(p1, p2, p3); matrix m = matrix::createtranslation(-4, -3, -2); // transform plane matrix plane result1 = plane::transform(plane, m); // transform plane transposed matrix plane result2 = plane::transform(plane, m.transpose()); // transform points matrix vector3 t1 = vector3::transform(p1, m); vector3 t2 = vector3::transform(p2, m); vector3 t3 = vector3::transform(p3, m); // plane transformed points p...

postgresql - Cannot run migrations when postgres extension added in rails 5 application -

i want use pg_trgm extension of postgres searching using query select * users location '%new%' order location desc; since postgres don't have pg_trgm need execute command install it. migration is class addtrigramindexlocationtousers < activerecord::migration[5.1] def change reversible |direction| direction.up { execute %{ create extension if not exists pg_trgm; create index index_users_trigram_on_location on users using gin (location gin_trgm_ops); } } direction.down { execute %{ drop index index_users_trigram_on_location; } } end end end so when run migration giving me error: activerecord::statementinvalid: pg::insufficientprivilege: error: permission denied create extension "pg_trgm" hint: must superuser create extension. : drop index index_users_on_location; ...

c# - Select Statement is not being read but works fine before until the Insert INTO query -

need 1 select statement cant read/execute anymore after placed insert into activity log works fine before did wrong placements? claylink.con.open(); string userid = txt_login.text; string password = txt_password.text; claylink.cmd = new sqlcommand("select usertype users username='" + userid + "'and password='" + password + "'", claylink.con); claylink.cmd = new sqlcommand("insert alog values ('" + txt_login.text + "','" + admin.lbl_username.text + "','" + admin.label7.text + "', 'login button click','')", claylink.con); datatable dt = new datatable(); claylink.adapter = new sqldataadapter(claylink.cmd); claylink.adapter.fill(dt); claylink.con.close(); try { if (dt.rows.count == 1) { if (dt.rows[0][0].tostring() == "administrator") { messagebox.show("successfully logged in administrator!"); ...

c++ - VS 2015: error C2899: typename cannot be used outside a template declaration -

Image
according thread: error c2899: typename cannot used outside template declaration ....in c++11, restriction has been lifted, , use of typename allowed not required in non-template contexts. is vs2015 not c++11 compliant? how can work round this? regarding duplicate question claim , link relevant thread: 1) provided link in original post. 2) supposed duplicate thread 9 years old predates c++11 , vs2015 topic of question.

mysql - mariadb Sql connection from excel is not working -

Image
i tried connect mariadb excel using below dialog seems not work. what doing wrong?

java - Spring Data findOne() NullPointerException -

i think i'm missing core concept, because encounter several problems, let's start one: when user subscription persisted in database , try using findone(id) , nullpointerexception . tried debug deep inside generated code , appears reason hashcode() of subscription object called, unclear reason has id set , other properties null , because (probably) take part in hashcode() method calling own hashcode() , exception. so want user part of many communities, in each of them can create subscription content. when first call subscriptioncontroller , goes fine , creates user , subscription , community , can see them in database, good. when call userrepository.findone() , crudrepository , inside userserivce - exception. i've been trying figure out 2 weeks , no luck, hope can spend time helping me this. below classes: user: @entity @data @noargsconstructor public class user { @column(nullable = false) @id private integer id; @onetomany(mappedby = ...