Posts

Showing posts from March, 2011

ios - Xcode Constraints -

i'm having problem xcode constraints. i'm laying out entire layout, selecting items , having xcode 'fill in missing constraints'. when run application in simulator, labels , textboxes not in right places. not visible @ (appear off screen) so there tips or tricks? should layout 1 item @ time, set constraints automatically move next? don't trust xcode , 'fill in missing constraints' feature. best option set constraints manually. after practice it's not hard. need indicate x , y coordinates , height/weight. i don't advice setting constraints automatically. causes more problems benefits. also check console log @ runtime. may happen there conflicts between constraints , need fix it. check out official guidlines

r - Setting weightages for Jarowinkler in compare.linkage -

i'm using compare.linkage method in record linkage package in r compare similarity of 2 set of strings. default string comparing method jarowinkler 3 default weightages set @ 1/3, 1/3 , 1/3. i want overwrite default weightages 4/9, 4/9 , 1/9. how do that? in advance. the default script is: rpairs <- compare.linkage(stringset1, stringset2, strcmp = true, strcmpfun = jarowinkler) you have create own comparison function, compares 2 strings. in function can call jarowinkler . easiest way create closure : jw <- function(w_1, w_2, w_3) { function(str1, str2) { jarowinkler(str1, str2, w_1, w_2, w_3) } } this function pass weight parameters want use. function returns comparison function can use in compare.linkage call: rpairs <- compare.linkage(stringset1, stringset2, strcmp = true, strcmpfun = jw(4/9, 4/9, 1/9)) the jaro-winkler algorithm counts number of characters match (withing bandwidth) m . 2 strings john , johan there 4 characters mat

c# - Unable to update EntityFramework models from MySQL database in Visual Studio 2015 RC -

my organization upgraded visual studio 2013 visual studio 2015 rc couple months ago, , attempted update of our existing "db-first" entityframework models our mysql database. when doing so, received following error. an exception of type 'system.argumentexception' occurred while attempting update database. exception message is: 'unable convert runtime connection string design-time equivalent. libraries required enable visual studio communicate database design purposes (ddex provider) not installed provider 'mysql.data.mysqlclient'. a quick search error produced this result november of 2013 (specifically in reference vs 2013)... apparently mysql , visual studio 2013 don't work yet. here link on mysql forums: http://forums.mysql.com/read.php?174,594798,600466#msg-600466 you'll need wait next release of mysql connector. does mean comparable issue, , have wait out until new mysql.data client available compatible vs 2015?

python - How to show two fields in view which is of same column in class in openERP -

in openerp purchase module i'm having 2 fields purchase order amendment of 'ordered quantity-old' , 'ordered quantity-new' retrieving data same column. want show 1. 1 field 'ordered quantity- old' should show current purchase order's 'ordered quantity' actual value table , should read field, 2. field 'ordered quantity- new' should not show value(should 0) , once new changed quantity given should update column in table how this? thanks in advance well, idea gave 2 fields have 1 field, can't done. create new field ordered quantity - new , let read-only . , when new quantity given update field . if still find undesirable, set second field invisible, , use helper field. there, store value in , when confirming new field take/store old value in history purposes. in view have old , new, have splited logic , user have easier time understand. third option related field if have connection different table. 'mod

javascript - JSON.parse from php's json_encode issue -

running issue parsing json recieved php backend. on php have array, send json_encode: $result[] = (object) array('src' => "{$mergedfile}", 'thumb_src' => "{$thumb_file}"); echo json_encode($result); and when trying json.parse recieve error: "uncaught syntaxerror: unexpected token f" the response looks like: [{"src":"upload\/lessons\/963\/video\/176481500-m.webm","thumb_src":"upload\/lessons\/963\/slide\/thumb_0f515a62753626e1aaefdc7968e8103e.jpg"}] very strange thing that, similar code works nearby.. looks fine.. appreciate help, thanks. you cannot json.parse() json, param must string : json.parse('[{"src":"upload\/lessons\/963\/video\/176481500-m.webm","thumb_src":"upload\/lessons\/963\/slide\/thumb_0f515a62753626e1aaefdc7968e8103e.jpg"}]'); the error receive can reproduced : json.parse([{"src":"uploa

php - Search Form Error sends to ?q= -

i'm using bootstrap theme , form this: <form class="navbar-form" role="search" method="get" action="<?=$domain?>search" onsubmit="dosubmit();"> <div class="input-group"> <input type="text" class="form-control input" placeholder="search" name="q"> <div class="input-group-btn"> <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> the original page placed http://www.domain.com/toys/search/electronics kids/ when search form "test" , press enter, sends me http://www.domain.com/toys/search/?q=test with should replace code send me to: http://www.domain.com/toys/search/test thanks in advance! i assume use jquery if use bootstrap.

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

i trying hit soap api in application login purpose , getting above mentioned error , can 1 tell me going wrong , first time soap apis. here code hit soap :- vector<object> args = new vector<object>(); hashtable<string, object> hashtable = new hashtable<string, object>(); hashtable.put("email", "mss.siddhart28@gmail.com"); hashtable.put("password", "siddharth"); args.add(hashtable); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.dotnet = true; envelope.xsd = soapserializationenvelope.xsd; envelope.enc = soapserializationenvelope.enc; (new marshalhashtable()).register(envelope); httptransportse androidhttptransport = new httptransportse( "http://tempuri.org/", 15000); androidhttptransport.debug = true; string result = ""; try { soapobject request = new soapobject("http:

django - iOS Push Notifications is not received -

backend - django frontend - objective c (x-code) i've followed this apple document configure push notifications , completed steps. for backend, using django-push-notifications django==1.7 , results no error when message sent. for frontend, have added following lines receive notification, uiusernotificationtype usernotificationtypes = (uiusernotificationtypealert | uiusernotificationtypebadge | uiusernotificationtypesound); uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:usernotificationtypes categories:nil]; [application registerusernotificationsettings:settings]; [application registerforremotenotifications]; - (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devicetoken {

sqlite - SELECT and ADD fields in SQL table -

i have db table created follows : create table mktdb( mktid number(19) not null, featureid number(20) not null, val varchar(100) not null, primary key (id) ); i want view records along additional field having current date each row in db. i tried following sqlite query erroneous : select *, current_date mktdb,date; don't know sqlite after typing "current date sqllite" in google shows me way https://www.sqlite.org/lang_datefunc.html and problem: select *, date('now') mktdb; p.s: wanted try sql fiddle. here is: http://sqlfiddle.com/#!7/92fd6/3

access vba - How to run function in vba using data macro? -

i new data macro in ms access 2013 , need it. lets assume have simple database 1 table of users. when change "age" field in table, want run external exe file (the reason why dosent matter). learn subject during last few days , end this: 1. build module in ms access called runminifix (minifix name of exe file want run). module uses shellexecute function , whole module looks that: option compare database const sw_show = 1 const sw_showmaximized = 3 public declare function shellexecute lib "shell32.dll" alias "shellexecutea" (byval hwnd long, _ byval lpoperation string, _ byval lpfile string, _ byval lpparameters string, _ byval lpdirectory string, _ optional byval nshowcmd long) long public function runminifix() dim retval long on error resume next retval = shellexecute(0, "open", "c:\program files\minifix\minifix.exe", "<arguments>", _ "<run in folde

c# - How to access ObservableCollection nested in view model -

i have simple single window wpf app using mvvm. xaml binded mainviewmodel.cs class, contains observablecollection sites. sitemodel class has property named owners, contains second observablecollection companies. i need bind companies property combobox in xaml. combobox nested in datagrid. situation described below. <datagrid name="uxsitegrid" dockpanel.dock="top" itemssource="{binding sites, source={staticresource viewmodel}}" autogeneratecolumns="false" margin="5,5,5,0" canuseraddrows="false" canuserdeleterows="true" canuserresizerows="false" canuserreordercolumns="false"> <datagrid.columns> <datagridtextcolumn binding="{binding name}" header="name"/> <datagridtextcolumn binding="{binding vseid}" header="vse id"/> <datagridtextcolumn binding="{binding imo}&quo

xcode - How can I enable UnAligned Access for ARM NEON in LLVM compiler? -

what flag enable unaligned memory access arm neon in llvm compiler. testing arm neon intrinsic program in xcode. accessing data unaligned memory: char tempmemory[32] = {0}; char * ptempmem = tempmemory; ptempmem += 7; int32x2_t i32x2_value = vld1_lane_s32((int32_t const *) ptempmem, i32x2_offset, 0); equivalent assembly intrinsic should vld1.32 {d0[0]}, [ptempmem] , compiler align next multiple of 32 , access data. because of that, program not working fine. so, how can enable unaligned access in llvm compiler? this isn't neon problem, it's c problem, , issue is: vld1_lane_s32((int32_t const *) ptempmem , i32x2_offset, 0); casting pointer message compiler saying "hey, know looks bad, trust me, know i'm doing". converting pointer type a pointer type b, if pointer not have suitable alignment type b, gives undefined behaviour. therefore compiler free assume argument vld_1_lane_s32 32-bit aligned because there's no valid way couldn't (

javascript - getting null value in list when passing by ajax call to mvc controller -

i passing list mvc controller getting null value in controller.but list has values when show in alert on client side. ajax call $("#addtiles").click(function() { usertiles = json.stringify({ 'usertiles': usertiles }); alert("entered function."); alert(usertiles[0].tileid); var url = '@url.action("addtiles")'; $.ajax({ type: "get", url: url, data: usertiles, success: function(d) { if (d.indexof('"issessionexpired":true') != -1) { location.reload(); } else { onaddtilessuccessful(d); } }, error: function() { errorinoperation(); }, contenttype: "application/html; charset=utf-8", datatype: 'html' }); }); function onaddtilessuccessful(e) { $("#tilessubmissionmsg").append(e); } function errorin

html - ng-click/onClick not working on <object> -

i'm not able invoke functions when click on image present in tag. particularly, want zoom , pan image. these functions work image tag not object tag. i've put debugger on functions called 'on click' , have put alert pop ups on click none of them seem work. how can them working? below code. <object ng-click="zoomservice.activatezoomandpan();" tb-refresh-graphic="tocservice.acti‌​ve_node.activegraphic"> </object>

How to see My newly added place in Google maps after adding by Google Places API? -

i trying add place google maps using google places api's. able response place id given particular area latitude , longitude. can view of map after adding new place ? according places api documentation android ... the resulting place object has unique place id, app can use point on retrieve place details. added places available after short time in results of get-current-place requests initiated app, , in place picker displayed app. scoping determined project id used generate api key. newly-added places enter moderation queue considered addition google places database. places not accepted moderation process continue retrievable through place id in app submitted them, no longer appear in results of get-current-place requests, api picker, or other api method. places pass moderation visible apps , on google maps. this means should able see within app via placepicker, not see inside other applications or google maps until passes moderation

Storing data in remote database using Android -

i want store data in database remotely using android, e.g, want value text box view , store in database isn't local android phone rather located @ remote location. what should i've learn that, sample code of more enough me understand , please mention tutorial links or other helping material understand how can done. it seems people use rest api connect android client server , service-side language communicate between server , database. when learnt android, people suggest me learning node.js , express , later loopback connect database used mongodb. http://cwbuecheler.com/web/tutorials/2014/restful-web-app-node-express-mongodb/ learnt node js , express through tutorials on website , think guide quite comprehensive recommend you. if prefer ignoring part of server side, mbaas, such parse, choice you. not sure best practice used node.js+express+mongodb+rest api connect android application server , learning loopback since provides more features express.

nginx - Website won't work after ssl installation -

my website working before installed ssl certificate. however, once installed, website stopped working. nginx starts fine usual, , no errors, website doesn't work. here's code nginx config: server { listen 80; server_name www.example.com; (example replaced domain name in code) location / { rewrite ^ https://$server_name$request_uri permanent; } } server { listen 443 ssl; server_name www.example.com; ssl_certificate /etc/nginx/ssl/example_com/ssl-bundle.crt; ssl_certificate_key /etc/nginx/ssl/example_com/example.key; ssl_prefer_server_ciphers on; location / { proxy_pass http://xxx.xx.xx.xxx:8004; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection 'upgrade'; proxy_set_header host $host; proxy_cache_bypass $http_upgrade; } }

osx - Xcode Cocoa text field to equal file path -

Image
how can have top text field equal path selected user? i'm new xcode appreciated. import cocoa class viewcontroller: nsviewcontroller { @ibaction func browsedmf(sender: nsopenpanel) { var openpanel = nsopenpanel() openpanel.allowsmultipleselection = false openpanel.canchoosedirectories = true openpanel.cancreatedirectories = false openpanel.canchoosefiles = false openpanel.beginwithcompletionhandler { (result) -> void in if result == nsfilehandlingpanelokbutton { } } } @iboutlet weak var textfielddmf: nstextfield! here updated code: import cocoa class viewcontroller: nsviewcontroller { @ibaction func browsedmf(sender: nsopenpanel) { var openpanel = nsopenpanel() openpanel.allowsmultipleselection = false openpanel.canchoosedirectories = true openpanel.cancreatedirectories = false openpanel.canchoosefiles = false

android - java.lang.RuntimeException: Unable to instantiate activity ComponentInfo After tapping button to hit second screen activity -

trying make memory matching game grid of imagebuttons change image after tapping, can't second screen activity start. crashes , gives me logs posted below. attached manifest, , activity second screen.i know second screen activity worked when don't have buttons initialized globally , comment out functions. begginner please help! android manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="eagle.abhishekravi.abhishek.eagle" > <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main&q

jquery - JavaScript Multiple Arrays in Object -

i'm trying display of items in list below. organized them such in order filter them out. for example, want titles separate array items contain (so titles display headers , items regular text. here code far: var general = { "hardcover" : { ["book a",4], ["book b",6], ["book c",5] } // ... other options }; (var title in general) { var title = ...; // assign title variable $('body').append("<h2>" + title + "</h2>"); for(var items in title) { // assign item variables separately var itemtitle = ...; var itemprice = ...; $('body').append(itemtitle + ": $" + itemprice); } } so final output like: hardcover book a: $4 book b: $6 book c: $5 i made quick fiddle below full list: http://jsfiddle.net/gekp6q8y/1/ http://jsfiddle.net/gekp6q8y/3/ $( document ).ready(function() { var genera

oracle - How to use two LIKE conditions? -

i need find students , m in first name not have , m in last name. query reason keeps displaying last names have m's... doing wrong? select (firstname || ' ' || lastname) "fullname" a5 lower(firstname) '%a%m%' , lower(lastname) not '%a%m%' order lastname, firstname where clause should be: where (lower(firstname) '%a%m%' or lower(firstname) '%m%a%') , lower(lastname) not '%a%' , lower(lastname) not '%m%' you including cases firstname had followed by m. similarly, excluding cases lastname had both , m, comes before m.

tdd using cpputest make errors in ubuntu 14.04 -

i trying learn cpputest, went cpputest manual , copied below code in ubuntu 14.04lts laptop, , tried make. new make files, , got bunch of errors - how can correct code? #include "cpputest/testharness.h" #include "cpputest/testoutput.h" test_group(firsttestgroup) { }; test(firsttestgroup, firsttest) { fail("fail me!"); } test(firsttestgroup, secondtest) { strcmp_equal("hello", "world"); longs_equal(1, 2); check(false); } that test.cpp , , have main below named test_main.cpp #include "cpputest/commandlinetestrunner.h" int main(int argc, char** argv) { return commandlinetestrunner::runalltests(argc, argv); } the make file is: all: test export cpputest_home=/usr/share/cpputest cppflags += -i$(cpputest_home)/include ld_libraries = -l$(cpputest_home)/lib -lcpputest -lcpputestext test: test_main.o test.o g++ -o mytest test.o test_main.o test_main.o: test_main.cpp g++ -c test_main.cpp $(cpp

django - How to sort dict list with multiple key attributes - python -

i trying sort list dict based on 2 key parameters - "id" , "type". imagine have list below dict_list = [ { "id" : 1, "type" : "snippet", "attribute" :'test'}, { "id" : 2, "type" : "snippet", "attribute" :'hello'}, { "id" : 1, "type" : "code", "attribute" : 'wow'}, { "id" : 2, "type" : "snippet", "attribute" :'hello'}, ] the end result should this. dict_list = [ { "id" : 1, "type" : "snippet", "attribute" : 'test' }, { "id" : 2, "type" : "snippet", "attribute" : 'hello' }, { "id" : 1, "type" : "code", "attribute" : 'wow' }, ] i tried method produces unique list based on "key" attribute.

how can i scroll text on a python tk/tinker Label? -

i'm trying add simple log output tk window/frame. so far found how (easily) add vertical scrollbar on canvas , entry lists , text (which fullblown text editor , has no textvariable linking support) the label can't attached scrollbar (easily) because lacks yview attribute. #my naive attempt:... self.lbl_log = tk.label(self, width=80, height=10, textvariable=self.string_log) self.lbl_log.pack(side="top") self.vsb = tk.scrollbar(self, orient="vertical", command=self.lbl_log.yview) self.lbl_log.configure(yscrollcommand=self.vsb.set) attributeerror: 'label' object has no attribute 'yview' is there easy , convenient way scroll label widget several lines in python tk? don't have use label because simple , has textvariable convenience) i'm open alternative widgets problem. no, there isn't easy way scroll label. if need scroll multiple lines, label wrong choice of widget. if need scroll multiple lines of t

mysql - Preventing Database Locking during updates -

i pulling large amount of data (700k lines) 1 database ( source database ), performing data manipulation, inserting/updating database ( lookup database ) altered data. the lookup database being accessed users regularly throughout day. performing select statements. updates lookup database occur hourly. size of data in source database increases, i'm noticing higher numbers of "lock wait timeout exceeded" errors when updating lookup database. assumption correct resulting select statements , update statements accessing same data? make sense larger number of updates occurring more hit data being accessed users. in attempts fix situation i've increased lock wait timeout 120 (up 60) has had little effect. one thought had update new table in lookup database, swap (in software users using) database queries go to. other ideas how might resolve issue? i'm not sure if it's relevant i'm using mysql , 2 databases on separate servers. thanks!

c++ - Please teach me how to make the template parameters of a following function -

i beginner of template. want make function template template parameters. me, complicated template template parameter. , cannot make it. someone, please let me know how can make it. thank much. class vertex { }; main() { std::vector<std::shared_ptr<vertex>*> vertexes_a, vertexes_b; comparevector(&vertexes_a, &vertexes_b); } /* made following template parameters. compiler cannot compile it. * said template parameters invalid... must have stupid understanding. * please ignore template parameters , * please teach me how make template parameters. */ template <typename elm, template<template<elm> class sharedptr, typename allocator=std::allocator<template<elm> class sharedptr> > class stl> bool comparevector(stl<std::shared_ptr<elm>>* org, stl<std::shared_ptr<elm>>* cmp) { } thank much. maybe want this? template <template <typename ...> class c, typename ...args> bool com

floating point - Why does python show 0.2 + 0.2 as 0.4? -

i think understood why 0.1 + 0.2 0.30000000000000004, following same logic why 0.2 + 0.2 = 0.4? isn't 0.2 value can't in binary base? thank time. to 0.2 need sum binary fractions of 2. here first few: decimal binary 1 = 1 0.5 = 0.1 0.25 = 0.01 0.125 = 0.001 0.0625 = 0.0001 so, 0.2, need sum 0.125 + 0.0625 = 0.187500 the next binary fraction 0.03125. if sum that, it's large (> 0.2), next 1 0.015625. following one, 0.0078125 ok, so 0.125 + 0.0625 + 0.0078125 = 0.195312 and on. have skipped 0.5 (gives 0), , 0.25 (another 0), did use 0.125 (1) , 0.0625 (1). again, skipped 2 values (00) , used next 1 (1)... but, whatever do, cannot represent 0.2 exact binary numner. have continue , continue... if don't continue infinitely, representation not 0.2... now try 0.25 or 0.25... now why seeing different things in modern pythons (>= 2.7, , >= 3), comes internal change: in versions prior python 2.7 , python 3.1, python r

input/output error while copying PNG files from linux server to desktop using scp in cygwin -

i trying copy png files linux server onto local desktop running windows 7. trying copy files cygwin using scp command. not syntax errors files copied input/output error. size of images on local after copying matches size on server image appears empty or cannot viewed. has seen issue before? most of suggestions on issue using winscp have tried , results in following message: *general failure(server should provide error description). error code:4 error messsage server:failure* i have tried pscp results in error while reading: failure . please let me know if know how around issue.

html - Set sprite image in Mobile -

i´m using sprite image in project. my html is: <div class="image-step"><img src="icon-sprite.png")" /></div> my css: .image-step{width: 132px; height: 72px; display: block; margin: 0 auto 15px auto; overflow: hidden;} .image-step img{position: relative; top: -41px;} it looks good. problem in mobile, because have show image in small size. can put in media query .image-step{width: 62px;} can´t set image size. if use percentage, i´ll have problem when modify mi image sprite. do know how can solve problem? thank you.

c# - Why does HttpClient throw an exception when the request is successful? -

i'm using httpclient in context of web request send web request follows: private async task sendmanagerinfoasync(uri baseuri, string accesstoken, object obj, string apipath, httpmethod httpmethod) { string authtoken = await getmanagerauthtoken(baseuri, accesstoken) .configureawait(false); string url = new uri(baseuri, apipath).absoluteuri; var request = new httprequestmessage(httpmethod, url) { content = new stringcontent(jsonconvert.serializeobject(obj)) }; request.content.headers.contenttype = new mediatypeheadervalue("application/json"); request.headers.add("authorization", authtoken); // whatever reason, throws taskcanceledexception. var response = await m_httpclient.sendasync(request).configureawait(false); response.ensuresuccessstatuscode(); } the request i'm tracking down http put. reason, code throws taskcanceledexception once reaches preset httpclient.timeout length, 30 secon

Writing single digit numbers to a text file -

i have code rem saved in d:\temp\writetext.bat @echo off @echo -attedit> atteditchangename.txt @echo y>> atteditchangename.txt @echo 36x24bdr>> atteditchangename.txt @echo subtitle>> atteditchangename.txt @echo b209 11.5 ton bridge elec layout 1 ^& 2>> atteditchangename.txt @echo 612.9014,43.8533>> atteditchangename.txt @echo 618.5063,35.8628>> atteditchangename.txt @echo 109.9409,-6.7209>> atteditchangename.txt @echo.>> atteditchangename.txt @echo v>> atteditchangename.txt @echo c>> atteditchangename.txt @echo b209>> atteditchangename.txt @echo b211>> atteditchangename.txt @echo next>> atteditchangename.txt pause that creates text file , fills text. problem line intended write text "b209 11.5 ton bridge elec layout 1 & 2" not writing. instead, gets fed on screen. see link screenshot http://gyazo.com/a97e6daaf4695b766659df426180c95b we troubleshooted problem as , found t hi

asp.net - Debug without write access to IIS logs -

i don't know asp , i've started working large corporation , had task asp-classic web app dumped in lap , doesn't work. no 1 knows , apparently not allowed write iis log files. far seem program failing because far can tell, post ed http parameters, can see in ie developer console, being sent in never make server , can not found in request.form . know make of , how might able print out response.querystring might have access it? clarifications : i can see log files can not add own debugging lines used php , apache on linux. i'm fish out of water. proof program failing there program called aspxtoasp.asp think turns .net request parameters classic parameters breaking. gets index out of bounds exception , think it's because being passed empty query string. when tried write query string somewhere never showed up. might able write query string can view it? i not know enough of components of web app organize working version on desktop debugging. i'v

sql server - SQL: How to bring back 20 columns in a select statement, with a unique on a single column only? -

i have huge select statement, multiple inner joins, brings 20 columns of info. is there way filter result unique (or distinct) based on single column only? another way of thinking when join, grabs first result of join on single id, halts , moved onto joining next id. i've used group by , distinct , these require specify many columns, not 1 column, appears slow query down order of magnitude. update the answer @martin smith works perfectly. when updated query use technique: it more doubled in speed (1663ms down 740ms) it used less t-sql code (no need add lots of parameters group by clause). it's more maintainable. caveat (very minor) note should use answer @martin smith if absolutely sure rows eliminated duplicates, or else query non-deterministic (i.e. bring different results run run). this not issue group by , tsql syntax parser prevent ever occurring, i.e. let bring results there no possibility of duplicates. you can use row_number this

javascript - Jquery animated div margins appear to change depending on window resize -

problem: have animated div 2d rendering of cube, each face being new page. however, whenever page resized (say on mobile device or tablet or giant desktop) left , right sides of square change position in relation edges of window, , different every turn of "cube". follow link below, resize screen smaller , try clicking on menu items see mean. top , bottom remain constant, left , right moving off of true center. question: how "cube" face remain centered no matter menu item clicked? thank help, time , patience! website: http://studiopowell.net/tp.html relevant code below: <style> .face { position: absolute; height: 100%; width: 97%; padding: 20px; margin: 0 auto; background-color:rgba(20,20,20,.5); border: solid 1px #ccc; pointer-events: none; } #cube { position: relative; margin: 0 auto; height: 70%; width: 80%; -webkit-transform-style: preserve-3d;

Validate all revisions in SVN + Jenkins -

trying setup continuous integration system. using svn source control. want validate(build) each revision using jenkins. default jenkins builds latest revision. commit , therefore important validate each revision. note : use inhouse developed utility update working copy next revision , builds it. sends out build results(fail/success) accordingly... you can setup subversion hook start build: https://wiki.jenkins-ci.org/display/jenkins/subversion+plugin#subversionplugin-postcommithook

.net - Bind Poses, Joint Transforms in Collada -

i'm trying export custom 3d model format collada. i've built collada data classes through xsd , problems come when try fill them data, concerns matrices. my skeleton class array of joint classes read binary file , every joint looks (values of traslation , rotation relative parent joint, or root if there no parent, always): class joint { list<joint> children; quaternion rotation; joint parent; string name; uint32 id; vector3 traslation; } the first thing build joint nodes in "library_visual_scenes" section of file. quite simple , correct results: foreach (joint joint in hierarchicaljoints) writejointnodes(joint); private void writejointnodes(joint joint) { vector3 rotationeulers = quaternion.toeulers(joint.rotation, eulersorder.zyx); writestartelement("node"); writeattributestring("id", string.concat(joint.name, "_id")); writeattributestring("type", "joint"

python - How to add manually customised seaborn plots to JointGrid/jointplot -

i want use seaborn jointgrid/jointplot. in middle add sns.regplot. on margins 2 sns.distplots or histograms. thats not problem, custmize 3 pplots differently , add different fiiting functions , labels 3 of them. but cant solve problem, how instances of plots if use predifined method: g = sns.jointgrid(x="total_bill", y="tip", data=tips) g = g.plot(sns.regplot, sns.distplot) to manually manipulated those. or other way around create 1 regplot , 2 distplot instances, define way wnat , add them jointgrid, in meaning of, unfortinaltely, these below methods don't exist or don't work way: g = sns.jointgrid(x="total_bill", y="tip", data=tips) g.add_joint(myreg) # great doesn't work g.ax_marg_x.add(mydist1) # invented code g.ax_marg_y.add(mydist2) # show you, way i'd solve issue can give me advice, how around issue? well, documentation has few examples . if want same distplot on both marginals:

variables - How to mine Specified from text in python? -

i have output program text like: ------------ action specified: getinfo gathering information... reported chip type: 2307 reported chip id: 98-de-94-93-76-50 reported firmware version: 1.08.10 ------------ but must save just, reported chip type: value "2307" in variable. how it's possible? you regex import re match = re.search('reported chip type:\s(?p<chip_type>\d+)', my_text) chiptype = int(match.group('chip_type')) >>> print chiptype 2307 in case though, it's simple enough use couple splits : chiptype = int(my_text.split('reported chip type:', 1)[-1].split('\n')[0].strip())

How to structure a Ruby on Rails model? -

in our app's user model, have: attr_accessor :remember_token, :activation_token, :reset_token before_save :downcase_email before_create :create_activation_digest before_save { self.email = email.downcase } validates :first_name, presence: true, length: { maximum: 50 } validates :last_name, presence: true, length: { maximum: 50 } valid_email_regex = /\a[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, length: { maximum: 255 }, format: { with: valid_email_regex }, uniqueness: { case_sensitive: false } has_secure_password validates :password, presence: true, length: { minimum: 6 }, allow_nil: true now, need add relationship associations model, namely: has_many :roles, dependent: :destroy has_many :agendas, through: :roles does matter whether include latter go before or after former, in model? if so, recommended / preferred / best way? it doesn't matter, import

c# - Prevent using Dispatcher.Invoke in WPF code -

i'm web , backend programmer nature. try avaoid making windows programs. have make wpf client. i have background task raises event every time. (it working poller , when criteria met event raised). noob wrote code attached event update ui. private void isdisconnectedevent() { userwindow.visibility = visibility.hidden; disconnectwindow.visibility = visibility.visible; } this gives exception because not on same thread. after googling found should change code with: private void isdisconnectedevent() { dispatcher.invoke(() => { userwindow.visibility = visibility.hidden; disconnectwindow.visibility = visibility.visible; }); } this works, not event , makes code horrible ugly. there better ways this? regarding this: this works, not event , makes code horrible ugly yes , wpf-based code extr

ruby on rails - What Mocha API call will stub a method which takes no arguments? -

i seem find posts asking how assert method has no return value want require method call in tests never see arguments passed method. i expected find documentation in http://gofreerange.com/mocha/docs/mocha/parametermatchers.html , no luck ... should looking elsewhere? the documentation with method doesn't appear this, discovered calling with() no parameters force mocha check method call happens no arguments. example: myclass.any_instance.stubs(:its_method).with.return true

optimization - Usefulness of prime numbers as Threading Timeouts in programming -

i .net programmer, founded in math. having argument fellow programmer. when add threaded timer program, interval in milliseconds use prime number. my coworker (and seemingly vast majority of programmers everywhere), insists even, round numbers sufficient. example, use 200 ms, 900 ms, 400 ms. tend use numbers either prime, or @ least, meaningful me (a former address, phone number, etc.) i haven't been able find in way of support on internet. read 1 entry in forum alluded harmonics of machinery. wouldn't, then, computer program analagous machinery? computer program virtual machine, , machine runs put together. seem if many "round" numbers used (the multitude of milliseconds multiples of 100), harmonics emerge. harmonics in computer software manifest in ugly ways, glitches, skipping, , abrupt visual sequences. can verify assertion? place in both mathematics , stack overflow since there strong overlap.

Rails Array not Saving to DB -

i have table check boxes in first column , list of plan names in column. want able check boxes next listings, click form_submit button, , have checked listings save array column in database. i have table functioning array column - can manually enter array column (using db management service called adminium). try update array values through application, clears array values , doesn't add selected items. view <%= form_tag :action => 'planselection', :id => @current_plan.id, :method => :put %> <%= submit_tag "add selected plans quote" %> <table id="dt" class="table table-striped table-hover"> <thead> <tr> <th></th> <th>plan name</th> <th>carrier</th> <th>plan type</th> <th>deductible</th> <th>monthly premium</th> <th></th> </tr> </thead>

audio - C# mixing the same inputs by 3 independent mixers -

good evening, i'm facing problem might easy in end. i've got different audio sources on single pc: 2 teamspeak instances, 1 voip connection, sound samples , background noise. there 3 independent headphone devices. each 1 needs mix source streams. how achieve this? thought of creating virtual audio devices, sending source's streams them, split each stream 3 times, mix them , send them headphones in end. possible?

sql server - sql pivot table with strings -

Image
i'm using sql 2008 , trying pivot data. sql fiddle i have tried can't figure out. i'd take data , have appear this. i put i've tried nothing run , can't both examid , score , pivot rest. i've tried simple this select * dbo.results pivot (max(answer) examid in ([19966], [19969]) ) p but returns nulls. anyway great. shannon you can use @bluefeet's answer, in order match expected output, need change sample data well: create table results ( examid int , score int , bank int , answer char(1) ); insert results ( examid, score, bank, answer ) values ( 1, 70, 15, 'a' ), ( 1, 70, 16, 'a' ), ( 1, 70, 17, 'b' ), ( 1, 70, 18, 'd' ), ( 1, 70, 19, 'c' ), ( 2, 81, 15, 'b' ), ( 2, 81, 16, 'd' ), ( 2, 81, 17, 'c' ), ( 2, 81, 18, 'c' ), ( 2, 81,

spring integration - PropertiesPersistingMetadataStore not writing to file -

i using sftpsimplepatternfilelistfilter , sftppersistentacceptoncefilelistfilter along metadata store. noticed not flushing entries file. never show flush() method being called propertiespersistingmetadatastore invokes savemetadata() method. here config looks <bean id="compositefilter" class="org.springframework.integration.file.filters.compositefilelistfilter"> <constructor-arg> <list> <bean class="org.springframework.integration.sftp.filters.sftpsimplepatternfilelistfilter"> <constructor-arg value="*.txt" /> </bean> <bean class="org.springframework.integration.sftp.filters.sftppersistentacceptoncefilelistfilter"> <constructor-arg name="store" ref="metadatastore"/> <constructor-arg value="myapp"/> </bean> </list> &l

c# - AutoMapper conditional map for recursive model -

i've got recursive model class following definition: public class itemfilterblockgroup { public itemfilterblockgroup(string groupname, itemfilterblockgroup parent, bool advanced = false) { groupname = groupname; parentgroup = parent; advanced = advanced; childgroups = new list<itemfilterblockgroup>(); } public string groupname { get; private set; } public bool advanced { get; private set; } public itemfilterblockgroup parentgroup { get; private set; } public list<itemfilterblockgroup> childgroups { get; private set; } } it has property called childgroups list of - used build hierarchical model. i'm trying map model view models, conditionally. (depending on ui setting) want include child objects advanced = false, , want include models. currently i'm achieving nasty hack involves mapper.reset() , runtime re-definition of maps - not , presents multiple problems: mapper.reset(); if (showadvance

mysql - Changing collation on indexed columns without changing data -

i trying change collation on bunch of columns. don't want mess current data, i've been looking @ doing in this answer : alter table modify name blob; the next step convert column nonbinary data type proper character set: alter table modify name varchar(12) character set hebrew collate hebrew_bin; or try this: alter table modify name varchar(12) character set utf8 collate utf8_unicode_ci unfortunately, mysql won't let me convert indexed column blob. sql error: [1170] - blob/text column 'baz' used in key specification without key length query: alter table foo.bar modify baz blob; is there way around this? or need somehow remove indexes , rebuild them after conversion? don't "2-step alter" unless character set wrong data 'right'. if want convert both character set , data, use alter table convert character set ...; see case 5 in my blog , which, might guess, has other cases. as

javascript - HTML5 Fetch ignores <access origin="*"/> from cordova -

i developing phonegapp app , use library data fetching. library using native "fetch" getting data. unfortunately in phonegap native fetch seems ignore <access origin="*"/> settings. when hack isomorphic fetch library force use polyfill works. think in general should work normal js api such fetch. has found better solution this?

ios - How can I tell that my application was launched / switched to from a localnotification? (SWIFT) -

i saw few questions regarding topic , of them implementing listener function in appdelegate.swift, none of solutions seem working me. have solution? i tried this: open view controller when remote notification pressed and this: check launching uilocalnotification in swift unfortunately, none of works

ruby on rails - Refile accepts_attachments_for issue -

i'm using refile rails 4 app. i'm getting error: undefined method accepts_attachments_for'` i'm trying multiple image upload, , have 2 models: books , blobs. my books.rb: has_many :blobs, dependent: :destroy accepts_attachments_for :blobs my blobs.rb: belongs_to :book attachment :file if check rake routes, shows refile mounted, issue? the feature you're looking use discussed here: https://github.com/refile/refile/issues/6 , doesn't seem released yet. if want use it, you'll need use master branch. can try using master branch changing gemfile: gem 'refile', require: "refile/rails", git: 'https://github.com/refile/refile.git', branch: 'master'

neo4j - How differentiate data for each database or Graph -

to differentiate data each database , in examples neo4j has movie db , northwind db, how know @ end sought of database/graphs we've. how these managed (database administration point of view). secondly if connect sqlserver client , can have list of database each database has own db objects. how can deal below points: to execute query on particular database or graph , in sqlserver can either use full qualified name under db context e.g select * amazon.dbo.people or "use amazon" , call store procedures,views,functions or whatever objects. neo4j not have concept of multiple databases in 1 neo4j instance. can run multiple databases setting multiple instances - on same machine. another option organize graph multiple distinct subgraphs.