Posts

Showing posts from February, 2014

ajax - function has stopped working once bootstrap was added to file -

i have hash_gen function passes hash number post next file. function set in operation once submit button pressed delivering text var called parm_x . that function called with: <input style="display:none;" name="parm_x" id="hash_gen"> after submit button. function is: function hash_gen() { var url = "hash_gen.php"; new ajax(url, { method: 'post', oncomplete: function(response) { $("hash_gen").value = response; } }).request(); } hash_gen(); hash_gen.php works fine. the function has stopped giving value once bootstrap elements , validator elements added. where problem? thanks the default syntax id selector $("#id") . $("#hash_gen").value = response;

linux - Passing hex to bash command in C -

i'm trying port bash script c. i'm having trouble passing hex string bash command. have far. char buffer[512]; char mp_fmt[] = "\x00\x00\x00\x00\x00\x09\x01\x10\x00\x00\x00\x01\02\x00\x01"; sprintf(buffer,"echo -e \"\x00\x00\x00\x00\x00\x09\x01\x10\x00\x00\x00\x01\02\x00\x01\" | nc 192.168.01.22 500"); //sprintf(buffer,"echo -e \"%s\" | nc 192.168.01.22 500"); system((char *)buffer); when run this, compiler returns test.c:7:5: warning: embedded ‘\0’ in format [-wformat-contains-nul] sprintf(buffer,"echo \"\x00\x00\x00\x00\x00\x09\x01\x10\x00\x00\x00\x01\02\x00\x01\" | nc 192.168.01.22 500"); but when run other sprintf that's commented out, doesn't complain not working because device isn't responding. also in bash script, how done , response device. echo -e "\0\0\0\0\0\x9\x1\x10\0\0\0\01\02\0\x01" | nc 192.168.01.22 500 thanks reading long post. doin...

javascript - Add a number only when a radio button is selected -

i want add number total amount based on radio button select if user selects radio button value = "serfeeadd" need check it, , add total can't figure out why not working when remove scope = this , use $scope directly kinda works, need value assigned variable. i trying build magento wristband designer app built stuck part . the code has been modified provide guys overview more can let me know. var app = angular.module('wdwristbanddesigner', []); app.controller("fontctrl", maincontroller); function maincontroller($scope){ //scope var scope = this; scope.foo = function(){ if (scope.serialisationfeecheck == 'serfeeadd') { scope.serialisationfee = 10; console.log(scope.serialisationfeecheck); } else { scope.serialisationfee = 0; }; } }; <section class="wd-section" ng-controller="fontctrl fs"> <input type="radio" name="serialno"...

html - How to trigger click event using JavaScript on querySelectorAll -

this question has answer here: what queryselectorall, getelementsbyclassname , other getelementsby* methods return? 7 answers in jquery have following code $("li#credit").trigger('click'); this code triggers click event on li has id credit. now using javascript document.queryselectorall("li#credit").click(); i getting error: click() not function the page working have multiple elements id "credit", need trigger click event on <li> has id credit. queryselectorall returns nodelist object ( source ) , not dom element. nodelist object contains dom elements. your code needs change first element , call click() : document.queryselectorall("li#credit")[0].click(); if want trigger .click() event elements can for loop for(var = 0; i<elems.length; i++) { elems[i].click(); } ...

java - Two dimensional array- Session -

i have 2 dimensional matrix want add session . add integer session object syntax is session.setattribute("mat", mat); int matr = (integer) session.getattribute("mat"); searched lot syntax add int[][] session . firstly can add, if yes idea on how go forward it? try below 1 :- int[][] 2darr = new int[2][3]; session.setattribute("2darr", 2darr ); int[][] 2darrfromsession = (int[][]) session.getattribute("2darr");

javascript - do the opposite of a regex split -

i have string so: var string = "{{ \"foo {0}\" | i18n:[\"bar\"] }}"; what want values in quotes, can achieve regex /".*?"/ . but when sprint, doesn't return what's in quotes, outside of them. string.split(/".*?"/); returns [ '{{ ', ' | i18n }}' ] you'll need use .match you want capture things inside quotes, you'll add capturing expression. var exp = /"(.*?)"/; string.match(exp);

Appropriate place to store custom properties in Jenkins `config.xml` -

i'm programmatically generating jenkins config.xml job configuration files, , store/attach metadata xml dom, ignored jenkins, not removed or marked "obsolete data". simple key/value pairs, things client tool build date, user, etc. where in xml structure appropriate put such thing? i've tried putting under /project/properties branch, data gets culled server when post new job. or there plugin allow (i tried metadata plugin, overwrote sections)? update: spoke quickly! job config updates after post, gets pruned on next jenkins build. for still wondering this, able add custom properties under root <project> tag post'ing updated config.xml. looked this: <project> ... <mycustomtag> <customprop>foo</customprop> </mycustomtag> ... </project> i combined of custom properties under 1 custom tag separate them rest of config , avoid accidental name collisions regular config props. jenkins versio...

android - Drawing line of sight between two actors -

i fresh learner of libgdx. trying learn libgdx developing demo game. in game when army , enemy visible each other want draw line of sight between them prove see each other. line of sight should increase gradually, when transfer file in windows 7 green portion increases gradually. working scene2d , have implemented screen interface of scene2d. i have developed game using andengine , have used andengine box2d physics , update position between 2 players continuously follows: have 2 players 1 player , other enemy. have drawn line , end position of line given player , enemy positions. have done getting coordinates //line of sight final line e1line = new line(player.getx(), player.gety(), enemy.getx(), enemy.gety()) and have used update handler continusely move line player moves follows: iupdatehandler updatehand = new iupdatehandler(){ @override public void onupdate(float psecondselapsed) { // line of sight , notifier update e1line.setposition(player.getx(), player.gety(...

How do I fit confidence bands to a custom function in R? -

Image
i'm beginning in r , struggling add confidence intervals function defined. have seen plenty of examples linear models , know ggplot2 can functions. however, fitting bands custom function proving tricky. below have data , function: data<-matrix(c(0.08, 0.1, 0.12, 0.13, 0.49, 0.11, 0.12, 0.15, 0.22, 0.47, 7, 8 , 9, 21, 30, 3, 8, 13, 15, 17),ncol=2) mycurve<-function(x){a+(b*log(x))} plot(data) curve(mycurve,add=t) this 1 example, have few more datasets , custom curve functions need in addition one. appreciate if suggest way of doing using either plot or ggplot (e.g. maybe using geom_ribbon ?). have spent quite while searching stackoverflow, haven't yet found solution. if there one, perhaps point me it... thanks in advance! edit: sorry, forgot add parameters a , b . are: a<-31 b<-9 edit 2: have tried suggestions @ben bolker , @marcin kosinski use geom_smooth , plotted along custom curve: data<-as.data.frame(data) #so ggplot can use it ggplot(da...

hibernate - Request return wrong data -

i'm project in use ninjaframework api (no-rest api). insert data database through request style: @transactional public result askcita(context context, datacitasask cita) { manager.gettransaction().begin(); manager.persist(cita); manager.gettransaction().commit(); } and when collect data database through request this; not return same data. not return last data inserted. @transactional public result listcitas(context context, datacitaslist cita) { if (cita == null) { return results.json().render(false); } // la ip del cliente string ipclient = context.getremoteaddr(); entitymanager entitymanager = provider.get(); dbcitas db = dbcitas.getinstance(); datacitaslistresult vuser = db.listcitas(entitymanager, cita); return results.json().render(vuser); } public datacitaslistresult listcitas(entitymanager manager, datacitaslist data) { string ucheck = cita.query_clinic_month; calendar calbefore = calendar....

The_title() Wordpress using in php script -

i'm trying the_title(); wordpress page use in php script my code: <?php global $post; $args = array( 'numberposts' => 10, 'category_name' => 'bin-o' ); $posts = get_posts( $args ); foreach( $posts $post ): setup_postdata($post); ?> $project_name = the_title(); $post_id = get_page_id('$project_name'); var_dump($project_name); ?> <a href="<?php echo get_site_url() . '/?p=' . $post_id ?>"><h1><?php the_title() ?></h1> <?php the_content() ?></a> the functions.php: <?php // id of page name function get_page_id($page_name){ global $wpdb; $page_name = $wpdb->get_var("select id $wpdb->posts post_name = '".$page_name."'"); return $page_name; } ?> the problem gives the_title() when printed. can't use the_title() use php script cause the_title return null how can fix can use request...

python 2.7 - 2D color plot when one of the dimensions has a single value -

Image
i trying make 2-d color plot script formerly dealing rectangle of data. however, need use work single point on x axis having data. what i've got is: self.fig = plt.figure('title', (10.,10.)) ax=plt.subplot(111) im=ax.imshow(color_array,interpolation='none',extent=[100,100,50,150],aspect=0.15) # setting labels, climate, color bar, saving image, etc.. i'm sure what's causing issue extent = [100,100 , i'm not sure how write code differently in order plot show other narrow vertical rectangle nothing inside. the color array typically 2-d array of numbers, in limited case, 1-d array. happens is, there 3 2-d arrays, same dimensions, , 2 of them make x , y axes, , third (the color array) determines coloring of field. right (simplified) this: y-axis: [[90,100,110,120]] x-axis: [[100,100,100,100]] color: [[10,11,13,14]] the answer turned out simple. that's required simple adjustment extent. basically, make sure 2 values on same axe...

Catching errors in a Perl REST API -

i coding rest api using perl/mojolicious when want throw error, example "invalid token" store error on variable called "object->lasterror" , render json response error message/code. however gets tedious way after while. wondering if there better way considering dying , catching die error with $sig{__die__} any suggestions? also, not using logger yet log errors on question of logging, see: http://search.cpan.org/~garu/mojox-log-log4perl-0.10/lib/mojox/log/log4perl.pm log4perl pretty best practice in wider perl world. without knowing lot of deep detail application, far prefer 'tedious' method [hopefully] provide information on receiving side of api, rather crash , burn $sig{__die__} . hope helps, bit, anyway!

jquery - Detect if Dropdown has been changed by Javascript function -

i have javascript function auto-populates form fields based on available list of addresses. if user selects option country other us, not going require zip code / state fields in our form gets populated (all "required" validation handled through "data-required=true"). form dynamically generated, cannot use .change() method people suggesting. i have "change" listener setup remove "data-required" attribute, works if click country dropdown , select different country. however, not work when javascript function changes same dropdown. jquery( document ).ready(function() { jquery('body').on('change','#cohcoun',function() { if(jquery(this).val() == 'us') { jquery('#cohpost').attr('data-required','true'); jquery('#cohste').attr('data-required','true'); } else { jquery('#cohpost').removeattr('data-r...

No SQL Server PowerShell snapin installed despite installing SQL Server -

i using sql server 2012 sp1 developer edition. lately had need use sql server snapin powershell claims not have one. made research on internet didn't find working solution. there way can add powershell? get-pssnapin -registered output: name : commonsnapin psversion : 2.0 description : common snapin name : configurationsnapin psversion : 2.0 description : configuration snapin name : definitionsnapin psversion : 2.0 description : definition snapin name : dynoportalsnapin psversion : 2.0 description : dynoportal snapin name : folderssnapin psversion : 2.0 description : folders snapin name : journalsnapin psversion : 2.0 description : journal snapin name : membershipsnapin psversion : 2.0 description : membership snapin name : metadatasnapin psversion : 2.0 description : metadata snapin name : notificationsnapin psversion : 2.0 description : notification snapin name : persistencesnapin psversion : 2.0 description : founda...

sql - Normal distribution in oracle -

i generate normal distribution in pl/sql - oracle. know can generate kind of distribution via dbms_random specify paremeters of normal function (interval, mean, standard deviation). is there easy way generate distribution or should code own function? thanks if want generate numbers arbitrary normal distribution, there 2 parameters make sense, mean , standard deviation. i'm not sure "interval" you'd want specify unless want produce truncated distribution. given number standard normal distribution (mean 0, standard deviation 1 dbms_random.normal returns), it's pretty trivial convert arbitrary normal distribution. multiply standard deviation want , add mean want. if want make distribution non-normal truncating particularly high or low values, can well.

Someone can solve my jquery -

i know less amount of jquery can me.. have written code failed in last thing, image(from lest side) 2 , 3 should fade out , first image slide left while clicking on button1. , same button tow , three. on clicking button1 if first sections active (left image , bottom text) should fade , re-appear sliding effect. $(".c2").css("display", "none"); $(".c3").css("display", "none"); $(".image03").css("display", "none"); $(".image02").css("display", "none"); $(document).ready(function() { $('.img01').click(function() { $(".image01").show("slide", { direction: "left" }); $(".c1").show("slide", { direction: "right" }); $(".c2").css("display", "none"); $(".c3").css(...

javascript - serving static content in code structure generated by yeoman for angular fullstack -

i following code structure generated yeoman angular fullstack. i want include script called core.js in file called app.html . <script src="core.js"></script> i not see express.static anywhere in serving static files. i tried using did not help. it can not locate , gives 404. how around ? it had happened before around using express.static , serving files location pointed it. it did not time though. update: i have app.html in folder called music. in same folder, have sub folder called js have placed core.js file included in app.html. tried access using absolute relative path did not , still gives 404. in angular, scripts go in relevant subfolder of /scripts. either in /controllers, /services/, /directives, etc. reference them in html such: <script src="scripts/controllers/core.js"></script> as express.static, express nodejs wrapper http. service create lives on node server remotely. express.static allows n...

mamp - PHP/MySQL – Error when connecting to server -

Image
i'm using mac osx , have mamp installed, running localhost server. however, there issues running php code because website keeps returning there error when connecting server. don't know what's wrong this; maybe can me out here. php code: <?php $connection = mysql_connect("localhost", "user", "password") or die ("there error when connecting server"); mysql_select_db("topaz", $connection) or die ("there error when connecting database"); echo " <body style='font-family: helvetica neue, helvetica, arial, sans-serif;'> <div style='width: 80%; padding: 10px; border: 1px solid #000000; background-color: #ffffff;'> <h1>login</h1> </div> </body> "; ?> phpmyadmin settings: mamp port settings: error: you need establish connection on port specified in control panel - default, mysql_connect() attempt connect mysql ...

d3.js - D3. How do I align an svg text string with an svg rect in a table row? -

Image
in d3 have simple table built svg: each row consists of rect followed 3 (3) text string elements. have had resort eye-balling rect line text strings not ideal. here markup: is there anyway height/width metric text use position rect?

how to create multiple mysql connectons through PHP -

we have application has @ 50k users active @ peak hours, using sqlserver backend db, planning migrate mysql.so part of this, need check if mysql can handle traffic. far have tried mysql_pconnect() , when check active connections in mysql console not reflecting expected number function reuses connections.it helpful if can tell me way open multiple connections db. use create 2 different connections: $first_db_conn = new mysqli('localhost', 'user_1', 'pw_1', 'db_1'); $second_db_conn = new mysqli('localhost', 'user_2', 'pw_2', 'db_2'); you can then: $first_db_conn->query("select * `users` limit 1"); $second_db_conn->query("select * `users` limit 1");

java - find fields of type String, Boolean, Integer using reflection -

is there way find fields in class of type java.lang.character.type java.lang.byte.type java.lang.short.type java.lang.integer.type java.lang.long.type java.lang.float.type java.lang.double.type there isprimitive method char, byte, short etc. you can start class#getdeclaredfields() array of fields in class. then, iterate on each field in array , filter needed. something this: public static list<field> getprimitivefields(class<?> clazz) { list<field> toreturn = new arraylist<field>(); field[] allfields = clazz.getdeclaredfields(); (field f : allfields) { class<?> type = f.gettype(); if (type.isprimitive()) { toreturn.add(f); } } return toreturn; } more info: field#gettype() class#isprimitive() (though sounds know one) edit it might worth clarifying types java.lang.character.type , etc., same thing class literals. is, java...

Python while loop condition check for string -

in codeacademy, ran simple python program: choice = raw_input('enjoying course? (y/n)') while choice != 'y' or choice != 'y' or choice != 'n' or choice != 'n': # fill in condition (before colon) choice = raw_input("sorry, didn't catch that. enter again: ") i entered y @ console loop never exited so did in different way choice = raw_input('enjoying course? (y/n)') while true: # fill in condition (before colon) if choice == 'y' or choice == 'y' or choice == 'n' or choice == 'n': break choice = raw_input("sorry, didn't catch that. enter again: ") and seems work. no clue why you have logic inverted. use and instead: while choice != 'y' , choice != 'y' , choice != 'n' , choice != 'n': by using or , typing in y means choice != 'y' true, other or options no longer matter. or means one of opt...

version control - How to remove/delete a large file from commit history in Git repository? -

occasionally dropped dvd-rip website project, carelessly git commit -a -m ... , and, zap, repo bloated 2.2 gigs. next time made edits, deleted video file, , committed everything, compressed file still there in repository, in history. i know can start branches commits , rebase 1 branch onto another. should merge 2 commits big file didn't show in history , cleaned in garbage collection procedure? use bfg repo-cleaner , simpler, faster alternative git-filter-branch designed removing unwanted files git history. carefully follow usage instructions , core part this: $ java -jar bfg.jar --strip-blobs-bigger-than 100m my-repo.git any files on 100mb in size (that aren't in latest commit) removed git repository's history. can use git gc clean away dead data: $ git gc --prune=now --aggressive the bfg typically @ least 10-50x faster running git-filter-branch , , easier use. full disclosure: i'm author of bfg repo-cleaner.

python - How to sort numerically but read_csv with dtype=object? -

given simplified test.csv file: wrong 8 7 6 3 1 2 4 5 9 10 and code: #!/usr/bin/python import pandas pd data = pd.read_csv('test.csv', dtype=object) counts=data['wrong'].value_counts(dropna=false) counts_converted=counts.convert_objects(convert_numeric=true) print counts_converted.sort_index() produces following output: 1 1 10 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 dtype: int64 why last print statement not sort index 1-10? i have force dtype object when csv file read overcome issues detecting mixed character, date, , numeric formats in columns, removing statement isn't going work me. i thought convert series numeric, doesn't seem work. editing question since commenting not allowing me use enter key without posting comment... [ahh, found many long rants feature. shift-enter works.] @edchum suggested solution works simplified case, not work production data. consider less simple data file: wrong,right 8,...

c - Send data from Host App to Chrome Extension -

after hours of work, i'm able run extension , host app when activate extension, everytime try receive data, undefined. this code: int main(int argc, char* argv[]) { char message[] = "{\"t\": \"t\"}"; unsigned int len = strlen(message); _setmode(_fileno(stdout), _o_binary); printf("%c%c%c%c", (char) 10, (char) 0, (char) 0, (char) 0); printf("%s", message); return 0; } what doing wrong? %c takes int argument ( intrpreted unsigned char ), not char . can/will result in wrong data being printed. strlen returns size_t . should read man-pages of functions use. important: when passing binary values (not characters), should either use uint8_t or - @ least unsigned char . remember char can signed or unsigned, depending on implementation. might lead surprises on arithmetic operations. note: printf("%c%c%c%c", (char) 10, (char) 0, (char) 0, (char) 0); printf("%s", m...

Azure AD Sign In -

i have web application secured azure ad. able allow people access application. have created account in directory these users , log them in without doing redirect azure ad. is there way azure auth cookie , allow them access application without redirecting them login? know username / password , able sign in behind scenes. you should able use resource owner credentials flow. assuming you're using adal , can leverage this sample app retrieve token. once have authentication result, can use build identity , pass cookie authentication manager (assuming you're using owin cookie authentication middleware). var claims = new list<claim>(); claims.add(new claim(claimtypes.givenname, result.userinfo.givenname)); var id = new claimsidentity(claims, defaultauthenticationtypes.applicationcookie); var ctx = request.getowincontext(); var authenticationmanager = ctx.authentication; authenticationmanager.signin(id); source: http://brockalle...

ios - UITableViewController scrolling optimisations for "Messenger App"-like functions -

i developing small app, includes messenger functionality. when showing chat thread used tableview , populate messages in small bubbles , @ point before viewdidappear scroll bottom, recent messages shown. there popular solution scrolling bottom of tableview scrolltocellatindexpath or scrollrecttovisible . these kinda work little data, , constant cell heights. in case there lot of message data , use uitableviewautomaticdimensions rowheight . results in slow loading, not scrolling bottom , crazy error messages. here's why (imo): scroll bottom, tableview has load cells because have automatic dimensions, , can scroll down after knows how far is. auto layout problem. doesn't scroll way down, because auto layout didn't finish yet , rowheight @ initial value still. what tried: putting scrolling in didlayoutsubviews: solves problem loads slowly, , scrolling called multiple times (+ crazy error message) i guess upside down tableview solve problem, because first ...

Improve usage of xsd:any in Java code -

i have legacy xml documents import in 1 of software. part causes me troubles @ moment content of param element: sample.xml <...> <param> <idnumber>12345678</idnumber> <factor>12.3</factor> <date>2015-07-01</date> <counter unit="1"> <medium>1</medium> ... </counter> <counter unit="2"> <medium>4</medium> ... </counter> ... </param> </...> there can many (number can vary) children elements in param , avoid list of them in xsd, has been declared follow: schema.xsd ... <xs:element name="param"> <xs:complextype> <xs:sequence> <xs:any minoccurs="0" maxoccurs="unbounded" processcontents="skip" /> </xs:sequence> </xs:complextype...

elixir - Flash messages in Phoenix show module not found -

Image
i'm attempting recreate flash messages guide in phoenix i'm getting error states undefined function: phoenix.controller.flash.put/3 (module phoenix.controller.flash not available) however: have plug :fetch_flash in router.ex browser pipeline. have included the: use phoenix.controller alias phoenix.controller.flash at top of module definition. i'm attempting adapt syntax code (where receive parameter in render). you looking @ old version of documentation (for v0.7.2 ) latest v0.14.0 , want following code: conn |> put_flash(:error, "some message") |> put_flash(:info, "another message") this change made in v0.8.0 the correct docs version available @ http://www.phoenixframework.org/v0.14.0/docs/controllers

android - build ffmpeg library with a sample project and use it in eclipse on Linux operating system -

i want ffmpeg project in eclipse on linux operating system following link: http://dmitrydzz-hobby.blogspot.in/2012/04/how-to-build-ffmpeg-and-use-it-in.html have add ndk in eclipse still shows error in loading ffmpeg library my logcat contains error: building file: ../jni/ffmpeg/libavcodec/x86/dct32_sse.asm invoking: gcc assembler -o "jni/ffmpeg/libavcodec/x86/dct32_sse.o" "../jni/ffmpeg/libavcodec/x86/dct32_sse.asm" ../jni/ffmpeg/libavcodec/x86/dct32_sse.asm: assembler messages: ../jni/ffmpeg/libavcodec/x86/dct32_sse.asm:1: error: junk @ end of line, first unrecognized character `*' ../jni/ffmpeg/libavcodec/x86/dct32_sse.asm:2: error: junk @ end of line, first unrecognized character `*' ../jni/ffmpeg/libavcodec/x86/dct32_sse.asm:3: error: junk @ end of line, first unrecognized character `*' ../jni/ffmpeg/libavcodec/x86/dct32_sse.asm:4: error: junk @ end of line, first unrecognized character `*' ../jni/ffmpeg/libavcodec/x86/dct32_sse.asm:5:...

wpf - TestStand APIs with C# -

i working in project have use teststand apis in c# (wpf). have not worked in area before , not able find references or materials regarding it. i want 2 inputs user x , y using c# ui. have send these x , y values teststand have function member of same class these inputs , add both. need enter x , y value in ui , press button ("save changes") values should populated in parameters of function called. whole thing custom step. any idea appreciated. feel thankful if suggest materials reference. in advance. it not clear c# ui launched edit substep. however, assuming writing c# ui launched edit substep in custom step type, can pass sequencecontext (thiscontext) c# ui reference provide correct context parameters propertyobject in given sequence. once button on ui pressed, able use teststand propertyobject api setval(type) (where 'type' data type of parameter setting i.e. number, string, etc.) of given lookupstring variable in parameters of sequence. if provi...

Eclipse java graphics issues -

i working in eclipse on creating canvas can draw lines or on it, simple program, know. have created canvas class, cartesiancoordinate class, , main class. have created method draw line of specified color on canvas created, whenever try enter color, told wrong. i've checked , seems right, if me i'd appreciative! here's code: import java.awt.color; public class lab { public static void main(string [ ] args){ cartesiancoordinate mycoordinate; mycoordinate = new cartesiancoordinate(300, 400); mycoordinate.getx(); mycoordinate.gety(); system.out.printf("the coordinates are: (%s)", mycoordinate.tocoord()); canvas mycanvas = new canvas(800, 600); mycanvas.drawlinebetweenpoints(400, 500, green); } } public class cartesiancoordinate { private int xposition; private int yposition; public cartesiancoordinate(int startingx, int startingy){ this.xposition = startingx; this.yposition = startingy; } public int getx(...

css - Flex 4: External stylesheet module - how to exclude classes? -

i have myclass.as class , myclassskin.mxml - custom skin class. building style swf (module), loading @ runtime , applying in app ok. the problem is: resulting .swf contains myclass , other classes, linked :( how to exclude these classes styles? had use hostcomponent metatag in skin. css file: m|myclass { skinclass: classreference("myclassskin"); } build, if it's needed: <mxmlc fork="false" failonerror="true" file="${dir.skins}/css/style.css" o="${dir.bin}/style.swf" static-link-runtime-shared-libraries="false"> <source-path path-element="${dir.src}" /> <source-path path-element="${dir.skins}" /> </mxmlc>

node.js - Nodejs/socket.io/express chatroom, across different ports -

i had google , searched stack haven't found relating need. have user side of chat(port: 3000) have admin side of chat (port:3001). in user side enter name , other details form , join chat. after they appear in admin side of chat, admin can click on room, enter , start chatting... have following admin join room if on same port, unsure how them room when on different port(these specs have been given , cant change them): admin client side: $('body').on('click', '.chatroom', function(){ var chatroom = $(this).attr('data-room'); console.log('chatroom client side: '+chatroom); socket.emit('switchroom', chatroom); }); admin server side: socket.on('switchroom', function(newroom){ console.log('new room: '+newroom); socket.join(newroom); socket.emit('updatechat', 'server', 'you have connected '+ newroom); socket.broadcast.to(socket.room).emit('updatech...

sql server - Understanding PIVOT function in T-SQL -

i new sql. i have table this: id | teamid | userid | elementid | phaseid | effort ----------------------------------------------------- 1 | 1 | 1 | 3 | 5 | 6.74 2 | 1 | 1 | 3 | 6 | 8.25 3 | 1 | 1 | 4 | 1 | 2.23 4 | 1 | 1 | 4 | 5 | 6.8 5 | 1 | 1 | 4 | 6 | 1.5 and told data this elementid | phaseid1 | phaseid5 | phaseid6 -------------------------------------------- 3 | null | 6.74 | 8.25 4 | 2.23 | 6.8 | 1.5 i understand need use pivot function. can't understand clearly. great if can explain in above case.(or alternatives if any) a pivot used rotate data 1 column multiple columns. for example here static pivot meaning hard code columns want rotate: create table temp ( id int, teamid int, userid int, elementid int, phaseid int, effort decimal(10, 5) ) insert temp values (1,1...

Thumb Drag in MVVM, WPF, C# -

i have 1 working app writen in c# wpf. practice working mvvm write same app mvvm. came problem. there in app use <thumb dragdelta="thumb_drag" dragstarted="thumb_dragstarted" dragcompleted="thumb_dragcompleted" ... how write "drag&drop/draggable" example in mvvm? use "binding" or else? example welcome :) thanks! if dont understand please ask me. it's possible use system.windows.interactivity library can added reference in project. add namespace: xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" and call commands through <i:invokecommandaction> : <thumb> <i:interaction.triggers> <i:eventtrigger eventname="dragdelta"> <i:invokecommandaction command="{binding datacontext.thumbdragdeltacommand, relativesource={relativesource ancestortype={x:type window}}}" /> </i:eventt...

How to combine 2 sql queries to one query in SQL Server? -

i'm bit confused 2 sql queries in ms access have add in sql server. i want write stored procedure, don't know how combine these 2 sql queries. here's first maxmonthdate : select max(day([datum])) daymax, month([datum]) monthmax, year([datum]) yearmax, dateserial([yearmax],[monthmax],[daymax]) datummax ds (((ds.datum)>=[formulare]![hauptmenü]![startdatum] , (ds.datum)<=[formulare]![hauptmenü]![enddatum])) group month([datum]), year([datum]); the second query maxmonthval : select ds.* maxmonthdate inner join ds on maxmonthdate.datummax = ds.datum order ds.datum; can tell me how combine these in 1 query? you can use subquery combine queries. please refer below query same: select ds.* ds ds.datum in (select datummax (select max(day([datum])) daymax, month([datum]) monthmax, year([datum]) yearmax, dateserial([yearmax],[monthmax],[daymax]) datummax ds (((ds.datum)...

file - How to prevent the browser from canceling downloads from the same url -

i hope can me. we have self written http server used proxy download logfiles other devices (which have httpservers). we have webpage lists device. each device has own downloadbutton, link same url, different query params (e.g. /logfile.log?device=12345, /logfile.log?device=67890, ..." the problem is, devices not respond immediately, collect data long time (e.g. 50 seconds) , send data. my problem is, if user clicks on first button , on second, before first device sent data, download canceled browser. download window (where user can selects if wants open or save file) display first bytes received. the query params ignored, browser seems think downloads same file , therefore skips previous download. i think problem should same if want download database server needs time respond , try download same link. should skip first download? i tried modify http proxy server responds head tells browser content-disposition file specific name downloaded, no bytes file right @ be...

nasm - What is the easiest way to draw a perfectly filled circle(disc) in assembly? -

i'd draw filled* circle(disc) in assembly in 320x200 mode 100 pixel radius. what's quickest/easiest way? (*: mean disc filled when color e.g. constant white , has no black pixels in it.) if quickest mean quickest write, here simple solution dos. it doesn't use dos service exit one. meant generate com file (raw output nasm fine, rename com extension). bits 16 org 100h push 0a000h ;video memory graphics segment pop es mov ax, 0013h ;320x200@8bpp int 10h push 09h ;blue push 159 ;cx push 99 ;cy push 60 ;radius call drawfilledcircle ;wait key xor ah, ah int 16h ;restore text mode mov ax, 0003h int 10h ;return mov ax, 4c00h int 21h ;color ;cx ;cy ;r drawfilledcircle: push bp mov bp, sp sub sp, 02h mov cx, word [bp+04h] ;r mov ax, cx mul ax ;ax = r^2 mov word [bp-02h], ax ;[bp-02h] = r^2 mov ax, word [bp+06h] sub ax, cx ...

javascript - $scope.$apply undefined angularJS unit testing jasmine -

i'm testing controller containing $document.on('click', $scope.$apply.bind($scope, $scope.deactivate)); when test controller using jasmine & karma 'use strict'; describe('controllers: arrayctrl', function() { var scope; beforeeach(module('ironridge')); beforeeach(inject(function($controller,$rootscope) { scope = $rootscope.$new(); $controller('arrayctrl', { $scope: scope }); })); it('test section ', inject(function($controller) { expect(scope.pannels.length).tobe(0); })); }); i following error : phantomjs 1.9.8 (linux 0.0.0) controllers: arrayctrl should located in quote section failed typeerror: 'undefined' not function (evaluating '$scope.$apply.bind($scope, $scope.deactivate)') undefined @ /home/hpro/ironridge/src/app/components/array/array.controller.js:183 @ invoke (/home/...

c++ - Instantiation/Template function specialization -

i'm reading book on c++ , reason can't seem understand template specialization (implicit template instantiation, explicit template instantiation, , explicit specialization) of functions. to clear, don't understand need explicit template instantiation or explicit specialization when 1 declare/define non-template function, override both generic template function , specialization. where, when, , why use explicit template instantiation and/or explicit specialization of functions? one area useful when want overload functions different return type. not supported normal functions there no way compiler resolve ambiguity of 1 variant call. template functions can achieve this template<typename t> t func() { ... } template<> std::string func() { ... } template<> bool func() { ... }

Facebook android sdk internal server error -

Image
i want integrate facebook signin in android app. using facebook-sdk-4.4.0 getting blank screen. tried debug app using fiddler , noticed webview not able created because request facebook getting 500 internal server error response. please figure out mistake making. try code. it's work successfully. callbackmanager = callbackmanager.factory.create(); loginbutton = (loginbutton) findviewbyid(r.id.login_button); list < string > permissionneeds = arrays.aslist("user_photos", "email", "user_birthday", "public_profile", "accesstoken"); loginbutton.registercallback(callbackmanager, new facebookcallback < loginresult > () {@override public void onsuccess(loginresult loginresult) { system.out.println("onsuccess"); string accesstoken = loginresult.getaccesstoken() .gettoken(); log.i("accesstoken", accesstoken); graphrequest request = graphrequest.newmereq...

c++ - void() issue - It doesn't print results -

i writing program split in 3 different files: 1) header named my.h ; a source cpp file named my.cpp ; the main file named use.cpp ; here statements: /* header file my.h define global variable foo , functions print , print_foo print results out */ extern int foo; void print_foo(); void print(int); /* source file my.cpp defined 2 funcionts print_foo() , print() , in called library std_lib_facilities.h */ #include "stdafx.h" #include "std_lib_facilities.h" #include "my.h" void print_foo() { cout << "the value of foo is: " << foo << endl; return; } void print(int i) { cout << "the value of is: " << << endl; return; } / use.cpp : definisce il punto di ingresso dell'applicazione console. // #include "stdafx.h" #include "my.h" #include <iostream> using namespace std; int _tmain(int argc, _tchar* argv[]) { int foo = 7; int...

Why can't I run a python script from the Windows Command Prompt? -

Image
i attempting use python script made available mrdoob's three.js; script allows me convert obj files binary code. script; convert_obj_three.py ran command line. however, none of attempts open have worked. i've de-installed, re-installed python (yes has path access) no luck. i bombarded syntax error message. does know how use windows command prompt execute python files? if so, i'd appreciate guidance. i'm not asking silly questions. if so.. please link me next best answer. you trying run command python convert_obj_three.py in python, of course invalid python syntax. you should run python convert_obj_three.py straight command line, , not python shell. open cmd in directory of .py file , run python convert_obj_three.py arg1 arg2 ... . you don't have in directory of file, of course need provide full path: python "c:\some_path\convert_obj_three.py" arg1 arg2 ...

javascript - Make a video play when i click on an image inside iframe -

i take video photo youtube iframe. can see when click on html button photo load try make photo change video in iframe after click on picture. all..! this html: <!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="index.css"/> </head> <body> <header></header> <nav> <a target="page" id="img" onclick="html()" href="http://i1.ytimg.com/vi/bwpmsssvdpk/hqdefault.jpg"> <button>html</button> </a> </nav> <iframe name="page" src="" frameborder="1"></iframe> <footer></footer> </body> </html> this javascript: function html(){ var iframes = document.getelementbyid('iframes'); iframes.innerhtml ='https://w...

Adding XML element with Scala's XML Support -

i got pretty basic question don't seem find elegant scala way of doing this. i want insert programatically generated xml tags existing xml structure read in file using xml.xml.loadfile(...) in how create xml root node in scala without literal element name? found approach creating tags. def textelem(name: string, text: string) = elem(null, name, null, topscope, text(text)) having xml tree <root> <set start="christmas"> <data> <val>abc</val> ... </data> <custom> <entry>def</entry> <!-- append here --> </custom> </set> <set start="halloween"> ... </set> </root> how select custom section christmas set, append programatically generated xml tags , save whole xml tree file? thanks help! q. how select custom section christmas set ? a. in scala, can use def \\(that: string): nodeseq val cus...

c# - Ajax posting method succeed but error method fire -

i sending msg mobile using ajax posting . receive msg fire error method not success. , should pass in data parameter.? here code .... var sendurl ="here send msg url"; $.ajax({ url: sendurl, type: 'post', data: "", success: function (data) { alert("success"); }, error: function (e) { alert("fail"); } }); $('#txtmobileno').val(''); in data property in ajax options want send object or value matches server side params posting to. data param in success function data returns server code when call successful. error function being called because posting method requires parameter passed in aren't supplying 1 (your data property in ajax options).

JavaScript Object Literals between function and function invoke ,how to with this? -

var chat = { isvisibility: function(){ } send: { add:function(){ //right here ,how invoke isvisibility function not chat.**** //except chat.isvisibility } } }

.net - Incorrect ISO8601 Week Number using DatePart() -

i have following sub within class. have no errors results not match iso-8601 standards private sub calculateallproperties(byval dt date) select case dt.dayofweek case dayofweek.monday m_currentweekstartdate = dt case dayofweek.tuesday m_currentweekstartdate = dateadd(dateinterval.day, -1, dt) case dayofweek.wednesday m_currentweekstartdate = dateadd(dateinterval.day, -2, dt) case dayofweek.thursday m_currentweekstartdate = dateadd(dateinterval.day, -3, dt) case dayofweek.friday m_currentweekstartdate = dateadd(dateinterval.day, -4, dt) case dayofweek.saturday m_currentweekstartdate = dateadd(dateinterval.day, -5, dt) case dayofweek.sunday m_currentweekstartdate = dateadd(dateinterval.day, -6, dt) end select 'now have our start point of m_currentweekstartdate can calculate other properties. m_currentweekst...