Posts

Showing posts from January, 2010

How to style radio button inside alert dialog in android? -

i change text color of radio buttons inside dialog, , other attributes well. how do? the code used create radio buttons inside dialog: alertdialog.builder builder = new alertdialog.builder(this); builder.setsinglechoiceitems(somearray, -1, somelistener); i have tried new contextthemewrapper(this, r.style.alertdialogcustom) , works on dialog itself, not work on embedded radio buttons(say text color). alertdialog.builder builder = new alertdialog.builder(new contextthemewrapper(this, r.style.alertdialogcustom)); builder.setsinglechoiceitems(somearray, -1, somelistener); r.style.alertdialogcustom example: (tried other attributes well, none works) <?xml version="1.0" encoding="utf-8"?> <resources> <style name="alertdialogcustom" parent="@android:style/theme.dialog"> <item name="android:textcolor">@color/colorgray</item> <item name="android:typeface"...

php - File download function fails to attach complete file name and extension -

i have function use prompt csv files download. however, filename fails complete in mozilla browser works chrome. instance, if file name should f1_open_marksheet.csv, mozilla prompt download f1 (missing rest of file name , extension. code buggy? <?php function pushdownloadfile($filename){ header('content-description: file transfer'); header('content-type: text/csv; charset=utf-8'); header('content-disposition: attachment; filename='.$filename); header('content-transfer-encoding: binary'); header('expires: 0'); header('cache-control: must-revalidate'); header('pragma: public'); header('content-length: ' . filesize($filename)); ob_clean(); flush(); readfile($filename); unlink($filename); } ?> the flaw caused white space in file name eg f 1_open_marksheet.csv replaced hyphen f_1_open_marksheet.csv . credits @cbroe sharing link in comment above.

c# - Unable to access methods and classes from my project in Windows Runtime Component in UWP -

i create background task synchronize data server background task using windows runtime component in uwp app. but, unable access methods , classes project in windows runtime component in uwp. is there alternate way create background task without windows runtime component? or how can able access classes. you can create class library , add reference winmd , project class. code of class library like: public class bridgeclass { public static event action<string> messagereceived; public static void broadcast(string message) { if (messagereceived != null) messagereceived(message); } } inside project class can subscribe event bridgeclass.messagereceived += showmessage; and make realization: void showmessage(string msg) { } now winmd class call it: bridgeclass.broadcast("some value");

bash - Wait for last created process (daemon which forks) to end -

i'm writing wrapper script use in inittab. script starts daemon , waits terminate. here's have currently: #!/bin/bash /usr/local/bin/mydaemon --lots_of_params_here while kill -0 `echo $!` 2> /dev/null; sleep 1; done; the problem second line; returns immediately. if instead do: while kill -0 `pgrep mydaemon` 2> /dev/null; sleep 1; done; it works fine, isn't solution me have other scripts prefix mydaemon . what doing wrong? edit: the problem seems related daemon fork(). so, parent pid in $! . i'm looking ways solve problem. maybe should use pid files , have mydaemon write pid there. you can following way through issue. #!/bin/bash /usr/local/bin/mydaemon --lots_of_params_here & wait $! wait command wait till process completes , comes out. if looking wait after other commands can store pid in other variable , use that. #!/bin/bash /usr/local/bin/mydaemon --lots_of_params_here & mypid=$! ### other commands wait $mypid ...

ruby on rails - URL replacement from submitted comment -

i displaying users website url in comments. works correctly on view page, wondering if can change how url displayed. can display http://google.com website? or remove http, https , display google.com? here current code: <%= link_to comment.website, url_for(comment.website), target: '_blank' %> if comment.website returns string as: " http://google.com " can use regex trim "//" using: comment.website.remove(/.*\/\//) this crash if comment.website nil can use different syntax write same code comment.website.try(:remove, /.*\/\//) so: <%= link_to comment.website.try(:remove, /.*\/\//), url_for(comment.website), target: '_blank' %> go , check http://rubular.com/r/ufmy2djohw play regex

android - How to set the size of vector drawable as drawableLeft drawable? -

i try use vector drawables in android app. have used http://android-developers.blogspot.com/2016/02/android-support-library-232.html . need set vector drawble in drawableleft. here vector drawable <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportwidth="24.0" android:viewportheight="24.0"> <path android:fillcolor="@color/colorprimary" android:pathdata="m12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zm18,8h-1l17,6c0,-2.76 -2.24,-5 -5,-5s7,3.24 7,6v2l6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2l20,10c0,-1.1 -0.9,-2 -2,-2zm8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1s3.1,1.39 3.1,3.1v2l8.9,8l8.9,6zm18,20l6,20l6,10h12v10z"/> in layout <android.support.design.widget.textinputlayout android:id="@+id/textinputlayoutpassword" android:layout_width...

python 3.x - TypeError: unorderable types: int() > Guessing_game() -

i studying python , trying make guessing number program connected gui. however, there bug , don't know how fix, please me. my code from tkinter import* import random class application(frame): def __init__(self, master): super(application, self).__init__(master) self.grid() self.widgets() self.answer = guessing_game(starting_number = 0, ending_number = 100) def widgets(self): label(self, text = "hello welcome new_version of guess number!" ).grid(row = 0, column = 0, sticky = w) label(self, text = "guess number(0-100):" ).grid(row = 1, column = 0, sticky = w) self.user_answer = entry(self) self.user_answer.grid(row = 1, column = 1, sticky = w) button(self, text = "submit", command = self.submit ).grid(row = 3, column = 0, stic...

How to make layout scroll past its content in Android? -

Image
in ios apps can make if scroll down bottom of page , keep scrolling see empty space. if let go pull bottom of content @ bottom of screen if being held spring. in fact, assume default behavior because happens often. i same thing in android, because activity has standard floating action button in bottom right corner , it's blocking of content. if scroll past content, able see of it. as example, made new android studio project blank activity (with floating action button) , modified content_main.xml adding scrollview , lots of lorem ipsum there scroll: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_m...

arrays - Find indices of blocks of 0s that are continuous -

this question has answer here: finding islands of zeros in sequence 7 answers i have vector , want find indices of blocks of 0s continuous @ least 3 times. y = [1 1 1 0 1 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 0 0 0 1 1]; so in case, blocks should [0 0 0] 7-9 , [0 0 0 0] 20-23. output should give me indices, [7, 9] , [20,23], or better, change these blocks of 0s single nan become: [1 1 1 0 1 1 nan 1 1 1 0 1 0 1 0 0 1 nan 1 1] thanks! what can is: pad vector 1 on each side. use find , diff find vector changes 1 0 (diff = -1) use find , diff find vector changes 0 1 (diff = 1) find duration of each interval subtracting values in 3 values in 2 (and add 1) create logical vector true duration >= 3 , , use vector find start indices (from values found in point 2). set value of each of start indices nan set value of start indices + 1 : end indice...

html - Bootstrap CSS Pull-Right issue -

Image
i have simple piece of code trying work , giving me issues. i have grid of 9 , 3 set up. 9 being tool title , 3 being status of tool. in code below however, though using pull-right content right side of col-md-3 content within isn't aligned right expect be. here fiddle: https://jsfiddle.net/p5yctnw0/2/ <div class="container-fluid"> <div class="row"> <div class="col-md-9"> <h1 class="tooltitle">tool title <small class="toolsubtitle">#244</small></h1> </div> <div class="col-md-3"><span class="pull-right"><h4>active</h4>(dates & replacement if applicable)</span></div> </div> </div> what expect: i know going silly css attribute missing not sure else try. the content aligned right text not right aligned. use text-right css class right align text. <span class=...

http - PHP to check if its plausible to get SSL -

well not own wildcard ssl homepage, have quite few subdomains included in ssl certificate, wanna see if there plausible check if subdomain has valid ceritificate before redirecting subdomain in https. why want know this? because i'm running domains through 1 php file, thats meant domaincontroll, that's including database pages exists , such, instead of having row in mysql weather not awailable in https kind-off waste, if there isn't answer question. there exists way wish. thanks ~martin you can use curl test. if curlopt_ssl_verifypeer set true (the default), result false. <?php $ch = curl_init('https://www.example.org'); curl_setopt($ch,curlopt_returntransfer,true); curl_setopt($ch,curlopt_followlocation,true); $result = curl_exec($ch); echo curl_error($ch); curl_setopt($ch,curlopt_ssl_verifypeer,false); $result = curl_exec($ch); echo curl_error($ch);

swift - JSONObjectWithData error : unexpectedly found nil while unwrapping an Optional value -

this question has answer here: what “fatal error: unexpectedly found nil while unwrapping optional value” mean? 5 answers hi i'm having problem nsjsonserialization reading json api code: func json() { let urlstr = "https://apis.daum.net/contents/movie?=\etc\(keyword)&output=json" let urlstr2: string! = urlstr.stringbyaddingpercentencodingwithallowedcharacters(nscharacterset.urlhostallowedcharacterset()) let url = nsurl(string: urlstr2) let data = nsdata(contentsofurl: url!) { let ret = try nsjsonserialization.jsonobjectwithdata(data!, options: nsjsonreadingoptions(rawvalue: 0)) as! nsdictionary let channel = ret["channel"] as? nsdictionary let item = channel!["item"] as! nsarray element in item { let newmovie = movie_var() // etc mo...

r - How to perform pairwise division based on row grouping -

Image
i have data frame made following way: df <- structure(list(celltype = structure(c(1l, 1l, 2l, 2l, 3l, 3l, 4l, 4l, 5l, 5l, 6l, 6l, 7l, 7l, 8l, 8l, 9l, 9l, 10l, 10l), .label = c("bcells", "dendriticcells", "macrophages", "monocytes", "nkcells", "neutrophils", "stemcells", "stromalcells", "abtcells", "gdtcells"), class = "factor"), sample = c("sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", "sp id treated", "sp id control", ...

How to store an array into a php file using javascript -

i need similar code have alert coordinates instead save coordinates php file. var array = []; navigator.geolocation.getcurrentposition(function(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; array.push(lat, lon); locationcode() }); function locationcode() { alert(array); } // try html5 geolocation. if (navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { var pos = { lat: position.coords.latitude, lng: position.coords.longitude };

ios - Swift Cannot append to subscript on type JSON -

i'm getting json data using swiftyjson, , got changeable array using: let worlddatagenjson = json(data:data) worlddatagenblocks = worlddatagenjson["blocks"]["x"].arrayvalue array with this, can append worlddatagenblocks like: worlddatagenblocks.append([ "y": [:] ]) i created new array inside worlddatagenblocks called "y", i'm not able append it worlddatagenblocks[0]["y"][0].append([ "bid": 0, "id": 0, "fid": 0 ]) it say: value of type 'json' has no member 'append' i tried set way too, no avail: worlddatagenblocks[cx]["y"][cy] = [ "bid": 0, "id": 0, "fid": 0 ] every time print "worlddatagenblocks" show empty "y" arrays. please help.

c# - Randomly Connected Graph Generator -

i'm trying generate simple graph randomly connecting n nodes. i'm looking efficient algorithm so, this: input: n number of nodes e number of edges n-1 n(n-1)/2 output: simple connected graph n vertices , e edges create array of n nodes. fisher-yates shuffle array. scan array , create edge each pair of nodes adjacent in array. result connected graph n-1 edges. if number of additional edges small, can randomly add edges till have enough. otherwise, create array of unused edges, fisher-yates shuffle array, , take first (e - (n-1)) edges array.

.net - DocFx: how to create table of contents navigation on site? -

Image
i want create table of contents looks docfx has on official site : using default docfx init command using of default values website looks upon build: \ i've tried tampering toc.yml files no such luck. how kind of navigation, , matter top-level navigation docfx? turns out issue trying serve files locally - security sandboxing prevented of javascript running. worked fine once used docfx --serve instead.

php - Finding a part of string in an array of strings -

iv been looking way search through array of strings , find if there strings contain part of string, if there merge whole array onto array. eg: searching jav: array->[java] -> return value , add whole array after looking around on stackoverflow , testing found solution using strpos works...kind of: $matches=array(); //just here show array declared , filled items prior calling foreach($myarray $fn){ if(strpos($fn,$searchstring)){ $matches = array_merge($myarray,$matches); } } the issue is, instead of adding whole array adding search string each loop however, after double checking number of times dont understand why. tts adding original search item rather entire other array.... eg. if search jav shown above array merge create array of correct length value : javjavjavjavjav any in understanding why or how correct appreciated. the function strpos return false or 0, array matches not save word text jav. this solution: $myarray = [...

symfony - Run PHP CS fixer with GrumPHP -

i'm using grumphp sniff commit in symfony project: https://github.com/phpro/grumphp here config: parameters: git_dir: . bin_dir: vendor/bin tasks: phpcsfixer: config_file: ~ config: sf23 fixers: [psr2, symfony, indentation] level: psr2 verbose: true my question is: is there way grumphp automatically run php-cs-fixer when commiting? yes there is! https://github.com/phpro/grumphp/blob/master/doc/tasks.md since post bit older here new updated doc, can still use version one! https://github.com/phpro/grumphp/blob/master/doc/tasks/php_cs_fixer2.md you try out configuration it's phpcsfixer version2!: # grumphp.yml parameters: bin_dir: "./vendor/bin" git_dir: "." hooks_dir: ~ hooks_preset: local stop_on_failure: false ignore_unstaged_changes: false process_async_limit: 10 process_async_wait: 1000 process_timeout: 60 asc...

c# - UWP . Copy file from FileOpenPicker to localstorage -

fileopenpicker picker = new fileopenpicker(); picker.viewmode = pickerviewmode.thumbnail; picker.suggestedstartlocation = pickerlocationid.computerfolder; picker.filetypefilter.add(".txt"); a user chooses file open. how can store/copy/save that file localstorage for future use, every time app opens, picks automatically file? after user opens file using fileopenpicker can "cache" access using storageapplicationpermissions api. once have storagefile want open automatically, can "cache" access using following code: string token = storageapplicationpermissions.futureaccesslist.add( file ); what string token, can save example in app settings. next time app opened, can retrieve file again using following code: storagefile file = await storageapplicationpermissions.futureaccesslist.getfileasync(token); note api has limitation of @ 1000 items stored, if expect more added, have ensure older files removed otherwise not able add new fi...

Quickbooks PHP API Generating Invoices On Order Submission -

i have client wants take orders via online form, idea being order can submitted , stored in database via application while simultaneously generating invoice on submission in quickbooks. how do in php when person entering in order not client client of client? seems quickbooks uses oauth tokens , javascript library generate them connect company app, i'm writing backend 1 company , want backend create invoices when saving order. how think this? i'm not interested in having hit button says "connect quickbooks" not person filling order because again, person customer , doesn't need know internals of customer's invoicing system. i want use accounting api generate invoices. there no way link backend 1 company directly in quickbooks sdk configuration , achieve this, or need use javascript library tokens. i'm unclear direction should going in , don't want waste time client-side library if don't need backend logic. here's example code y...

go - golang reading long text from stdin -

i want read long text os.stdin, can't make happen. read in subject, tried codes supposed work. every method cuts after 4096 characters, no matter what. eg. here 's working example. after first run of loop, reads first 4096 characters, , waits more processing each enter, until end eof (ctrl+d). same thing fmt.scan, bufio.newscanner, bufio readline, ioutil.readall. if save file, , read it, works expected. stdin doesn't. i'm on arch linux, 32 bit, go 1.7, tested in mate-terminal 1.14, tty 8.25, same thing in both of them. , same thing happens on hackerrank.com page, don't know technology they're using. please help! edit: my input little bit longer 4096 characters. checked out link amd shared, , got following: input 1 line containing space separated integers. when changed spaces newlines, worked. since excercise format on hackerrate uses long space-separated lines, problem still up, refinement. i able solve ian lance taylor: https://groups.go...

php - Radio Buttons not showing up as checked -

i'm trying write theme options page wordpress. in it, user select alignment of div through radio buttons. currently looks when option selected: https://gyazo.com/e27c2fc2c2e1f751ab27d98453581c52 i wondering how i'd fix (for radio buttons show checked , not checked='checked'center). works , correctly outputs front-end doesn't show checked without checked='checked'. if use jquery remove checked='checked' removes radio buttons together. register_setting('slider_setting','slider_section1_direction'); add_settings_section( 'slider_section', '', 'slider_settings_callback', 'register_slider_settings' ); add_settings_field( 'slider_section1_direction', '', 'slider_section1_direction_callback', 'register_slider_settings', 'slider_section' ); function slider_section1_radio_buttons_callback() { $s1_radio_buttons_settings = array( 'left' => a...

How to write a jQueryUI selectmenu with dynamic options into a Meteor Blaze template -

i having trouble making jqueryui selectmenu work in meteor app when options dynamic. using: meteor 1.4.1 jquery 2.2.4 jqueryui 1.11.4 lodash 4.15.0 physiocoder said on different question , "the meteor reactivity force choose in charge of dom updates.". i realize fundamental problem here. accordingly, there no problem if page/template can let meteor load page content/data , hand on dom control jqueryui's widgets. have case want have cake , eat -- want have meteor reactively feed options jqueryui widget (specifically selectmenu @ moment) still let jqueryui handle styling/theming. initializing jqueryui widgets in template onrendered functions works fine, destroying jqueryui widgets, necessary, in template ondestroyed functions. calling selectmenu('refresh') on option template's onrendered function refresh selectmenu when new options available. however, cannot find anywhere can call refresh when options reactively removed such selectmenu refreshe...

javascript - Newer Samsung devices can't display webpages in their built-in SMS app -

when open url (say https://www.google.com ) in sms in samsung's built-in messages app, it's opened in in-app browser, blank page displayed, , stays blank instead of displaying website. is known samsung/android bug? is there known workaround? to reproduce: receive (or send) url in sms in samsung's built-in messages app . tap on url in sms: the app opens webpage in in-app browser instead of opening in chrome. observe blank page displayed, , stays blank. to work around: rotate device orientation (e.g. portrait -> landscape ). observe page appear in front of puzzled eyes! what kind of page works? none. 1 fails shown: <html> <body>how wish you'd show me immediately!</body> </html> a few more surprises: alert('ah, ha!') works immediately! the css style background-color works immediately! is, blank page uses color defined in rule. document.body.innerhtml('show this, @ least!') doesn't ...

python - What Happens when a Generator Runs out of Values to Yield? -

to illustrate question, suppose have simple generator: def firstn(n): num = 0 while num < n: yield num num += 1 in firstn(10): print this print digits 0 through 9. if have: def firstn(n): num = 0 while num < 5 < n: yield num num += 1 in firstn(10): print (the change in while statement.) prints digits 0 through 4. once num >= 5 , generator no longer yields values. what i'm curious goes on under hood: used pythontutor step through code, , impression i'm under once while statement no longer true , function implicitly returns none , for loop somehow detects, , breaks. used next built-in inspect more closely: >>> def firstn(n): ... num = 0 ... while num < 5 < n: ... yield num ... num += 1 ... >>> >>> mygen = firstn(100) >>> next(mygen) 0 >>> next(mygen) 1 >>> next(mygen) 2 >>> next(mygen) 3 >>...

javascript - Detecting user-initiated page unload vs browser crashing -

i have memory-intensive webgl code runs in both desktop , mobile devices. user able add/remove webgl modules thereby changing memory requirements page. on low-power devices possible user bad state. try load page, page runs out of memory due many modules loading. page crashes. working on providing user means of recovering scenario. some high-level pseudocode recovery solution looks like: during init, write flag sessionstorage each module. flag indicates given module has not loaded yet. if module has flag in storage - don't try load it. for every other module - attempt load. as each module loads, clear flag. overall, code has effect of preventing browser attempting load modules every time. however , clear module's load flag if user refreshes page. manual page refresh not browser crash -- , modules should continue try , load: window.addeventlistener('unload', function() { /* clear flags here */ }); this seems work fine in desktop environments, in testi...

javascript - How do you tell if one element is above another from results from querySelectorAll -

how tell if 1 element above (like after z indexes calculated) results queryselectorall. don't think there easy solution, in there browser api call , element "z-height". you approach problem how rendering engine working, stacking elements 1 on top of other based on dom tree depth. there css engine, changes element positions based on tag types , special rules css, such z-index , special position properties ( relative , absolute , etc.) , css "quirks", example z-index + opacity changes how elements stacked. based on goal, simplify parsing , ignore css doing , take html in consideration. there have dom api, makes traversing tree structure super easy , dom rendering engine handle weird cases of wrong-but-still-working markup.

floating point - Does Java's BigDecimal leverage the hardware architecture like long double in C++? -

as understand it, long double in c++ leverages hardware architecture (at least architectures). bigdecimal in java small enough inputs? does bigdecimal in java small enough inputs? no, , not. floating-point numbers lossy, while every bigdecimal has associated precision, , can represent number below precision. there no "small enough input" can usefully rendered floating point number, because if happen have bigdecimal value can represented in floating-point notation, you'd hard-pressed sort of operations on value , maintain specified precision. put way, purpose of bigdecimal offer precision while sacrificing speed. runs contrary floating-point, sacrifices precision in favor of speed. it sounds you're asking if java offers way work long double sized floating-point numbers, , there not . can conclude fact it's not provided jdk authors have never felt necessary add language.

reactjs - How can I set state in a child component from a parent? -

i have slider component nested in form in app. slider adjusts parameters live in redux store . normally, slider controlled, values set props passed down redux store . when slider moved, onchange dispatch action update store , , slider values change. however, in case, solution poses problems: the slider has 100+ steps, dragging 50% across means dozens , dozens of onchange events since slider isn't connected store , every onchange forces re-render on parent, props changing. eviscerates performance. so, i've implemented partial solution: the slider values live in slider's state, dragging re-renders slider onchange events. an afterchange event--which fires when user releases mouse after dragging slider, dispatch es new values store . however, parent has "reset" button should set slider's values initial state. so, how can communicate slider component parent it's time reset values? have parent's reset button whatever ne...

angularjs - Insert HTML Tags in ng-options -

i'm trying insert html tags in ng-options , when document's rendered options have icons before text. html: <select chosen id="receive-country-selection" ng-model="current.recipientcountry" ng-change="selectrecipientcountry(current.recipientcountry)" ng-options="x.name.tolowercase() x in data.recipientcountries" > <option value=""></option> </select> needs rendered like: <select chosen id="receive-country-selection" ng-model="current.recipientcountry" ng-change="selectrecipientcountry(current.recipientcountry)" ng-options="x.name.tolowercase() x in data.recipientcountries" > <option> <span class="flag-sprite-container"> <svg class="flag-sprite"> <use xlink:href="someurl"></use> </svg> </span> text </optio...

forms - How to use VBA to add new record in MS Access? -

i'm using bound forms user update information on new or existing customers. right i'm using add new record macro on submit button (because i'm not sure how add or save new record through vba). added before update event (using vba) have user confirm want save changes before exiting form. reason overriding add record button , users cannot add new record until exiting forms. how can use vba add new customer information correct table? should done macros instead? form beforeupdate code: private sub form_beforeupdate(cancel integer) dim strmsg string strmsg = "data has been changed." strmsg = strmsg & " save record?" if msgbox(strmsg, vbyesno, "") = vbno docmd.runcommand accmdundo else end if end sub add record button: private sub btnaddrecord_click() dim tblcustomers dao.recordset set tblcustomers = currentdb.openrecordset("select * [tblcustomers]") tblcustomers.addnew tblcustomers![customer_id] = me.txtc...

c++ - Is myDesign for thread communication acceptable? -

Image
i trying create , working qt design communication between several threads. have preference window, emits different signals on clicking on apply. example 1 creating sql connection , 1 changing other stuff. want change preferences in background thread in different classes , after making changes shall emit result signal. in preferences window want wait until signals received (either true or false result) before either close window or print error message. i tried draw design in attached picture. correct way purpose? struggling way of waiting results. thinking of creating kind of array save every result , check array, whether signals received. sounds pretty ugly... there better method wait until signals received? also idea make classes in background thread singelton ? need 1 instance of classes , make access classes pretty easy since not need drag pointers every object, needs know classes. also know, whether idea store public member in mysql class, tells me, whether database con...

html - Setting Up Events in Google Tag Manager with Parent/Child Attributes -

pushing code out on site happens monthly , wanted add in event tags on buttons on site using google tag manager. because classes & id's in parents , not directly on click attribute having trouble figuring out how target specific button. right every time test in different ways can't seem work. reading article try me: http://www.periscopix.co.uk/blog/new-gtm-trigger-condition-matches-css-selector/ the piece of code i'm trying target users click on 'apply' button. <div id="universal-actions" class="pull-right"> <ul class="nav nav-pills"> <li class="button-visit"><a href="/visit/">visit</a></li> <li class="button-apply"><a href="/apply/">apply</a></li> <li class="button-login"><a href="/login/">login</a></li> i trie...

sql - JAVA update Database - wrong -

package application; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; public abstract class query { private static final string driver_classname = "org.sqlite.jdbc"; private static final string password = ""; private static final string username = ""; protected static string base = "data/pezaldb"; private static string jdbc_url = "jdbc:sqlite:" + base + ".db"; protected static connection connection; protected static statement statement; public static resultset resultset; public static void connecttodatabase() throws classnotfoundexception, sqlexception { class.forname(driver_classname); connection = drivermanager.getconnection(jdbc_url, username, password); } public static void executesql(string sql) throws sqlexception { statement = connection.createstate...

Mysql Query order by multiple items(statments) -

this have. select karma , profanity , username users order (karma - profanity) desc limit 10 how can order order (karma - profanity) desc limit 10 , order profanity desc limit 10 create table test (`id` int, `username` varchar(55), `karma` int,`profanity` int) ; insert test (`id`, `username`, `karma`, `profanity`) values (1, 'user1', '10', '1'), (2, 'user2', '8', '2'), (3, 'user3', '1', '2'), (4, 'user4', '11', '1'), (5, 'user5', '5', '0'), (6, 'user6', '6', '3'), (7, 'user7', '1', '1'), (8, 'user8', '2', '3'), (9, 'user9', '2', '1'), (10, 'user10', '1', '7'), (11, 'user11', '7', '7'), (12, 'user12', '1', '1'), ...

Java Loop Error -

hi i'm running simple loop supposed output numbers 0-10, when program run, nothing appears in output box, yet program doesn't throw errors. here loop: for(int num = 0; num <= 10; num++){ system.out.println("num = " + num); } since op clarified in comment intention print numbers 1-9: you start loop num = 0 . means start printing 0 . if supposed print 1 first number, loop should start for(int num = 1; . also, @gersee wrote in comment, condition of loop should num < 10 if intention print 9 last number. condition of loop says num <= 10 , still valid when num == 10 , , therefore results in code printing 10 .

css - What units are referenced by responsive web design breakpoints? -

when breakpoints set in css responsive web designs, media queries check width of device different layouts can appropriately displayed. thought understood it, pixel units in media queries referencing rendered pixel resolutions commonly see in device specs. example, iphone 5 @ 640 x 1136px or nexus 5 @ 1080 x 1920 . but i’m confused whether breakpoints instead meant reference device’s points (for ios) or density-independent pixels (for android). question largely stems how i’ve seen common breakpoints referenced, buckets defined phones, tablets, , desktop screens. this, instance, bootstrap’s documentation : // small devices (portrait phones, less 544px) // no media query since default in bootstrap // small devices (landscape phones, 544px , up) @media (min-width: 544px) { ... } // medium devices (tablets, 768px , up) @media (min-width: 768px) { ... } // large devices (desktops, 992px , up) @media (min-width: 992px) { ... } // large devices (large desktops, 1200px , up) @me...