Posts

Showing posts from August, 2012

python - Image processing approach -

Image
in following greyscale image,i trying identify objects have manually labelled in red. have suggestions of how this? i have attempted use gaussian blur , thresholding cannot exclusively identify these particles. edge detection approach? suggestions welcome. your images suitable target machine learning . i created following probability map using trainable weka segmentation plugin imagej/fiji (taking second image input): you should able objects simple thresholding , possibly subsequent size filtering. you might want try ilastik , free software combines pixel classification , object tracking power of machine learning. edit : this how proceeded using trainable weka segmentation: in settings window, activated more features, set sigma range 4 32, , named classes "objects" , "background": i created freehand line traces, added them respective classes, , clicked on "train classifier". (the creation of feature stack takes...

python - Matplotlib axis time formatter -

Image
i have logarithmic axis time in seconds on labels 10^1 sec, 10^2 sec, 10^3 sec, 10^4 sec ... like similarily possible engformatter want have axis ticks , labels in seconds, minutes, hours, days, this: 0 sec, 30 sec, 1 min, 30 min, 1 hour, 12 hour, 1 day ... how axis ticks , labels that? i able create axis wanted with code: def to_time(x, position): x = float(x) timeunit = 'sec' if x >= 60: x = x/60 timeunit = 'min' if x >= 60: x = x/60 timeunit = 'h' # can modify actual string here string = '%.0f%s' % (x,timeunit) return string #... plots here ax.set_yscale('log') tickermajor = loglocator(base=60) tickerminor = loglocator(base=60, subs=[10,20,30,40,50]) ticklabels = funcformatter(to_time) ax.yaxis.set_major_locator(tickermajor) ax.yaxis.set_minor_locator(tickerminor) ax.yaxis.set_major_formatter(ticklabels) hope helps somebody. works sec,...

jquery - fancybox related thumbnails are not loading instead it loads all the thumbs from the gallery -

i trying create gallery load thumbnails.using fancybox able achieve loads thumbnails @ once instead of related gallery thumbnails. here code reference: <div class="fancybox_container" data-project="<?php echo $post->id; ?>"> <?php $slider = get_field("slider"); if($slider): foreach($slider $slide): $img = $slide["slide"]["img"]; $gallery = $post->id; $title = get_the_title(); echo "<a class='fancybox-thumbs' data-fancybox-group='thumb' rel='gallery-{$gallery}' title='{$title}' href='{$img}'><img src='{$img}' /></a>"; endforeach; endif; ?> </div> jquery: <script type="text/javascript"> jquery(document).ready(function($){ $('.fancybox-thumbs').fancybox({ ...

sql - SAS Concatenate Multiple Variables to Create Data-Driven Macro Statements -

in order keep process data-driven, i'm trying concatenate multiple variables, separated comma, in order put them in proc sql list call in multiple macro statements otherwise clutter sas pogram. take following sample dataset: data test; input year condition $ qrts $12. sample $; datalines; 2008 mi (1,2,3,4) 2008 mi (1,2,3,4) b ; run; i'd concatenate these variables together, again separated comma, , add %append front create huge list of macro statements. new string variable, , macro statements, like: %append(2008,mi,(1,2,3,4),a); %append(2008,mi,(1,2,3,4),b); i've used following compile strings of means , confidence intervals, , imagine similar (i cannot figure out these quotes, commas, , bars data): ci=compress(put(mean,7.2))||"("||compress(lo)||","|| compress(hi)||")"; once long string variable created, select variable long list through proc sql statement like: proc sql; select distinct *new long ...

php - WP : Custom Post Type pagination by cats Issue -

i'm going crazy i'm working on wordpress mobile theme , have issue pagination of custom post type. explanations : this winery website. on website there 3 cats of wine. on single-wine.php want able navigate between wine wich on same cat. doesn't work want , don"t know why cause each use same code : cat 1 : dry wines - pagination looks good cat 2 : vintage wines - can navigate between 3 wines ( >< why ..?) cat 2 : oxy wines - can navigate between 1 wines ( >< why ..?) next_post , previous_post function have same link time. can me ? don't understand issue, i'm on since 2 days. single-wine query ? pagination ? try on mobile understand : mas.triangle-fr.com single-wine.php <?php include('winecats-2.php');?> <?php wp_reset_query(); ?> <?php if (have_posts()) : ?> <?php while ( have_posts() ) : the_post(); ?> <section id="wine-head"> <div class="containerwine"> <?php...

One jar library for Android and Java (One compiled library for both) -

i'm writing java library uses classes available in android , other in awt (like android bitmap , jwt bufferedimage). use these classes internally (none of them public). now want both of them in same jar (i added checking (if android or not) before calling of these specific classes). i tried , works fine. now question, safe, or there might problem face users of library when using in apps (java or android)?

javascript - AngularJS Controller is not a function error -

i'm getting error when adding ng-controller="headercontroller" div. error: ng:areq bad argument argument 'headercontroller' not function, got undefined my html looks that: <div ng-app="myapp"> <div ng-controller="headercontroller"> </div> <div ng-controller="postcontroller"> </div> </div> also include following files: myapp.js var myapp = angular.module('myapp', ['postservices', 'angularfileupload', 'ngsanitize', 'ui.date', 'bootstraplightbox', 'profileservices']); headercontroller.js myapp.controller('headercontroller', ['$scope', 'postservices', '$http', function($scope, postservices, $http) { $scope.getbookmarkscount = function() { postservices.getbookmarkscount().then(function(response) { if (response.data.status == 'success') { ...

scala - Convert RDD to JSON Object -

i have rdd of type rdd[(string, list[string])]. example: (fruit, list(apple,banana,mango)) (vegetable, list(potato,tomato)) i want convert above output json object below. { "categories": [ { "name": "fruit", "nodes": [ { "name": "apple", "isintoplist": false }, { "name": "banana", "isintoplist": false }, { "name": "mango", "isintoplist": false } ] }, { "name": "vegetable", "nodes": [ { "name": "potato", "isintoplist": false }, { "name": "tomato", "isintoplist": false }, ] } ] } please suggest best possible way it. note: ...

android - Gather Touches from MainActivity -

Image
i want gather possible touches entire screen. implemented a @override public boolean ontouchevent(motionevent e) { double x = e.getx(); double y = e.gety(); } but added tableview "scene" , when click on above method not being called because tableview swallowing touches. everything around yellow area clickable yellow area not. want clickable well, want time whole screen area clickable can store touch positions. how it? edit: ontouchevent method in mainactivity class. here activity_main.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <scrollview android:layout_width="match_parent" android:layout_height="match_parent" > <tab...

c# - One row of list view is updating, but duplicate row is also inserted -

Image
hello folks trying update quantity of product being ordered. if product exists in users 'basket' instead of inserting new row, quantity in row existing item should updated. updating new row inserted quantity should have been added original row, so: i'm guessing wrong logically in code but, can't spot it. private void btn_add_click(object sender, eventargs e) { try { listviewitem item = new listviewitem(list_select_product.selecteditems[0].text); item.subitems.add(list_select_product.selecteditems[0].subitems[1].text); item.subitems.add(txt_quantity.text); bool ok = true; if (!validnumbers(txt_quantity)) ok = false; if (!validlength(txt_quantity, 1, 2)) ok = false; if (ok == true) { foreach (listviewitem lvi in list_view_orderitems.items) { if(lvi.subitems[0].t...

Problems connecting via HTTPS/SSL through own Java client -

i'm trying establish connection trackobot.com receive json data. server allows connections through https/ssl. here code: java.lang.system.setproperty("https.protocols", "tlsv1,tlsv1.1,tlsv1.2"); url url = new url("https://trackobot.com/profile/history.json?username=user&token=tocken"); inputstream = url.openstream(); jsonparser parser = json.createparser(is); opensteam throws javax.net.ssl.sslhandshakeexception: received fatal alert: handshake_failure i read through several posts related similar problems none of suggestions helped. appropriate certificate in truststore. when try connect to, example, google.com there no error. so, problem seems in handshake-specifics of server i'm trying connect to. i ran code using -djavax.net.debug=ssl returning this: keystore : keystore type : jks keystore provider : init keystore init keymanager of type sunx509 truststore is: /library/java/javavirtualmachines/jdk1.8.0_25.jdk/contents/ho...

c# - Wrong WParam value in IMessageFilter.PreFilterMessage -

i in process implement application-wide keyboard hook 1 of applications. done using imessagefilter implementation overriding prefiltermessage method , adding imessagefilter main form. far able test, of number , letter keys work without problem, when comes to, let's say, keys.left (code 37), wparam of message contains a, seems, wrong value (code 39). , yes, did bit-and keys.keycode (which 65535 btw. means wouldn't matter). if has idea or hint why works letter/number keys not keys.left highly appreciate that. code: public bool prefiltermessage(ref message m) { if(m.msg == wm_keydown) { _keytable[(keys)m.wparam & keys.keycode] = true; } if(m.msg == wm_keyup) { _keytable[(keys)m.wparam & keys.keycode] = false; } return false; }

ruby - How to calculate median in a Rails app that uses SQLite3? -

is there way median calc in rails 4 app uses default sqlite3 database? i've built app add median function, , see active_median gem works postgresql now: https://github.com/ankane/active_median try calculate median def median(array) sorted = array.sort len = sorted.length return (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0 end

javascript - Send in one ajax POSt checked checkboxes with selected dropdowns -

checked checkboxes decided hold code $('.list input[type=checkbox]').on('change', function () { var favorite = {}; $('.list input[type=checkbox]:checked').each(function () { var $el = $(this); var name = $el.attr('name'); if (typeof (favorite[name]) === 'undefined') { favorite[name] = []; } favorite[name].push($el.val()); }); $.ajax({ url: '/search.asp', type: 'post', data: $.param(favorite), datatype: 'text', success: function (data) { $("#exsearchform").html(data) .find('input[type=checkbox]').each(function () { var $el = $(this); var name = $el.attr('name'); var value = $el.attr('value') if (favorite[name] && favorite[name].indexof(value) !== -1) { ...

javascript - Cannot read property 'offsetHeight' of null -

i have strange issue showed on script , not sure causes issue happen. popping on chrome browser , guess function 'offsetheight' either deprecated or invalid. here full code: var rep_templates = { // array of pre-defined reasons answers: null, // popup container context_menu: null, // popup copntiner height menu_height: 0, error_msg: null, // ajax form , param values pseudoform: null, url: null, postid: 0, // information phrases display user thanks_phrase: '', description_msg: '', timer_id: null, /** * inits popup * @param answers array of pre-defined reasons * @param error_msg display in case of empty message * @param url of current page * @param thanks_phrase diaplyed after successful submission */ init: function(answers, url, phrases) { if (ajax_compatible) { this.answers = answers; this.error_msg = phrase...

javascript - x3d TimeSensor pause and resume on click -

i have cute solar system implemented in x3d, , thing i've been trying couple hours stop rotation of planet on single click mouse, "works" : <timesensor def='clocksol' id='clocksol' cycleinterval='80' loop='true' enabled='true' /> ... <orientationinterpolator def='interrotacion' key='0 0.25 0.5 0.75 1' keyvalue='0 1 0 0 0 1 0 1.57079 0 1 0 3.14159 0 1 0 4.71239 0 1 0 6.28317'/> ... <route fromnode='clocksol' fromfield='fraction_changed' tonode='interrotacion' tofield='set_fraction'></route> <route fromnode='interrotacion' fromfield='value_changed' tonode='rotacionsol' tofield='set_rotation'></route> *............* that's implementation of sun animation. the click event follows: document.getelementbyid('sol').addeventlistener('click', function() { if(docum...

html - Width not responding on android browser only on samsung galaxy tab 3 -

Image
i'm having weird issue page design, works in every device , resolution, issue android browser on samsung galaxy tab 3 1280x800 res. width of box wide on samsung galaxy tab, ideas? i'm using sass/compass code long paste here, same compiled css. basic html https://jsfiddle.net/nayl9wt9/2/ basic sass: .group-product-info { min-height: 0; max-height: 100%; height: 65% !important; width: 40.65% !important; //original width max-width: 40.65% !important; overflow: auto; -webkit-overflow-scrolling: touch; } here screenshot of how should look: samsung galaxy tab view:

python - Jinja2 find_undeclared_variables ignores globals? -

i want find out variables of jinja2 template not covered globals. load template source, parse , feed result meta.find_undeclared_variables . no matter in global dictionary of environment full list of variables template. how make operation recognize globals in environment , in template , return list of variables not covered them. the sample below creates environment, renders template show global variables indeed read , calls meta.find_undeclared_variables show result. from jinja2 import environment, meta, functionloader, prefixloader def load_mapping(name): return 'mapping %s {{version}} {{docid}}' % name def load_link(name): return 'link %s {{version}} {{docid}}' % name loader = prefixloader({ 'link': functionloader(load_link), 'map': functionloader(load_mapping) }) env = environment(loader=loader) globals = {'version': '1.0'} env.globals.update(globals) print env.get_template('map/test').render(doc...

jsf 2 - this.jq.draggable is not a function when using primefaces dialog framework -

i'm trying open dialog using primefaces dialog framework in: http://www.primefaces.org/showcase/ui/df/basic.xhtml my jsf code: <p:commandbutton icon="ui-icon-extlink" actionlistener="#{grabacionesservicios.vergrabacion}"></p:commandbutton> in grabacionesservicios managed bean following method: public void vergrabacion() { requestcontext.getcurrentinstance().opendialog("dialog_playgrabacion"); } amd dialog_playgrabacion.xhtml simple helloworld jsf page. when click button opening dialog dialog_playgrabacion.xhtml contents next javascript error: uncaught typeerror: this.jq.draggable not function in primefaces.js file. i have read other post , found solution talk inserting following code in head section: <h:outputscript library="primefaces" name="jquery/jquery-plugins.js"/> i have paste code in different locations same error. when use developer tools in chrome , consult network activit...

java - Security of uploading and parsing Named Binary Tag files (NBT) via PHP -

i'm building application deals uploading/downloading named binary tag files (nbt). after they're uploaded need parse them , information. i'm bit concerned security wise don't have necessary knowledge understand how they're build or kind of data expect them. what sanity checks can perform, when files uploaded, make sure indeed nbt files. should concerned when parsing them? if there's else should concerned with, please, tell. i realize these vague questions. there aren't lot of answers on google, else wouldn't here. the file-format nbt simple , compact. it's binary stream (uncompressed or gzipped), specified notch. one "problem" comes special crafted nbt-files, contains lot of empty lists , lists of lists ... memory-overhead of parsing these may result in service failure (mostly because created objects each entry fills memory). one solution limit amount of entries reading , when reaching limit dropping parsed fil...

nsmutablestring - Objective C - Extract substring by finding first and second occurrence of a character -

i trying port android app ios. need extract string present between first , second occurrence of single quote ' character. for example, javascript:popupwindow7('news_details.asp?slno=2029',620,300,100,100,'yes') , need extract news_details.asp?slno=2029 . in java, did this: string inputurl = "javascript:popupwindow7('news_details.asp?slno=2029',620,300,100,100,'yes')"; stringbuilder url = new stringbuilder(); url.append(inputurl.substring(inputurl.indexof('\'')+1, inputurl.indexof('\'',inputurl.indexof('\'')+1))); i can't find method similar indexof in objective c, did following: nsuinteger length =0; nsmutablestring* url; nsstring* urltodecode = @"javascript:popupwindow7('news_details.asp?slno=2029',620,300,100,100,'yes')"; (nsinteger i=[urltodecode rangeofstring:@"\'"].location +1; i<urltodecode.length; i++) { if([urlto...

c# - Is there something like ThrottleOrMax in rx? -

use case: i'm writing thing monitors changes , saves automatically. want throttle don't save more every 5 seconds. want save every 30 seconds if there continuous stream of changes. could not find observable.throttle(mergetime, maxtime) in docs , think of ugly ways of writing own hence question. here's way using groupbyuntil : public static iobservable<t> throttlewithmax_groupby<t>(this iobservable<t> source, timespan throttle, timespan maxtime, ischeduler scheduler = null) { return source .groupbyuntil( t => 0, // same key t => t, // element element g => { // expire group when slows down throttle // or when exceeds maxtime return g .throttle(throttle, scheduler ?? scheduler.default) .timeout(maxtime, observable.empty<t>(), scheduler ?? scheduler.default); }) ....

orm - Hibernate does't update joined collection -

i have employee entity (employee(id,name,company_id)): @entity public class employee { @id @column(name="id") private integer id; @manytoone(fetch = fetchtype.eager, cascade=cascadetype.all) @joincolumn(name = "company_id") private company company; ... } and have company entity (company(id,name)): @entity public class company { @id @column(name="id") private integer id; @onetomany(fetch=fetchtype.eager, cascade=cascadetype.all) @joincolumn(name="company_id") @where(clause="status_code = '1'") private set<employee> employeeset; ... } a company can have more employees, 1 employee belongs 1 company @ time. joined them (i want employees status 1) , set cascade all, when update employee @ company employeeset in company doesn't refresh, nor old neither new company. update method employee: sessionfactory.getcurrentsession().merge(employee); i trie...

java ee 7 - Routing all Jersey REST requests through a method prior to execution -

what define method @ root resource level called prior sub resources of class. looking through api see nothing this. jersey 1.6 well, simplest way have no-arg constructor of controller , call whichever function want there.

sql - Can I order by rank or dense rank in ntile function? -

i looking in regards finding out whether can use rank/dense rank function within ntile query. i have following code have written: ntile(5) on (partition job_type order score desc) m_ntile ,dense_rank() on (partition month_ending, job_type order m_ntile desc) rank but want instead of order score in ntile ordered results in rank query. is possible? if please advise appreciate it. you need use subquery: select t.*, dense_rank() on (partition month_ending, job_type order m_ntile desc) rank (select . . ., ntile(5) on (partition job_type order score desc) m_ntile . . . ) t however, doesn't seem necessary. why not use score ? select t.*, dense_rank() on (partition month_ending, job_type order score desc) rank

ios - Framework causing errors in Xcode after adding cocoapods -

Image
i'm trying implement idscan framework , can build in brand new blank project. add cocoapods these errors. i have been trying around them day , i've not been able thing build... anyone got insight? thanks you can test on device. error, can't support simulator.

php - Calling Array in Mail -

i working on project stucked :( i following php academy oop login/register videos me alot complete project in there oop videos series there no email verification system, see have videos series covering email verification, problem that. my code sending email when see email there no key :- to: **@gmail.com subject: activate account from : ****@****.com hello superman, you need activate account http://localhost:8080/ ****/developers/activate.php?email=******@gmail.com&key= unique verification generating , saving in db automatically when register. my code :- if ($validate->passed()) { $user = new user(); $salt = hash::salt(32); $email_coder = md5(input::get('username') + microtime()); try { $user->create(array( 'name' => input::get('name'), 'username' => input::get('username'), ...

sql - All users can access DBC tables by default -

i created test dbuser basic rights , log in in sql assistant, can select on every tables in dbc database. checked other users, , can. tried : revoke select on "dbc" my_user; but didn't work. know how can modify access rights on dbc ? those access rights not granted on user lever, public. if done on dbc (= database level) should revoked, because there security tables dbc.dbase holds encrypted passwords. revoke select on "dbc" public; end users should have access on dbc.views.

Python 3 urllib produces TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str -

i trying convert working python 2.7 code python 3 code , receiving type error urllib request module. i used inbuilt 2to3 python tool convert below working urllib , urllib2 python 2.7 code: import urllib2 import urllib url = "https://www.customdomain.com" d = dict(parameter1="value1", parameter2="value2") req = urllib2.request(url, data=urllib.urlencode(d)) f = urllib2.urlopen(req) resp = f.read() the output 2to3 module below python 3 code: import urllib.request, urllib.error, urllib.parse url = "https://www.customdomain.com" d = dict(parameter1="value1", parameter2="value2") req = urllib.request.request(url, data=urllib.parse.urlencode(d)) f = urllib.request.urlopen(req) resp = f.read() when python 3 code run following error produced: --------------------------------------------------------------------------- typeerror traceback (most recent call last) <ipython-input-56-20...

Can I run a Sub based on whether another Sub Has run? (EXCEL VBA) -

all, have userform , trying allow users use 2 different text boxes search worksheet based on value in either text box. form populates other boxes based on active cell. question is: can write code 2 subs check if other 1 has executed? pseudocode below: >sub statustextbox_afterupdate() >>'check if transittextbox_afterupdate() has run >>>'if yes end sub >>>>'if no carry on rest of statustextbox_afterupdate() this change value of transittextbox pull worksheet, , want prevent transittextbox_afterupdate() running. problem transittextbox populated afterupdate event runs , 2 conflict. there way of preventing this? use global variable allow 2 subs communicate: public imdone boolean sub shouldrunfirst() imdone = true end sub sub shouldrunsecond() if imdone msgbox "first macro has been run" else msgbox "first macro has not run yet" end if end sub edit#1: we need make communication va...

version control - Git: how to commit and cherry-pick bug fix? -

our development team uses dev branch majority of commits , branch out each month release branches. wondering what's popular model handle bug fix commits. commit head of monthly branch (most recent one, 2015.jun branch) , cherry-pick (or rebase) dev branch? or commit head of dev branch, cherry-pick monthly branch. way better? according site , says "bugfixes rel.branch may continuously merged dev branch". model? there issues it? git-flow (your link) or similar workflows quite commonly used. merging release branches develop regularly when bugfixes applied way go imho. about other points in question commit head of monthly branch (most recent one, 2015.jun branch) , cherry-pick (or rebase) dev branch? you cherry-pick them develop wouldn't give explicit "merge", visible in history. rebasing release branch onto develop, you don't want that , develop have recent commits not stable , not related ongoing release. if meant rebase ...

python - Django Form Validation Only if User is Not Authenticated? -

i have form need check user email if user not logged in. know can check email in view form prefer check email in form. with code below, i'm getting error: global name 'request' not defined inside clean_email though request imported. class myform(forms.modelform): def __init__(self, request, *args, **kwargs): super(myform, self).__init__(*args, **kwargs) def clean_email(self): if not request.user.is_authenticated(): email = self.cleaned_data['email'] if user.objects.filter(email=email).exists(): raise forms.validationerror(u'email "%s" in use!' % email) return email the request object doesn't go form. but can change constructor of form class receive user object: def __init__(self, user, *args, **kwargs): self.user = user super(myform, self).__init__(*args, **kwargs) and can check if user authenticated later on: def clean_email(self): ...

Cannot interact with public Instagram user feed -

i'm working on small project friend , i'm running issues instagram feed. i'm using instagram widget, when put username in, returns nothing. i've ensured account not set private , shows when searching , on website. http://instagram.com/pantylanddiary . when input username or else's works fine. clue can start in troubleshooting this? i've authorized app in instagram called iconosquare stats , widget not show feed in question , show feed fine.

javascript - Web Script to Filter Documents -

i'm intern working contractor company receives several 80 page government contract proposals daily in form of pdfs. emails containing these pdfs sent specific folder within individual company gmail account, , task sort them. i'm given list of keywords company me separate documents based on relevancy types of tasks company wants complete. want separate important pdfs unimportant pdfs through automated process based on keywords. ultimately, able automate entire process, includes: process of opening emails located in specific folder, opening link pdf proposal within emails, , determining whether pdf qualifies proposal company (which phase 1 of assignment). end product automated accurate list of "good" , "bad" proposals saves higher ups , myself loads of time. my issue have no idea start this.. language should use implement script this? , in general sense how process happen? can learn need know quickly... need know start since i've never done this. ...

delphi - How can I convert PNG to GIF keeping the transparency? -

how can convert png gif keeping transparency? i have hoped using assign( ) method work doesn't seem migrate transparency. in gif, it's represented black. png:=tpngimage.create; try png.loadfromfile(sfile); // comes file: png.transparencymode; // comes file: png.transparent // didn't help: gif.transparent:=true; gif.assign(png); // didn't help: gif.transparent:=true; gif.savetofile('e:\tmp\out.gif'); png.free; end; i haven't found way handle in delphi... thanks! it possible transfer image png gif. however, don't recommend so. gif format substantially less capable png. png supports rgba color channels , partial transparency. gif uses 256 color palette , no support partial transparency. there many libraries available make best of bad job , attempt produce gif image close png image, information lost. the gif format dates late 1980s , time has moved on. has long ...

java - Using multiple JComboBoxes; but they all get any action events -

i'm sure i'm doing stupid here; it's been bugging me hours. i'm using netbeans 8.something, if helps. have form multiple combo boxes, select data set. first selects year, choice populates monthcombo, selection populates daycombo, , on. the automatically generated code here: javax.swing.grouplayout jpanel1layout = new javax.swing.grouplayout(jpanel1); jpanel1.setlayout(jpanel1layout); jpanel1layout.sethorizontalgroup( jpanel1layout.createparallelgroup(javax.swing.grouplayout.alignment.leading) .addcomponent(jscrollpane1, javax.swing.grouplayout.alignment.trailing, javax.swing.grouplayout.default_size, 1323, short.max_value) .addgroup(jpanel1layout.createsequentialgroup() .addcontainergap() .addcomponent(yearcombo, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size) .addpreferredgap(javax.swing.layoutstyle.componentplacement.re...

jquery - How to make parent div's height scale to its children? -

i want make message box centered vertically x, if more content added message box. tried wrapping message , x in div called tips , setting message div top: -50% did not seem work. css or jquery thing? tried adding overflow: hidden no luck. css body{ background: gray; } /* tips */ .tooltips{ width: 600px; margin: auto; } .tip-icon{ position: absolute; right: 0px; height: 40px; width: 40px; } .tips{ position: relative; } /* message */ .tip-message{ position: absolute; background: #fff; padding: 10px 40px; top: -50%; width: 400px; } .arrow-right { position: absolute; top: 50%; margin-top: -20px; right: -50px; width: 0; height: 0; border-top: 20px solid transparent; border-bottom: 20px solid transparent; border-left: 50px solid #fff; } https://jsfiddle.net/z7ou07rl/ i solved jquery var toolheight = $('.tip-message').height(); $('.tip-icon').css(...

javascript - Using same image map on multiple images but with a different link for each area on each image -

i trying use multiple images using image map "imagetilemap". <map name="imagetilemap"> <area id="quiz"shape="circle" coords="41,193,20" href=""> <area id="video"shape="circle" coords="112,193,20" href=""> <area id="presentation"shape="circle" coords="184,193,20" href=""> </map> and using javascript each area links anchor on separate page, page being dependent on image itself. function is: <script type="text/javascript"> function changelink(clicked_href) { var url = clicked_href; var areaquiz = document.getelementbyid("quiz"); areaquiz.href = url + "#quiz"; var areavideo = document.getelementbyid("video"); areavideo.href = url + "#video"; var areapresentation = document.getelementbyid("presentation"); areapresentat...

mysql - RDBMS to Elastic Search -

suppose have 5 tables called groups , posts , groups_posts , post_comments , posts_votes . groups table has fields: user_id , name , description , posts has fields: user_id , comment relationship between groups , posts many_2_many each post can belong many groups , each group can contain 0-* posts. table groups_posts does. post_comments table has fields: text , post_id , user_id , added_at (date), total_comments , total_votes posts_votes table has fields: post_id , user_id , vote_at (date) i want model these structure in elastic search. main reason need have quick search popular posts user groups(user can belong 0-* group) specific user last 12 hours based on sum of post comments , post votes amount of time. could please tell me how map on elastic search indexes. i think have make decisions. first, create 1 index each day search 1 index when running queries current day. since don't have joins in elasticsearch, need aggregate data related data...

windows - How to break code on a click event? -

i have application need disassemble. don't have clue on how stop running code on desired location, decided best guess breaking upon button click. how capture button clicks? know has windows functions such callnexthookex . i'm using ida pro disassembly. ida pro used disassembler, static analysis purposes. i'd suggest use ollydbg (or other debugger, if want to) because suit better debugging purposes. i don't know if can set breakpoint on api that. but can this: load application in olly, or attach it. generate event clicking on anything. stop application ollydbg(f12) use c(k)all stack(alt+k) you see few calls functions, 1 of them doing need. may need go upper calls see whole loop. try 1 is. there loop in 1 of them.that loop have conditional jumps , generate events, load forms, fill app etc. , when place breakpoint on right jump there, stop @ each mouse click. when i'm debugging apps, of times find myself on breakpoint this, , see beginning h...

python - How to get a number as user input and use in while loop to print Fibonacci number -

i using following print fibonacci numbers. a, b = 0, 1 while b < 200: print b, a, b = b, a+b in above program, want take number 200 user input. tried following: a, b = 0, 1 while b < (int(raw_input("enter number : "))): print b, a, b = b, a+b if run above script, asks input 2 times , prints nothing shown below: c:\users\test\desktop>python fib.py enter number : 200 1 enter number : 1 c:\users\test\desktop> how fix this? if raw_input in condition of while , prompt user input every single time go through loop. if want prompt user once, put before loop. a, b = 0, 1 limit = int(raw_input("enter number : ")) while b < limit: print b, a, b = b, a+b result: enter number : 200 1 1 2 3 5 8 13 21 34 55 89 144

asynchronous - Catch exception from async workflow run on different thread -

let failing = async { failwith "foo" } let test () = try async.start(failing) | exn -> printf "caught" this code doesn't catch exception. how can start asynchronous workflow on separate thread , catch exception in main program? as alternative start workflow task , use it's methods , properties instead. example task.result rethrow exception again works, , tried: let test () = try async.startastask failing |> fun t -> t.result _ -> printfn "caught" run > test ();; caught val : unit = () on differnt thread sorry - saw want on different thread - in case want use internal approach rch gave - use continuewith (although bit ugly): open system.threading.tasks let test () = (async.startastask failing).continuewith(fun (t : task<_>) -> try t.result _ -> printfn "caught") run > test ();; caught val : task = system.threading.tasks.task ...