Posts

Showing posts from March, 2015

need to explain bash grep regular expression grep -E '(^|[^0-9.])'2 *.c -

i'm confused grep command. explain me. for each digit i, search (nondigit)i sequence in textd.sh) grep -e '(^|[^0-9.])'i *.c in 0 1 2 3 4 5 6 7 8 9; grep -e '(^|[^0-9.])'$i *.c > lines_with_${i} done this grep command: grep -e '(^|[^0-9.])'$i *.c is matching digits 0, 1, 2, 3,.... in loop. while matching these digits makes sure digits either @ start ( ^ ) or else there non-digit non-dot character before these digits ( [^0-9.] ). so example match: abc 1 2 def5 and won't match: abc.1

twitter bootstrap - How can i open the drop-down using jquery -

i using phonegap , bootstrap. how can open select using jquery? <select class="selectpicker" data-width="100%" name="selvalue" id="msg_counts_id"> <option value="" >select</option> <option value="1">you</option> <option value="2">are</option> <option value="3">my...</option> </select>

c# - IsLightDismissEnabled="True" is not actually dismissing the popup -

i have pop , want close when tap anywhere outside pop up. searched , advised me use property islightdismissenabled; if touch outside, remove pop oup leaving inactive grey screen if doesnt close pop code snippet: <popup x:name="logincontroler" isopen="false" margin="0,190,896,276" islightdismissenabled="true"> <stackpanel height="300" width="470" x:name="popup" flowdirection="righttoleft"> <grid width="470" background="white" > <grid.rowdefinitions> <rowdefinition height="70"/> <rowdefinition height="*"/> </grid.rowdefinitions> <richeditbox grid.row="1" height="250" textwrapping="wrap" fontsize="20" name="notespopuptextbox" flowdirecti

java - Process freeze( or crash) because of JFrame -

this code. processbuilder process = new processbuilder(mypath); process prp1 = process.start(); final jframe frmscanner; frmscanner = new jframe(); frmscanner.settitle("updater"); frmscanner.setresizable(false); frmscanner.setbounds(100, 100, 370, 300); frmscanner.setdefaultcloseoperation(jframe.exit_on_close); label1.setbounds(100,50,200,50); final jbutton startbutton = new jbutton("start!!!"); startbutton.setbounds(50, 140, 100, 50); jpanel p1 = new jpanel(null); p1.setbackground(new color(255,255,255)); p1.add(startbutton); p1.add(stopbutton); frmscanner.add(p1); frmscanner.setvisible(true); my process task collecting data project's hardware text file. i have tested , found text file can collect data 1kb , process hang because of frmscanner.setvisible(true); . if manually run process process can collect data more 1kb. how can solve this? you need ui rel

mysql - LEFT OUTER JOIN to return specific data -

i have 2 tables 1 related table , other base table. first 1 class_has_student , other student. need return related data of classes particular student in class_has_student , class information classes student not registered even. (student.id references class_has_student.student_id) class_has_student table student table class_id | student_id id | name ---------|----------- --------|--------- 1| 1001 1001| john 2| 1001 1002| michael 1| 1002 1003| anne 3| 1002 1| 1003 2| 1003 3| 1003 4| 1003 i need information class_has_student when pass student.id , class_has_student.class_id related data , null class_has_student.class_id if student not registered class. example if want class registration information john classes 1, 2 , 3. result expect related class student data classes 1 ,

javascript - Dropzone Bootstrap JS Error -

heyho - i not best in javascript. tried dropzone bootstrap ( http://www.dropzonejs.com/bootstrap.html ) work getting error in console. this error: http://postimg.org/image/f1fx0cz1j/ i can see bootstrap theme milli secound im getting default theme. the form has class dropzone. i copy , pasted code above given link, there should nothing wrong. i have no problems sample code. could be, copied visible sample code page , did not include dropzone.js in html header or @ end of body? if want copy sample, need copy whole page - save local or view html source , copy paste it. code snippets shown on page explanation not run on own. so make sure have sort of: <script type="text/javascript" src="dropzone.js"></script> either in html head or before last </body> tag

google app engine - Developing a web client without servlet -

i m new appengine development.i have few basic question web client appengine.when make google cloud module in android studio, android client, end , web client auto-generated.a few files auto-generated web interface. questions are: why need web-inf/web.xml web client? found there's servlet api dependency added in gradle, though didnt find , servlet file, used ? i want make web interface/client andorid app, dont know servlet,jsp, can make pure javascript or js lib? will default template web client work other web-hosting appengine? how can make web client pure javascript,css,html, google cloud doc javascript suffice purpose? why need web-inf/web.xml web client? found there's servlet api dependency added in gradle, though didnt find , servlet file, used ? both base elements java web applications though not using servlets modern web frameworks built on top of them. i want make web interface/client andorid app, dont know servlet,jsp, can make pure

git - How do I change paths in a unified patch? -

i have git repository in made changes folder structure. moved in ./_test_html directory root ./ of repository , continued working. now wanted revert changes had made before directory change, realized not normal revert because files affected no longer present in current branch, created patch file , changed paths in file ./subdir ./ make references correct again, git apply gives me error: patch failed, patch not apply errors. see below (parts) of old , adjusted patch file , git output. doing wrong , there command/tool use instead of manually editing patch file? old file --- _test_html/mobile/css/sf.css | 53 ++++++++++++++-- _test_html/mobile/images/logo_temp_x.png | bin 17636 -> 19362 bytes _test_html/mobile/js/secretflirt.js | 16 ++++- _test_html/mobile/templates/footer.tpl.php | 7 ++- _test_html/mobile/templates/header.tpl.php | 90 ++++++++++++++++++++++++++- _test_html/mobile/templates/ingelogd.tpl.php | 40 +---

javascript - Three.js - How to check if object is behind a sphere (not visible) -

i have sphere (globe) objects (pins) on surface dom elements (labels) calculated pin position 2d world. my problem when pins go behind globe (with mouse dragging or animation) need hide labels in dom text label isn’t visible without pin. my logic if can pin in 3d world tell me if it’s behind globe can hide label associated pin. codepen whole code. the function have researched together: function checkpinvisibility() { var startpoint = camera.position.clone(); (var = 0; < pins.length; i++) { var direction = pins[i].position.clone(); var directionvector = direction.sub(startpoint); raycaster.set(startpoint, directionvector.clone().normalize()); var intersects = raycaster.intersectobject(pins[i]); if (intersects.length > 0) { // ? } } } i have researched through many posts can’t result needed: threejs: how detect if object rendered/visible three.js - how check if object visible camera

Java ArrayList how to check if one of the rectangles contains the mouse? -

i have application place tiles. can place tiles on tiles , don't want that. know need if tile rectangle contains mouse don't place tile on it. doesn't work. @ code: for (int = 0; < b.toarray().length; i++) { b.get(i).tick(); if (b.get(i).r.contains(comp.mx, comp.my)) { canplaceatile = false; // system.out.println("yes"); } else { canplaceatile = true; //system.out.println("no"); } if (b.get(i).remove) { b.remove(i); i--; } } this how check if mouse inside area of 1 of tiles. block class: public abstract class block { public int x,id; public int y; protected image img; public boolean remove; public int rotate; public rectangle r; protected int bx, by; public block() { } public abstract void tick(); public abstract void render(graphics g); public void createcollisionrect() { r.setbounds(x - (int) play.c

javascript - Underscore extend with dot.notation quotes are removed, How to get it with quotes? -

here example: var 1 = {test: 'test'}; var 2 = {'test.test': 'test inside test'}; console.log(_.extend(one, two)) http://jsfiddle.net/nmnck67b/ the extended object return test.test: 'test inside test' bad me because i'm looking use mongodb , need make sure it's 'test.test' quotes. way return or super simple solution add quotes? make single-quote part of string using double-quote around or escaping second inner-set of single quotes. var 2 = {"'test.test'": 'test inside test'}; or: var 2 = {'\'test.test\'': 'test inside test'}; http://jsfiddle.net/nmnck67b/1/

c - link a library I wrote with pthread library -

this part of assignment. basically, need write library, linked against test programs professor writes, so: gcc -o libexample.o -c libexample.c ar rvs libexample.a libexample.o #later gcc -o test test.c -l . -lexample the thing libexample uses posix semaphores, needs linking pthread library when generating final executable. without changing way test program compiles, there way package pthread library libexample.a? thanks! without changing way test program compiles, there way package pthread library libexample.a? no. are restricted supplying single libexample.a file? if not (and if using gnu linker), possible solution provide libexample.a linker script, link against e.g. libexample_code.a containing object files and add -lpthread .

javascript - How to return two html contents from ajax? -

i'm developing shopping cart application in php, have 2 functions, first function display total items in cart , second function list products in cart. how can return 2 function's html output ajax? here php server side: <?php require '../init.php'; require $root . '/functions/basic.php'; require $root . '/functions/products.php'; if(isset($_request['id'])) { $product_id = $_request['id']; $_session['cart'][$product_id] = isset($_session['cart'][$product_id]) ? $_session['cart'][$product_id] : ""; if($product_id && !productexists($product_id)) { die("error. product doesn't exist"); } $qty = dbrow("select id, quantity products id = $product_id"); $quantity = $qty['quantity']; if($_session['cart'][$product_id] < $quantity) { $_session['cart'][$product_id] += 1; //add 1 quantity of produc

objective c - How to access rootViewController from React-Native -

i'm creating react-native module access admob. gadbannerview object requires rootviewcontroller perform. know how create react-native view/module it? thank much. from native objective c code in module, can access root view controller of app follows: uiviewcontroller *rootviewcontroller = [uiapplication sharedapplication].delegate.window.rootviewcontroller;

How to connect R with PostgreSQL on OSX 10.10.2? -

i have following setup: osx 10.10.2 postgresql 9.4.1 r 3.1.3 this answer of 2011 says easiest approach use rpgsql package. removed cran repository. rodbc mentioned there available as source , fails configure: configure: error: "odbc headers sql.h , sqlext.h not found" error: configuration failed package ‘rodbc’ i've found package, me - rpostgresql , fails compile: in file included rs-pqescape.c:7: ./rs-postgresql.h:23:14: fatal error: 'libpq-fe.h' file not found # include "libpq-fe.h" ^ 1 error generated. make: *** [rs-pqescape.o] error 1 error: compilation failed package ‘rpostgresql’ is there other way connect r , postgresql? see rodbc connect sql server on mavericks rodbc isn't supported on osx. ended doing use rjdbc, in cran. setting connection data base isn't easy. can done: postgres db can't connect r rjdbc

Kendo UI grid, search box in toolbar in mvc -

Image
kendo-grid search box in toolbar in mvc razor syntax, i facing need toolbar in searching box , searching box search grid data. just copy , paste code bind mvc model , custom button(crud) , search box in toolbar in kendo grid template <div> @(html.kendo().grid(model) .name("diagnosistestgrid") .columns(columns => { columns.bound(c => c.description).title("description"); columns.bound(c => c.cost).title("cost"); columns.bound(c => c.costingrequired).title("cost req."); columns.bound(c => c.dxtestid).clienttemplate(@" <a href='/diagnosistest/details/#=dxtestid#' class = 'dialog-window'>detail</a> | <a href='/diagnosistest/edit/#=dxtestid#' class = 'dialog-window' >edit</a> | <a href='/diagnosistest/delete/#=dxtestid#' class = 'dialog-window'>delete</a>

How to run Valgrind on my program in C? -

how use valgrind utility simple c program in linux? suppose executable a.out . how check leaks in program valgrind. i want know how use valgrind. it simple as: $ valgrind ./a.out if a.out in current working directory. in case have got valgrind installed can learn usage running: $ valgrind --help. unfortunately, there no entry manual entry valgrind when running man valgrind .

ubercart - How to add my CSS class to form in drupal 7 -

i newbie in drupal 7. writing new theme , don't know how add class form in drupal 7. install ubercart setup e-commerce website. added new attribute product (size). want redesign in product page. in page, has size field don't know how add css. e.g: <form action="/drupal-7.34/node/6" method="post" id="uc-product-add-to-cart-form-6" accept-charset="utf-8"><div><div id="uc_product_add_to_cart_form-6-attributes" class="attributes"><div class="attribute attribute-1 odd"><div class="form-item form-type-select form-item-attributes-1"> <label for="edit-attributes-1">size <span class="form-required" title="this field required.">*</span></label> <select id="edit-attributes-1" name="attributes[1]" class="form-select required"><option value="" selected="selected"

how to draw a histogram in python matplotlib? -

Image
my data name called ranges_freq below buckets userid 0 10 730 1 50 435 2 100 150 3 500 314 4 1000 97 5 1001 244 i able draw bar chart using below code unable draw histogram same data. >y = ranges_freq['userid'] xlabels = ranges_freq['buckets'] bar_width = 0.50 x = np.arange(len(y)) fig, ax = plt.subplots() ax.bar(x, y, width=bar_width) ax.set_xticks(x + (bar_width/2.0)) ax.set_xticklabels(xlabels) ax.set_title('user frequency range') ax.set_xlabel('buckets') ax.set_ylabel('no.of.users') plt.show() so how can draw histogram samedata same parmeters have used barchart please me how draw histogram in same way? so remove spaces in bar chart, thing need do, set bar_width = 1.0 result: but have understand is bar chart (just without spaces in between bars).

R function to evaluate expression over variable and create new variables filling in with logical -

df1 (below) event log. variable 1 consists of (non-unique) timestamps (posixct). variables 2:4 consist of attributes of events (factors). i've created df2 , df3 define time bins. df2 stores initial time , df3 end time each time bin. question how expand df1 variable names of df2 (which same df3) while filling in true or false each event, based on wether event belongs 1 of time bins of variable. in other words, if event belongs time bin (as defined df2 , df3) value true, otherwise false. each event in df1 needs checked against time bins (all pairs of elements of df2 , 3), 1 variable (of df2&3) @ time. due large number of variables , events, cannot interactively. learn how r way, avoiding explicit loops, , taking advantage of vectorization. data (small sampled datasets) df1 <- data.frame(time.stamp = c("2015-01-05 15:00:00", "2015-01-05 15:01:00", "2015-01-05 15:02:00", "2015-01-05 15:02:00", "2015-01-05 15:03:00"

mysql - Full backup of GoDaddy site via command-line script -

is there simple way automated backup of entire website on host godaddy via command-line? so far, know need backup files in home directory recursively. possibly automated sftp connect , issue get -r * command full file dump, or use scp. the other half of puzzle getting of tables available, wordpress tables. guess maybe there's command-line command issue dumps database contents flat file, pull via sftp. if such command exists, plan use combination of telnet , expect scripts login godaddy site, issue commands, disconnect local shell. the end result should have folder of server content in it, plus flat file backup of sql database server. know there wordpress backup plugins, tend provide slew of zip files, when want raw data directly can put in private svn server backup , versioning. so question: how extract of databases on godaddy server via command-line file? thank you. in end, found working solution. first, used 2 separate expect scripts . telnet server,

java - How to get integer value from JTextField of Swing? -

how integer value jtextfield of swing string value via gettext() method? try { string sql = "insert employeeinfo (username,password,obtainmark) values(?,?,?)"; pst = conn.preparestatement(sql); pst.setstring(1, txt_username.gettext()); pst.setstring(2, txt_password.gettext()); pst.setint(3, txt_obtainmark.gettext()); pst.execute(); joptionpane.showmessagedialog(null, "data inserted"); } catch (exception e) { joptionpane.showmessagedialog(null, e); } i not able insert integer data type value jtextfield , able insert string or varchar type data. you can integer.parseint(string) integer value. pst.setint(interger.parseint(txt_obtainmark.gettext()));

local storage - How do I unit test localStorage being undefined with Mocha/Sinon/Chai -

i have 2 simple methods abstract reading , writing localstorage: _readlocalstorage: function(key) { if (window.localstorage && window.localstorage.getitem(key)) { return json.parse(window.localstorage.getitem(key)); } else { throw new error('could not read localstorage'); } }, _writelocalstorage: function(key, data) { try { window.localstorage.setitem(key, json.stringify(data)); } catch (e) { throw new error('could not write localstorage'); } }, obviously, stubbing window.localstorage.getitem/setitem simple. case localstorage undefined? i've tried caching/unhinging window.localstorage (the second assertion): describe('#_readlocalstorage', function() { it('should read localstorage', function() { // set var stub1 = sinon.stub(window.localstorage, 'getitem') .returns('{"foo": "bar"}'); // run unit

format - Matlab - save calculated variable with 5 decimal cases -

i want use calculated variable result has 5 decimal cases, matlab saves 4. need have 5 decimal cases use in rest of code. hence: not want display variable user. example: l=10; n=1600; fs=l/n; matlab stores "fs" "0.0063" instead of "0.00625", , need "0.00625". thank time , help! you can use built-in function digits(n) n precision parameter. digits(5) fs=vpa(l/n) fs=0.00625

jquery - Why I couldn't see alert when click? -

$(document).ready(function(){ $('.filter a').on('click', function(){ $.ajax({ type: 'get', cache: false, url: 'example.json', datatype: 'json', success: function(data){ alert(data); }, error: function(response) { $("#accordion").css("display","none"); alert("error occured because of no data"); } }); }); }); frustrated while couldn't data show up. puzzled why alert not showing testing. there might have overlooked or missed? in case: json [ { "name": "a", "type": "judge" }, { "name": "b", "type": "con" }, { "name":"c", "type":"whatever" }, { "name": "d", "

twitter bootstrap - Text size too small on mobile optimised site -

i have made website using bootstrap, works on desktop on mobile text size shrinks small, solutions make text appear on mobile site? <div class="col-md-4 col-xs-12"> <a href="#" class="thumbnail"> <img src="dapp/theme/images/hidden_superpower.jpg"alt="125x125"> <h4>your name's hidden meaning!</h4> </a> </div> use css3 media rules: @media screen , (max-width: 480px) { body div h4 { font-size: 2em; } } or if using sass, change value of variables.

Need to create a character map of a long string with php -

i need create character map long string, need each character , position in string, characters repeating many times need each position have appeared in string. thought lot didn't idea. below example string: "/9j/4aaqskzjrgabageayabgaad/4q8hrxhpzgaatu0akgaaaagabgeyaaiaaaauaaaavkdgaamaaaabaamaaedjaamaaaabadiaajydaaeaaaaoaaaaaoocaacaaaf0aa+fhgkddfevbbghhhghhhhgskfaaaaaaabbbbbbbbbbb===bbhjstdef" sounds searching this: $string = "/9j/4aaqskzjrgabageayabgaad/4q8hrxhpzgaatu0akgaaaagabgeyaaiaaaauaaaavkdgaamaaaabaamaaedjaamaaaabadiaajydaaeaaaaoaaaaaoocaacaaaf0aa+fhgkddfevbbghhhghhhhgskfaaaaaaabbbbbbbbbbb===bbhjstdef"; $positions = array(); for($i=0;$i<strlen($string);$i++) { $char = $string[$i]; if(!isset($positions[$char])) { $positions[$char] = array(); } $positions[$char][] = $i; } // example output foreach($positions $key => $val) { printf("%s occurs @ %s\n", $key, implode(',', $val)); } out

How to generate dynamic empty 2D array without default constructor in C++ -

i have class named test , i'd create empty 2d array hold instances of class , add them later 1 one using constructor accepts parameters. basically, i'd reserve memory fill in later objects. needs bee on heap since have class generate 2d arrays of different sizes. this first approach doesn't work since test class doesn't have default constructor: test** arr; arr = new test*[10]; (int = 0; < 10; i++) arr[i] = new test[10]; [edit] here full test code. in all, i'm getting wrong values out, should numbers 0 99: #include <iostream> using namespace std; class test { private: short number; public: test(short n) { this->number = n; } short getnumber() { return number; } }; int main() { test** arr; arr = new test*[10*10]; (int = 0; < 100; i++) arr[i] = new test(i); (int = 0; < 10; i++) { (int j = 0; j < 10; j++) cout << arr[i][j].getnumber() <

objective c - Whats the difference between array[index] and [array objectAtIndex:index]? -

i noticed both array[index] , [array objectatindex:index] work mutable arrays. explain difference between them? in terms of performance, , 1 best practice? none. that's part of clang extensions objective-c literals , added 2-3 years ago. also: array-style subscripting when subscript operand has integral type, expression rewritten use 1 of 2 different selectors, depending on whether element being read or written. when expression reads element using integral index, in following example: nsuinteger idx = ...; id value = object[idx]; it translated call objectatindexedsubscript: id value = [object objectatindexedsubscript:idx]; when expression writes element using integral index: object[idx] = newvalue; it translated call setobject:atindexedsubscript: [object setobject:newvalue atindexedsubscript:idx]; these message sends type-checked , performed explicit message sends. method used objectatindexedsubscript: must

android - How to retrieve the drawable name using id? -

i have imageview changes depending on imagebutton clicked trying name of imagebutton pressed , since know id of imageview, wondering how retrieve name of drawable. searched on internet , found ways of getting id using drawable name or getting entire file path of drawable, there way name of drawable , without extension also, thanks since imagebutton imageview use tagging: imagebutton button = (imagebutton) findviewbyid(r.id.buttonid)// button button.settag("youdrawablename"); // drawable name and read need it: string drawablename = (string) button.gettag();

c# - Not able to append string in ScriptManager.RegisterStartupScript's alert -

i want show alert on click event of button in aspx page in want display name of user logged in. i trying using scriptmanager.registerstartupscript in following way found here : scriptmanager.registerstartupscript(lnkbtnsavecart, lnkbtnsavecart.gettype(), "key", string.format("alert(mr/ms.'{0}' , cart saved successfully!);",customerobj.name ), true); i have put break points see if customerobj contains name property or not , had necessary name of logged-in user. this way works though , dont need : scriptmanager.registerstartupscript(lnkbtnsavecart, lnkbtnsavecart.gettype(), "key", "alert('some message!')", true); the single quotes in alert message incorrect. content within alert function should in single quotes. if need single quotes around name have escape it. try this scriptmanager.registerstartupscript(lnkbtnsavecart, lnkbtnsavecart.gettype(), "key", string.format("alert('mr/ms. {

mysql - Query to find out solution for finding difference rows of two table -

tablea (master data) (productcode, rate) tableb (transaction data) (productcode, rate, qty) i want see whole row rate alter while selling (transaction data tableb) example: tablea (master data) productcode rate 1000 50 2000 100 3000 200 tableb (transaction data) productcode rate 1000 50 2000 90 3000 200 expected result: tableb productcode rate 2000 90 thanks in advance if want rows have same productcode different rate need this: select * tableb tableb.rate <> (select tablea.rate tablea tablea.productcode = tableb.productcode) or select tableb* tableb inner join tablea on tableb.productcode = tablea.productcode tableb.rate <> tablea.rate

javascript - How to extract the parameter value from the url? -

response.sendredirect("http://localhost:8080/cse/welcome.html?first=fname&last=lname&dname=dept&mname=mobno"); how extract first,last,dname,mname parameters url , want use extracted values in redirected html document(welcmoe.html). how can achieve this? if wanted client side using js, following. //create array query strings //such ['first=fname', 'last=lname', ...] var querystring = location.search.substring(1).split("&"); var props = {}; //loop thru array querystring.foreach(function(item) { //split each item var item = item.split("="); //set first part key , last/second part value props[item.shift()] = item.pop(); }); alert ("first: " + props["first"]); alert ("last: " + props["last"]); //and on...

ruby on rails - Display all posts from a certain category -

i'm looking display posts category on page, have posts & category models linked habtm relationship. want able click link on index.html.erb , go through page lists posts belong category. do need create controller category , new routes? post.rb class post < activerecord::base has_and_belongs_to_many :categories belongs_to :user end category.rb class category < activerecord::base has_and_belongs_to_many :posts end index.html.erb (my current way display category each post) <% post.categories.each |category| %> <% category.posts.each |post| %> <%= link_to category.name, post_url(post) %> <% end %> <% end %> ** update ** after answer routes have been produced below. category_posts /categories/:category_id/posts(.:format) posts#index post /categories/:category_id/posts(.:format) posts#create new_category_post /categories/:category_id/posts/new(.:format)

sql server - SQL - Convert String Values to a Date -

here question trying solve: find same day of same week of previous month 2014/12/01. result should 2014/11/03. my approach taking values of original input date 2014/12/01 , breaking them down component parts (month-(1), day name, day value, week of month, year) below query: i've put sqlfiddle query determine of output values: declare @date datetime set @date = '2014-12-01' select (month(@date)-1) 'month', datename(dw, @date) 'day name', datepart(dw, @date) 'day value', (datepart(week, @date) - datepart(week, dateadd(mm, datediff(mm,0,@date), 0))+ 1) 'week of month', year(@date) 'year'; the output query below: ----------------------------------------------------- month | day name | day value | week of month | year | ----------------------------------------------------- 11 | monday | 2 | 1 | 2014 | ----------------------------------------------------- what i'd next take compon

internet explorer - Google Map with Api 3 not showing on mobile ie -

Image
i've implemented map google api 3, works fine on every browser, android , ios phones, too. not on windows 8.1 phone mobile ie. isn't displayed - empty page :-( i've searched in google , here, found posts 2013 says, there problem windows phones , googlemaps. nothing newer. me have problem? here's code: <!-- call api funktions --> <script> function initialize() { var mapoptions = { center: new google.maps.latlng(50.2014, 8.5804 ), zoom: 16, maptypeid: google.maps.maptypeid.roadmap, scrollwheel: false, pancontrol: true, draggable: false }; var map = new google.maps.map(document.getelementbyid("map_canvas"), mapoptions); var marker = new google.maps.marker({ map: map, position: new google.maps.latlng(50.2014, 8.5804 ), title:"schmerzzentrum" }); var contentstring = '<div id="mapinfo_box" style="color:#666;max-width:280px;"

How to format & print floating point numbers in Java with leading zeros? -

this question has answer here: how can pad integers zeros on left? 12 answers for example: 23.7748884 , 344.456445 numbers working with. looking output format "000.0000". desired result 023.7749 , 344.4564. tried: string.format("%.4f", 23.7748884) // output: 23.7749, not ok! desired: 023.7749 string.format("%.4f", 344.456445) // output 344.4564, ok! you reach such result using like: string.format("%08.4f", 23.7748884); // results 023.7749 string.format("%08.4f", 344.456445); // results 344.4564

arrays - Input and Output date class Java -

i'm doing class date project user input date , output date 3 difference formats. a) mm/dd/yyyy b) monthname dd, yyyy c) ddd, yyyy (date of year). i got stuck @ 1 point, output result part a. here got far import java.util.scanner; public class implementation { private static int month; private static int day; private static int year; private static final int[] dayspermonth = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; public static void date(string args[]) { scanner input = new scanner(system.in); while(year != -1) { system.out.print("enter month: "); month = input.nextint(); system.out.print("enter day: "); day = input.nextint(); system.out.print("enter year: "); year = input.nextint(); system.out.printf("\nmm/dd/yyyy: %d/%d/%d"); system.out.printf("\nmonth dd/yyyy: "); system.out.println(&

actionlistener - How to make a section of code start first-Java Small error/last little step -

so task i've been set make animation of lamp. there buttons added different actions such change colour of sphere etc. code: sphere class public class sphere extends jpanel { private boolean flashinglights = false; private int x = 168; private int y = 75; private color[] colors = new color[] {color.orange, color.light_gray }; private int colorindex = 0; public void paintcomponent(graphics g) { super.paintcomponent(g); graphics2d g2 = (graphics2d) g; graphics2d g3 = (graphics2d) g; if (!flashinglights) { rectangle box0 = new rectangle(x+16, y+50,14, 50); g3.setcolor(color.black); g3.draw(box0); g3.fill(box0); rectangle box1 = new rectangle(x+16, y+90,14, 50); g3.setcolor(color.white); g3.draw(box1); g3.fill(box1); rectangle box2 = new rectangle(x+16, y+130,14, 50); g3.setcolor(color.black); g3.draw(box2); g3.fill(box2); rectangle box3 = new rectangle

java - javamail store.isconnected() function bug -

i came across strange bug in javamail store isconnected() function. using in android application reconnect store if connection dropped. if (!store.isconnected()) store.connect(host, username, password); but, when connection dropped, function returns true first time called, , false second time called. means above code not trigger store.connect if store not connected, code: if (!store.isconnected()) store.connect(host, username, password); else if (!store.isconnected()) store.connect(host, username, password); will reconnect store because of second call isconnected() function return false. i don't know if explained bug enought. know if known behavior or not. maybe, doing wrong. or, maybe there better way reconnect store if disconnected. thank in advance! edit: this code: logger.warning("start1"); if (!store.isconnected()) { logger.warning("start1 conn"); store.connect(host, username, password); logger.warning("end1 conn&quo

c# - MVC 4 post automatically redirect to action that i dont want -

i have problem asp.net mvc 4 application. have partial view fallowing code: <li>@using (html.beginform("logoff", "account", formmethod.post, new { id = "logoutform", style = "display: inline;" })) { @html.antiforgerytoken() <a href="javascript:document.getelementbyid('logoutform').submit()">log out</a> } </li> and after click "log out" im redirected to: /account/login?returnurl=%f2account%f2logoff , going action: // // get: /account/login [allowanonymous] public actionresult login() { viewbag.title = logintitle; return view(); } but want handle in action: [httppost] [validateantiforgerytoken] public actionresult logoff() { session["user"] = null; return redirecttoaction("index", "index"); } can me? it looks not logged in during logging off.

java - Composite Mode "Add" (and more) -

for implementing colored lightning in exercise-engine need composite mode add. there no mention of mode (and many other commonly used subtract, average, burn, etc...) here: https://docs.oracle.com/javase/tutorial/2d/advanced/compositing.html i don't find experimenting. since pretty new java suppose doing wrong. could please point me in right direction? i prefer not doing in software (mainly because don't want loose hardware-acceleration, secondly because don't know how). you right, alphacomposite cannot blending modes typically found in image editors. there 2 java2d libraries provide extended composite implementations: jhlabs filters swingx or if using javafx, has them out of box don't worry performance, pretty fast.

electron - How to reset the renderer javascript context in atom-shell -

in standard browser, loading new url reset javascript context. ie. global variables, compiled functions , events cleared, , browser start clean slate. in atom-shell however, calling mainwindow.loadurl load new html file, keep javascript context alive. , variables need deleted hang around. how can tell atom-shell wipe out whole javascript context on renderer side? check out browserwindow.reload() or webcontents.reload() . if on 'renderer' side, can use remote.getcurrentwindow().reload() https://github.com/atom/atom-shell/blob/master/docs/api/browser-window.md#browserwindowreload if want wipe 'javascript context' on browser side too, need dereference window , create new window.

r - complex data.table subset and vectorised maniulation -

ok have complex function built using data.frames , in trying speed i've turned data.table. i'm totally new i'm quite befuddled. anyhow i've made much simpler toy example of want do, cannot work out how translate data.table format. here example in data.frame form: rows <- 10 data1 <- data.frame( id =1:rows, = seq(0.2, 0.55, length.out = rows), b = seq(0.35, 0.7, length.out = rows), c = seq(0.4, 0.83, length.out = rows), d = seq(0.6, 0.87, length.out = rows), e = seq(0.7, 0.99, length.out = rows), f = seq(0.52, 0.90, length.out = rows) ) dt1 <- data.table(data1) #for later data2 <- data.frame( id =3:1, = rep(3, 3), d = rep(2, 3), f = rep(1, 3) ) m.names <- c("a", "d", "f") data1[match(data2$id, data1$id),m.n

algorithm - What should be the ideal threshold on array size in order to use a non-recursive sorting method? -

i did revision on sorting algorithms. while revisioning, imagined code selects optimal of 2 available sorting algorithms sort array, according array's size. example, has choose between insertion sort , quicksort . it's known quicksort used extensively sort large arrays , achieves average case time, o(nlogn) , although worst-case time o(n^2) . on other hand, insertion sort isn't recursive, may consume less cpu time when sorts small-sized array. so, should nice threshold size aforementioned code in order choose efficient of algorithms? other performance factors, "how close" given sequence sorted permutation, aren't concerning me right now. from princeton university's quicksort page cutoff insertion sort. mergesort, pays switch insertion sort tiny arrays. optimum value of cutoff system-dependent, value between 5 , 15 work in situations. i prefer cut off size of 15. again system dependent , may or may not best in case.

button created programmatically doesn't respond to target, swift -

i'm creating button in tableview header in section 1. i so: func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { let header = uiview(frame: cgrectmake(0, 0, tableview.frame.size.width, 40)) header.backgroundcolor = uicolor.greencolor() if section == 1 { var button = uibutton() button.frame = cgrectmake(100, 100, 100, 50) button.backgroundcolor = uicolor.greencolor() button.settitle("button", forstate: uicontrolstate.normal) button.addtarget(self, action: "action:", forcontrolevents: uicontrolevents.touchupinside) header.addsubview(button) } return header } func action(sender: uibutton){ println("button pressed") } the button appears in section 1 (as should) if press on instead of printing message, nothing happens. my problem wasn't specifying button.frame correctly. since button outside frame, never c

batch file - Modify "Start in" properties box of shortcut with VBS? -

i'm trying create basic installer , i'm having trouble shortcut. installer works fine, program refuses start shortcut gets created because missing "start in" box information, how go putting information in vbs? here have far, shortcut gets created , else fine, code works fine other .exe's , launches them fine, not 1 program: set mypath=%cd% set script="%temp%\%random%-%random%-%random%-%random%.vbs" echo set ows = wscript.createobject("wscript.shell") >> %script% echo slinkfile = "%userprofile%\desktop\shortcut.lnk" >> %script% echo set olink = ows.createshortcut(slinkfile) >> %script% echo olink.targetpath = "%mypath%/myexe.exe" >> %script% echo olink.save >> %script% cscript /nologo %script% del %script% edit: here finished working script if needs 1 create shortcuts: set mypath=%cd% set script="%temp%\%random%-%random%-%random%-%random%.vbs" echo set ows = wscript.create

c++ - fast way for string comparison -

i have simple question makes me confused. i have 2 strings, , want count how many different characters between two. strings sorted, equal length. not split strings. for example input: abc, bcd output: 2, because , d different characters input: abce, bccd output: 4, because a, c, d , e different. i know can in o(n^2), how can solve in o(n) these sorted strings? only need number of different characters, no need indicate number. i thinking needed complicated algorithm, smith-waterman example. restrictions on input makes easy implement in o(m + n) , m length of first string, , n length of second string. we can use builtin algorithm calculate number of characters in common, , can use information produce number looking for: #include <algorithm> #include <iostream> #include <string> int main() { std::string m = "abce"; std::string n = "bccd"; std::string result; std::set_intersection( m.begin