Posts

Showing posts from September, 2014

Playing iframe videos in android 4.2.2 -

did have problems playing videos embedded in webview using iframe on android 4.2.2, works fine on 4.4+ on 4.2 videos won't play. this how data loaded string content = "<iframe allowfullscreen=\"\" frameborder=\"0\" height=\"270\" src=\"http://www.dailymotion.com/embed/video/x22rv5x\" width=\"480\"></iframe>" mwebview.getsettings().setjavascriptenabled(true); mwebview.loaddata(content, "text/html", "utf-8"); you can try adding youtube links too.

assembly - Difference between long and short jump (x86) -

i've read short jumps used when the relative jump less 124 in address , , long jumps should used otherwise. what difference in terms of operations performed in cpu / performance between 2 types of jumps on x86? there 3 types of jmp instructions; short, near , far (long). a short jmp relative jmp refer to. encoded 2 bytes; actual jmp , number of bytes +/- relative current ip. a near jump allows jump within current "segment" (using real mode terms) or within selected memory area in cs selector. a long or far jmp additionally includes selector (or segment in real mode) you can timings yourself. biggest difference related time caused different numbers of bytes must read accomplish jmp .

php - MySQL like on special characters which are not present -

this strange question here goes have tv listing page displays list of shows genre. genre column value each show looks (text string): adventure, action & adventure, sci-fi & fantasy now if search adventure correct results, if have special characters in between no results see below: $query .= " select t1.*, t2.content genres tvshows t1 left join tvshows_content t2 on t2.tvshows_id = t1.id , t2.type = 'genres' (t2.content "%,sci fi fantasy,%" or t2.content "sci fi fantasy,%" or t2.content "%,sci fi fantasy" or t2.content = "sci fi fantasy" or t2.content "%sci fi fantasy%" or t2.content "sci-fi-fantasy" ) "; my question remove special characters page slugs, want check if maybe present? possible? if can't find results searching 'action & adventure' not problem, using special character, more likely, using different character encodings in field , query. try binary opera

java - How to check a String's character not matching with other character of another String -

i have 2 strings i.e string test1 = "if want succeed work hard.best of luck" . string test2 = "if want succeed work hard.best of yuck" . basically , these dummy test strings have taken reference here.in , have strings have more 10000 lines of character. i want check these strings equal or not . know .equals compare both strings value return boolean value. want check @ character didn't match. i tried :- for(int i=0 ; i<=test1.length();i++){ for(int j=0 ; j<=test2.length();j++){ if (test1.charat(i)==test2.charat(j)){ system.out.println("matched "+test1.charat(i)+" "+test2.charat(j)); } else{ system.out.println("not matched "+test1.charat(i)+" "+test2.charat(j)); } } } but code check each character of test1 string every character of test2 , print. want check each character of test1 each

c - '.' is not reconized as an internal or external command -

after compiling hello.c ,when try run using ./a.out ,it says following '.' not recognized internal or external command,operable program or batch file. here system variables path:c:\windows\system32;c:\windows;c:\windows\system32\windowspowershell\v1.0;c:\program files\java\jdk1.7.0_71\bin;c:\apache-maven-3.2.5\bin;c:\program files\mingw\bin; rename a.out a.exe , run using .\a.exe or a.exe make sure current directory contains a.exe

c# - timer not stopped in asp.net after timer disabled in asp.net -

i set timer in asp.net web page. disabled timer after completing process, timer still running. static bool _end; protected void updatetimer_tick(object sender, eventargs e) { if (_end) { _end = false; updatetimer.enabled = false; download(); } } this click event: protected void btnstart_click(object sender, eventargs e) { stringbuilder threadbuilder = new stringbuilder(); progressbar1.visible = true; preadytodown.visible = true; _end = false; progress progress = progressbar1.progress; thread thread = new thread(() => { _end= start(progress); _builder = threadbuilder; }); thread.start(); } this download file fun: public void download() { string path = server.mappath("~/") + "excelfiles\\sample.xlsx"; response.clearcontent(); //context.response.clearheaders(); response.bufferoutput = true

javascript - Current Reading Position and Progress in iBooks with js -

i'm trying calculate current reading position , reading progress of epub opened in ibooks. in other reading systems (like readium or adobe rmsdk) position of content relative viewport can use var firstrect = nodes[0].getboundingclientrect(); var lastrect = nodes[nodes.length- 1].getboundingclientrect(); so can calculate progress like var progress=firstrect.left+lastrect.left>0?math.round(math.abs(firstrect.left*100)/(math.abs(firstrect.left)+lastrect.left)):100; although ibooks webkit based , allows use of js compliant epub3 standard - position of rects not change when content scrolled in ibooks view, i.e. stays same. i'm stuck here. thoughts? i want integrate functionality open source library epubtrack.js

regex - Sublime Text 3 syntax definition: how to capture a multiline C-style block comment? -

so target block this: /* comments more end */ anything between /* , */ considered comment. current rule captures single line comments: match: \/\*(\w|\s|\w|\n|\r\n)*\*\/ i know sublime text uses oniguruma i'm not sure how match multilines. ok. joachim pileborg 's comment helpful. here's how did it. approach 1- install packagedev package. 2- copy relevant package temporary directory , unzip it. c , did this: cp /applications/sublime text.app/contents/macos/packages/c++.sublime-package ~/tmp cd ~/tmp unzip c++.sublime-package unzipping create many *.tmlanguage files. 3- open c.tmlanguage in sublime. 4- command palette, choose build with: covert ... yaml (block style) create c.yaml-tmlanguage . 5- open yaml file , copy regex need. answer for c-style blocks, rule worked: - begin: /\* captures: '0': name: punctuation.definition.comment.mn end: \*/ name: comment.block.c

c++ - How do I pass an array to function by reference? -

i want pass array function reference. function dynamically allocate elements. this code give me error message: access violation #include <iostream> using namespace std; void func(int* ptr) { ptr = new int[2]; ptr[0] = 1; ptr[1] = 2; } void main() { int* arr = 0; func(arr); cout << arr[0] << endl; // error here } c++ passes arguments value. if want pass int pointer reference, need tell c++ type "reference pointer int ": int*& . thus, function prototype should void func(int*& ptr); note still not handling pointers or references arrays, rather pointer first element, close not same. if wanted pass array of size 2 reference, function prototype this: void func(int(&my_array)[2]);

Go - Inconsistent Evaluation of Deferred Functions -

i experimenting go , seeing unexpected behaviour deferred functions. consider following program increments global variable given amount. package main import "fmt" var z = 1 func main() { defer increasez(10) defer fmt.println("z =", increasez(20), "deferred value 1") defer fmt.println("z =", increasez(30), "deferred value 2") fmt.println("z =", z, "main value") } func increasez(y int) int { z += y println("z =", z, "inside increase function") return z } when run in go playground , outputs: z = 21 inside increase function z = 51 inside increase function z = 61 inside increase function z = 51 main value z = 51 deferred value 2 z = 21 deferred value 1 if switch order of deferred functions, has effect: defer fmt.println("z =", increasez(20), "deferred value 1") defer fmt.println("z =", increasez(30), "deferred value 2&q

qt - Change color of QGraphicsView rubber band -

i know it's possible change color of rubber band rectangle way: qrubberband rubberband = new qrubberband(qrubberband::rectangle, this); qpalette pal; pal.setbrush(qpalette::highlight, qbrush(qt::white)); rubberband->setpalette(pal); but here way achieve rubber band, rendered qgraphicsview when rubberbanddrag mode active? or in "global scope"? i'm sorry wrote question, i've looked solution long time, , nothing. few minutes after asking, found solution setting stylesheet. i'm sharing it. just go designer of qt creator, click on canvas (qgraphicsview). in "qwidget" part find "stylesheet", edit it, , put like: selection-background-color: rgba(255, 255, 255, 128); that's :-). thanks.

razor - Html.BeginForm not outputting Form for first item in collection -

i using mvc5 , want display form each item in collection. form post action in different controller when submitted. my razor follows: @foreach (var skuinorder in model.order.skus) { using (html.beginform("delete", "skuinorders", new { id = skuinorder.id }, formmethod.post, new { name = skuinorder.id, id = skuinorder.id })) { <input id="orderid" name="orderid" value="model.order.id" type="hidden" /> <input type="submit" class="btn btn-default" value="delete" /> } } this code works items in collection apart first one. for second item onwards, form element displayed , works expected, form not outputted first item. instead 2 elements not within element. this example of outputted html (with 2 items in collection) via firefox dev tools. notice there no form first item , inputs displayed on own, there form second item. i cannot post images not have

matrix - Understanding Dual Quaternion skinning -

i trying switch animation code matrices dual quaternions. i've read ladislav kavan's paper, , understand offers technique, transform animation matrix 2 special quaternions. reconstruct original matrix on gpu. however, failing work. when inserted code in app, animations got twisted, meaning reconstructed matrices incorrect. i've written c# console app check , indeed case: matrices different before , after transformation. did normalize matrix before decomposition, not matter, reconstructed matrix never same. missing something? maybe input matrix should of specific type? here console app code: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using microsoft.xna.framework; namespace dualquaterniontest { class dualquaternion { public quaternion ordinary; public quaternion dual; public static matrix normalize(matrix m) { vector3 v = new vector3(m.m11,

How to eliminate Vowels from a string in java? -

i want eliminate vowels string, can eliminate them, fail return them main() . got exact output using following code. string string = "ajeiokluj"; string s = string.replaceall("[aeiouaeiou]",""); return s; it great if required output came using loop. hope have written code similar below considering fail return statement . public static void main(string[] args) { string string = "ajeiokluj"; string s = eliminatevowels(string); system.out.println(s); } private static string eliminatevowels(string string) { string s = string.replaceall("[aeiouaeiou]",""); return s; } if did works fine , if not use above reference ;) based on comments since looking using for loop (which not recommended) please find code below. public static string removevowels(final string string){ final string vowels = "aaeeiioouu"; final

javascript - Removing the item being clicked -

i created canvas , can add objects. how can remove item clicked? var canvas = new fabric.canvas('c'); var rect = new fabric.rect({ left: 50, top: 50, fill: 'green', width: 40, height: 80 }); var circle = new fabric.circle({ radius: 20, fill: 'red', left: 100, top: 100 }); canvas.add(rect); canvas.add(circle); fabric.js provides object:selected event on canvas . can listen event , remove item occurred on. here's sample code: canvas.on('object:selected',function(ev){ canvas.remove(ev.target); }); you can read documentation , @ jsfiddle created here: http://jsfiddle.net/yrl4elsn/1/

Performance Improvement and Data Migration Strategies in mysql -

how take care of performance when have alter column in table billions of rows? dml operations in large table tedious job requires proper analysis , migration strategies while performing operations. suppose in mysql database have giant table having 600 millions of rows, having schema operation such adding unique key, altering column, adding 1 more column cumbersome process takes hours process , there server time out. in order overcome that, 1 have come migration plan, 1 of jotting below. 1) suppose there table orig_x in have add new column colnew default value 0. 2) dummy table dummy_x created replica of orig_x except new column colnew. 3) data inserted orig_x dummy_x following settings. 4) auto commit set zero, data not committed after each insert statement hindering performance. 5) binary logs set zero, no data written in these logs. 6) after insertion of data bot feature set one. set autocommit = 0; set sql_log_bin = 0; insert dummy_x(col1, col2, co

javascript - AngularJS Karma Test Spec Promise not resolved and .then() not called -

i have problem angularjs karma unit testing service. i have service service method this: service.getintersectingelements = function (element, elements) { var deferred = $q.defer(); var tolerance = 20; var intersectingelements = []; $timeout(function () { (var = 0; < elements.length; i++) { if (element.$$hashkey != elements[i].$$hashkey) if (service.checkintersection(element.location, elements[i].location, tolerance)) intersectingelements.push(elements[i]); } if (intersectingelements.length > 0) deferred.resolve(intersectingelements); else deferred.reject(); }); return deferred.promise; }; it works fine if called controller. want test method, returns promise resolved later. want value resolved , compare in unit test. so wrote following karma test: it('should intersecting elements', function () { var element = {id: 1, name: '

android - How to detect end of IF loop when using sensorEventListener -

im getting linear acceleration phone , have problem. wanted i=i+1 if acceleration higher 10m/s add 1 once not time readings above 10 m/s. thinking getting moment when values getting down again below 10 , adding +1 i. can me? for im doing works bad. @override public void onsensorchanged(sensorevent event) { float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; //odczytwyswx.settext(float.tostring(x)); //odczytwyswy.settext(float.tostring(y)); // odczytwyswz.settext(float.tostring(z)); if (event.sensor.gettype() == sensor.type_linear_acceleration) { gravsensorvals = lowpass(event.values.clone(), gravsensorvals); grav[0] = event.values[0]; grav[1] = event.values[1]; grav[2] = event.values[2]; } odczytwyswz.settext(float.tostring(grav[2])); wychwytywaniegornegotapniecia(); } void wychwytywaniegornegotapniecia(){ if(grav[2]>10){ i++ } try using simpl

apache - Prevent unwanted url on centos server -

someone attacking site sending thousands of requests not on site. example there page on site like: www.example.com/page-foods attacker tries links like; www.example.com/page-foodsgdg www.example.com/page-foodygmnj i use cloudflare when close "i under attack mode" server down again. there tool learn of site urls , prevent unwanted url's request? my site drupal6. serves system centos5 , apache web server. you can use fail2ban automatically block ips of unwanted bots.

eclipse - which file should I run in Git Repositories? -

i'm using eclipse. created git repository , pulled code url. want run code when try run, error: select run: ant build ant build... is code in git repository not executable? how can run project? appreciated. a git repo doesn't know nature of text files stores: make sure replicated same. once clone, need check haw project work, independently of git. in case, see " eclipse: running ant buildfiles ", or use ant view in eclipse . can make 1 of ant target run automatically too . if isn't ant project, see: " what ant build? ". make sure java project builder (if not, default, eclipse proposes ant), in " eclipse won't compile/run java file "

java - "No transaction is in progress" after migrating to Wildfly -

we have spring 3.6 application hibernate 4.2.2 working fine on glassfish 4, until migrated wildfly 8.2. use spring-data 1.5.0. the following 2 problems appear: when saving entity, it's not persisted. no exception thrown here, save method in org.springframework.data.jpa.repository.support.simplejparepository returns entity no id assigned when updating (merging) entity, flush throws exception: javax.persistence.transactionrequiredexception: no transaction in progress persistence.xml: <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/persistence http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="persistencesql" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider>

Is node.js suitable for long polling which requires an open connection at all times? -

i have online feature requires me set field in database have integrated getting notification updates. such being done via long polling (since short polling isn't better , results in less connections server). i used on php of know php understand, php lose it's available connections quite quickly, under fpm. so turned node.js supposed able handle thousands, if not millions, of concurrent connections more seems node.js handles these via event based programming. of course event based programming has massive benefits. this fine chat apps , not if have online feature have integrated long polling mark user still online? would node.js still saturated or able handle these open connections still? long polling node.js long polling eat of connection pool, sure set ulimit high if using linux or unix variety. ideally you'll maintain state in memcached or redis. prefered approach use redis. you'll subscribe pub/sub channel, , everytime user state updates you&

r - Using dplyr to compare models -

working through examples in dplyr documentation of do() function , until came across snippet summarize model comparisons: # compare %>% summarise(p.value = aov$`pr(>f)`) error "error: expecting single value". found way forward accessing list of aov elements directly. question sub-setting operators , ask if there better way this. here full attempt , solution. models <- group_by(mtcars,cyl) %>% do(mod_lin = lm(mpg ~ disp, data = .), mod_quad = lm(mpg ~ poly(disp,2), data = .)) compare <- models %>% do(aov = anova(.$mod_lin, .$mod_quad)) compare %>% summarise(p.value = aov$'pr(>f)') error: expecting single value looking structure of compare select comparison 1 compare$aov[[1]] select comparison 1 , of element 6 (the pvalues) compare$aov[[1]][6] pvalues compare$aov[[1]][2,6] compare %>% summarise(pvalue = aov[2,6]) # gets pvalues group suppose i'm wondering how object of classes

PHP error handling, form is submitting anyway? -

i have following code, below. stop script , display errors next 3 selected input fields. however, when leave 1 of required fields blank , hit submit, form processes anyway. if replace $error[]'s in beginning die() stops properly, when try display them on form page doesn't work , submits/runs query. appreciated! <?php if(!empty($_post)) { // if there $error, keep submitted values $submitted_firstname = htmlentities($_post['firstname'], ent_quotes, 'utf-8'); $submitted_lastname = htmlentities($_post['lastname'], ent_quotes, 'utf-8'); $submitted_phone1 = htmlentities($_post['phone1'], ent_quotes, 'utf-8'); $submitted_phone2 = htmlentities($_post['phone2'], ent_quotes, 'utf-8'); $submitted_ext1 = htmlentities($_post['ext1'], ent_quotes, 'utf-8'); $submitted_ext2 = htmlentities($_post['ext2'], ent_quotes, 'utf-8'); $submitted_email

javascript - Updating <div> text with value from the previous page -

i'm redirecting user page when click "edit" button using code below. $('#editlistbutton').click(function(){ window.location.href = "http://localhost/yyy.php"; //redirect // changes need made $('#defaulttext').remove(); $('#orderlist').append('<p' + 'message' + '</p>'); }); the page redirects predefined link, after need update html <div> tag text. code coming other page nothing. how can change text in div tag? there many ways pass information 1 page another. give idea of concept, in relation question posted, here's one: page a: $('#editlistbutton').click(function(){ window.location.href = "http://localhost/yyy.php?action=remove&value=" + encodeuricomponent('ashdahjsgfgasfas'); }); page b: var action = /(?:\?|&)action=([^&$]+)/.exec(location.search) if ( 'remove' === action[1] ) { var value = /

c - How to count the same products from a binary file and listing them with their numbers? -

i'm reading products binary file. when i'm reading these products, i'm counting repetition of same products. @ end,i'm listing products , numbers. void product_counting_listing(file *fileptr) { product p; while(!feof(fileptr)) { fread(&p.p_code,sizeof(product),1,fileptr); ?? } rewind(fileptr); while(!feof(fileptr)){ printf("product code number of product\n"); printf("-------- --------"); fread(&p.p_code,sizeof(product),1,fileptr); printf("%d %d",p.p_code,?) } any ideas counting same products , listing them? while(!feof(fileptr)) not approach pointed @joachim pileborg. can find fruitful information why @ why “while ( !feof (file) )” wrong? now assuming file contains multiple product structure information, simple approach read structures be int bytesread = 0; while((bytesread = fread(&p.p_code,sizeof(product),1,fileptr)) > 0){ //print product information //check duplicat

Neo4j 2.2 spatial withindistance label issue -

just started playing around neo4j 2.2. awesome work! unfortunately ran in problem using spatial-0.14-neo4j-2.2.0-m02 :( in application have query fetches nearest users: start n=node:geom('withindistance:[42.0,1.0, 1000.0]') n:user return n; after updating latest version above query not seem care label anymore , nodes has lat/lon , added spatial layer back. else have experienced problem? your observation seems correct, reproduce it. seems where directly following spatial index query not honored. however there easy workaround introducing with : start n=node:geom('withindistance:[42.0,1.0, 1000.0]') n n:user return n; please check if works. please file bug report @ https://github.com/neo4j/neo4j/issues/new .

php - How to create ActiveRecord query for this MySQL query? -

i got mysql query, how can write activerecord? select * `sel_posts` `login_id` = 22 or 23 or 24 ... (this ids array $ifollow) order `datetime` desc limit 0 , 20 first of all, it's better replace or in in where part. assuming model named selpost , here how can activequery : $models = selpost::find() ->where(['login_id' => $ifollow]) ->orderby(['datetime' => sort_desc]) ->limit(20) ->all(); where smart enough automatically add in operator in case of $ifollow being array. official documentation: sql in active record activequery

java - How to sort array object by specific string field? -

this class of object (i need timestamp string): public class evento{ public string timestamp; public evento(string timestamp) { super(); this.timestamp = timestamp; } public string gettimestamp() { return timestamp; } } in activity have: evento evento = new evento[10]; for(int = 0; i<10; i++) evento[i] = new evento(/*casual string timestamp*/); then have populated array, how can sort timestamp inserted? as stated, going need custom implementation of comparator interace. since string, first convert timestamp date object: converting string timestamp date , , follow example sort date sort objects in arraylist date?

Change span to font ckeditor color button -

ckeditor add <span></span> tag element after change color editor i need change tag <font></font> i review code in ckeditor.js , don't found color to switch span font add 2 lines on ckeditor config.js file. config.colorbutton_backstyle.element = 'font'; config.colorbutton_forestyle.element = 'font'; you can can more @ it's manual . this ckeditor config.js, 2 lines: ckeditor.editorconfig = function (config) { config.toolbargroups = [ {name: 'document', groups: ['mode', 'document', 'doctools']}, {name: 'clipboard', groups: ['clipboard', 'undo']}, {name: 'editing', groups: ['find', 'selection', 'spellchecker']}, {name: 'forms'}, {name: 'basicstyles', groups: ['basicstyles', 'cleanup']}, {name: 'paragraph', groups: ['list', 'indent', 'blocks&#

Wordpress browser-cached content -

i'm providing premium content expiration date on blog, , force browser not cache it. on backend-side there're links redirect video content, , these links expire. if adds redirected link favorites, can still see content. far tried setting meta tags in html, adding randomly generated strings both in markup , in url param, somehow browsers ignoring it. thought of ajax loading content, think it'd complicated content-person maintain page. content videos stored on third party's server. please let me know if have suggestions? you can approach other way around. try setting cookie whenever grant access user , deleting when content expires.

C++ Error Primary Expression Before -

#include <iostream> #include <string> using namespace std; string name; string friend; int gender; int drive; int main() { //name prompt future reference cout << "hello. want play game. you'll going on a"; cout << std::endl; cout << "wild ride it's own ups , downs."; cout << std::endl; cout << "to start out name?"; cout << std::endl; cin >> name; //determining gender player identifies cout << "perfect " <<name; cout << ". shall ask few more questions determine"; cout << std::endl; cout << "path best suited you."; cout << std::endl; cout << "what gender?"; cout << std::endl; cout << "if male enter 1"; cout << std::endl; cout << "if female enter 2";

Haskell: get memory address of a list -

is there way address of data element (say list element) in haskell. combinelists :: [a] -> [a] -> [a] combinelists [] y = y combinelists (x:xs) y = x : combinelists xs y *main> let x=[1,23, 12, 45] *main> x [1,23,12,45] *main> let y =[90, 56, 78] *main> y [90,56,78] *main> let z = combinelists x y *main> z [1,23,12,45,90,56,78] now z constructed copying elements x , y (internal haskell representation) or would z like: z = [ [copy of elements x] y] i wanted see if &y == &z[4] (z[4] = 90). also there way dump internal representation using similar ctypes in python. thanks. you can use stablename or reallyunsafepointerequality# (note name , don't use in real programs; you'll need magichash extension call it) check whether 2 expressions refer same object. see what advantages stablenames have on reallyunsafeptrequality#, , vice versa? differences.

All Scripts Stop Working After Navigating on Mobile -

i'm working on mobile version of website, desktop version working perfectly. on mobile, after first navigation (random internal page), jquery scripts stop working. when navigate index, doesn't execute working scripts. i have included html parts, example: $(".header").load("header.html"); and lots of different in-page scripts or slideshows, toggle buttons. i'm aware of dom loading issue , tried solution, none of them fixed bug. so how can fix without creating different mobile version of website? try instead of load() . $(document).ready(function(){ $.ajax( { url: "header.html", type: "get", cache: false, success: function(html) { $(".header").html(html); } }); });

ios - Get reference of facebook access token - Facebook SDK 4.X -

i have been using facebook's login functionality link aws cognito system. link them require string of facebook's access token. prior version 4.0 used nsstring *facebooktoken = fbsession.activesession.accesstokendata.accesstoken; since update no longer works. tried nsstring *facebooktoken = fbsdkaccesstokenchangenewkey; but didn't work. suggestions? can't find in reference guide or sample projects. fbsession.activesession.accesstokendata.accesstoken; has changed to [fbsdkaccesstoken currentaccesstoken].tokenstring

asp.net mvc - MVC Passing ViewModel to @Html.Partial -

passing viewmodel @html.partial have 2 viewmodels public class registervm { ... properties public addressvm addressinformation { get; set; } //viewmodel } public class addressvm { public string street1 { get; set; } public string street2 { get; set; } public string postalcode { get; set; } } when loading main view using vm: @model viewmodels.registervm all field load. when add partial view , pass viewmodel @html.partial("_addressdetails", model.addressinformation) it fails error: exception details: system.nullreferenceexception: object reference not set instance of object. why fail? the partial view _addressdetails expecting @model viewmodels.addressvm update based on changes prashant, when submitting information address information null. in controller: [httppost] public actionresult register(registervm vm){ ... //when viewing vm.addressinformation.street1 null. , there value //is there diffe

android - How can I get the colors hex code from custom colors.xml that I used on a View object? -

so have custom colors.xml: <color name="yellow">#ffff00</color> <color name="pink">#ff00ff</color> <color name="red">#ff0000</color> .................... if used color on object (i.e. view) color background how can hex code in tags? mean colored view yellow , know hex code has object -> #ffff00 how can that? relativelayout re=(relativelayout)rootview.findviewbyid(r.id.idstack); colordrawable colordrawable=(colordrawable)re.getbackground(); string hexcolor=integer.tohexstring(colordrawable.getcolor()); hexcolor -> ffff00 update in order name of color (#ff0000->red), assuming you're not doing complicated since provided color.xml example in question should this: //create map of colors you'll need map<integer,string> mycolors=new hashmap<integer, string>(){ { //color constants @ http://developer.android.com/reference/android/graphics/color.html#black put(-1677

wordpress - Allow client to edit jquery slider -

i add slider client's wordpress site such owl carousel or jquery plugin provides full page background slider. client able edit slides within wordpress dashboard. what best way go this? i had same exact situation. 1) install simple image widget plugin 2) register new sidebar each image https://codex.wordpress.org/function_reference/register_sidebars 3) under dashboard -> appearance -> widgets -> add image each sidebar created 4) display each sidebar in carousel using <?php dynamic_sidebar( 'your-sidebar-name' ); ?> works treat! to register sidebars said in step 2, paste functions.php file (this 3 sidebars, add more if need more images): if (function_exists('register_sidebar')) { register_sidebar(array( 'name'=> 'banner slide 1 picture', 'id' => 'image3', 'before_widget' => '', 'after_widget' => '', 'be

javascript - Webpack splitting code into separate modules included via npm, how to compile es6? -

i'm trying write system of modular components can dynamically loaded @ runtime webpack. example, when user switches tabs, code display content of new tab should load when user clicks on tab. here of code accomplishes (quite nicely, might add): onrender(){ this.observe("route", (route) => { if(route.length>0){ this.set("loading", true); this.get("pages."+route).loadcomponent((component) => { this.components.page = component.component; this.set("loading", false); }); } }); }, data: { pages: { "#hello": { name: "hello", loadcomponent: (callback) => { require.ensure([], () => { callback(require("./page_component/hello/hello.js")); });

outlook - background Image with VML -

i'm having problem - have background image ( background image here ) it's not displaying in outlook desktop. in first line can find background-image location. know should add vml, don't know where. here's code <table height="400px" width="100%" class="wrapper" style="border-collapse: collapse;border-spacing: 0;;width: 100%;min-width: 620px;background-image: url();m-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;table-layout: fixed;background-image: url(background image here)"> <tbody><tr> <td style="padding-top: 0;padding-bottom: 0;padding-left: 0;padding-right: 0;vertical-align: top; background-image: url()"> <center> <table height="400px" class="one-col-feature" style="border-collapse: collapse;border-spacing: 0;border-radius: 6px;background-image: url()-moz-border-radius: 6px;width: 600px;margin-left: auto;margin-right: auto"&

Access C++ COM Interface from C# throws exception in GetIdsOfNames -

i have c++ com object (32 bit). com object calls c# com object , part of initialization, passes interface pointer (idispatch) c#. idea c# code can call c++ com object using interface. example: c++ calls c# com method --> openservice(...., [..marshalas..idispacth]) the issue having when c# tries call interface methodnotfound exception. internally declare interface [comimport, guid(...), interfacetype.dual] public interface callbackinterface { void sodata(int data) } i cast given idispatch pointer interface callbackinterface cb = (callbackinterface)inputobject; cb.sodata(0); it call gives exception namenotfound in getidsofnames. interesting thing got reflector , tried debug source. exception seems coming comeventssinks.cs not connection point container or connection point. trying access interface given calling c++ object. i gave , created simple atl com object , tried accomplish same, , works great. wanted do, comarshalinterfacethreadinstream , coge

Openshift, can't connect to Mysql from console -

i'm connected via ssh openshift server. type: env | grep mysql openshift_mysql_db_port=42361 openshift_mysql_db_host=xxxxxxx-mydomain.rhcloud.com openshift_mysql_db_password=mypassword openshift_mysql_path_element=/opt/rh/mysql55/root/usr/bin openshift_mysql_db_gear_uuid=xxxxxxxxx openshift_mysql_db_username=myusername openshift_mysql_db_url=mysql://myusername:mypassword@xxxxxx-mydomain.rhcloud.com:42361/ openshift_mysql_ld_library_path_element=/opt/rh/mysql55/root/usr/lib64 openshift_mysql_db_gear_dns=xxxxxxx-mydomain.rhcloud.com then, run mysql -u $openshift_mysql_db_username -h $openshift_mysql_db_host -p $openshift_mysql_db_port -p and type exact same password... error: error 1045 (28000): access denied user 'myusername'@'10.169.187.123' (using password: yes) i can't access mysql , application shows 503 unavailable error (i guess reason). i don't want lose data stored inside, change password or something.. since can't connect mysql, c

Java Driver License Program - Having trouble displaying which problems I missed -

i created program according instructions below. when run program, output incorrect answers missed incorrect. example, if input correct answers #19, 1 or 2 in incorrect answers section of output data. did wrong? the local driver's license office has asked write program grades written portion of license exam. exam has 20 multiple choice questions. here correct answers: 1. b 2. d 3. 4. 5. c 6. 7. b 8. 9. c 10. d 11.b 12. c 13. d 14. 15. d 16. c 17. c 18. b 19. d 20. a student must correctly answer 15 questions of 20 questions pass exam. write class named driverexam holds correct answers exam in array field. class should have array field hold student's answers. class should have following methods: passed. method returns true if student passed exam, false otherwise totalcorrect: returns total number of correctly answered questions totalincorrect: returns total number of incorrectly answered questions questionsmissed: int array co