Posts

Showing posts from May, 2012

javascript - WordPress custom theme live preview and customization is not saving current preview -

Image
i developing website wordpress. using gt3themes' corp theme. have managed customize layout of site, when comes partners and/or featured posts sections, theme's javascript not working expected. can see preview of the site . have tried deactivate of active plugins, still not working. however, when live preview theme, showing layout expected, when save , publish it, becoming before. before activation after activation as can see here, in first image, live preview and, example, our partners section showing 5 partners , rest of them hidden. whereas, in second image, partners in section visible, overflow made hidden. same problem latest news , announcements section. i have reviewed javascript files, , cannot differentiate theme's live demo can find here . any suggessions can solve problem highly appreciated. thanks. i´m not sure how able without files of theme. altough had quick overlook between website , theme preview @ http://www.gt3themes.com/wordpr

generating self signed SSL certifcate, permissions error (OSX) -

i'm following this tutorial. i've got dnsmasq working getting permissions error when trying generate self-signed certificate using script: #!/usr/bin/env sh cat > openssl.conf <<-eof [req] distinguished_name = site_distinguished_name x509_extensions = v3_site prompt = no [site_distinguished_name] cn = *.${pwd##*/}.dev [v3_site] keyusage = keyencipherment, dataencipherment extendedkeyusage = serverauth subjectaltname = @domains [domains] dns.1 = *.${pwd##*/}.dev dns.2 = ${pwd##*/}.dev eof openssl req -new -newkey rsa:2048 -sha256 \ -days 3650 -nodes -x509 -keyout site.key \ -out site.crt -config openssl.conf here's i'm getting in terminal project_directory $ ./ssl_cert_gen.sh -bash: ./ssl_cert_gen.sh: permission denied project_directory $ sudo ./ssl_cert_gen.sh password: sudo: ./ssl_cert_gen.sh: command not found am way off? ideas? in advance. you have make script executable: $ chmod +x ssl_cert_

math - Formula for calculating camera x y position to force 3d point to appear in center of screen -

i need formula calculating camera x y position force given 3d point appear in center of screen. in other words, camera pans move point center, without changing fov, rotation, or z co-ordinate. let's assume current camera position campos , direction camdir . depending on projection, there several options how view ray screen center calculated of time just: ray(t) = campos + camdir * t we don't want change position's z-coordinate. calculating parameter t hit target point p quite simple (given position had correct x , y coordinates): t = (p.z - campos.z) / camdir.z we can calculate current point @ screen center @ given depth by: currentscreencenter = campos + camdir * t in order hit p , campos has shifted difference: campos += (p - currentscreencenter) = p - campos - camdir * (p.z - campos.z) / camdir.z

gd - function imagewebp doesn't exist in PHP 5.6? -

php-file: <?php echo phpversion(); echo "\n"; var_dump(function_exists('imagewebp')); output: 5.6.0rc2 bool(false) gd support enabled (gd version:bundled (2.1.0 compatible)) where problem? "imagewebp" should exist since php 5.5.0 (see: http://php.net/manual/en/function.imagewebp.php ) ps: (i'm not one... how compile php enable webp support? )

python - Oracle connection string with at sign @ in pasword -

i have code connect oracle using connection string: conn = cx_oracle.connect('username/password@server:port/services') but problem password contain @ character may become conn = cx_oracle.connect('username/p@ssword@server:port/services') it return databaseerror: ora-12154: tns:could not resolve connect identifier specified i use django oracle settings databases = { 'default': { 'engine': 'django.db.backends.oracle', 'name': 'services', 'user': 'user', 'password': 'p@ssword', 'host': 'ip', 'port': 'port', } } i cant change password :( know problem? i haven't tried cx_oracle, might able connect specifying individual parameters - conn = cx_oracle.connect(user='username', password=&#

jquery - Kendo UI Tooltip issue -

Image
i using kendo ui mvc asp.net tooltip control show formatted data. instead of showing data along formatting, tooltip showing html code. using below code segment show tooltip tolltip('#calendar table tbody', "#timetemplate", 'td a.acurrent', "top"); function tolltip(target, template, filter, position) { $(target).kendotooltip({ filter: filter, content: kendo.template($(template).html()), position: position }); } on view i'm using following script snippet. <script id="timetemplate" type="text/x-kendo-template"> #if (target.data('title') != null) {# <p> #:target.data('title')# </p> #}# </script> what missing in code? function tolltip(target, template, filter, position) { $(target).kendotooltip({ filter: filter, content: function(e) { kendo.template($(template).html())(e) }

python - Vectorised Haversine formula with a pandas dataframe -

i know find distance between 2 latitude, longitude points need use haversine function: def haversine(lon1, lat1, lon2, lat2): lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) dlon = lon2 - lon1 dlat = lat2 - lat1 = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) km = 6367 * c return km i have dataframe 1 column latitude , column longitude. want find out how far these points set point, -56.7213600, 37.2175900. how take values dataframe , put them function? example dataframe: seaz lat lon 1 296.40, 58.7312210, 28.3774110 2 274.72, 56.8148320, 31.2923240 3 192.25, 52.0649880, 35.8018640 4 34.34, 68.8188750, 67.1933670 5 271.05, 56.6699880, 31.6880620 6 131.88, 48.5546220, 49.7827730 7 350.71, 64.7742720, 31.3953780 8 214.44, 53.5192920, 33.8458560 9 1.46, 67.9433740, 38.4842520 10 273.55, 53.3437310, 4.4716664 i can't

javascript - To access class attribute using Prototype JS -

function popup() { } popup.prototype.openpopup = function() { var div = document.getelementbyid("test"); div.style.display = 'block'; }; popup.prototype.closepopup = function() { var div = document.getelementbyid("test"); div.style.display = 'none'; }; window.onload = function() { var popup = new popup(); var opnpopup = document.getelementsbyclassname('clck'); opnpopup.addeventlistener('click', function() { popup.openpopup(); }); var cnclpopup = document.getelementbyid('cancel'); cnclpopup.addeventlistener('click', function() { popup.closepopup(); }); } html code : <button id="clck" class="clck">click here</button> <div id="test" class="popup"> test message <div id="cancel" class="cancel" ></div> </div> in above js when access class name &

python 2.7 - OpenERP 7 service start issue -

i installed openerp 7 in centos 64 bit , have problem when starting service: starting openerp server daemon (openerp-server): [ ok ] root@****[~]# error: couldn't create logfile directory. logging standard output. 2014-09-10 14:04:58,739 29029 info ? openerp: openerp version 7.0-20140804-231303 2014-09-10 14:04:58,739 29029 info ? openerp: addons paths: /usr/lib/python2.6/site-packages/openerp-7.0_20140804_231303-py2.6.egg/openerp/addons 2014-09-10 14:04:58,739 29029 info ? openerp: database hostname: localhost 2014-09-10 14:04:58,739 29029 info ? openerp: database port: 5432 2014-09-10 14:04:58,740 29029 info ? openerp: database user: openerp traceback (most recent call last): file "/usr/bin/openerp-server", line 5, in <module> pkg_resources.run_script('openerp==7.0-20140804-231303', 'openerp-server')

random - Collisions when generating UUIDs in JavaScript? -

this relates this question . using this answer generate uuid in javascript: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); return v.tostring(16); }); this solution appeared working fine, getting collisions. here's have: a web-app running in google chrome. 16 users. about 4000 uuids have been generated in past 2 months these users. i got 20 collisions - e.g. new uuid genereated today same 2 months ago (different user). so questions are: what's causing issue? how can avoid it? my best guess math.random() broken on system reason (bizarre sounds.) first report i've seen of getting collisions. node-uuid has test harness can use test distribution of hex digits in code. if looks okay it's not math.random(), try substituting uuid implementation you're using uuid() method there , see if still results. [update: saw veselin'

Why do I get NaN from I function in JavaScript -

i have simple javascript program converts celsius fahreinheit , vice versa. 1 function not work , returns nan. <script type="text/javascript"> function ctof() { c = parseint(document.getelementbyid("celsiustemp").value); fah = c * (9 / 5) + 32; document.getelementbyid("resc").innerhtml = fah; } function ftoc() { f = parseint(document.getelementbyid("celsiustemp").value); cel = (f - 32) * (5 / 2); document.getelementbyid("resf").innerhtml = cel; } </script> <body> <form> <p>insert celsius temperatur: <input type="text" id="celsiustemp" /> <br> </p> <p>insert fahrenheit temperatur: <input type="text" id="fahreheittemp" /> <br> </p> <input type="button" cla

vim - Emacs + Evil: non incremental search and persistent highlighting? -

i'm trying emacs+evil after 2 decades vim user. i'm moving of vim configuration evil 1 thing i'm having lot of problems set search , highlighting 1 use vim. i'm trying have non-incremental search , highlights remain until clear them manually or make search. i've set these settings on config file: ;; keep search highlights (setq lazy-highlight-cleanup nil) (setq lazy-highlight-max-at-a-time nil) (setq lazy-highlight-initial-delay 0) using / key search evil incremental thing , highlights removed press other movement key (like j key c-s (emacs internal i-search) highlights remain. c-s ret (non incremental search) highlights doesn't remain. ok, found working solution highlighting: (defun highlight-remove-all () (interactive) (hi-lock-mode -1) (hi-lock-mode 1)) (defun search-highlight-persist () (highlight-regexp (car-safe (if isearch-regexp regexp-search-ring search

angularjs - symfony2 form how to accept json payload from angular resource -

i'm trying combine symfony form angularjs ... service posts data form, should save entity database. unfortunately, ngresource sends data json payload, symfony forms can't process it... tried many things on angular side, changing headers: headers : {'content-type': 'application/x-www-form-urlencoded'} i couldn't find more on angular side, thought find solution on symfony side. idea how work? angular-solutions welcome of course. i found solution, after reading deeper in documentation. symfony\component\form\form::bind doesn't require request, works array too. here's solution (the sloppy way, need checking of header, etc. production use..) public function setfooaction(request $request){ $form = $this->createform();//get form class, etc... $json_data = json_decode($request->getcontent(),true);//get response data array $form->bind($json_data); //bind data form if ($form->isvalid()) { ... } }

c# - How to allign a treeview childjust below the parent? -

Image
i have 3 columns , 4 rows. in each row first , second column contains textblock , third column contains button . second row alligned below first one. but in in third row have treeview , child of tree view disturbs allignment. shifts the child textblocks in little right (because treeview's child in bit right). i want position them (allign) below textbox of parent. possible ? currently this: but want this: my code this: <telerik:radtreeview grid.row="2" name="radtreeviewobj" margin="10" background="{staticresource bgbrush_1}" borderbrush="{staticresource bgbrush_1}" itemssource="{binding eoddatastepscollection}" selectionmode="single" itemcontainerstyle="{staticresource treeviewitemstyle}"> <telerik:radtreeview.itemtemplate> <telerik:hierarchicaldatatemplate itemssource="{binding relateditems}"> <grid> <grid

android - Long click confirmation (vibration) -

in app, views react onlongclick . in others, want achieve same functionality, want know part of view long-clicked -- i'm simulating ontouchevent . default device behavior on long click vibration. same on simulated long click. i know how permission vibrator , whatever want it. way? i'm looking function "default" vibrate, playsoundeffect plays handful of default system sounds. basically, want perform default system reaction long click. may not vibration on devices... basically, onlongclick return true , confirmed (vibrate). when returnning false not vibrate. view.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view view) { dosomething(); return true; } });

group by in lambda expression mvc with c# -

i have lambda expression returning correct values want sum of grouped items well, here query ienumerable<cjtviewmodel> objmodel = (from q in db.current_jct_transaction q.job == job group q new { q.cost_code, q.category } g select new cjtviewmodel() { job = job, category_e = g.key.category == "e" ? g.sum(s => s.amount) : 0, category_l = g.key.category == "l" ? g.sum(s => s.amount) : 0, category_lb = g.key.category == "lb" ? g.sum(s => s.amount) : 0, category_oh = g.key.category == "oh" ? g.sum(s => s.amount) : 0, cost_code = g.key.cost_code, category = g.key.category }).tolist().orderby(x => x.cost_code ); it gives me output below cost code category amount ------------------------------------------------ 1001 e $100 1001 l $200 1001 oh $120 1002 l $100 1002 lb $100 1002 oh $200 but

How to find all combinations of elements in JavaScript array -

i have following array: [[a,1,x],[b,2,y],[c,3,z]] i want able combinations of first index of each sub array , loop through combinations performing single task on each. these combinations i'm after (note need combination of same value well): [[a,a],[a,b],[a,c],[b,a],[b,b],[b,c],[c,a],[c,b],[c,c]] i'd loop through , each of values. i'm not sure start here advice or pointers helpful! you need loop through array twice. based on want can statically access first element each time: var arr = [['a',1,'x'],['b',2,'y'],['c',3,'z']]; var newarr = []; var length = arr.length; var curr; (var = 0; < length; i++) { curr = arr[i][0]; (var j = 0; j < length; j++) { newarr.push([curr, arr[j][0]]); } } console.log(newarr); fiddle

jquery - HTML5 elements display in Chrome but not Firefox -

my site works fine in chrome , safari image elements not display correctly in firefox or internet explorer. don't understand how solve problem. the problem occurs here , here the images paired captions , triggered clicking on row of buttons @ bottom of page. <div class="slide-caption copy-1"> <div class="slide" id="showcase-1"> the captions working fine. change when click buttons. images paired captions not appear after first image in firefox , internet explorer. or old version of jquery that's linked? when tried update latest version of jquery blew apart in browsers. note have added 1px outlines elements while working on problems. the site seemed working fine until when gave me heads up. hired developer site few years ago , he's no longer available. appreciated. in advance. in chrome (a webkit-based browser) works because .slider-inner div being moved left-and-right using -webkit-transform property. ma

javascript - Why does window.onload allow me to use functions when they are used as function expressions? -

this question has answer here: var functionname = function() {} vs function functionname() {} 28 answers i understand function expressions must expressed @ top if want use them vs function declarations hoisted top. when call constructor window.onload, works. if don't have window.onload, , call constructor before function expression, code breaks. <script type="text/javascript"> window.onload = function () { var c = new c(); } // works, if delete window.onload code breaks. var c = function () { console.log("test"); }; </script> that's simple. window.onload executed later, when c defined, if call new c throw because c undefined. move call after definition, or define using 'function' keyword, not 'var'

Interpolating data at different heights for various times in Matlab -

i have set of data (144 rows , 7 columns). first column time , remaining 6 temperature @ heights 1,2,4,8,16 , 32 m. interpolate (linearly) between heights i.e. h = 1:0.5:32. , make contour plot.. please guide me regarding this, doing first time in matlab.. appreciated.. shital you linear interpolation per row (see interp1 @ matlab): for lp = 1:size(data,1) datai(lp,:) = interp1([1 2 4 8 16 32],data(lp,2:end),h,'linear'); end for contour plot; figure(1); contour(data(:,1), h, transpose(datai)) xlabel('time') ylabel('temperature') legend('height')

uiviewcontroller - Supporting Multiple Interface but have single interface in home screen not working in iOS8 + iPhone -

Image
i have view structure below. homeview(support portrait mode) | | v view1(support orientation) | | v view2(support orientation) problem : when coming view2(landscape mode) homeview calling poptorootviewcontroller method,it did not call supportedinterfaceorientationsforwindow method of app_delegate , display homeview in landscape mode . image: note : same thing not happens when came view1(landscape mode) homeview calling poptorootviewcontroller method call supportedinterfaceorientationsforwindow , works great. if run app using xcode6 in ios7 works great. i read below question did not me . how maintain presenting view controller's orientation when dismissing modal view controller? in above link matt said ios8 stop support friezing orientation , did not find in apple document if have reference link change please share. question : 1] why delegate method supportedinterfaceorientationsforwindow not calling. 2] possible have 1 view support single ori

jquery - Hide/Show Google Maps markers based on their category or group -

i'm in process of creating google map can show users groups of markers. restaurants or parks in area. i've been able create set of restaurants , set of parks, each own marker color. can hide or show of markers clicking text under map. want separate markers categories can hide or show them based off checkbox. code below, here things i'd do: the map should blank no markers default i can separate markers own categories , hide , show each category multiple categories can shown @ time here code <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>google maps multiple markers</title> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script></script> </head> <body> <div id="map" style="width: 100%; h

java - How to set App Theme programatically in Android? -

now going on app theme transparency have 1 class. i have 2 button options if user click 1 button should load app theme , other 1 transparency should load. so decided show transparency theme progrmatically set parent layout id in class , tried set theme there can't able set. reffered many set no use if have idea please me friends. you can try using settheme(..) before calling setcontentview(...) , super.oncreate()

javascript - How to close div when div loses focus? -

i made simple plunkr here http://plnkr.co/edit/znb65eryh5hxgaqposm0?p=preview i created little datepicker close when focus out of (focusout of datepicker) if put blur on input i'm unable use datepicker, if put focusout event on datepicker doesn't works i tried: angular.element(thecalendar).bind('blur', function () { $scope.hidecalendar(); }); but doesn't work. any clue? this because removing item before chance anything, here working example: http://plnkr.co/edit/mdfv9nlaqcp4l7whdlfi?p=preview just add timeout: thisinput.bind('blur', function () { $timeout(function(){ $scope.hidecalendar(); }, 200); }); have considered using existing datepickers? angularui or angular-strap: http://mgcrea.github.io/angular-strap/##datepickers update: not complete solution, should quite closer: angular.element($document[0].body).bind('click', function(e){ console.log(angular.element(e.target), e.target.nodename)

c# - Entity Framework 6.1.1 Code First create unreadable table -

i have problem code: class program { static void main(string[] args) { database.setinitializer(new dropcreatedatabasealways<mycontext>()); using (var context = new mycontext()) { var newtype = new systype { name = "new name" }; context.systypes.add(newtype); context.savechanges(); } using (var context = new mycontext()) { console.writeline(context.systypes.firstordefault()); } console.readline(); } } public class systype { public int id { get; set; } public string name { get; set; } } public class mycontext : dbcontext { public mycontext() : base("name=mydb") { } public dbset<systype> systypes { get; set; } } during execution program exception happens: system.data.entity.infrastructure.dbupdateexception" system.data.sqlclient.sqlexeption:

java - Session expiring when redirecting to URL -

it seems when attempt call url modelandview(), session ended , when view loaded, new session created without of data hope persist. return new modelandview("redirect:http//.....) is there better way handle sessions besides @sessionattributes when moving different controllers? @sessionattributes session objects not meant shared among controllers. here alternatives: you can store attributes directly httpsession object. can obtain httpsession object adding controller method parameter: public modelandview mycontrollermethod(..., httpsession session) { ... session.setattribute("someattribute", somevalue); ... } you can autowire httpsession object , use in controller methods: @autowired private httpsession httpsession; you can create session scoped bean , inject bean controllers need it: <bean id="mysessiondatabean" class="com.example.mysessiondatabeanimpl" scope="session"> <aop:scoped-proxy /&g

css - Zurb Foundation Print Styles - How to disable urls appearing next to anchors when printing? -

when print page actual url appears next every anchor tag, looks weird in breadcrumbs or footer links. appropriate way disable behavior when using zurb foundation 5? alternatively, if there css style can use override behavior, great. you can see description of behavior in documentation here: http://foundation.zurb.com/docs/components/typography.html#print-styles that caused pseudo elements being added attribute selectors; this: a[href*="/"]:after, a[href*="/"]:visited:after {content: "("attr(href)")";} you can override resetting content of pseudo element. try adding following print stylesheet: a[href*="/"]:after, a[href*="/"]:visited:after {content: normal;}

oracle - Collect Data from DBMS_PIPE using Java -

i working on project lot of users making changes our data , rest of clients suppose see data updates. have implemented web sockets broadcasting data problem using oracle dbms_pipe whenever data changed in db wondering if there api or documentation tell how collect data dbms_pipe using java. suggestions? thank f. irfan

Matlab: How to change the scaling of the legend on a wind rose plot -

this may simple problem appreciate help. have created direction/intensity plot using wind_rose function in matlab, however, change scaling of legend. plot produces legend has 12 colors go in 10 cm blocks, example blue = 0-0.1, light blue = 0.1-0.2, green = 0.2-0.3 etc. there far less colors , scaling more blue = 0-0.5, light blue = 0.5-1.0 etc. code use plot wind rose: h = wind_rose(m,d,'dtype','meteo','n',12,'lablegend','hm0 (metres)','ci', 0:10:60,'quad',[4]) am able add simple code scale legend how want be? figured out: 'di', 0:0.5:3 very simple oops. looking remove white boxes appear around text on figure, ideas?

How could I centralise AngularJS configuration when part of an ASP.NET MVC project? -

i have angularjs spa served part of asp.net mvc application. within have angular factory accesses rest api elsewhere on our intranet. have various instances of api development, production , uat. i'd able configure url of api within web.config when build each different solution configuration correct url provided factory. unfortunately i'm working within environment cannot use npm (it's complicated - suffice ntlm proxy authentication combined smartcard login don't play nicely npm), lot of front-end build tools seem might have been helpful aren't available use. currently i'm thinking of adding method on controller returns value in web.config, doesn't seem terribly elegant. perhaps there's better way?

javascript - How to replace character in URL string? -

how can convert following url string [ipaddress]/folder/\\2014\\5\\5\\abc\\\\cde\\efg\\\\ir12345676765454554\\123456.jpg] to [ipaddress]/folder/2014/5/5/abc/cde/efg/ir12345676765454554/123456.jpg] thanks in advance. it looks want replace every sequence of / , \ single / . here's way : str = str.replace(/[\/\\]+/g, '/'); edit for new question in don't want replace double / of "http://" (and guess "file://" , etc), can : str = str.replace(/(:?)([\/\\]+)/g, function(_,d,s){ return d ? d+s : '/' });

c# - JToken.ToObject giving same value again and again -

i have following method.. public void handle(jtoken jsontable) { var myvar = jsontable.toobject<abctable>(); // other code } abctable structure: public class abctable { public string column1 { get; set; } public string column2 { get; set; } public bool column3 { get; set; } } when call handle method-- jsontable has column1="a" , column2="b" , column3 not present..... after going through .toobject(), myvar gets column3 = false along other 2 values i need column3 = null after object formed.. any sincerely appreciated thanks as mentioned in comments, bool can not set null. variable create type bool automatically set false , not null . create boolean can set null, use nullable type bool? . public bool? column3 { get; set; } now can set column3 do: col

c# - regex to validate server path -

i can't seem find regex or other means validate sever path here server path must exist in following format when arguments c# console app: @"\\myserver\testfolder\tests\" i must have \\ @ beginning this how passing value myapp.exe "\\myserver\testfolder\tests\" ty np i came following. allows characters such _ , . , , - in names, might want adjust depending on server/share names like. requires server , share name, , makes directory within share optional. ^\\\\[\w\-.]+\\[\w\-.]+\\[\w\-.\\]*$ ^\\\\ --> double-backslash @ beginning [\w\-.]+\\ --> server name (at least 1 character) followed backslash [\w\-.]+\\ --> share name (at least 1 character) followed backslash [\w\-.\\]*$ --> directories (0 or more characters including backslashes)

java - Why don't I get a firewall warning when using minecraft for the first time? -

when installed minecraft , started program, didn't firewall warning. minecraft totally written in java. when wrote simple java program myself , used sockets communicating on lan network, got firewall warning. think there way make java program uses network communication without getting firewall warning. dont mean there security leak or something. want same result minecraft. think: when firewall doesn't show me warning/confirmation dialog, there nothing worry about. don't worry safety of minecraft, own program.

3dsmax - 3DS Max - Rendering surface normals -

i tried using google find answer question kept finding results related applying normal maps surfaces. want different. i have simple model (think cube) render diffuse image (only use ambient lighting). want place rendered image in 3d scene (a game) , have light bounce off of it. have dynamic lighting effects, need know normals of every pixel of diffuse map. so question is, how can render model not show texture or color, show normal "color"? i'm not interested in normal maps! want normal map mapped onto model. there way in 3ds max? cheers, rene okay, nevermind managed done using plugin called "normaltexmap" ( http://www.scriptspot.com/3ds-max/scripts/normaltexmap ). allows create material can render diffuse or 100% self illuminated , contain normals version of render. i creating tutorial display on portfolio. once done post link here. :)

sql server - SQL:where column not equal return result else result equals blank value -

so coming across issue sql query (mssql) have been working on has multi-statement clause, , 1 of statements may or may not return value. if condition not met how can have return empty value , still return rest of results? using multiple ctes. here select clause: select cte_devinfo.serialnumber, cte_devinfo.devicename, cte_devinfo.deviceid, dev_cte.concurrencies, (cte_slots.locationindex +1) 'total media', cte_changer.slotcount, cte_changer.totalmounterrors, cte_changer.totalmounts, cte_mismatch.mismatchserialnumber cte_devinfo, dev_cte, cte_slots, cte_changer, cte_mismatch here clause: where cte_devinfo.deviceid = dev_cte.deviceparentid , cte_slots.locationid = dev_cte.deviceparentid , cte_changer.changerid = dev_cte.deviceparentid , cte_mismatch.locationid = dev_cte.deviceparentid i want add clause: and cte_mismatch.mismatchserialnumber != cte_devinfo.serialnumber but condition may never occur, , if doesn't how can ignore condi

events - Return value ignored from Jquery function -

i have piece of jquery attached asp.net web forms front-end (the input controls of form wrapped standard asp.net ajax panel) has 3 dropdown lists have piece of jquery attached: $(document).ready(function () { jquery("select").change(function () { alert("hi"); return false; }); }); the dropdowns have server-side change event attached asp.net expect postback: <select name="ctl00$leftcontent$cmbpressureunitspo" tabindex="6" class="unit" id="cmbpressureunitspo" onchange="javascript:settimeout('__dopostback(\'ctl00$leftcontent$cmbpressureunitspo\',\'\')', 0)"> <option value="1">kpag</option> <option value="1000">pag (n/m²)</option> <option selected="selected" value="0.001">mpag</option> <option value="0.14504">psig</op

ruby - How to broadcast or make connection in em-websocket? -

i using em-websocket make communication clients (may 2 or more users). in introduction . https://github.com/igrigorik/em-websocket i want modify simple echo server example achieve purpose. but in example , handshake.path output show "/" . i cannot know client . is there have solution can know client source place , make broadcast message of them ? i found answer in example. https://github.com/igrigorik/em-websocket/blob/master/examples/multicast.rb eventmachine::websocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) |ws| ws.onopen { sid = @channel.subscribe { |msg| ws.send msg } @channel.push "#{sid} connected!" ws.onmessage { |msg| @channel.push "<#{sid}>: #{msg}" } ws.onclose { @channel.unsubscribe(sid) } } end but still have problem that: how can send message specified clients? (e.g.) 2 clients (no.1 , no.2) make own communication.

sql - Flatten Hierarchical Table -

follow here: getting lowest level in tree higher level self-join i realized asking wrong question. have hierarchical table looks this: type | code | parent_type | parent_code 4 | 123 | 2 | 1 4 | 234 | 2 | 1 6 | 1234 | 4 | 123 6 | 2345 | 4 | 234 7 | 12345 | 6 | 1234 7 | 23456 | 6 | 1234 7 | 34567 | 6 | 2345 it maps "type 2" codes "type 4", "type 4" "type 6" , "type 6" "type 7". previous question (and answer) dealt how select type 7 codes under single parent code. so, example, how type 7 codes under type 2, code 1. but need join table list of types , codes. example, might have table: type | code 4 | 123 6 | 7851 and need level 7 codes under both codes. in other words, ( i think ) need flatten hierarchy this: type | code | parent_type | parent_code 7 | 12345 | 2 |

javascript - ExtJS 5 requests file with empty name /.js -

i've made fresh workspace latest sencha cmd 5.0.2.270 , latest extjs 5.0.1. generated app in. wrote little bit of code. i generate production build sencha app build. the development loads well, production build tries load file no name , gets 404 get http://yassa-built.dev/.js?_dc=1410352524548 404 (not found) after error doesn't load @ all. i can't understand searching for. development not complaining @ all. i made archive https://mega.co.nz/#!dk0gdrjd!dnitsq1fgfs5t4d-4yyfna6_k6ecahfkxoeejaju7my (~600kb). includes sources , production build. upd i've found place starts break. in file radioadmincontroller.js. case 'menu_referals': return app.setsubview('redmed-radioapp-referals', { store: ext.create('redmedadmin.store.referals') }); if not create store - works. production build ok. store nothing special: ext.define('redmedadmin.store.referals', { extend: 'ext.data.store', model: 'red

psychology - psychopy builder experiment with feedback and multiple if loops -

i trying use coder view make experiment involves feedback , multiple conditional statements. how do though? task involve 4 math problems, , participants allowed have 3 attempts each problem. structure should this... loop 1: goes through 4 problems loop 2: allows 3 attempts per problem loop 3: if response correct, "correct" , move onto next problem; else, "incorrect" , ask if try again or move on this first time using python , can't work out kinks in code. there no error message returned, rather, code not register response , task frozen in place @ prompt screen. code below. didn't include libraries , other setup. t=0 nproblem=4 nattempt=3 while currentprob <= nproblem: problemtimer.reset() attempt = 1 # *prompt* updates prompt.setautodraw(true) prompt.settext(u'problem prompt go here.\n\ntype in answer , press enter submit.', log=false) while attempt <= nattempt: response = [] # *response

ruby on rails - cocoon select2 ajax load of partial - select2 element doesnt load -

i have rails app uses cocoon = link_to_add_association to call partial form on main form have coffee script load of data select2 elements when ajax partial inserted select2 element doesnt appear. need instantiate it. this form coffee/js $(document).ready -> $(".select2").each (i, e) -> select = $(e) options = {} if select.hasclass("ajax") options.ajax = url: select.data("source") datatype: "json" data: (term, page) -> q: term page: page per: 10 results: (data, page) -> results: data options.placeholder = "select value" options.allowclear= "true" options.dropdownautowidth = "true" options.initselection = (element, callback) -> data = {id: element.val().split('||')[0], text: element.val().split('||')[1]}; callback data select.select2 o

c++ - Input only integers from a line of a .txt file -

this question has answer here: reading integers text file words 6 answers i wondering there way of getting integers line of text using c++ without using seekg(). lets file data.txt has line: position {324,71,32} in it, , want integer values. i tried following code didn't work, , i've searched web solution , didn't find - that's why i'm asking. #include <iostream> #include <fstream> using namespace std; int main() { string x, num1, num2, num3; fstream fs; fs.open("data.txt", ios::in); if (fs.fail()) cerr << "failed open file"; fs >> x; num1 = x; fs >> x; num2 = x; fs >> x; num3 = x; cout << num1 << " " << num2 << " " <<num3 << endl; return 0; } try more this:

php - why session data not being destroy? -

i have simple php simple scripts. 1 display login user, , other 1 log out. these code fragments larger file. anyway, first executed login script , enter user name, user name showed fine. next executed logout. if entered login page again, expected login_user empty, not. older login_user name still there. if clear cache , bring login page again, login_user gone. how clear session data good? here login.php <?php session_start(); $_session['myerror']="xxx"; displayloginuser(); function displayloginuser() { if (isset ($_session['login_user'])) { echo $_session['login_user']; } } // end displayloginuser ?> here logout.php <?php // note none of statements below seem clear login_user $_session['login_user'] = " "; unset ($_session['login_user']); session_destroy(); header("location: library.php"); ?> try this: session_start(); $_ses

javascript - highlight and un-highlight item selected in jquery -

i have dynamic list of image thumbnails. every time image selected want unselect selected image , select newly clicked image. html looks below: <ul class="imglist"> <li> <div id="item1" class="imgstyle" order="{#}" imgid="{imgid}"> <img src="{imgpath}"/> </div> </li> <li> <div id="item2" class="imgstyle" order="{#}" imgid="{imgid}"> <img src="{imgpath}"/> </div> </li> <li> <div id="itemn" class="imgstyle" order="{#}" imgid="{imgid}"> <img src="{imgpath}"/> </div> </li> </ul> and use jquery bind items on click event this: $( ".imgstyle img").bind( "click", function() { $(item1).css("bo

c++ - boost serialization - polymorphic archives - archive-type-dependent behavior -

i'm using boost serialization (v 1.55 , i'm trying implement serialization behavior foo dependent on archive type (xml or binary). @ same time, need use polymorphic archive types. here trivial example: #include <sstream> #include <boost/archive/polymorphic_binary_iarchive.hpp> #include <boost/archive/polymorphic_binary_oarchive.hpp> #include <boost/archive/polymorphic_xml_iarchive.hpp> #include <boost/archive/polymorphic_xml_oarchive.hpp> #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/xml_iarchive.hpp> #include <boost/archive/xml_oarchive.hpp> using namespace boost::archive; typedef polymorphic_binary_iarchive bi; typedef polymorphic_binary_oarchive bo; typedef polymorphic_xml_iarchive xi; typedef polymorphic_xml_oarchive xo; /* typedef binary_iarchive bi; typedef binary_oarchive bo; typedef xml_iarchive xi; typedef xml_oarchive xo; */ struct foo

While loop without a body in Java -

the body of while (or other of java's loops) can empty. because null statement (one consists of semicolon) syntactically valid in java. consider : i = 100 j = 200 while(++i < --j); // no body in loop system.out.println(i); system.out.println(j); i noticed if value of less j, loop repeats , when condition fails fulfill, 2 below statements exceuted. correct or there other logic behind this? yes, continues repeat without executing other statements. it test conditions 101 < 199 , 102 < 198 , , on, until tests 150 < 150 . breaks out of loop , executes println statements. output: 150 150 note reason it's not infinite loop condition changing values ++ , -- operators.

osx - How to run launchd agent/daemon from a NSApplication? -

in nsapplication i've button. when click it, want launch/start daemon/agent. how can proceed? i've tried: - (void) runagent { nstask *task = [[nstask alloc] init]; task.launchpath = @"launchctl load /system/library/launchagents/com.mycompany.myagent.plist"; [task setlaunchpath:@"/bin/sh"]; [task launch]; } with no success... nstask *task = [[nstask alloc] init]; [task setlaunchpath:@"/bin/launchctl"]; [task setarguments:[nsarray arraywithobjects:@"load",@"/system/library/launchagents/com.mycompany.myagent.plist", nil]]; [task launch];

c# - How to change the color for entire GridView row -

protected void yourtasksgv_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { system.web.ui.webcontrols.imagebutton btnshowdepend = e.row.findcontrol("btnshowdepend") system.web.ui.webcontrols.imagebutton; if (!string.isnullorempty(e.row.cells[5].text)) { if (datetime.parse(e.row.cells[5].text).date < datetime.now.date) { e.row.cells[5].forecolor = color.fromname("#c00000"); e.row.cells[5].tooltip = "task past due"; //instead of column per row, set every row matches condition color } else if (datetime.parse(e.row.cells[5].text).date <= datetime.now.adddays(indateoffset).date) { e.row.cells[5].forecolor = color.fromname("#dca704"); e.row.cells[5].tooltip = "task @ risk"; //instead of colu

SQL Detecting if only integers in varchar -

this question has answer here: how numeric column values? 5 answers i'm hoping there basic string function haven't found yet. specifically scenarios length of string unknown: there succinct method of telling if string variable contains [0-9] values? for example, following method works require additional mention of possible characters appear other numerals. select var #table1 var not '%[a-z]%' and select var #table1 var '[0-9][0-9][0-9][0-9][0-9]...' doesn't work because length of var required filter. thanks in advance select var #table1 var not '%[^0-9]%'

multithreading - Python subprocess return code without waiting -

my question particular enough not relate of other ones i've read. i'm wanting use subprocess , multiprocessing spawn bunch of jobs serially , return return code me. problem don't want wait() can spawn jobs @ once, want know when finishes can return code. i'm having weird problem if poll() process won't run. hangs out in activity monitor without running (i'm on mac). thought use watcher thread, i'm hanging on q_out.get() leading me believe maybe i'm filling buffer , deadlocking. i'm not sure how around this. code looks like. if has better ideas on how happy change approach. def watchjob(p1,out_q): while p1.poll() == none: pass print "job done" out_q.put(p1.returncode) def runjob(out_q): logfile = open('job_to_run.log','w') p1 = popen(['../../bin/jobexe','job_to_run'], stdout = logfile) t = threading.thread(target=watchjob, args=(p1,out_q)) t.start() out_q= qu