Posts

Showing posts from July, 2013

exception handling - visual studio 2015 wdk 10 command line error -

i following guide https://msdn.microsoft.com/en-us/library/windows/hardware/hh439665(v=vs.85).aspx i using visual studio 2015 wdk 10. however, when trying build solution (step 14), following error: command-line error: exception handling option can used when compiling c++ in line 1 any ideas ? thank you it's simple. there bug in vs 2015. need wait vs 2015 update 1, there no workaround.

rascal - Is there a construct like `Either`/`Validation`? -

for use case want have either successful result (with value) xor failed result list of errors. in haskell use either this, in scalaz have validation . there construct in rascal this? is see maybe available, hope either well. at moment support maybe in library, write own either if want. useful addition our library.

Looping through user input and reversing character array in C? -

i trying user's input while loop character array (this array can have maximum length of 255 characters). here have far, nothing happens once press enter after entering data. #include <stdio.h> int main() { char inputstring[255]; printf("enter line of text 255 characters\n"); int = 0; while(i <= 255) { scanf(" %c", inputstring); i++; } // display reversed string int x; for(x = 255; x >= 0; --x) { printf("%c", inputstring[x]); } return 0; } i new c , don't understand wrong code. thanks in advanced. eg: " hello world! " should print " !dlrow olleh " you got except 2 things the indices in c go 0 n - 1 , instead of int = 0; while(i <= 255) { it should be for (int = 0 ; < sizeof(inputstring) ; ++i) { as can see loop goes i == 0 i == 254 or i < 255 , not i <= 255 . same goes reverse loop, should start @ siz

Javascript help using helper function random button to display 1 of 5 different input boxes? -

i create 1 set of 5 input boxes using submit button produce results producing random mad lib. 1.)create submit button when clicked randomly chooses number runs mad lib 2.)without changing page creates boxes according mad lib 3.) gets user input 4.)prints out mad lib .is document.addeventlistener("domcontentloaded",init); function init(){ var randombutton = document.createelement('button'); randombutton.innerhtml ="random"; randombutton.addeventlistener("click", random); document.getelementbyid("displayarea"); } function random(){ var randomnumber = math.random(); randomnumber *= 10; randomnumber = math.floor(randomnumber); randomnumber = randomnumber % 7; console.log(randomnumber); if(randomnumber==1){ var userdataobject = buildingmadlib0(); var madlib0 = madlib0(userdataobject); var displayarea = document.getelementbyid("madlib0"); displayarea.innerhtml = madlid0; }else if(randomnumber==2){ var userd

android - What happens to a Fragment once it's removed or replaced? -

android documentation doesn't seem have on it, other stating fragment removed once transaction committed. fragment gone? in metaphysical sense? or exist somewhere still, able called when needed? if so, how call it? as more pragmatic question, if have activity contains 1 fragment view , multiple fragments go view, there way reference fragments other recent 1 on stack (for question purposes, assuming they're placed on there) when remove or detach fragment doesn't removed project, can attch activity. but once pop fragment stack , destroy, can't revoked. because when destroy fragments, cleanup function being called cleans every part of fragment.

python - How to store socket object in google app engine Datastore (aka can I pickle a socket object) -

i need store socket object datastore/memcache in gae python based app. the approach taking 1. use pickle.dumps convert socket object string 2. when needed retrieve string , unpickle using pickle.loads(<pickledsock>) complete error message below, main part is: typeerror: __init__() got unexpected keyword argument '_sock' does mean can't use above approach because "unpickling" won't work? ssl_sock2use=pickle.loads(pickledsock) file "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 1382, in loads return unpickler(file).load() file "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 858, in load dispatch[key](self) file "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 1217, in load_build setstate(state) file "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/socket.py", line 181, in __s

JavaScript Console Output to Single Line with For and While Loop -

i need figure out how output list of numbers in loop console. however, output console must in same line, opposed cascading down page every new number. below, have 2 separate blocks of code accomplish same thing. 1 uses while loop , other uses loop. if there's difference between being able accomplish in loop versus while loop, i'd know well. thank you. while loop var number = 2; while (number <=10) { console.log(number++); number = number + 1; } for loop for (var number = 2; number <= 10; number = number + 2) console.log(number); while: var number = 2, output = []; while (number <=10) { output.push(number++); number = number + 1; } console.log.apply(console, output); for: var number, output=[]; (number = 2; number <= 10; number = number + 2) { output.push(number); } console.log.apply(console, output); note, recommend don't for(var x... - gives false sense of scope var x - that's opinion on part

mysql - How to find top 3 topper of each subject in given table -

id - name - subject - marks 1 - acb - mat - 90 2 - acb - sci - 80 3 - acb - eng - 90 4 - acb - - 96 5 - acb - phy - 70 6 - acb - che - 43 7 - xyz - mat - 90 8 - xyz - sci - 80 9 - xyz - eng - 90 10 - xyz - - 96 11 - xyz - phy - 70 13 - xyz - che - 43 etc ..... just want show 3 topper of each subject abc - math - 90 xyz - math - 90 def - math - 80 etc you can using variables. select t.* (select t.*, (@rn := if(@s = subject, @rn + 1, if(@s := subject, 1, 1) ) ) rn t cross join (select @rn := 0, @s := '') params order subject, marks desc ) t rn <= 3 order t.subject, t.rn;

makefile - resource file not linked -

people..i'm using autotools build gtk2 application. want make crossplatform. configure.ac: ac_prereq([2.67]) ac_init([gtk2gifviewer], [1.0.0.0], aullidolunar@gmail.com) ac_config_macro_dir([m4]) ac_config_srcdir([main.c]) am_init_automake ac_prog_cc lt_init ac_check_prog([windres],[windres],[yes],[no]) am_conditional([have_windres], [test "x$windres" = xyes]) pkg_check_modules([gtk2], [gtk+-2.0 >= 2.20]) ac_config_files([makefile]) ac_output and makefile.am: aclocal_amflags = ${aclocal_flags} -i m4 suffixes: .rc bin_programs = gtk2gifviewer gtk2gifviewer_sources = callbacks.c main.c extra_dist = callbacks.h main.xpm main.ico build.txt if have_windres gtk2gifviewer_sources += resource.rc endif gtk2gifviewer_cflags = $(gtk2_cflags) gtk2gifviewer_ldadd = $(gtk2_libs) .rc.o: windres -o $@ $< run: $(package_name)$(exeext) ./$< .phony: run and simple resource file: #include <windows.h> app_icon icon "main.ico" both ic

linux - Libraries paths defined by Master bash script, but having to run it in every terminal session, how to make more efficient? -

i have build set of libraries , many of fortran programs use them. creates problem in if ever need change location of libraries need individually update path directories in each make file. how overcome? have planned instead have each make file read path single master path file in home or root directory (this files location never change). within file path each library , if path changes file needs updated. so wrote bash script file, called master_library_paths: export library1_name = {library1_name_path} echo $library1_name export library2_name = {library2_name_path} echo $library2_name export library3_name = {library3_name_path} echo $library3_name and placed in home directory. in make files, have line: $(shell . {path master_library_paths} ) \ and load libraries: -i$(library1_name) -i$(library2_name) -i$(library3_name) this works great if run ./master_library_paths in terminal session first , go directory compile program, quite time consuming, how can fix these argu

objective c - IOS 8.1 localization not working,only show key not value -

first of all,i did follow site http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014 i create new localizable.strings file,and localize ,then add english , japanese support. i edit localizable.strings(en) file follow: "apptitle" = "calibrate"; i edit localizable.strings(ja) file follow: "apptitle" = "こんにちわ"; at source code,the code : self.title = @"pianodisc calibrate"; instead of : self.title = nslocalizedstring(@"apptitle", nil); then run it,but "apptitle" not "こんにちわ"; my environment ipad mini,ios 8.1 system,xcode 7 or 6.4. i'm searched long time on stackoverflow,like nslocalizedstring retrieves key, not value in localizable.strings (ios) ,i have tried answer,but still not work. there info,i use follow code, nsstring *path = [[nsbundle mainbundle] pathforresource:@"ja" oftype:@"lproj"]; nslog(@"!!!!!!!!!!!!!!!!%@"

algorithm - How to check if a for a given number N, N^2 can be expressed as the sum of squares of two non-zero integers? -

given number n, how can find out if n^2 can expressed sum of squares of 2 non-zero integers. example if n=10, 10^2 can expressed (6^2)+(8^2). i've read such numbers n can expressed 4k+1 9 fits expression, 81 cant expressed sum of squares of 2 integers. what's right way this? the numbers want hypotenuses ("c" values) of pythagorean triples, series a009000 in oeis. comments there point out number hypotenuse if , if it's divisible @ least 1 prime of form 4k+1. can check whether number hypotenuse obtaining prime factorization , seeing whether of primes have remainder of 1 when divided 4. in case of example, 81 doesn't qualify because prime factor 3. 81 divisible 9, 9 isn't prime.

woocommerce - How do is show product by user role in wordpress? -

i have created 4 different user roles(administrator, designer, blogger, team) in wordpress different privileges. each user can post own product , requirement have created 4 pages show products according user role. example: supposed logged administrator , add product.after logout when click on administrator page want show product have posted administrator. administrator if logged designer after logout @ designer page should show products posted designer. same process other user roles. that's pretty easy in wordpress. check code. $current_user = wp_get_current_user(); if($current_user->roles[0]=='administrator'){ //admin code }elseif($current_user->roles[0]=='designer'){ //designer code } elseif($current_user->roles[0]=='blogger'){ //blogger code } elseif($current_user->roles[0]=='team'){ //team code }

ios - MMDrawer left side drawer not showing -

i using mmdrawer here . have used 2 navigation controllers . issue on menu click, drawer doesn't open. debugged , found methods called properly, still drawer doesn't show up. here flow: login view controller inside separate uinavigationcontroller , push other uiviewcontrollers in uinavigationcontroller . the above uinavigationcontroller shown in modal pop segue . , dismiss entire uinavigationcontroller . screen shows has drawer doesn't open on menu click. code: - (ibaction)btnmenu_click:(id)sender { [appdel.drawercontroller toggledrawerside:mmdrawersideleft animated:yes completion:nil]; // doesn't open } when login uinavigationcontroller not used, works fine. let me know getting wrong , how solve this?

Allocated heap discrepancy in Android Device Monitor -

Image
i beginner android development , trying understand problem of efficient heap usage our application. app plays lot of bitmaps, large offline maps used ground overlays google maps. i use heap viewer of android device manager. however, there big discrepancy between "allocated" heap (52.4mb) , sum of "total size" of items in "stats" (around 34mb excluding "free" item). possible explanation helpful!

HTML/CSS: How do I keep multiple divs inline horizontally in header? -

Image
so i'm working on webpage, , i'm having problem header. header i'm making has 4 elements: the header background. the website logo (top left) the website title (center) the login button website's application portal my problem keeps aligning vertically. i'm going link screenshot below temporary page made try , work out issue below. can't seem figure out. i should add did using float. having 3 "inner" elements (everything except background) floating, lined properly. unfortunately, works terrible when page resized. if it's less height, components slip out of alignment. here html/css code. appreciated. can't seem figure out. .header{ display: inline-block; text-align: center; font-family: "comic sans ms", cursive, sans-serif; font-weight: bold; width: 100%; height: 80px; box-shadow: 0px 3px 5px gray; } /* title text in header */ .header-title{ text-shadow: 3px 3px 5px gray; margin-left

javascript - AngularJS - Access $statParams from a parent controller with UI-Router -

i have rather complicated prototype app have been asked throw together... in app have routes / states defined using ui-router, here code app.js file, can see 1 parent , child route / state: .state('myapp.loggedinhome.contacts.default', { url: '/:profileid', // myurl.com/home/contacts/31333194 template: '<ui-view/>', publicaccess: false }) // nested state contacts profile... .state('myapp.loggedinhome.contacts.default.news', { url: '/news', // myurl.com/home/contacts/31333194/news templateurl: '/prototype/app/people/views/news.html', publicaccess: false, controller: 'visitorsnewsctrl' }) now in visitorsnewsctr l controller want access :profileid defined in parent root... when try access using $stateparams service undefined ! doing wrong in controller? .controller('visitorsctrl', ['$scope', '$stateparams', function ($scope, $stateparams) {

Is it possible to find the factorial of 10000 in java? -

is possible find factorial of 10000 in java? has done program find factorial of 1000 using biginteger when tried find factorial of 10000 not getting output. class factorial{ public static void main(string[] args) { factorial fact= new factorial(); fact= getfactorialof(10000); } void getfactorialof(long n) { biginteger result = biginteger.one; (int = 2; <= n; i++) result = result.multiply(biginteger.valueof(i)); system.out.println(result); } this complete code. yes possible. according http://gimbo.org.uk/texts/ten_thousand_factorial.txt , 10000 factorial has 35,659 decimal digits ... within capabilities of biginteger . which suggests problem either have bug in code, or being impatient.

php - Regular expression change the text, when it shouldnt -

Image
this strange , cant find similar on internet. i got table of strings in greek characters contains alot of special chars, wanted remove 'em. function clean($string) { $string = preg_replace('/([$@!\?!\+\#\%\^\*\[\]\<\>\;\:\'\"\`\~\,\?\_\=\«\»])+/', ' ' ,$string); $string = preg_replace('/\s+/', ' ',$string); return $string; } $prok=clean($row['name']); echo $row['name'].'-'.$prok; this working ok except when character Π inside string. if Π replace questionmark. does have idea problem ?? you can try using mb_ereg_replace support multibyte: function clean($string) { $string = mb_ereg_replace('/([$@!\?!\+\#\%\^\*\[\]\<\>\;\:\'\"\`\~\,\?\_\=\«\»])+/', ' ' ,$string); $string = mb_ereg_replace('/\s+/', ' ',$string); return $string; } $prok=clean($row['name']); echo $row['name'].'-'.$prok; or use /u

Network simulation tool supporting Bluetooth -

we'd perform bluetooth network simulation. far have researched, bluetooth module has not been implemented in ns-3 , ns-2 modules recommended in this question have not been updated years. have not found other simulation tool supporting protocol apart this mention qualnet , have not been able verify on website. there current network simulation tool includes bluetooth module or should still use ns-2? all bluetooth examples in ns-2.29/ucbt-0.9.8.2a/test/ working ok : $ ns-nist-pmipv6 1f.tcl etc. etc. ( except tcp.tcl, causes "segmentation fault", when old executable 'ns-nist-pmipv6' used contemporary "linux os".) examples : 1f.tcl mr5n.tcl pico-3mb.tcl scat-form-law.tcl test_inq.tcl 2sco_inq.tcl ms5n1.tcl pico.tcl tcp.tcl test_sco.tcl 3f.tcl ms5n.tcl rphsi.tcl tdrp.tcl test_sdp.tcl dsdv.tcl multislot.tcl rs.tcl test_fh.tcl udp.tcl code : ns-2.29-nist-mob

java - Android Material design error -

Image
hi learning create material design using tutorial. https://www.youtube.com/watch?v=pmo8evkhjo8&list=plonjj3bvjzw6ctambjz1xd8elus1kxatd&index=3 and in design appbar has padding on sides. can me remove padding , make app real app bar. here screen app_bar <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#dddd"> </android.support.v7.widget.toolbar> main activity <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@d

typescript - Different behaviour of "export = class" -

i writing external module (using amd) needs export single class. want import import myclass = require('./myclass') , therefore in myclass module use "export =" syntax: export = class myclass { // ... } this compiles without errors , produces reasonable js code: define(["require", "exports"], function (require, exports) { return (function () { function myclass() { /* ... */ } return myclass; })(); }); next, try import it: import myclass = require('./myclass'); var my: myclass = new myclass(); compiling gives me error @ "var my: myclass": "ts2304: cannot find name 'myclass'". but, when change module export to: class myclass { // ... } export = myclass; everything works okay, produced js code seems same: define(["require", "exports"], function (require, exports) { var myclass = (function () { function myclass() { /* ... */ }

android - ionic overwrite active element in css -

i tried many example answer stackoveflow no 1 useful in application please me solve problem thank sidemenu: <ion-list class="side" id="sidemenuactive"> <ion-item menu-close href="#/sidemenu/home"> <i class="icon ion-ios-home-outline"></i>&nbsp; home </ion-item> <ion-item menu-close href="#/sidemenu/mydeal"> <i class="icon ion-compose"></i>&nbsp; profile </ion-item> </ion-list> css: #sidemenuactive .active{background: #000000 !important;} the ion-item directive injects "a" element in content. element need use when define styles. <ion-list> <ion-item ui-sref=".item1" ui-sref-active="active">item 1</ion-item> <ion-item ui-sref=".item2" ui-sref-active="active">item 2</ion-item> </ion-list> css: ion-list ion-item.active { ba

powershell - Save off env: drive and later revert -

i running multiple scripts powershell console. these scripts add/modify variables in env: drive. between running each script, reset env: drive when opened console. there way save off/copy env: drive, , copy @ later point? the easiest way start process each script. instead of .\foo.ps1 just use powershell -file .\foo.ps1 then each script gets own process , own environment mess with. doesn't work, of course, if scripts modify things global variables you'd rather have retained in between. on other hand, saving state of environment simple: $savedstate = get-childitem env: and restoring again: remove-item env:* $savedstate | foreach-object { set-content env:$($_.name) $_.value }

java - LibGDX basic stage draw error -

i'm trying create game, code keeps giving me error: exception in thread "lwjgl application" java.lang.illegalargumentexception: no uniform name 'u_projmodelview' in shader @ com.badlogic.gdx.graphics.glutils.shaderprogram.fetchuniformlocation(shaderprogram.java:287) @ com.badlogic.gdx.graphics.glutils.shaderprogram.fetchuniformlocation(shaderprogram.java:277) @ com.badlogic.gdx.graphics.glutils.shaderprogram.setuniformmatrix(shaderprogram.java:507) @ com.badlogic.gdx.graphics.glutils.shaderprogram.setuniformmatrix(shaderprogram.java:498) @ com.badlogic.gdx.graphics.glutils.immediatemoderenderer20.flush(immediatemoderenderer20.java:147) @ com.badlogic.gdx.graphics.glutils.immediatemoderenderer20.end(immediatemoderenderer20.java:160) @ com.badlogic.gdx.graphics.glutils.shaperenderer.end(shaperenderer.java:1104) @ com.badlogic.gdx.graphics.glutils.shaperenderer.check(shaperenderer.java:1092) @ com.badlogic.gdx.graphics.glutils.shaperenderer.rect(shaperenderer.j

Need .ami file wiith CentOS and perl modules -

i need putting amazon ami file following perl modules: getopt::long list::moreutils parallel::forkmanager mail::checkuser mail::checkuser mail::checkuser::treat_timeout_as_fail mail::checkuser::treat_full_as_fail mail::checkuser::sender_addr mail::checkuser::helo_domain mail::checkuser::timeout mail::checkuser::debug parallel::forkmanager net::dns data::dumper if have link can find centos ami file these perl modules installed, or abiliy install them, please let me know. thank you! go fresh copy of centos perl. run command: yum install perl-getopt-long perl-list-moreutils perl-parallel-forkmanager perl-mail-checkuser perl-mail-checkuser perl-mail-checkuser-treat_timeout_as_fail perl-mail-checkuser-treat_full_as_fail perl-mail-checkuser-sender_addr perl-mail-checkuser-helo_domain perl-mail-checkuser-timeout perl-mail-checkuser-debug perl-parallel-forkmanager perl-net-dns perl-data-dumper you can use cpan: cpan getopt::long list::moreutils parallel::forkmanager ma

regex - Is there a way to get a list with of all functions which names match a given regular expressions? -

i list of functions name match given pattern. instance, have functions name includes "theme_". i've seen this post gives solution vector of names. possible have same list of functions instead of vector of names ? for local packages might try this: if (!require("pacman")) install.packages("pacman"); library(pacman) regex <- "theme_" packs <- p_lib() out <- setnames(lapply(packs, function(x){ funs <- try(p_funs(x, character.only=true)) if (inherits(funs, "try-error")) return(character(0)) funs[grepl(regex, funs)] }), packs) out[!sapply(out, identical, character(0))] here's output: ## $cowplot ## [1] "theme_cowplot" "theme_nothing" ## ## $ggplot2 ## [1] "theme_blank" "theme_bw" "theme_classic" "theme_get" "theme_gray" "theme_grey" "theme_light" "theme_line"

Matlab `localfunctions` function is undefined -

Image
i have tried following advice from docs using localfunctions function. when execute script in matlab command window gives following error: >> athing() undefined function or variable 'localfunctions'. error in athing (line 2) fs = localfunctions; in file thing.m have written: function fs = athing() fs = localfunctions; end function babo() end function hidden() end i'm not sure else can try debug this. using matlab: 8.0.0.783 (r2012b). localfunctions introduced in r2013b. need update version of matlab r2013b or newer able use it. at bottom of function reference documentation on mathworks website comment stating version introduced.               

c++builder - inttypes.h file not found compiling Duktape with C++ Builder and Clang -

i have created simple duktape example using c++ builder seattle , follow code in "initialize context" duktape . compiles fine when using classic mode. if switch clang via unchecking project->options->c++ compiler->use 'classic' borland compiler, following error. inttypes.h file not found on line 780 of duktape.h if comment out include following errors: unresolved external _va_copy unresolved external _fmin unresolved external _fmax the normal way ensure clang has -std=c99 no legacy type detection necessary. legacy type detection isn't reliable. however, if can't use c99/c++11 reason, can edit duk_config.h header directly ( duk_config.h present since duktape 1.3.0), contains detection logic.

progress bar - ionic change progressBar bar color in javascript -

the code below not working in application html: <div class="progressbar"> <div class="progressbarindicator"> </div> </div> css: .progressbar{background-color: #fff; height:20px;} .progressbarindicator{background-color: #000; height:20px;} javascript: $('.progressbarindicator').css({"background-color" : "red"}); first check, whether jquery.min.js present or not. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> if yes, change script way. <script> $(document).ready(function(){ $('.progressbarindicator').css("background-color","red"); }); </script> $('.progressbarindicator').css({"background-color" : "red"}); ^ ^ ^ remove replace comma remove for more info, che

C language or programminng -

can me print out following characters: * ******** ** ******* *** ****** **** ***** ***** **** ****** *** ******* ** ******** * that's code: #include <stdio.h> int main(void) { int row; int column; // fig : (row=1;row<=7;row++) { (column=1;column<=row;column++) printf("*"); printf("\n"); } printf("\n"); } you not printing upper right part. change loops print * remaining number if subtract row 7 for (row = 1; row <= 7; row++) { (column = 1; column <= row; column++) putchar('*'); putchar(' '); (column = row; column <= 7; column++) putchar('*'); putchar('\n'); }

c# - Downloading a file from a redirection page -

how go downloading file redirection page (which calculations based on user). for example, if wanted user download game, use webclient , like: client.downloadfile("http://game-side.com/downloadfetch/"); it's not simple doing client.downloadfile("http://game-side.com/download.exe"); but if user click on first one, redirect , download it. i think, should go customized webclient class that. follow code 300 redirects: public class mywebclient : webclient { protected override webresponse getwebresponse(webrequest request) { (request httpwebrequest).allowautoredirect = true; webresponse response = base.getwebresponse(request); return response; } } ... webclient client=new mywebclient(); client.downloadfile("http://game-side.com/downloadfetch/", "download.zip");

html - Scaling animation in CSS don't work -

i have problem make animation works. trying scale object nothing hapens. looked many similar answers on stackoverflow, nothing helped. <!doctype html> <html> <head> <style> .logo { margin:auto; position: relative; background-color: black; background-size: 100% auto; background-repeat: no-repeat; background-position: center; width:60%; height:300px; -webkit-animation-name: example; -webkit-animation-duration: 4s; -webkit-animation-iteration-count: 1; animation-name: example; animation-duration: 4s; animation-iteration-count: 1; } @-webkit-keyframes example { 0% {-webkit-transform: scale(1,1);} 10% {-webkit-transform: scale(1.5,1.5); 100% {-webkit-transform: scale(1,1); } @keyframes example { 0% {transform: scale(1,1);} 10% {transform: scale(1.5,1.5); 100% {transform: scale(1,1);} } </style> </head> <body> <div class=&

php - sum of element in a table jquery -

i've php file create table this <table style="text-align:center; margin-top:20px;" align="center" cellpadding="5"> <caption><u><b>ordine del 22-10-2015 delle ore 16:08:38<b/></u><br /></caption> <thead style="background-color:#ebe9e9"> <tr> <th scope="col">prodotto</th> <th scope="col">quantit&agrave;</th> <th scope="col">prezzo</th> <th scope="col">totale parziale</th> </tr> </thead> <tbody style="background-color:f5ffff"> <tr> <td>coca cola</td> <td> x1</td> <td>1,50 &euro;</td> <td>1,50 &euro;</td> <td><input type="hidden" class="toadd" value="1.50"></td> </tr><tr> <td>limona

java - Display menus in appbar right -

Image
hi learning material design , have created appbar. when add items main_menu displays in drop down, want display new icon before settings icon in app bar. my app 1) want add icon next settings icon. shows in dropdown box when click on settings icon. main menu <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity"> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:orderincategory="100" app:showasaction="never" /> <item android:id="@+id/favorite" android:title="@string/favourite" android:orderincategory="200" android:showasaction="always" android:icon="@drawable/ic_favorite_white_24dp"

c# - Draw mouse pointer in a position without changing its actual position -

in wpf application, have canvas grid in background. idea is, once cursor has entered canvas (and mousemove event being fired), draw mouse pointer moves in grid intersection closest actual position, without - logically - changing (since otherwise stuck in intersection , never able calculate proper intersection should drawn), until has reached intersection closer actual position current one. can't seem use cursor.draw() because system.drawing.graphics not wpf...

javascript - How to retain timezone when formatting a date in moment.js? -

i have date 2015-10-24t17:12-05:00 , i'm using moment.js format this: moment('2015-10-24t17:12-05:00').format('h:mm a'); instead of showing time in timezone specified in string, moment.js seems converting timezone of computer. how can preserve timezone when formatting?

vb.net - How can I close a file created with Word.SaveAs2 method? -

i running visual studio 2015 community, visual basic. referencing microsoft.office.interop.word . the code below creates pdf file converting simple word file using doc.saveas2 method pdf parameter format. my problem when try delete pdf file later in application, tells me still in use. it seems should need close file, i'm not sure how that. code below closes word document not pdf. i've tried using fileclose() method accepts integer parameter. i've tried no value, 1 , 2, i'm still getting "file in use" error when try delete it. i'm new vb coding , appreciate help. private sub createtitlepage() dim wdapp microsoft.office.interop.word.application = new microsoft.office.interop.word.application dim wddoc microsoft.office.interop.word.document = new microsoft.office.interop.word.document dim wdpara1 microsoft.office.interop.word.paragraph 'dim wdpage1 microsoft.office.interop.word.page wddoc.application.vis

php - RegEx to find anchor element in HTML page -

i have string mixed content of plain text , html tags. example: the state of <a href="/wiki/texas" title="texas">texas</a> cool place i want search specific string in html page using php file_get_contents(). eventually, want replace string string mixed content. i tried preg_replace(), didn't work. is going easy task regex? can give example? i'm starting out regex. if not suitable can please suggest solution.

android - Error: "Fatal signal 11 (SIGSEGV), code 1" when passing Mat object from java to jni function -

i running video camera using opencv function. pass mat object jni function works awhile, them error: 10-10 13:03:17.978: a/libc(28693): fatal signal 11 (sigsegv), code 1, fault addr 0x9 in tid 28791 (thread-5418) java code runs camera , calls jni function: package com.adhamenaya; import java.util.arraylist; import org.opencv.android.baseloadercallback; import org.opencv.android.camerabridgeviewbase; import org.opencv.android.camerabridgeviewbase.cvcameraviewframe; import org.opencv.android.camerabridgeviewbase.cvcameraviewlistener2; import org.opencv.android.loadercallbackinterface; import org.opencv.android.opencvloader; import org.opencv.core.mat; //import org.opencv.highgui.highgui; import org.opencv.imgproc.imgproc; import android.app.activity; import android.os.bundle; import android.os.handler; import android.util.log; import android.view.motionevent; import android.view.surfaceview; import android.view.view; import android.view.view.ontouchlistener; import androi

Setting android:screenOrientation="sensorLandscape" prevents actiity restart -

i have added android:screenorientation="sensorlandscape" activity in manifest. , there no android:configchanges attribute. this seems bug me, activity not being re-created i.e. oncreate() not being called when device rotated. also, onconfigurationchanged() not being called either. removing line android:screenorientation="sensorlandscape" fixes problem , activity restarted expected. can confirm bug, and/or there workaround it? can confirm bug... this not bug. it's how designed it. according dianne hackborn , this post on google groups (about half-way down): this not configuration change. there no notification platform provides when this, because invisible environment app in. ...is there workaround it? a possible workaround register sensors detect orientation change, little more work since orientation sensor deprecated. you'd need magnetic field sensor , accelerometer replace functionality. this post demonstra

android - setVisibility(View.VISIBLE) doesn't show TextView -

i have following layout in res/layout/main.xml second textview hidden <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/tv1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="hello"/> <textview android:id="@+id/tv2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="world" android:visibility="gone"/> </linearlayout> and android activity, should display second textview public class mainactivity extends activity { @override public void o

multithreading - Synchronization Fail in Java -

from the tutorial read: it not possible 2 invocations of synchronized methods on same object interleave. when 1 thread executing synchronized method object, other threads invoke synchronized methods same object block (suspend execution) until first thread done object. however, in simple example there still race competition access message object. public class testthread extends thread{ int thread; stringbuilder message; public testthread(int thread, stringbuilder message) { this.thread=thread; this.message=message; start(); } public void run() { synchronized(this){ (int i=0; i<1000000; i++) { double a=2*2; } modifymessage(); } } public synchronized void modifymessage() { message.append(thread); } } public class testmultithreading { static testthread[] testthreads = new testthread[5]; public static void main(string arg

angularjs - Directive, Link Function, Array, DataBinding Order of things is ambiguous -

i have problem challenging, don't know how define, i'm going give example , able explain doing wrong. html is: <tr ng-repeat="object in objects"> <td> <div table-checkbox row-index="{{$index}}" bind-model="selectedchecks[$index]" selected-checks="selectedchecks"> </div> </td> </tr> the selectedchecks array define controller this: $scope.selectedchecks = {} , result of markup column of checkboxes here directive's code: return { restrict: 'ea', scope: { rowindex: '@', selectedchecks: '=', bindmodel: '=' }, template:'<input type="checkbox" ng-model="bindmodel" ng-change="checkit(rowindex)">', link: function(scope, elem, attrs) { scope.checkit = function(i){ alert(scope.bindmodel + " " + scope.selectedchecks[i]);

swift2 - What is the best method to store data on Apple Watch -

i'm programming app needs store data files (or non-volatile method). have nsuserdefaults not idea case since i'm storing arrays of structs. tried storing c's fwrite() options seems inefficient. questions now: how can efficiently store data apple watch's storage swift apple's core data persistence engine of choice complex data structures. integrated apple's other frameworks , under active development , mature.

algorithm - Knights Tour recursive C# Im getting something wrong in my way of doing the stuff -

class knight { public static readonly double legaldistance = math.sqrt(5); public stack<field> steps { get; set; } private static readonly list<field> board = board.gameboard; private static list<field> fields; private static readonly random random = new random(); private static readonly object synlock = new object(); public knight(field initial) { steps = new stack<field>(); steps.push(initial); } public void move() { field destination = choose(); if (destination == null) { return; } console.writeline("moving " + getposition().getfieldname() + " " + destination.getfieldname()); steps.push(destination); } public field back() { field = steps.pop(); console.writeline("moving " + from.getfieldname() + " " + getposition().getfieldname()); return from;

powerpivot - Why can I not share a Power BI report outside my organization? -

Image
power bi doesn't allow users share reports outside organization. severely limiting , makes me wonder how i'm supposed create power bi solution customers. why this? , preferred method setting customers power bi? vote feature . edit: feature supported. alternatives publishing public content pack salesforce appears under data menu. or sending external people power bi desktop file can upload power bi. or provision users in domain external people , have them log tenant. or if want host analysis services model , let external people see in power bi here option: http://www.artisconsulting.com/blogs/greggalloway/2015/10/22/power-bi-analysis-services-connector-and-azure-active-directory-domain-services

ruby on rails - JQuery: Trigger Event based on Form Input Length -

i trying autosave form whenever form length changes. below code. initial form length recorded correctly , variable $("form input").length change when play form block inside if statement not triggered. anyone knows why is? var formlength = $("form input").length; console.log("the current formlength is" + formlength); $(document).ready(function() { if ($("form input").length > formlength) { settimeout(autosaveform, 10000); formlength = $("form input").length; console.log("the updated formlength is" + formlength); } }); update: florian has solved problem. , have update of 1 new problem. form have nested form using cocoon gem in rails. datepicker.js loaded whenever 1 child inside nest added. however datepicker loaded after set time interval. below new code. thoughts? var formlength = $("form input").length; console.log("the current formlength : " + formlength); $(docu

javascript - set bootstrap radio as per given value by server -

i'm trying loading data page, server send value browser, example "male". did try $("#optgender").val("male"); to activated/checked radio button male, doesnt works <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <label class="btn btn-danger active"> <input type="radio" name="optgender" value="male" checked=""> male </label> <label class="btn btn-danger"> <input type="radio" name="optgender" value="female"> female </label> </div> </div> $("#optgender").prop('checked',"male");

android - How to make AppCompatSpinner more visible to the user? -

i'm using android.support.v7.widget.appcompatspinner. problem down arrow triangle shape small. there no background default color set spinner either. though user can hardly know there spinner on page cause pretty looks simple text view. arrow size cannot changed , become bigger. when try put background small arrow totally goes away! supposed do? found no related guide in material design documents. thanks lot in advance. here material design spinner: <android.support.v7.widget.appcompatspinner android:entries="@array/contract_type_array" android:id="@+id/spinner" style="@style/styleforsimplespinnermedium" android:background="@color/color5" /> <style name="styleforsimplespinnermedium"> <item name="android:padding">30dp</item> <item name="android:paddingend">10dp</item> <

c - How to make a process continue it's execution when it's waiting a signal with pause() and it doesn't recieve it -

i'm new forum , i've been googling , searching here problem didn't find it. anyway i'm not expert in searching in forum please excuse me if has been answered. ok let's point: i'm doing small project college have following code written in c: #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> int arb,a,b,x,y,z,i; void senyal(){ //signal usr1 method if(getpid()==a){ printf("i'm process, i've received signal\n"); system("pstree"); } else if(getpid()==b){ printf("i'm b process, i've received signal\n"); system("pstree"); } else if(getpid()==x){ printf("i'm x process, i've received signal\n"); execlp("ls", "ls", "-al", "*.c", null); } else if(getpid()==y){ printf("i'm y process, i've received signal\n"); execlp("ls", "