Posts

Showing posts from August, 2014

javascript - How to simulate Click in cronjob? -

i'm using web service transfer files ftp dropbox. want update version in dropbox every week. right have go service , manually click 'transfer now' button every week. i'd create cron job or other automated solution runs every week, logs service , clicks on set of buttons interval of 60s between each button (to give service enough time start action). the buttons nothing div id , actual click on triggers js listener. the way going approach write curl script in php loads page , tries action occurs when button pressed (i.e. triggers listener). it's not easy though , before spend time on it, i'd know if can think of simpler approach? the basic structure of process should be: runs automatically every week (e.g. on lamp server or using web service) logs service (simple form triggering post request) clicks on buttons class 'buttonnow' , waits x amount of seconds between clicks ideally send kind of confirmation once task has been completed

how to optimize this random playlist html5 audio script -

<script type="text/javascript"> function random_playlist(){ var myrandom=math.round(math.random()*4); var soundurl='http://dummy.xy/dummy.mp3'; if (myrandom==0){soundurl='http://path_to.mp3';} else if (myrandom==1){soundurl='http://path_to.mp3';} else if (myrandom==2){soundurl='http://path_to.mp3';} else if (myrandom==3){soundurl='http://path_to.mp3';} else if (myrandom==4){soundurl='http://path_to.mp3';} console.log(soundurl); return soundurl; }; </script> <audio id="audioplayer_id" controls="controls" loop> <source id="source_id" src="" type="audio/mp3"/> browser not support audio element </audio> <script type="text/javascript"> var audioload = random_playlist(); console.log(audioload); document.getelementbyid('source_id').src= audioload; var audioplayer_id

how to use looping and array with php -

i newbie in programming php, have output query data database this name activity payment english activ 20 english activ b 25 english activ c 30 biology activ d 50 biology activ e 60 but want show output this: name activity payment english activ 20 activ b 25 activ c 30 biology activ d 50 activ e 60 how logic program use php show 1 name in same name? can solve problem? database show names same name activity payment english activ 20 english activ b 25 english activ c 30 biology activ d 50 biology activ e 60 but if want show records as name activity payment english activ 20 activ b 25 activ c 30 biology activ d 50 activ e 60 you can in php for example $datas = $fetched_data; // $fetched_data store data selected database // in php use foreach loop $previous_colm = ""; foreach($datas $data){ if($previous_colm ==

ios - How can i check from watchOS 2 if application on iPhone is opened or not and be able to send NSUserDefaults no matter the app status? -

how can check watchos 2 if application on iphone opened or not? i want send message nsuserdefaults watch iphone via sendmessage (to able update interface on phone when message received) when both applications running , want send nsuserdefaults if watchos 2 app running. from read found this: /** counterpart app must reachable send message succeed. */ @property (nonatomic, readonly, getter=isreachable) bool reachable; it's reachable check. reachable means apple watch , iphone connected via bluetooth or wifi. doesn't mean iphone app running. if reachable true, when try sendmessage apple watch launch iphone app in background. need assign wksession delegate possible because delegates methods (sendmessage) fire soon. think saying want call sendmessage if can, , not use transferuserinfo method instead. this, first on apple watch: func applicationdidfinishlaunching() { let session = wcsession.defaultsession() session.delegate = self session.acti

Can C program be used without main function? -

from fortran code, intend run c code (to read file) , fetch read information. main program fortran code, uses function written in c processing. in c code, necessary run main function? if fortran calls c function, c code not need main() function. the main() function of c program entry point. system loads .exe, transfers control startup code, address mentioned in .exe file (the startup code called crt , c run-time start-up). run-time startup initialization , transfers control user code. user code entry point main() . since fortran main program, no c run-time start-up needed , no main() needed.

java - How to remove jax-ws webservice from project after it's been created -

Image
in eclipse created dynamic web project, wrote pojo class , exposed soap webservice. after whole bunch of files , other directories got created: just few examples of i'm talking about. want know is, how go removing generated "webservice stuff" , return project contains original pojo class created. how remove generated webservice, not class generated from? my first instinct delete , sounds has webservices. i'm sure that's not way it. if maven project simple type mvn clean command on project remove generated code.

php - Propel "ModelCriteria::FORMAT_ON_DEMAND" reuses same object? -

apparently using modelcriteria::format_on_demand ( propelondemandformatter ) not make propel hydrate objects row row , without instance pooling as documented , hydration takes place on the same object . this means $object in example below stay same, , contents change. $objects = objectquery::create() ->setformatter(modelcriteria::format_on_demand) ->find(); foreach ($objects $object) { } this becomes problem if propel object has additional data not mapped database table columns managed in object. why design chosen over, say, cleanly instantiating object , hydrating it? , recommended way of working design decision? my guess better performance because no instantiation necessary. if code expected use on-demand fetching, should override posthydrate() class of object being fetched perform necessary object-related updates data propel not automatically map columns. note ensureconsistency() called on "rehydration" apparently not case here

calendar - logic for calculating ISO year from gregorian year and other fields -

as mentioned above need calculate iso year calendar view, have created view on top of calculating iso week number i'm unable figure out logic calculating iso year, can please post possible. thanks in advance. kishor structure of calendar view replace view sys_calendar.calendar( calendar_date, day_of_week, day_of_month, day_of_year, day_of_calendar, weekday_of_month, week_of_month, week_of_year, week_of_calendar, month_of_quarter, month_of_year, month_of_calendar, quarter_of_year, quarter_of_calendar, year_of_calendar) sel calendar_date, daynumber_of_week(calendar_date), daynumber_of_month(calendar_date), daynumber_of_year(calendar_date), daynumber_of_calendar(calendar_date), dayoccurrence_of_month(calendar_date), weeknumber_of_month(calendar_date), weeknumber_of_year(calendar_date), weeknumber_of_calendar(calendar_date), monthnumber_of_quarter(calendar_date), monthnumber_of_year(calendar_date), month_of_calendar, q

jquery - Adding product quantity to cart in php only if product is available in cart with same color and size -

Image
i've created php ekart site testing purpose. query when click on add cart should firstly validate whether 1 color , 1 size selected, if both have been selected adds product cart works fine if add same product different color or size overlaps same product added , products quantity turns 1 if select product works same thing goes when select different size or color. since beginner @ php, i'm not sure going wrong here. php code of product add cart given below: $sql = "select * allprods listing = '$listing' , id = '$id'"; $data = mysql_query($sql); if (mysql_num_rows($data) == 1) { $row = mysql_fetch_array($data); if (isset($_session['cart'][$id])) { if(isset($_session['cart'][$id][$color]) && isset($_session['cart'][$id][$size])) { $_session['cart'][$id]['quantity']++; echo "<script>alert('".$row['product_name']." ha

Python variable scope is type specific? -

from functools import wraps def mywrapper(func): variable1 = {} variable2 = 0 @wraps(func) def newfunc(*args): if args in variable1: return variable1[args] else: variable1[args] = func(*args) variable2 = 1 return variable1[args] return newfunc if run code, got error message "local variable variable2 not assigned". if change dictionary, worked fine variable1 . confuses me on python variable scopes----does rely on type? using 2.7.6.

ios - Alamofire.requestObject custom case not invoking -

as lot of people has error, i, have no idea why "responseobject cannot invoked argument list of type ((jsonresponse>) -> _)" i'm using mapping json alamofire+objectmapper do have idea, whats wrong alamofire, error, may thoughts understanding alamofire? import foundation import alamofire import alamofireobjectmapper import objectmapper public protocol mappable { static func newinstance(map: map) -> mappable? mutating func mapping(map: map) } class jmapping { func getjson() { let url = "http://www.somestringtojson/json.json" alamofire .request(.get, url, parameters: nil) .responseobject { (response: jsonresponse?) in println(response?.title) if let events = response?.events { event in events { println(event.id) println(event.title) } } } } }

Working with couchdb and push to git repo in a angularjs project -

i'm working in project using couchdb, it's first time use couchdb. process have edit couchdb file, commit , push our git repo, , run curl command update row couchdb, can edit couchdb row in couchdb interface too. is process correct? how can ensure files in couchdb in same version have in git, if user changed couchdb file through interface? i looked tutorials how management, have indication? when open couchdb interface make sure pointing files in git repository on system. one way check is: 1. make changes using couchdb interface, dont commit or anything 2. open location houses git repo of couchdb files , run git status . should show files modified in interface changed. if not, interface pointing files stored @ other location

android - Mobile ads compatible with google play policies -

i looking admob alternative complies gogle play ad policies (using android advertising id instead of device id). found mobup able ( https://dev.twitter.com/mopub/android/getting-started ). and other ad networks? of them safe use @ googleplay? to add on comment, here list of trusted of mobile ad networks google play services: adcolony adfalcon adfonic admob adrally adresultsdk amoad amobee appflood appsfire brightroll domob drawbridge facebook flurry hunt mobile ads iad inmobi leadbolt lifestreet media liquidm lg u+ad mdotm medialets millennial media mobfox mojiva mopub nend nexage pontiflex rhythm newmedia tapit tencent gdt tremor video vpon vdopia vserv source : https://developers.google.com/admob/android/mediation-networks?hl=en you can use admob mediation : https://support.google.com/admob/answer/3063564?hl=en , https://support.google.com/admob/answer/6000997 here how set up: https://developers.google.com/admob/android/mediation?hl=en

GnuTV: Can't stream video over rtp/udp -

on server tried: gnutv -out udp raspberrypi 1000 arte and gnutv -out rtp raspberrypi 1000 arte but on client can't recieve stream! playing udp://raspberrypi:1000. stream_udp, url: udp://raspberrypi:1000 failed connect server udp_streaming_start failed no stream found handle url udp://raspberrypi:1000 playing rtp://raspberrypi:1000. stream_rtp, url: rtp://raspberrypi:1000 failed connect server rtp_streaming_start failed no stream found handle url rtp://raspberrypi:1000 try use rtp://localhost:1000 on client.

excel - Naming sheets and copying data based on cell names -

i have database created following information: company, worksite, element name, date, number, , few columns numerical values. thing need create new worksheet (that's easy), worksheets named after unique company/worksite information (that's hard part). after sheets created, need whole information regarding each combination database copied there respective worksheets (also not sure how it). worst part company/worksite name longer 31 characters, can't directly use full names move within sheets. is possible ? i count unique company/worksite rows, , copy them whole, while creating new worksheet index. still have no idea how deal naming. edit: had free time on hands, , decided work on this. sub zaloz_arkusze() application .screenupdating = false .enableevents = false end dim wbk3 workbook dim wbk4 workbook dim lw long dim lr long dim integer dim j integer dim test integer dim rng range, rcell range, mytable ran

Non Collapsible TreePanel in GXT -

Image
i new gxt , need little in implementing tree panel. user has requirement treepanel should not allowed collapsed , should remain expanded. (as in image) there way can achieve ? may using other widget ? for example, can use on tree addcollapsehandler() call tree.setexpanded(true);

javascript - Hide input but still let JS auto fill data -

i have set of 3 input fields, take first , second input , math auto fill third input. i don't want third input seen, using display:none , visibility:hidden both return nan in out database. there anyways hide input, not autofilled data? <div class="form-item webform-component webform-component-textfield webform-container-inline hs_total_donor_percent_change field hs-form-field total-field"> <label for="one">total donors percent change *</label> <input id="edit-submitted-acquisition-percent-change" class="form-text hs-input" name="total_donor_percent_change" readonly="readonly" size="60" maxlength="128" type="text" value="" placeholder="0"> </div> you use hidden input field: <input id="inputone" type=&

sql - How to aggregate data using computed groups -

my data stored in spark data frame in form (roughly) col1 col2 a1 -5 b1 -20 c1 7 a2 3 b2 -4 c2 17 i want turn into: col3 col4 2 b -24 c 24 (adding numbers , concatenating x1 , x1 x) how can using data frame api? edit: the col1 values arbitrary strings (endpoints) want concatenate 1 column (span), maybe in form "a1-a2". planning on mapping endpoints other endpoints in map , querying in udf. can udf return none? - let's didn't want include a in col3 @ all, did want include b , c , add case example a rows skipped when mapping col1 col3? you can extract group column , use group aggregation. assuming data follows pattern in example: with raw sql: case class record(col1: string, col2: int) val df = sqlcontext.createdataframe(seq( record("a1", -5), record("b1", -20), record("c1", 7), record("a2", 3), record("b2", -4), record("c2", 17)

Unity3D: UGUI Benefits of applying a Material to UI Image elements -

the ui image ( http://docs.unity3d.com/manual/script-image.html ) object has material , source image attribute. two questions: if i'm rendering plain square solid-color element in ui (ie background or non-rounded button) there benefit setting non-null source image? thought maybe adding white 'filler' sprite that's attached central sprite map might reduce draw calls or something, appears has no effect vs leaving sprite null. in same plain square solid-color element, there benefit using non-null material? in, default ui shaders provided unity performance value on using null setting? 1) yes, use white filler sprite in sprite atlas ui engine can easier batch draw calls together. don't expect of performance boost that, unless have lot of them. 2) yes, wrote 2 special super simple shaders: 1 invisible images (used hidden buttons) , 1 opaque images. dramatically improved performance, in test scenario 12 overlapping opaque images on ipad 3, 26ms dow

php - cakephp flash messages dissapearing on apache server -

been stuck few hours here! i using cakephp 2.4.4 , have pretty standard redirects flash messages. reason flash messages don't appear on production server(running apache)?! if comment out redirect flash message appears. my app appears work on development server (which running nginx). does have ideas? $this->session->setflash(__('the user -'.$e["user"]['name'].'('.$e["user"]['resource_payroll_number'].') - has been activated'), 'alert', array('class' => 'alert-success')); $this->redirect(array('action' => 'index')); this must because of debug level have. check core.php file. /** * cakephp debug level: * * production mode: * 0: no error messages, errors, or warnings shown. flash messages redirect. * * development mode: * 1: errors , warnings shown, model caches refreshed, flash messages halted. * 2: in 1, full debug messages , sql output. * * in pr

keyboard shortcuts - Visual Studio 2015: Ctrl+Shift+8 (View.PopBrowseContext) to navigate back not working? -

a keyboard shortcut i've used going several visual studio versions ctrl + shift + 8 go was, after doing f12 go definition. in visual studio 2015, pressing ctrl + shift + 8 doesn't seem anything. opening visual studio 2013 , looking @ tools | customize | keyboard dialog, ctrl + shift + 8 mapped command view.popbrowsecontext. in visual studio 2015, ctrl + shift + 8 has same command mapping, command doesn't seem work. is there way view.popbrowsecontext command navigate after doing go definition ( f12 ) in visual studio 2015? visual studio 2015 connect -> view.popbrowsecontext command , others doesn't work ( issue removed connect site microsoft ) issue on github -> bring go definition navigation stack #14496 view.navigatebackward (ctrl+-) not replacement view.popbrowsecontext (ctrl+shift+8). if invoke edit.gotodefinition (f12) , click few times mouse moving cursor around, moves recorder in navigation stack. view.popbrowsecontext (ct

c# - Binding Winform Chart using INotifyPropertyChanged Interface -

Image
i trying implement winform application presents on line-chart set of samples (coming form hw device). i used inotifypropertychanged interface , bind chart model of hw device, seems chart doesn't updated when samples changed @ hw model. sorry, if basic (i more of embedded guy), seems missing part connects inotifypropertychanged event data binder. is there missing here? or should implement differently? at winform class wrote following code bind chart samples of hw model buttons should demonstrate case when 'adcsamples' changes: public partial class form1 : form { public form1() { initializecomponent(); streamchart.series[0].points.databindy(gswatch.adcsamples); } private gswatchmodel gswatch = new gswatchmodel(); private void button1_click(object sender, eventargs e) { uint[] muki = new uint[128]; (int = 0; < 128; i++) { muki[i] = (uint)(i / 10); } gswatch.adcsample

sql - Safe to compare DB data as Java String in Oracle? -

i'm pulling row data 2 oracle db's 2 string list. want compare these rows iterating through these lists , running basic .equals() comparison. safe/practical iterate through each list , compare each element via string comparison? example: list<string> resultset1 = <result set of rows db1 string list> list<string> resultset2 = <result set of rows db2 string list> //assuming result sets same size , point rows same primary/composite key for(int = 0; < resultset1.size(); i++) { if(resultset1.get(i).equals(resultset2.get(i))){ <do something> } } as assumption states, result sets need same size. further, must both sorted in same order , include same set of keys. is, if recordset1 has {1,2,3,4}, recordset2 must have {1,2,3,4}. {1,2,4,3} won't cut it, nor {1,2,3,5}. among other things, means list must use actual implementation class preserves order (or allows control order). personally, approach joining data in datab

c# - Build an API for Multiple -

i'm building api using webapi accessed via ajax calls. however, api controller need more 1 post method. understand can specify {action} in routing, because i've seen not recommended - using right tool? 2 questions: is web api best tool this, or there else should using? why should not use more 1 post method in webapicontroller ? including {action} in routing enough solution problem? 1. web api best tool this, or there else should using? i think webapi fine choice you, regardless of whether have 1 or many post calls per controller. 2. why should not use more 1 post method in webapicontroller? to remain restful you'll want controller per entity type. without getting deep details, post against specific type of entity should 'add entity' call, , why have more 1 of those? having said that, don't have restful... if requirements suite multi-post model go it, can refactor later if necessary. ...is including {action} in routing enough soluti

jquery - On click, slide div down and change button icon -

i want slide div down top of page when clicking button - , change icon on button. on clicking again, want div slide (off page) change button icon it's original state. i have div set display:none , slides down fine , button changes icon slide place disappears! how can stop , slide on clicking again? here's attempt: $('.menu-up').on('click', function(e) { $( ".icon-bar" ).slidedown( "slow", function() { // animation complete. }); $(this).toggleclass("menu-up menu-down") e.preventdefault(); }); use slidetoggle instead. demo $('.menu-up').on('click', function(e) { $( ".icon-bar" ).slidetoggle( "slow", function() { // animation complete. }); $(this).toggleclass("menu-up menu-down") e.preventdefault(); });

vba - Excel combine multiple columns into one? -

i've seen other threads question, solutions kept crashing or not starting me. working in excel 2011 (mac) , need combine multiple columns 1 long one. columns don't have headers, , aren't contiguous (but if it's easier code for). my columns have 20,000+ rows, many other macros i've tried keep crashing. sub movealldatatocolumna() dim long, ws worksheet, rngcopy range, rngend range set ws = activesheet until ws.cells(1, 2).value = "" set rngcopy = ws.range("b2", ws.cells(ws.rows.count, "b").end(xlup)) set rngend = ws.cells(ws.rows.count, "a").end(xlup).offset(1, 0) rngend.resize(rngcopy.rows.count, 1).value = rngcopy.value rngcopy.entirecolumn.delete loop end sub credit ayazgreat on other forum.

javascript - Radio buttons are slow to change with Angular debounce enabled -

when turn on debounce, radio buttons slow switch. half second see both buttons enabled, , old 1 clears. works ok, visually annoying. note: found answer, i'm posting others learn. here code <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script> </head> <body ng-app="formexample"> <div ng-controller="examplecontroller"> <form novalidate ng-model-options="{ debounce: { default: 500 } }"> <input type="radio" ng-model="formdata.t1" value="yes" /> <input type="radio" ng-model="formdata.t1" value="no" /> <input type="radio" ng-model="formdata.t1" value="na" /> <input type="button" ng-click="reset()" value="reset"

linux - Is there a way to 'uniq' by column? -

i have .csv file this: stack2@example.com,2009-11-27 01:05:47.893000000,example.net,127.0.0.1 overflow@example.com,2009-11-27 00:58:29.793000000,example.net,255.255.255.0 overflow@example.com,2009-11-27 00:58:29.646465785,example.net,256.255.255.0 ... i have remove duplicate e-mails (the entire line) file (i.e. 1 of lines containing overflow@example.com in above example). how use uniq on field 1 (separated commas)? according man , uniq doesn't have options columns. i tried sort | uniq doesn't work. sort -u -t, -k1,1 file -u unique -t, comma delimiter -k1,1 key field 1 test result: overflow@domain2.com,2009-11-27 00:58:29.793000000,xx3.net,255.255.255.0 stack2@domain.com,2009-11-27 01:05:47.893000000,xx2.net,127.0.0.1

azureservicebus - NServiceBus with Azure Service Bus (Basic mode) -

sorry if can't provide details, i'm trying use nservicebus on azure service bus using basic configuration. nservicebus fails on start because tries create topic , queue, , basic mode of azure service bus doesn't suport topics. or workaround? thanks! i think you're talking basic tier (pay). not current version of asb transport. current version of transport has 1 topology queueandtopicbyendpointtopology creating topics default. have 2 options: switch paid tier or implement alternative topology , use (not trivial task). next version of transport support more topologies , allow better mechanism plug custom implementations. but have considered following: without topics cannot have pub/sub. severe limitation when using bus architecture.

php - 3 element per row in bootstrap/Wordpress -

Image
i have following problem: need create simple layout, on each line have 3 box of same size, , if understood right, in order achieve need construct structure following: <div class="row"> <div class=" news col-md-3 col-centered"> </div> <div class=" news col-md-3 col-centered"> </div> <div class=" news col-md-3 col-centered"> </div> </div> this php script in index.php: <?php while(have_posts()) : the_post();?> <div class="row"> <div class=" news col-md-3 col-centered"> <h4><a href="<?php the_permalink();?>"><?php the_title();?></a></h4> <p><?php the_excerpt(); ?> </p> </div> </div> <?php endwhile; wp_reset_query(); ?> with code, each box <div class="row"> element following: &

Microsoft Edge javascript toLocaleTimeString incorrect spacing -

i'm having trouble understanding going on javascript seems behave differently in edge. boiled down to: var testi = new date().tolocaletimestring(); var len2 = testi.length; alert(len2); my length in edge 17, in chrome , ie it's 10 there seems phantom spaces in string, screwed attempting substring it. https://jsfiddle.net/m1m8h7ym/ fyi time zone central. looks microsoft slipping in the invisible left-to-right mark . occurs in ie11 in edge mode. figured out looping through each character in string , passing encodeuricomponent() var output = document.getelementbyid("output"); var testi = new date().tolocaletimestring(); var row; (var = 0, len = testi.length; < len; i++) { row = document.createelement("pre"); row.innerhtml = encodeuricomponent(testi[i]); output.appendchild(row); } <div id="output"></div> you strip out removing unicode, can captured in regex expression \u200e .

jquery - Facebox getting slower and slower when reopened, close buttons increasing, i think multiple Copies of Content -

facebox works fine , open faster when opened first time, when click on facebox link second time, third time, slower & slower. first time, show 1 cross/close button on top-right corner of facebox window, continue increase close buttons when facebox reopened. i.e. 2 close buttons when facebox opened second time , 3 when opened 3 times , on. think, opening multiple copies of content in facebox becoming slower & slower each time reopened. i have seen post, related older version of facebox , not solving problem. https://groups.google.com/forum/#!topic/facebox/9kjptizntzy i have version 1.3 of facebox ( https://github.com/defunkt/facebox ). reffering above post, seeing following code in facebox.js, have pasted code here follows. kindly please guide. reveal: function(data, klass) { $(document).trigger('beforereveal.facebox') if (klass) $('#facebox .content').addclass(klass) $('#facebox .content').empty().append(data) $('#facebox .popup&

Python requests gives SSL unknown protocol -

i trying send request api have set on aws machine. the code use follows: import requests import json report_dict = { "client_name": "wayne enterprises", "client_id": 123, "report_type": "api_testing", "timestamp_generated": "2015-07-29t11:00:00z", "report_data": {"revenue": 9000.00} } report_json = json.dumps(report_dict) resp = requests.post("https://my-url.com:8080/my-api/reports", data=report_json,verify=false) doing this, get: traceback (most recent call last): file "art2_java_test.py", line 124, in <module> main() file "art2_java_test.py", line 9, in main test_post_good_data() file "art2_java_test.py", line 29, in test_post_good_data resp = requests.post("https://my-url.com:8080/my-api/reports", data=report_json,verify=fal se) file "c:\python27\lib\site-pac

c# - Insert Many-to-Many entities into Entity Framework error -

i've struggled far long now. i'm trying insert records relationships database, code: public class innehåll { public innehåll(int antal) { this.antal = antal; this.frys= new hashset<frys>(); } public innehåll() { } [key] public int id { get; set; } public int antal { get; set; } public virtual icollection<frys> frys{ get; set; } } public class frys { public frys(string ort) { this.ort = ort; this.innehåll = new hashset<innehåll>(); } public frys() { } [key] public int id { get; set; } public string ort { get; set; } public int teslse { get; set; } public virtual icollection<innehåll> innehåll { get; set; } } and when run code; innehåll i1 = new innehåll(10); boxinfo b = new boxinfo { pris = 10, typ = "körv" }; db.boxinfos.add(b); db.frysar.add(frys); frys.innehåll.add(i1); db.savechanges(); frys declared through m

javascript - Anchor link to content inside hidden div -

i'm trying link content external page, using <a name="anchor"></a> and <a href="/somepage/#anchor"></a> the content anchor located hidden inside drawer, using jquery: $(".toggle_container").hide(); see fiddle: http://jsfiddle.net/bd1mbu5j/1/ i've tried wrapping head around method found here , know there's i'm missing. window.onload = function() { var hash = window.location.hash; // "#div1" or if(hash != "") { var id = hash.substr(1); // rid of # document.getelementbyid(id).style.display = 'block'; } }; also should noted, i'm not trying open drawer, link specific content within drawers. see fiddle http://jsfiddle.net/bd1mbu5j/2/ $(".toggle_container").hide(); $("h3.trigger").click(function(){ var _this = this; $(this).toggleclass("active").next().slidetoggle("normal", functio

android - Cannot wrap blockquote-like TextView of arbitrary line count by width -

Image
i need render quote block of arbitrary length. text must aligned left, while block aligned right, similar one: for i'm trying textview android:width="wrap_content" , android:gravity="start" , , android:layout_gravity="end" . however, works expected when text fits single line — if text longer that, textview behaves this: 1st quote block sentence spaces — devours parent's width; 2nd block — spaces non-breaking: raw&#160;persistence may&#160;be only&#160;option other&#160;than giving&#160;up&#160;entirely. — still block behaves match_parent . 3rd block uses explicit line break — looks closest what's required, that's least flexible option, , there's still padding on right. here's layout ( paddingright replaced layout_marginright highlight purpose — behavior same either way): <linearlayout android:layout_width="match_parent" android:layout_height="wrap_conte

function - Purpose of a constructor in Java? -

what purpose of constructor? i've been learning java in school , seems me constructor largely redundant in things we've done far. remains seen if purpose comes about, far seems meaningless me. example, difference between following 2 snippets of code? public class program { public constructor () { function(); } private void function () { //do stuff } public static void main(string[] args) { constructor = new constructor(); } } this how taught things assignments, wouldn't below same deal? public class program { public static void main(string[] args) { function(); } private void function() { //do stuff } } the purpose of constructor escapes me, again we've done far has been extremely rudimentary. constructors used initialize instances of classes. use constructor create new objects parameters specifying initial state or other important informati

c# - ReactiveUI SelectMany form of CreateDerivedCollection -

using reactiveui 6.5, i'm trying achieve selectmany linq expression createderivedcollection feature of rxui. objects in source collection (type 'a') have isselected property, collection property items of type 'b'. want end ireactivederivedlist<b> flattened list of of b objects a's selected. makes sense. to make little more concrete, let's use example of app browsing log files. have logfileviewmodel type , our main screen's view model has list of these. each instance in list represents log file on system, , present list of these user can select. it's multi-select list can select more 1 @ time. the logfileviewmodel has isselected boolean property, set true/false user selects or deselects corresponding item in list. , has property list<logentry> . each logentry object of course represents 1 entry in corresponding log file. what want have reactive list in main view model list of of logentry objects of selected logfileviewmode

C++ Static members of a class are initialized after constructor -

i have problem static members of class not being initialized before constructor. doing wrong? bug in g++ ? workarounds? g++ --version : (ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 using eclipse ide, copy static lib headers /usr/include/statictestlib/inittest.h , library /usr/lib/x86_64-linux-gnu/libstatictestlib.a note happens if object holds data defined before main , class in static library. static library header (the static library named statictestlib): inittest.h #include <iostream> namespace statictestlib { class notifier_header{ public: notifier_header(){ std::cout<<"static var init"<<std::endl; } }; class inittest { public: static notifier_header _header_notifier; inittest(); virtual ~inittest(); }; } static library source file: inittest.cpp #include "inittest.h" namespace statictestlib { notifier_header inittest::_header_notifier; class n

drupal theming - Difference between THEME_preprocess_image and THEME_image ? -

what difference between these 2 functions can put in template.php drupal? function theme_preprocess_image(&$variables) { // } function theme_image($variables) { // } function theme_image renders html output renderable array. theme_preprocess_image i believe, right name template_preprocess_hook , called inside of theme() before theme function eg. theme_image please consider use case here: // in custom.module $variables = array( 'path' => 'path/to/img.jpg', 'alt' => 'test alt', 'title' => 'test title', 'width' => '50%', 'height' => '50%', 'attributes' => array('class' => 'some-img', 'id' => 'my-img'), ); $img = theme('image', $variables); if want change attributes of image, following: function mytheme_preprocess_image($vars) { // changes, before it's rendered. }

android - View files from folders -

i'm using filedialog view files/explore files. i'm having import function can import files if there not inside folder. problem filedialog doesn't show files inside folder. how can view files inside folder using filedialog? please help what should modify code view files inside folder package utils; import java.io.file; import java.io.filenamefilter; import java.util.arraylist; import java.util.list; import utils.listenerlist.firehandler; import android.app.activity; import android.app.alertdialog; import android.app.dialog; import android.content.dialoginterface; import android.content.dialoginterface.onclicklistener; import android.os.environment; import android.util.log; public class filedialog { private static final string parent_dir = ".."; private final string tag = getclass().getname(); private string[] filelist; private file currentpath; public interface fileselectedlistener { void fileselected(file file); }

api - Pagination on Soundcloud not working with favorites -

i have problem soundcloud api when querying authenticated user's tracks. i'm testing on ios using nxoauth2 provide oauth2 authentication. not using now-deprecated soundcloud ios sdk. if make request https://api.soundcloud.com/me/tracks.json?limit=50&linked_partitioning=1 , returned json contains 50 tracks, , string " https://api.soundcloud.com/me/tracks.json?limit=50&linked_partitioning=1&offset=50 " key "next_href". making request url returns next page of tracks. works expected. if make request https://api.soundcloud.com/me/favorites.json?limit=50&linked_partitioning=1 , returned json contains 50 tracks, , string " https://api.soundcloud.com/me/favorites.json?before=1395763236&linked_partitioning=1&page_number=1&page_size=50 " key "next_href". making request url returns json same set of tracks obtained original url, , same "next_href" string. it looks /me/tracks.json has not been updated ne

c# - SqlBulkCopy - The given ColumnName does not match up with any column in the source or destination -

i'm trying use sqlbulkcopy copy data sql database table (wrongly) saying columns don't match. match. if use breakpoint see names of columns being mapped, they're correct. error message shows name of column, , correct. this method. have identical method does work , difference gets column names from. strings containing column names, however, identical. public static bool manualmapimport(datatable datatable, string table) { if(datatable != null) { sqlconnection connection = new sqlconnection(connectionstring); sqlbulkcopy import = new sqlbulkcopy(connection); import.destinationtablename = "[" + table + "]"; foreach (string s in global.selectedcolumns) { /* s string variable here exact same c.tostring() in other method below */ if (columnexists(table, s)) import.columnmappings.add(s,

java - Expectation-Maximization in Weka for custom objects -

i'm planning use java weka library's em algorithm in order assign probabilities objects in cluster , then, work these probabilities. furthermore, properties of objects loaded database, load them clusterer directly memory, instead of dumping them arff file in examples have found around web (e.g. serialization ). firstly, know if weka library proper 1 purpose of there exists 1 such apache commons math. secondly, there example not manage file in order create instances? i grateful help.

Why is Flash/Firefox abandoning HttpServiceRequests... sometimes? -

this started recently. .swf loads hit 2 servlets on same server. app still works in chrome , ie. but in firefox getting 2302 streaming errors. opening firebug shows getting responses http 200. content length not length specified in header of time. it's firefox quits trying. work. any ideas? (i tried firefox safe mode without luck.) this caused update in firefox 40 , resolved last night hotfix. firefox bugzilla #1196000. i given advice on mozilla team should have worked workaround before fix applied: set about:config > dom.ipc.plugins.asyncinit = false local workaround. edit: tested beta , ff41 work set true.

r - update value in xml field conditional upon values in a data frame -

i have xml file exported reference manager. here sample 2 entries. <?xml version="1.0" encoding="utf-8" ?><xml><records><record><database name="mhealth.enl" path="/users/ericpgreen/dropbox/+projects/maternal mhealth/mhealth.enl">mhealth.enl</database><source-app name="endnote" version="17.4">endnote</source-app><rec-number>3843</rec-number><foreign-keys><key app="en" db-id="z2xx2a2rpatev4e22v152e5idp2s5tdprtwv">3843</key></foreign-keys><ref-type name="journal article">17</ref-type><contributors><authors><author><style face="normal" font="default" size="100%">vickery, c.</style></author></authors></contributors><titles><title><style face="normal" font="default" size="100%">m