Posts

Showing posts from February, 2015

html - how to align elements within a div -

i have parent div ("prizes") 3 child divs ("galleryitem"). each div has h2, img, , p element. h2 elements on same line when viewing in browser, can't figure out how align img's , p's same line well. here link code: <div class="prizes"> <h1>prizes</h1> <div class="galleryitem"> <h2>6/29</h2> <img src="ipad3.jpg"> <p>ipad mini 3</p> </div> <div class="galleryitem"> <h2>6/29</h2> <img src="xbox.png"> <p>xbox one</p> </div> <div class="galleryitem"> <h2>6/29</h2> <img src="beats.png"> <p>beats dre pro</p> </div> <div class="galleryitem"> <h2>6/29</h2> <img src="ikea.png">

c - Connecting to Bluetooth Device using bluetooth_client_connect_service() - gnome-bluetooth 3.8.2.1 -

i glad if can pointed in right direction community concerning above topic. i interested in connecting bluetooth devices using gnome-bluetooth api in ubuntu 14.04 using bluetooth_client_connect_service() function. i have tried searching not find results on how use decided read gnome-bluetooth 's source code due insufficient commenting unable understand. below have done far not errors when try running application yet when double-click on device nothing. #define agent_path "/org/bluez/agent/wizard" #include <stdio.h> #include <errno.h> #include <ctype.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <getopt.h> #include <sys/param.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <signal.h> #include <math.h> #include <glib.h> //#include <dbus/dbus.h> #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> #include &

x3d - X3DOM Custom Navigation -

does x3dom have proper way of implementing custom camera navigation? zoom when user drags zoom slider , pan when user drags across screen. x3dom have api calling pan(), zoom(), or rotate() funcitons? so far think of 3 workarounds, not ideal solutions: change viewpoint attributes manually: document.getelementbyid("the_viewpoint").setattribute("orientation", "some numbers here"); keep viewpoint fixed , change position/rotation of <transform> , contains whole 3d world reroute events. example, when user slides zoom slider, fire mousewheel event zoom. looks this functionality added recently , has yet documented the pr includes example: var d = function(selector) { return document.queryselector(selector)} x3dom.runtime.ready = function() { var x3d = d('x3d'); var viewpoint = d('viewpoint'); var x3dcanvas = x3d.runtime.canvas; var _onmousewheel = x3dcanvas.onmousewheel; x3dcanvas.onmousewh

jquery - How to enable or disable a listbox -

how enable or disable listbox control using jquery? the html code follows: <div> <select size="4" name="ctl02$ddlcompensationdates" multiple="multiple" id="ctl02_ddlcompensationdates" disabled="disabled" class="chzn" style="width: 173px; display: none;"> <option value="06/12/2015">06/12/2015</option> <option value="06/15/2015">06/15/2015</option> <option value="06/20/2015">06/20/2015</option> <option value="06/21/2015">06/21/2015</option> </select> <div class="chosen-container chosen-container-multi chosen-disabled" style="width: 173px;" title="" id="ctl02_ddlcompensationdates_chosen"> <ul class="chosen-choices"> <li class="search-field"> <input t

How to tell Visual Studio to load only the extension I'm currently debugging (and nothing more)? -

Image
i've read how debug visual studio extensions . as fact, vs2013 sets extension project automatically that. i have number of extensions (also add-ons , on: resharper, ozcode, gitextensions..). of them have slow loading times, obviously. is there way, run extension debug session on "clean" visual studio? vanilla: nothing installed except extension under debug. edit: wanted clear little: resharper not loading in experimental hive, other extensions are, though welcome wonderful world of visual studio extensibility! in order prepare environment serious extension development, need several things, involving moving installed extensions around , changing visual studio configuration files. below brief explanation process: prerequisites before going further, here necessary "knowledge" every extension developer needs posses: what's pkgdef? - important information visual studio package format vsix discovery - how visual studio discovers ,

arrays - Needs Logic explanation java reverse string -

this question has answer here: how can char array in reverse order? 5 answers question of reverse string without using string function didn't inner loop why s.length()-1 ? why -1 ? have multi dimensional arrays? char ch[]=new char[s.length()]; for(i=0;i < s.length();i++) ch[i]=s.charat(i); for(i=s.length()-1;i>=0;i--) system.out.print(ch[i]); found code the indices of java string's characters go 0 string's length - 1 (just indices of java array start in 0, indices of string). therefore in order print string in reverse order, second loop iterates s.length()-1 0. prior that, first loop iterates 0 s.length()-1 in order copy characters of string character array. this has nothing multi-dimensional arrays.

jquery - Add and Return Value From Function With Json -

i have function uses ajax , json values table review. json works. gives value need. now, wanna add every value got inside tr , td , return it. gives '' or blank value. hope there solution :) function get_review(id_jurnal){ var row= ''; var example = (function () { function self() { } self.request = function (params) { $.ajax({ data: "idjurnal_review="+id_jurnal, url: "php/ambildata.php", cache: false, async: true, success: function ($json) { params.success($json); } }); }; return self; })($); var locale = example.request({ async: true, // set false enable synchronized calls url: "php/ambildata.php", success: function ($json) { locale = $json; var response = eval("(" + $json + ")"); for(i=0;i < response.messages.pesan.length; i++) { id_review = res

Mysql Error when creating trigger -

error note:error : have error in sql syntax; check manual corresponds mysql server version right syntax use near '@sum int default 0; set @sum=(select count(*) inserted); if @sum>1 ' @ line 5 and code: delimiter // create trigger insert_only_one after insert on sc each row begin declare @sum int default 0; set @sum=(select count(*) inserted); if @sum>1 print('dont insert more 1 record'); rollback transaction end the error note shows have error @ line 5. tried int(5) or 'int', or without default 0 still can't work. you don't need declare variable because using @sum variable initialized automatically.. you can't print inside trigger... also command rollback transaction invalid mysql. use rollback semicolon..

ios - Is the stack size of iPhone fixed? -

when trying adjust of stack size of threads: - (void)teststack:(nsinteger)n { nsthread *thread = [[nsthread alloc]initwithtarget:self selector:@selector(dummy) object:nil]; nsuinteger size = 4096 * n; [thread setstacksize:size]; [thread start]; } - (void)dummy { nsuinteger bytes = [[nsthread currentthread] stacksize]; nslog(@"%@", @(bytes)); } - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. (nsinteger = 126; <= 130; i++) { [self teststack:i]; } return yes; } in output, size not changed: 2015-06-19 11:05:06.912 stack[52982:2082454] 524288 2015-06-19 11:05:06.913 stack[52982:2082457] 524288 2015-06-19 11:05:06.913 stack[52982:2082456] 524288 2015-06-19 11:05:06.913 stack[52982:2082458] 524288 2015-06-19 11:05:06.913 stack[52982:2082455] 524288 is iphone stack size fixed? p.s. testing above in

javascript - Code works when running node console but not when invoking node <app_name.js> -

i'm using: npm install babyparse --save when invoking node in terminal (os x yosemite), run following commands , see output: > var baby = require('babyparse'); undefined > var fs_test_data = baby.parsefiles('fs_test.csv'); undefined > var rows = fs_test_data.data; undefined > rows.foreach(function(element, index, array){ ... console.log(element); ... console.log(index); ... }); [ '3000', ' 1000', ' 2000', ' 30', ' 0', ' 1', '' ] 0 [ '3000', ' 1000', ' 2000', ' 40', ' 0', ' 5', '' ] 1 undefined > that's great! works! but.... //test_babyparse.js var baby = require('babyparse'); var fs_test_data = baby.parsefiles('fs_test.csv'); var rows = fs_test_data.data; rows.foreach(function(element, index, array){ console.log(element); console.log(index)

html - Why is vertical-align: bottom not working? -

i have section of code header portion of website: .nav { position:relative; display:inline-block; } #header-image { display:inline-block; position:relative; height:50%; } .header-container { height:6vw; position:relative; vertical-align: bottom; } <div class="header-container"> <a href='index.html'> <img src='img/logo.png' alt="logo" id='header-image'/> </a> <nav class="nav"> <ul> <li><a href='aboutus.html'>about us</a></li> <li><a href='activities.html'>activities</a></li> <li><a href='google.ca'>media</a></li> <li><a href='google.ca'>contact us</a></li> </ul> </nav> </div> i wanted bottom o

jquery - Mobile menu's jerky sliding animation -

when viewing my page (login = "mmt" | pass = "mmt_nv2014") viewport width below 1068px or on mobile phone, hamburger icon (top left) opens menu sliding left via code: $( '#mobile_left_menu_icon' ).click(function() { if( $('#mobile_left_menu').css('left') == '-280px' ) { $( "#mobile_left_menu" ).animate( { left: "0" }, open_delay, 'easeinoutexpo' ); $( "#wrapper" ).animate({ left: "280px" }, open_delay, 'easeinoutexpo' ); $( "#mobile_top_menu" ).animate({ left: "280px" }, open_delay, 'easeinoutexpo' ); $( 'body' ).addclass( 'overflow_hidden' ); } else { $( "#mobile_left_menu" ).animate({ left: "-280px" }, close_delay, 'easeinoutexpo' ); $( "#wrapper" ).animate({ left: "0" }, close_delay, 'easeinoutexpo' );

java - AVL Trees: How to properly rebalance? -

i'm writing avl tree class , professor has included tests our code. have passed tests except three, , 3 tests i'm failing seem indicate when elements added or removed tree, tree doesn't balance when necessary. i've been trying debug it, can't seem find error. please point out i'm missing? edit: failed tests: removeroot - removes root of avl tree , replaces successor. addmanysingle - adds several elements , forces single rotation. addmanydouble - adds several elements , forces double rotation. private int count, height; private avlnode < e > root; public avltree() { root = null; count = 0; height = 0; } //the private inner node class private class avlnode < e > { private int height, bf; private e data; private avlnode < e > left, right; public avlnode() { data = null; left = right = null; bf = 0; height = 0; } public avlnode(e data) { this.data = data;

c# - JSON how to ignore missing object during deserialization -

i have sample json when deserialize "object reference not set instance of object" because found out field missing reappear again. the json similar this { "title": "example", "type": "object", "properties": { "firstname": { "type": "string" }, "lastname": { "type": "string" }, "age": { "description": "age in years", "type": "integer", "minimum": 0 } } } if deserialize , map corresponding fields result ok but if example "age" missing { "title": "example", "type": "object", "properties": { "firstname": { "type": "string" }, "lastname&q

python - Django: Overwrite ROOT_URLCONF with request.urlconf in middleware -

i trying overwrite root_urlconf url when request contains "api" subdomain , have far. from django.utils.cache import patch_vary_headers class subdomainmiddleware: def process_request(self, request): path = request.get_full_path() root_url = path.split('/')[1] domain_parts = request.get_host().split('.') if (len(domain_parts) > 2): subdomain = domain_parts[0] if (subdomain.lower() == 'www'): subdomain = none else: subdomain = none request.subdomain = subdomain request.domain = domain if request.subdomain == "api": request.urlconf = "rest_api_example.urls.api" else: request.urlconf = "rest_api_example.urls. i tried using set_urlconf module "from django.core.urlresolvers" didn't work. missing here? interestingly, used set_urlconf module , request.urlconf set url path , it's working! django

mongodb - php mongo Uncaught exception 'MongoDuplicateKeyException' E11000 -

i trying migrate data mysql mongo. adds 1 record fine mongo on second record getting fatal error: uncaught exception 'mongoduplicatekeyexception' message 'localhost:27017: e11000 duplicate key error index: app.hospitals.$_id_ dup key: { : objectid('558365d7423467484bd63af3') }' not sure doing wrong here code <?php //echo phpinfo(); $host = "localhost"; $user = "root"; $password = "root"; $database = "database"; // create connection $conn = new mysqli($host, $user, $password, $database); $connection = new mongoclient(); $db = $connection->database; $collection = $db->hospitals; // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select * hospitals"; if($result = $conn->query($sql)){ $i=0; while($row = $result->fetch_assoc()) { foreach($row $key=>$value){ $collection->

Print new line not working in Python -

the \n doesn't seem work me when use print. using python 2.7.8. don't whats wrong, think \n print should print new line straight forwardly. import sys import os import subprocess collections import ordereddict import xmlrpclib import hawkey op_name = sys.argv[1] pkg_name = sys.argv[2] # hawkey configurations sack = hawkey.sack() path = "/home/thejdeep/test_repo/repodata/%s" repo = hawkey.repo("test") repo.repomd_fn = path % "repomd.xml" repo.primary_fn = path % "b6f6911f7d9fb63f001388f1ecd0766cec060c1d04c703c6a74969eadc24ec97-primary.xml.gz" repo.filelists_fn = path % "df5897ed6d3f87f2be4432543edf2f58996e5c9e6a7acee054f9dbfe513df4da-filelists.xml.gz" sack.load_repo(repo,load_filelists=true) # main function if __name__ == "__main__": print "querying repository\n" print "-----------------------\n" print "found packages :\n" print "--------------\

c# - How to minimize the memory used by array -

i trying optimize memory usage in game. lot of memory taken huge array of struct: /// <summary> /// represents keyframe in animation track. /// </summary> public struct bonekeyframe { /// <summary> /// creats new bonekeyframe. /// </summary> /// <param name="transform">the transform keyframe.</param> /// <param name="time">the time in ticks keyframe.</param> public bonekeyframe(matrix transform, long time) { this.transform = transform; this.time = time; } /// <summary> /// transform keyframe. /// </summary> public readonly matrix transform; /// <summary> /// time keyframe. /// </summary> public readonly long time; } i want replace transform member custom class/struct. should contain optional translation vector3, optional scale vector3 , rotation quaternion (vector4). how can design becomes compact possible

ios - Am I using correctly the requestImageForRequest at DFImageManager? -

i'm using lib called dfimagemanager , , i'm not quite sure i'm going right way. i led believe within completion block of requestimageforrequest info can used detect if request success. however, 10% of time info nil image has value. what info param for? when info nil , can still use value of image ? dfimagerequestoptions *options = [[dfimagerequestoptions alloc] init]; options.expirationage = 60; dfimagerequest *request = [dfimagerequest requestwithresource:[nsurl urlwithstring:imageurl] targetsize:imageview.frame.size contentmode:dfimagecontentmodeaspectfill options:options]; [[dfimagemanager sharedmanager] requestimageforrequest:request completion:^(uiimage *image, nsdictionary *info) { if (info != nil) { [imageview setimage:image]; } else { // use placeholder } }]; completion block guaranteed called on main thread. completion block called synchronously when requested image can retr

asp.net mvc - Fill a combo depending on user choice -

i have combo 1 contains quantity , combo 2 contains max value selected in combo 1 how can set values of combo 2 after user change combo 1 combo 1: @html.dropdownlistfor(model => model.qtitetobuy, new selectlist( new list<object>{ new { value = 0 , text = "0"}, new { value = 1 , text = "1"}, new { value = 2 , text = "2"}, new { value = 3 , text = "3"}, new { value = 4 , text = "4"}, new { value = 5 , text = "5"}, new { value = 6 , text = "6"}, new { value = 7 , text = "7"}, new { value = 8 , text = "8"}, new { value = 9 , text = "9"} }, "value", "text")) if user choose combo1 = 4 should have in combo 2 0 4 @melom made sample

c++ - Pointer Referring to an Array -

recently, i've been trying strengthen skills pointers, , ran following issue: i have following piece of code, run runtime error. tried looking stuff iterating through pointer represents array, couldn't find anything. could me find problem? #include <bits/stdc++.h> using namespace std; int main() { int * arr; arr[0]=1; arr[1]=2; (int g=0; g<2; g++) cout << arr[g] << '\n'; } you haven't declared storage array, nor arr pointing first element of array (dereferencing undefined behavior ). you missing like: int solve[2]; int * arr = solve; or int solve[2]; int * arr = &solve[0]; both ways assign address of correctly allocated storage within scope arr , , dereferencing it, defined behavior.

algorithm - risk of "big" computations on hardware -

assuming doing big computations (i know that's relative... , i'm not gonna specify nature of operation keep question open, may sorting data, searching elements, calculating prime factors of long number... ) using badly designed, brute force algorithmes or itterative process results, can approach have bad effetcs on cpu or ram on long period of time ? intensive processing increase heat generated cpu (or gpu) , ram (to smaller degree). recent cpu chips have ability slow down once heat exceeds thresholds prevent damage cpu. typically indicate failure in cooling system though. i not believe there other issues other electricity consumption , overheating risks.

c++ - Multiple client and single server handling -

will approach work? i gonna present code in simplified form easier readability. trying implement multiple client/one tcp server. my listener loop this(as thread) handles connections void waitandacceptconnection(){ if(socket_temp = accept(sock_listen, (sockaddr*)&address, &addresssize)) { socketsmanager.push_back(socket_temp); currcount++; std::cout<<"\n connection found!"<<std::endl; send(socketsmanager[currcount], "welcome! have connected athena server", 46,null); // cond.notify_one(); //notify waiting thread } } wherein have.. std::vector<socket> socketsmanager; //handles socket int currcount=-1; //keep track on number of connections if client connected currcount increased one, in our case it's gonna currcount = 0 , socketsmanager[0] store accept's return. if 1 connected currcount = 1 socketsmanager[1] handler. for

parallel processing - OpenGL: draw particles at the same time -

i reading article "particles / instancing" here quote: clearly, need way draw particles @ same time. there many ways this; here 3 of them : (a) generate single vbo particles in them. easy, effective, works on platforms. (b) use geometry shaders. not in scope of tutorial, because 50% of computers don’t support this. (c) use instancing. not available on computers, vast majority of them. yes, (a) implemented @ same time. for (c), thought gldrawarraysinstanced equal loop of gldrawarrays. real same-time implementation? for (b), think use vertex have same effect. for instancing, gldrawarraysinstanced has same visual effect calling gldrawarrays multiple times, however, if driver has support true instancing (which desktop gpu drivers will, , many mobiles), perform better. savings, due less data transfer between cpu , gpu, , fewer gl api calls. these days, geometry shaders on vast majority of desktop gpu drivers - article fe

wordpress - CSS 'background-attribute: fixed' but for image -

i want edit wordpress site using theme's css, want make header image fixed when scrolled problem header not background image, picture. i know if can background image: .homebg { background-image: url('someimage.jpg'); background-attribute: fixed; } but command use if case: .homebg { content: url('someimage.jpg'); /*make image stay when scrolled*/ } note: changing "content" "background-image" not work theme using. you try position:fixed; change: .homebg { content: url('someimage.jpg'); } to: .homebg { content: url('someimage.jpg'); position:fixed; top:0px; left:0px; } it's important note when using top:0px; left:0px; or alternatively right:0px; position elements via position:fixed; position fixed relative entire browser window. may need adjust z-index of .homebg if becomes fixed on top of other elements. more information on position http://css-tricks.

r - how to use select for multiple fields using dplyr -

i have character vector of field names want select using dplyr. i'm using underscore version of select_(). select(mtcars, mpg) # works ok select(mtcars, mpg, disp, am) # works ok multiple fields now let's use underscore version fie <- c("mpg") select_(mtcars, fie) # works ok 1 fie <- c("mpg", "disp", "am") select_(mtcars, fie) # problem: returns 1 column select_(mtcars, ~fie) # problem: doesn't work i'm confused how work. suggestions? if use select: select(mtcars, one_of(fie))

ios - How do I store the High Score? -

this question has answer here: how set high score in game sprite kit , swift 1 answer saving , loading highscore in swift using nsuserdefaults 3 answers how store high score. when exit out of app high score goes 0. code determine high score. if(scoring.text > best.text){ best.text = string(score) } use nsuserdefaults. see code below... save score var defaults: nsuserdefaults = nsuserdefaults.standarduserdefaults() defaults.setobject(self.scorelabel.text, forkey: "score") defaults.synchronize() load score back var defaults: nsuserdefaults = nsuserdefaults.standarduserdefaults() if let scoreisnotnill = defaults.objectforkey("score") as? string { self.scorelabel.text = defaults.objectforkey(&

c# - Generation of new random items from a List -

i have code generates new random item ist without repetition. class text_generator { public int getwordindex(list<string> source, random value) { return value.next(0, source.count - 1); } public bool checklistlength(list<string> source) { return source.count == 0; } public string gettext(list<string> source, list<string> backup_source, random value) { if (checklistlength(source)) { source.addrange(backup_source); } ; int index = getwordindex(source, value); string result = source[index]; source.removeat(index); return result; } } then open main list , empty list. text_generator textix = new text_generator(); list<string> hi = new list<string> { "hi", "howdy", "hey" //etc }; list<string> work_hi = new l

java - Load Python class through Jython -

i'm trying load python class embedding jython in java application. the code have far is string pythonroot = main.class.getresource("/python").getpath(); pysystemstate state = new pysystemstate(); pyobject importer = state.getbuiltins().__getitem__(py.newstring("__import__")); pyobject sysmodule = importer.__call__(py.newstring("sys")); final pystring pythonpath = py.newstring(pythonroot); pylist path = (pylist) sysmodule.__getattr__("path"); path.add(pythonpath); pymodule module = (pymodule) importer.__call__(py.newstring("building.blah.again.blah2.test")); pyobject klass = module.__getattr__(py.newstring("address")); addressinterface ai = (addressinterface) klass.__call__().__tojava__(addressinterface.class); the class i'm trying access can found in /python/building/blah/again/blah2/test.py and name of class is addre

Ionic Socket.io Build on android giving Transport Pollings Issue -

i building game on ionic using socket.io communicating plays between clients. have tried connecting express server running on local host same 1 on digital ocean: var express = require('express'); var app = express(); var socketio = require('socket.io'); var server = app.listen(8080); var io = require('socket.io').listen(server); io.sockets.on('connect', function(socket) { }); it works fantastic ionic serve, , when emulate on ios, howerver, when run or emulate on android can't connect, giving me following errors: failed load resource: server responded status of 404 (not found) http:// server /socket.io/?eio=3&transport=polling&t=1434658858975-0 failed load resource: server responded status of 404 (not found) http:// server /socket.io/?eio=3&transport=polling&t=1434658860600-1 failed load resource: server responded status of 404 (not found) http:// server /socket.io/?eio=3&transport=polling&t=14346

jquery - Can C# MVC act as standalone web api service? -

lately i've been having problems returning json responses php , jquery based url. use post request as: $(document).ready(function() { (function(){ console.log("ran"); $.ajax({ type: "get", url: "https://chad-test4.clas.university.edu/employees/edit/22", datatype: "json", success: function (data) { console.log("response recieved"); console.log("success: " + data); empdata = data; }, error: function() { console.log("failed"); } }); })(); }); my controller is: public jsonresult edit(int? id) { if (id == null) { return json("error: id not exist", jsonrequestbehavior.allow

php - MySQL Trigger create multiple records based on fields changed in SQL query? -

Image
i have mysql trigger creates "task event log" record in db table when task record modified. the event record trigger creates can specific "task edited" , need more advanced. i need create separate event log records each task field modified. if task title, description, , due date changed, need make 3 event records, 1 each field modified. "task due date modified" is there way create separate event table records each task field "modified" using triggers? the main reason using triggers have mass update task page allows mass update task records , there field values. allows drag , drop change there sort order , when sot order changes on records, not make taks modified date change unless real task fields changed well. begin if not (new.date_modified <=> old.date_modified) insert apoll_web_projects_events (event_type, project_id, task_id, created_by_user_id, description, date_created) values ('7', new.project_i

html - Gutter Width Issues in Susy -

i have 24 susy column grid. i'm trying boxes each span 6 columns (so 4 per row), i'm wanting add gutters around them, withing wider container 24 columns wide. unfortunately, no matter try, can't work. seems columns not adjusting width accommodate gutters...i thought susy supposed that, no? i'm new of i've read lots of articles , posts , can't figure out answer, can give appreciated. here's code: .solutionthumbnails { @include span(24 no-gutters); @include container; @include clearfix; li { @include span(6); @include gutters(8px after); background: #666; float: left; height: 240px; display: block; &:nth-child(4) { margin-right: 0px; } } } and here's it's looking right now, ignore formatting otherwise, still coding :) (you'll see knocking fourth item down): http://i.stack.imgur.com/5tmwp.jpg because sass isn't aware of dom, susy doesn't know span , gutter mixins bein

c# - xaml binding not working as expected -

i have created simple credo (create, review, edit, delete, overview) wpf application cars learn c# , have run issue. when either adding or editing item observable collection, want allow user able browse computer picture associated car. had accomplished in code behind following: namespace carapp { public partial class mainwindow : window { public mainwindow() { initializecomponent(); } /// <summary> /// open browser window when user clicks on 'browse' button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void add_browse_button_click(object sender, routedeventargs e) { //send path textbox addpicturepath.text = this.browse(); } ///// <summary> ///// open browser window when user clicks on 'browse' button ///// </summary> ///// <param name="sender"></param>

multi select - Use jQuery to check for number of options NOT selected in a multiselect -

i have multiselect has huge list , i'm not allowed have option says "all". but in background still want check see if selected or not. saw/had snippet of code did before can't find it. remember doing checking see if number of options not selected equal 0, knew options selected. i want check on 1 line if can: $("#my-multiselect:not(:selected)").length === 0 but $("#my-multiselect:not(:selected)").length returning 1 or 0 true or false imagine. using :not() incorrectly? or else need exact count? you missing space: $("#my-multiselect :not(:selected)").length === 0 because want select options inside #my-multiselect element.

matlab - How do I make complex int16 numbers in octave? -

in matlab (my version happens r2010b) 1 can convert complex double complex int16 type so: >> = 8.3+4.9j; >> ai16 = int16(a) ai16 = 8 + 5i >> whos ai16 name size bytes class attributes ai16 1x1 4 int16 complex i.e. ai16 complex int16 type (equivalent c++ complex< short > example). octave (ver 4.0.0) not 1 bit: >> ai16 = int16(a) error: invalid conversion complex scalar int16 scalar i trying port legacy matlab code octave. have suggestion on how around in painless way? thought of this: ai16.real = int16(real(a)); ai16.imag = int16(imag(a)); but propagate lot of pain through out code base. there many arrays have been converted complex double complex int16. , these arrays used in many computations.

C++ Reference Variable Declaration Syntax Reasoning -

all other declaration syntaxes in c++ make lot of sense, examples: int i; i int int *i; when i dereferenced, result int int i[]; when i subscripted, result , int int *i[]; when i subscriped, result derefrenced, final result int but when @ syntax reference variables, otherwise consistent reasoning falls apart. int &i = x; “when address of i taken, result int ” makes no sense. am missing something, or exception apparent reasoning behind other sytaxes? if exception, why syntax chosen? edit: this question addresses why & symbol may have been chosen purpose, not whether or not there universally consistent way read declarations different way described above. once bound, reference becomes alias referent, , cannot distinguished (except decltype ). since int& used int is, declaration-follows-usage syntax not work declaring references. the syntax declaring references pretty straightforward, still. write down declaration correspon

ruby - Rails / RSpec factory girl testing with invalid model produces strange behaviour -

i testing rails controller rspec , factory_girl my actions returns error messages in json format 412 status in case of invalid attributes format.json{render json: user.errors.messages, status: 412} like when trying test functionality let(:invalid_attributes){ factorygirl.attributes_for(:user,password: "password") } "returns error if invalid attributes" post :create,{user: invalid_attributes},valid_session expect(response).to have_status(412) end i error failure/error: expect(response).to have_status(412) expected #<actioncontroller::testresponse:0x00000006f4cc10> respond `has_status?` if try test it "returns error if invalid attributes" user = factorygirl.build(:user,invalid_attributes) post :create,{user: invalid_attributes},valid_session expect(response.body).to eq(user.errors.messages.to_json) end i error failure/error: expect(response.body).to eq(user.errors.messages.to_json) expecte

mysql - Most Efficient way to write HAVING condition -

i completing more join operations tutorial of sqlzoo , encountered following code answer #12: select yr,count(title) movie join casting join actor on actorid=actor.id , movie.id=movieid name='john travolta' group yr having count(title)= (select max(c) (select yr, count(title) c movie join casting on movie.id=movieid join actor on actorid=actor.id name='john travolta' group yr) t ) is there not more concise way express code? yes. if understand quesiton correctly more simple. select yr,count(title) movie join casting on movie.id=movieid join actor on actorid=actor.id name='john travolta' group yr having count(title) > 2

https - How can I send this XML request to my server and have it send to and get a response from another server -

my situation need send xml request user validation server desktop application installed on multiple users workstations. validation server has strict whitelist policy not accept request multiple users ip change regularly. i think solution have desktop application send xml request coldfusion webserver, webserver somehow send validation server , send response desktop app. i've no idea how accomplish , have little control on webserver, pretty strict on can put on there. the request pretty simple on https: <?xml version ="1.0"?> <cspinput appid="asdfasdf" apppassword="asdf1234" > <account userid="johndoe" action="authenticate"> <password>mypasswd1234</password> </account> </cspinput> and response: <?xml version ="1.0"?> <cspoutput returncode="0"> <account userid="johndoe" action="authenticate"> <returnvalue>true</ret