Posts

Showing posts from February, 2010

javascript - Check what $(this) is -

i trying alert each 1 checkbox clicked. this js code: $('#acts').find(':checkbox').click(function(){ if($(this) == 'all') { alert('checkbox clicked'); } }); and html: <div id="acts"> <input type="checkbox" id="all"> <input type="checkbox" value="brussel" name="locality"> <label>brussel</label> <input type="checkbox" value="anderlecht" name="locality"> <label>anderlecht</label> <input type="checkbox" value="oudergem" name="locality"> <label>oudergem</label> </div> i tried first way, tried adding var thename = $(this); and var thename = string($(this)); and compare in if statement agains 'thename', $(this) or variable assign to, keeps returning me [object][object], against can't compare that.

wpf c# update values combobox while typing -

i'm writing wpf-application has combobox. values combobox db (using stored procedure), however, if place them cbo, have 13,000+ values, slow down application. what cbo (user editable) shows 10 values and, while user types, list gets updated. i new wpf (as in couple of days, maybe week), please clear it. thx!!! jan please take @ these posts describes virtualisation combobox es: wpf combobox performance problems binding large collections faster controls ui virtualization hot tip! improving performance of combobox try searching in google many more examples.

css - Use viewport for iPhone only, not iPad -

i'm using following meta tag display site correctly in iphone: <meta name="viewport" content ="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width"> on ipad however, when using meta viewport, site not correctly zoomed once loaded. instead of showing entire page, have scroll right see hidden part of it. looks perfect though if not meta viewport not used. is there way use viewport devices width under 481px? or possible use css archive meta viewport does? for iphone: <meta name="viewport" content="width=device-width; initial-scale=0.65; maximum-scale=1.0;"> for ipad: <meta name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1.0;">

excel - Redesigned website: New URL structure: 301 Redirecting all old URLs -

i have 5500 indexed urls in google on website , launch redesigned version of brand new url structure. because of thousands of backlinks want redirect old urls new ones using htaccess 301 redirect. the problem is, takes forever manually write htaccess-rules in excel because have match new urls old ones. i.e. how excel document set up: | old url | new url | htaccess rule | /default/category/product-id/my-product | /category/my-product/ | 301 redirect /default/category/product-id/my-product http://mydomain.com/category/my-product/ is there way (software/service/tool) match these urls based on product name inside of url don't have manually??? there 2 ways can think of: you can use http module reads excel , loads in key-value pair old , new url , put in cache. in beginrequest, if url (old url) found in key, response.redirect new page. can add 301 header here make sure browser gets message permanently redirected. check codeproject article if old , new url h

java - Android TextView does not work properly in HTC NEW ONE -

Image
android textview not show correctly in htc new 1 following: right word truncated ( in htc new 1 ) my xml code following: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="5dp" android:paddingright="5dp" android:paddingtop="3dp" android:paddingbottom="3dp" android:background="@layout/date_bar"> <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="5dp" android:paddingright="5dp" android:paddingtop="4dp" android:paddingbottom="5dp" android:background="@layout/round_corner"> <imageview android:id="@+id/left_arrow" android:visibility="gone"

sql - A cursor with the name 'cursor_name' does not exist -

i have code uses nested cursors. when parse it, sql studio tells me "command(s) completed successfully," whenever execute, bunch of repeated "a cursor name 'cursor_stats' not exist." error message displays every line cursor_stats mentioned in, repeats many times. idea problem is? declare @dc_grp varchar(50) declare @reqt_id int declare cursor_pairs cursor select distinct dc.dc_grp, dcx.reqt_id dc_grp dc inner join dc_grpx dcx on dc.dc_grp = dcx.dc_grp inner join reqt req on dcx.reqt_id = req.reqt_id dc.calc_stddev = 1 , req.v_a = 'v' , dcx.stddev_last_update != convert(datetime, convert(int, getdate())) order dc.dc_grp, dcx.reqt_id -------------------------------------- declare @vavg float declare @vstddev float declare cursor_stats cursor select avg(r.[var]), stdev(r.[var]) results r inner join instance on r.inst_id = i.inst_id i.dc_grp = @dc_grp , r.reqt_id = @reqt_id , r.[var] != 0 , r.inst_id in (

Print three columns with awk, then sets of three columns -

i want create number of files larger file, dividing columns. example, header of larger file looks this: name chr position snp1a snp1b snp1c snp2a snp2b snp2c snp3a snp3b snp3c and want create these files: name chr position snp1a snp1b snp1c name chr position snp2a snp2b snp2c name chr position snp3a snp3b snp3c i've been trying use awk, i'm bit of novice it, command reads: for ((i=1; i<=440;i++)); awk -f printindivs.awk inputfile done where printindivs.awk is: {print $1 $2 $3 $((3*$i)+1) $((3*$i)+2) $((3*$i)+3))} the output i'm getting suggests way of trying sets of 3 wrong: how can this? thanks you can simple awk script: $ awk '{for(i=4;i<=nf;i+=3)print $1,$2,$3,$i,$(i+1),$(i+2) > ("out"++j)}' file the output files in out[1..n] : $ cat out1 name chr position snp1a snp1b snp1c $ cat out2 name chr position snp2a snp2b snp2c $ cat out3 name chr position snp3a snp3b snp3c

vba - Get Column name from a query table -

with normal tables, can access column name using select column_name information_schema_columns table_name = '" & tbl & "' " and works... but during execution of vba code need retrieve columns name not tables, table resulting after query, how can in vba? dim qry querydef dim mrgtbls querydef dim t1 string dim t2 string dim sqljoin string ... set mrgtbls = currentdb.createquerydef(qry.name, sqljoin) ... , later on want create query such as select column_name information_schema_columns table_name = 'mrgt' which returns nothing since table mrgt not in information_schema_columns, unlike other tables. to column names querydef , can use fields collection: dim firstcolumnname string firstcolumnname = mrgtbls.fields(0).name alternatively can use pure sql , msysobjects , msysqueries system tables. see here details structure of table.

Differences between two result sets MySQL -

very beginner question haven't been able come answer after reading various resources. i have table group_affiliations joining table between tables users , groups. relevant columns: id , user_id , group_id . doing data cleanup users assigned group_id based on location used 3 character abbreviation of city has since gone spelling out full city (ex: group_id cha assigned , group_id charlotte). users have both group_id s associated user_id still have old group_id , never assigned new one. what efficient way of finding ids in result set: select user_id group_affiliations group_id=oldid; and not in result set: select user_id group_affiliations group_id=newid; select 'user_id' 'group_affiliations' 'group_id' = oldid , 'group_id' != newid

php - Make Query More Efficent (Really slow query taking forever!) -

what trying of users right conditions i'm building foreach statment sub_queries make work. the problem got 100,000+ records in database. , kind of query takes forever run. i know i'm not doing in best way tried left joins, slow too.. this function i'm using: public function get_affected_users_by_conditions($conditions, $mobile_type) { // basic query // selecting of users `enswitch_mobile users` table // total , `users` conditions $sql = "select count(*) `users`, (select count(*) `enswitch_mobile_users`) `total` `enswitch_mobile_users` `musers` `musers`.`phone_type` = :mobile_type"; $value_counter = 0; $values = array(); // foreach loop talking // looping conditons. // , when theres value i'm adding subquery. foreach($conditions $cnd) { switch ($cnd[

uv mapping - Automatic UVMapFlat for Three.js -

anybody made automatic flat uv mapping three.js base on (any) geometry ? function uvflat(object) {object.geometry.facevertexuvs[0] = [?]}; i don't care matrix orientation. need default flat mapping 3ds max, choose uvmapping modificator , it. i find three.geometryutils.uvmapflat( geometry, matrix ) of mrdoob, it's not finished yet think. thank ! i have got it, adding loop, scaling , offset three.extrudegeometry.worlduvgenerator.

ExtJs 4.1.1 Tree Panel node selection logic -

Image
i using tree panel extjs. consider above image tree panel. if user selects node 1.1.1.2, should check if sibling checked/selected, if yes, system should select 1.1.1 node , deselect 1.1.1.1, 1.1.1.2, 1.1.1.3 nodes. similarly, @ point should check siblings of 1.1.1 node (1.1.2 & 1.1.3) & if selected/checked, should deselect 1.1.1, 1.1.2, 1.1.3 , should select 1.1 node. this kind of check continues until reach root node or 1 siblings of selected node not checked/selected. what best way achieve this. when best way, looking in-build property or method me achieve this. thank you i start bubble method: http://docs.sencha.com/extjs/4.1.1/#!/api/ext.data.nodeinterface-method-bubble

python - django-table2: Table subclassing and Meta inner class attributes -

i'm trying create generic table view, take model , tuple of columns names, , show given columns of model. problem inner meta class. assume 2 models: # models.py django.db import models class model_a(models.model): column_a_1 = models.field() column_a_2 = models.field() column_a_3 = models.field() column_a_4 = models.field() column_a_5 = models.field() class model_b(models.model): column_b_1 = models.field() column_b_2 = models.field() column_b_3 = models.field() column_b_4 = models.field() column_b_5 = models.field() the objective have single view generates right table of columns in given order. so, i've urls.py this: # urls.py django.conf.urls import patterns, url import myapp.views myviews import myapp.models mymodels urlpatterns = patterns( '', url( r'^table_a/$', myviews.show_table, { 'model': mymodels.model_a,

c - forkpty + libreadline: auto completion issues -

i have small tcp client/server application in c , on linux client can connect e.g. via telnet server-side cli. on server, after accept called, forkpty(3) executed , traffic between master (pty) , socket forwarded. slave (pty) implements cli uses libreadline. works well. my question is, how libreadline auto-completion work? have implemented auto-completion , can use stand-alone on shell, not on pty (two tabs printed instead). hints nice!

python - Why json.keys() get keys in different order -

this question has answer here: how convert json string dictionary , save order in keys? [duplicate] 1 answer can json load ordereddict in python? 4 answers hi have following code in python: import json jsonpost = json.loads('{"player": {"_id": "3","firstname":"kim","surname":"jones"},"newtable": {"_id": "4","surname": "abcd"}}') key in jsonpost.keys(): innerkey in jsonpost[key]: print innerkey my question why when print out inner key order of keys jsonpost['player'] following: _id , surname, firstname python dictionaries implemented internally hash table. means key order not preserved. issue?

javascript - AngularJS browser autofill workaround by using a directive -

when submitting form in angularjs , use browser remember password functionality, , in subsequent login attempt let browser fill in login form username , password, $scope model won't changed based on autofill. the dirty hack found use following directive: app.directive("xsinputsync", ["$timeout" , function($timeout) { return { restrict : "a", require: "?ngmodel", link : function(scope, element, attrs, ngmodel) { $timeout(function() { if (ngmodel.$viewvalue && ngmodel.$viewvalue !== element.val()) { scope.apply(function() { ngmodel.$setviewvalue(element.val()); }); } console.log(scope); console.log(ngmodel.$name); console.log(scope[ngmodel.$name]); }, 3000); } }; }]); the problem ngmodel.$setviewvalue(element.val()); doe

html - Trying to send email through PHP using an email address that is configured on Microsoft's SMTP servers (@live.com, @outlook.com, etc.) -

i'm trying send email via php script. here's line of code supposed send email: mail($owner_email, $subject, $messagebody, $headers) here variables set to: $owner_email = mike@mikemarks.net $subject = "blah" $messagebody = "blah" the email address, mike@mikemarks.net , configured on microsoft's email servers. have email sending , receiving servers - smtp.live.com (for outgoing). reason, above line of code isn't sending email mike@mikemarks.net . questions : are there email services won't work php's email functionality, such microsoft's? i understand can't set smtp settings in php - mean php uses own smtp server? php uses smtp server specified in php.ini. often, it's localhost, uses hosting server's own smtp server. check response of mail function (true/false) make sure email going through, , check mail log of server see if there's error there. can see http://www.phpclasses.org/bl

java - Saving a file in Android -

i have following code: btnsavetrip.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub if (showlog != null && showlog.gettext().tostring().length() > 0) { file folder = new file(environment.getexternalstoragedirectory() + "/tc"); if (!folder.exists()) { folder.mkdir(); } string externalstoragepath = environment.getexternalstoragedirectory().tostring(); final file file = new file(externalstoragepath + "/tc/strip.tcl"); try { if (file.exists()) { new alertdialog.builder(getactivity()) .settitle("file exist") .setmessage("do want overwrite file?") .setpositivebutton("yes", new dialo

java - How can I check if something has written in consol input? -

how can check if has written in console input? if isn't code go on if write new happens? possible? scanner k2sk; k2sk = new scanner(system.in); k2sk.nextline(); but code waits until write something if want wait user input, , @ same time don't wish wait it, assign duty thread . here have done short example, hope useful: import java.util.scanner; public class testinput { public static void main(string[] aa) { new thread(new t1()).start(); system.out.println("moved further"); } public static class t1 implements runnable { public void run() { scanner k2sk; k2sk = new scanner(system.in); k2sk.nextline(); system.out.println("done"); } } }

android - BroadcastReceiver and PostDelay -

in activity have private broadcastreceiver , when triggered, should update ui after ms. in activity have: private broadcastreceiver broadcastreceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { log.e("broadcastreciever: ", "updatecaselist"); update.refreshcaselist(); } }; this broadcastreceiver beeing triggered service : @override public void oncreate() { super.oncreate(); intent = new intent(broadcast_action); } @override public void onstart(intent intent, int startid) { handler.removecallbacks(sendupdatestoui); handler.postdelayed(sendupdatestoui, 0); } private runnable sendupdatestoui = new runnable() { public void run() { handler.postdelayed(this, 10000); // 10 seconds sendupdatetouithread(); } }; private void sendupdatetouithread() { sendbroadcast(intent);

gradle - Get product flavor or build variant in an android app -

i have android app number of different product flavors configured in build.gradle file eg productflavors { someflavor {} anotherflavor {} } in application code, want able hold of name of compiled flavor (or build variant). 1 solution this: productflavors { someflavor { buildconfig "public static final string product_flavor = \"someflavor\";" } anotherflavor { buildconfig "public static final string product_flavor = \"anotherflavor\";" } } and in android app call buildconfig.product_flavor . is there way can gradle automatically? or there other api in android can use product flavor name? edit: done automatically starting version 0.7 of plugin. buildconfig.java contains public static final string build_type = "debug"; public static final string flavor = "f1fa"; public static final string flavor_group1 = "f1"; public static final string flavor_group2 = &q

python - Matplotlib - Broken axis example: uneven subplot size -

Image
i haven't found solution adjust height of bottom , top plot of broken axis example of matplotlib . btw: space between 2 plots can adjusted by: plt.subplots_adjust(hspace=0.03) update: i've figured out using gridspec: """ broken axis example, y-axis have portion cut out. """ import matplotlib.pylab plt # new: import matplotlib.gridspec gridspec import numpy np pts = np.array([ 0.015, 0.166, 0.133, 0.159, 0.041, 0.024, 0.195, 0.039, 0.161, 0.018, 0.143, 0.056, 0.125, 0.096, 0.094, 0.051, 0.043, 0.021, 0.138, 0.075, 0.109, 0.195, 0.05 , 0.074, 0.079, 0.155, 0.02 , 0.01 , 0.061, 0.008]) pts[[3,14]] += .8 # new: gs = gridspec.gridspec(2, 1, height_ratios=[1, 3]) ax = plt.subplot(gs[0]) ax2 = plt.subplot(gs[1]) plt.subplots_adjust(hspace=0.03) ax.plot(pts) ax2.plot(pts) ax.set_ylim(.78,1.) ax2.set_ylim(.0,.22) ax.spines['bottom'].set_visible(false) ax2.spines['top'].set_visible(false) ax

requirejs - Dart2js : Is it possible to start Root Isolate from Javascript? -

i have application compiled in dart2js (dart sdk version 0.6.13 .0_r25630) , i'd load requirejs everytime need. first of all, thanks god wrapper function in compiled javascript , in case not enough :( i use requirejs load dart2js application require(["application.dart"], function () {}); but handle when start application. example on click event. require(["jquery","application.dart"], function (jquery,$) { jquery(element).click(function(){ $.startrootisolate($.main$closure); }) }); i hacked compiled javascript, i'd know if it's possible in native way. in application.dart.js wrapped function in amd module (function (factory) { if (typeof define === 'function' && define.amd) { // amd. register anonymous module. define([],function(){ return factory(); } ); } else { // browser globals. factory(); } })(function($) {...}) then return $ object return $;

Android getDrawable() from inside a Fragment -

i have fragment following code: final myactivity activity = (myactivity )getactivity(); and bit later: drawable d = (drawable) ((context)(activity)).getresources().getdrawable(r.drawable.marker_report_path_merge); bitmap b = bitmap.createbitmap(d.getintrinsicwidth(), d.getintrinsicheight(), bitmap.config.argb_8888); layerdrawable ld = (layerdrawable) ((context)(activity)).getresources().getdrawable(r.drawable.marker_report_path_merge); ld.setbounds(0, 0, d.getintrinsicwidth(), d.getintrinsicheight()); ld.draw(new canvas(b)); i getting error: 07-31 19:59:12.491: e/androidruntime(14341): fatal exception: main 07-31 19:59:12.491: e/androidruntime(14341): android.content.res.resources$notfoundexception: file res/drawable-hdpi/marker_report_path_merge.xml drawable resource id #0x7f020049 07-31 19:59:12.491: e/androidruntime(14341): @ android.content.res.resources.loaddrawable(resources.java:1951) 07-31 19:59:12.491: e/androidruntime(14341): @ android.content.res.resource

visual studio 2010 - Switch Case Statement in C# -

i need speech recognition program i'm working on in c#. this refers the switch statement. if have example this: //first case statement case "open chrome": system.diagnostics.process.start(@"c:\program files\google\chrome\application\chrome.exe"); jarvis.speak("loading"); break; //second case statement case "thanks": jarvis.speak("no problem"); break; how make if first case statement not said second 1 not work. if first case statement said allow second 1 work. i'm thinking here need if statement i'm not sure. thanks. you didn't specify this, way set up, switch 1 have hit 1 time every time want switch 2 fire: bool isvalid = false; switch(whateveryourvariableiscalled) { //first case statement case "open chrome": system.diagnostics.process.start(@"c:\program files\google\chrome\application\chrome.exe"); jarvis.speak("loading"); isvalid =

Using Javascript, is it possible to upload images along with text pasted from other web pages/clipboard? -

in question paste image web page , have found reference in answer works when copy images. is possible upload images mixed content text , image? use case is, user copy rich content web page , paste rich editor. , images embedded in content uploaded server. i can obtain image objects, contain remote url, need image content user's browser/cache. can retrieve image remotely server-side scripts, website has anti-leach technique can't bypass. user download picture , uploaded server manually, want my site more user friendly. to answer question, yes, possible upload images , text, may need parse images' urls etc. as implied question, "can images , text pasted clipboard:" in ie. js doesn't allow access clipboard data security reasons (except in ie). can't data in element.onpaste event either; according mdn ( https://developer.mozilla.org/en-us/docs/web/api/element.onpaste ): "there no dom-only way obtain text being pasted; you'll have

Set or read Date in HTTP header (Windows Phone 8) -

does knows of way set or read 'date' http header in http request on windows phone 8? i need able set value of date header or @ least read value sent in request. i have tried like: var web_request = httpwebrequest.createhttp(url); web_request.headers["date"] = the_date; but produces exception @ run time: system.argumentexception: 'date' header must modified using appropriate property or method. there's sample code here httpclient apparently not available under windows phone 8: how set content-type header httpclient request? i have tried reading date after: var web_request = httpwebrequest.createhttp(url); the date not seem set yet. that worked after adding "microsoft http client libraries". there still problem in library on windowsphone platform. problem: i have scenario want add "date" header in specific format, used string customdate = "11/29/2013 7:46:25" defaultrequestheaders.tryaddwitho

canvas - How to draw a line from first mouseclick to second with easel.js -

i tried create eventlisteners drawing stage.mousey stage.mousex coordinates, no matter click line exact same straight down middle. here's code ext.onready( function(){ var g; canvas = document.getelementbyid('canvas'); var stage = new createjs.stage(canvas); function draw(a){ var mousex = stage.mousex; var mousey = stage.mousey; a.lineto(mousex, mousey); } g = new createjs.graphics(); g.setstrokestyle(1); g.beginstroke(createjs.graphics.getrgb(0,0,0)); g.beginfill(createjs.graphics.getrgb(255,0,0)); stage.addeventlistener('click', draw(g)); g.lineto(0,50); var s = new createjs.shape(g); s.x = 100; s.y = 100; stage.addchild(s); stage.update(); }); my long term goal create user created polygons selectable/highlightable way it? this problem is: stage.addeventlistener('click', draw(g)); it execute draw function parameter g . won't wait click. problem parentheses following function name, function executed

c# - Callback syncronization between threads -

i want wait on getvalues.get method , return values syncronously caller. serverdataprovider, bookdatafetcher classes external mycode, on have no control. on how achieve appreciated. namespace test { class program { static void main(string[] args) { getvalues val = new getvalues(); val.get("books", datahandler); console.readkey(); } static void datahandler(ilist<string> values) { } } class getvalues { public delegate void datahandler(ilist<string> values); public event datahandler onreceivedatahandler; public void get(string colname, datahandler handler) { onreceivedatahandler += handler; getdatafromserver svr = new getdatafromserver(); svr.onreceivedatahandler += onreceivedata; svr.getdata(colname); } // callback handler private void onreceivedata(ilist<string> values) { onreceivedatahandler(values); } } class getdatafromserver {

mysql - Trigger phpMyAdmin using variables -

i trying create trigger in phpmyadmin, can modify value of field whenever inserted depending of field name. using syntax create trigger lawyers after insert on wp_posts each row begin update wp_posts set post_content = '<!--:en-->&nbsp;<!--:--><!--:es-->&nbsp;<!--:-->' id = new.id , post_type = 'lawyers'; end but can't make work, says: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 4 can please me? you can't write such trigger anyway, updating same table you're inserting into. when tested trigger, got this: error 1442 (hy000): can't update table 'wp_posts' in stored function/trigger because used statement invoked stored function/trigger. the following should same thing trigger: create trigger lawyers before insert on wp_posts each row begin if (new.post_type = 'lawyers') set new.post_content = '

iphone - Fitting a 480 pixel layout to a 320 pixel viewport -

i'm using dreamweaver's fluid grid layout system. while i've been able create 3 designs (desktop/tablet/mobile), dreamweaver uses mobile viewport @ 480 pixels wide. however, on iphones, viewport 320 pixels wide, part of design gets cut off on right side. is there metatag shrink/scale 480 pixel design down fit 320 pixels, without affecting tablet or desktop display? thank you! this solution question: <meta name="viewport" content="width=480, user-scalable=no" /> it sets width of content 480px , lets browser find right scale.

jsf - How to set a Map value in h:inputText -

i'm struggling implement trivial functionality jsf involves dynamically displaying content of nested map on page , editing capabilities values. has turned out mappedvalueexpression$entry when iterating on map c:foreach not writable! <c:foreach items='#{inflectionbean.word.inflectionalforms}' var="number" > <p:fieldset legend="#{number.key}"> <c:foreach items="#{number.value}" var="case" > <p:panel header="#{case.key}"> <h:inputtext value="#{case.value}" /> </p:panel> </c:foreach> </p:fieldset> </c:foreach> when trying submit above form i'm getting: javax.el.propertynotwritableexception: /inflection.xhtml @39,56 value="#{case.value}": class 'com.sun.faces.facelets.tag.jstl.core.mappedvalueexpression$entry' not have writable property 'value'. i wonder if

SQL Server CE 3.5/MS Sync Upgrade path -

first off, i'm hoping can word question in way ok question here. have connected application sync remote server when program starts up, again when closes. i have been using sql server ce 3.5 microsoft sync framework, appears have been discontinued microsoft in sql server ce 4.0 (yes, know behind times here, getting around doing major overhauls program). i have been searching "official" upgrade path, , solutions can find appear revolve around sql azure not option here. there options here upgrade path? don't have control on db server here, , hearing rumors in planning stages of upgrade sql server 2012 break application stands. you can use sql ce 4 sync fx desctibed here, via binding redirect http://jtabadero.wordpress.com/2012/04/20/sync-framework-and-sql-compact-4-yes-you-can/

forecasting - fourier() vs fourierf() function in R -

Image
i'm using fourier() , fourierf() functions in ron hyndman's excellent forecast package in r. looking verify whether same terms selected , used in fourier() , fourierf() , plotted few of output terms. below original data using ts.plot(data) . there's frequency of 364 in time series, fyi. below plot of terms using fourier(data,3) . basically, looks mirror images of existing data. looking @ sin1 term of output, again, variation shows similar 364-day seasonality in line data above. however, when plot results of fourier forecast using fourierf(data,3, 410) see below data. appears far more smooth terms provided original fourier function. so, wonder how results of fourier() , fourierf() related. possible see 1 consolidated fourier result, can see sin or cosine result moving through existing data , through forecasting period? if not, how can confirm terms created fourierf() fit in-sample data? i want use in auto.arima or glm function other ext

jquery - Get JSON via javascript [Cross-Domain] -

please me following situation: there page p1.aspx 1 button: <button id="btn1" onclick="btnclick();">button</button> <script type="text/javascript"> $('#btn1').click(function () { $.getjson("http://localhost/p2.aspx", function (data) { $.each(data, function (i, field) { alert(field); }); }); }); </script> above how want json text via javascript. web application http://localhost/p2.aspx redirected http://localhost/p3.aspx inside. , page http://localhost/p3.aspx again redirected http://localhost/p2.aspx?code=1 . code=1 is value want read in javascript code. it's not works. in p2.aspx generate json data following response.clear(); response.contenttype = "application/json; charset=utf-8"; response.write(jsonstring); response.end(); after can not read json data via javascript. if put http://localhost/p2.aspx via web browser json dat

command line interface - What is the "right" way to refer to javascript dependencies installed via bower in a yeoman project HTML file? -

yeoman's quickstart , package manager guides suggest using bower manage dependencies. they installed app/bower_components/[component_name] the guide suggests inserting a <script src="app/bower_components/[component_name]/[relevant_file.js]"></script> line html file. that's fine. except if component has dependencies. bower helpfully fetches components, but, far can see, doesn't give list of them , order need inserted code. (i know list of got installed when install, , 1 dig out of json file somewhere, that's still bower's name component, not path actual file needs referenced). means that, popular component jquery-maonsonry have manually insert <script src="bower_components/get-size/get-size.js"></script> <script src="bower_components/doc-ready/doc-ready.js"></script> <script src="bower_components/eventemitter/eventemitter.js"></script> <script src="bower_

Wordpress Installing Theme failed -

here error. download failed. not open handle fopen() http://wordpress.org/themes/download/pinboard.1.1.0.zip im new wordpress. you need following 2 things fix this: first, add wp-config.php file: define(‘wp_temp_dir’,abspath.’wp-content/uploads/’); and give write permission upload folder. make sure ‘wp-include‘ , ‘wp-content‘ directory set 755 permission. if hosting wordpress blog on iis should make directory writable else try manually... download zip file url , install file upload theme option

IOStream operator<< Conversion from C++ to C# -

i trying convert old c++ code c# , having difficulty in understanding following code , how can converted c#. ifstream fin; fin.open(file, ios::nocreate); if (!fin) { m_ierrornumber = 1567; num = 0.0; } else { (int x = 0; x < count; x++) { fin >> num; // <==== line problem!! } }; fin.close(); this has different semantics c++ code, should relatively similar: ienumerable<string> readwhitespaceseparated(string filename) { using(var lines = file.readlines(filename)) { return lines.selectmany(line => line.split(new []{' ','\t', '\r', '\n'}, stringsplitoptions.removeemptyentries)); } } ienumerable<string> readdoubles(string filename) { return readwhitespaceseparated(filename) .select(s => double.parse(s, cultureinfo.invariantculture)); } then can read count doubles file readdoubles(filename).take(count)

flash - Combine several flv in one video -

i recording several video on server using flash plugin , fms (flash media server). combine them 1 big video can been played later. looking in ffmpeg solution requirements generate video via php script. love hear options or guide lines. there 2 different way concatenate video file ffmpeg , but 1 work flv files . create text file store flv file list, example: file 'file1.flv' file 'file2.flv' etc... so can use concat demux method: ffmpeg -f concat -i concat.txt -c copy concat.flv

matlab - Output morse code from a file -

my program supposed read text file , output in morse code. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function morse(filename) % morse converts text morse code , writes file % defining characters & numbers = ['.-']; b = ['-...']; c = ['-.-.']; d = ['-..']; e = ['.']; f = ['..-.']; g = ['--.']; h = ['....']; = ['..']; j = ['.---']; k = ['-.-']; l = ['.-..']; m = ['--']; n = ['-.']; o = ['---']; p = ['.--.']; q = ['--.-']; r = ['.-.']; s = ['...']; t = ['-']; u = ['..-']; v = ['...-']; w = ['.--']; x = ['-..-']; y = ['-.--']; z = ['--..']; period = ['.-.-.-']; comma = ['--..--']; question = ['..--..']; slash_ = ['

php - Automatic calendar from dates of events -

i have site wordpress, client want add, in home, calendar contains days , months selected multiple events. for example: i want add, article, event contain: " date: 05/05/2013 title: marathon milan" so, want create calendar select automatically number , doing color @ 05/05/2013, @ event created. this website http://www.dencity.info/ , can see famous simple calendar and, under slideshow, i've 3 categories (red, green , cyan) events per category. at creation of event (article), have field calendar (generated in wordpress) datepicker. how can make it? it's hard me! :( i hope you've understand! ps: urgent! ps2: sorry bad english, i'm italian! :/ frank for can use event calendar plug-in. http://wordpress.org/plugins/cp-multi-view-calendar/ “> cp-multi-view-event-calendar

http - Pause and resume of Enterprise application download on iOS -

when downloading application appstore, it's possible pause download tapping icon, or continue download after network failure we trying achieve same enterprise applications through our private store. got working android using http partial content (status 206) , unable same ios. once app download in progress, tapping icon has no effect , if network connexion lost, download failed. got eye on http requests made appstore application, set same http headers on our private app store doesn't help. so possible implement behaviour ?

c# - Ninject WithConstructorArgument not overriding global binding for type? -

i have general bindings, , 1 of this: bind<ihasher>().to<sha256hasher>(); this works great, there few classes throughout use hasher. there 1 or 2 controllers require type of hasher using hash 3rd parties, such gravatar expect md5 hashes. below: bind<isomecontroller>().to<somecontroller>().named("somecontroller").withconstructorargument("emailhasher", new md5hasher()); then controller looks like: public class somecontroller : controller { private ihasher emailhasher; public campaigncontroller(ihasher emailhasher) { this.emailhasher = emailhasher; } } when debugging expect ihasher md5hasher, sha256hasher. expected behaviour , way make use overridden type? i suppose mvc controller. mvc framework resolve somecontroller not isomecontroller . hence binding not apply ninject use implicit binding somecontroller toself instead. create binding somecontroller toself

sas - how many values are missing for each observation -

i have data follows: id date shoesize shoetype 1 4/3/12 . bball 2 . 12 running 3 1/2/12 8 . 4 . 9.5 bball i want count number of '.' there in each row , make frequency table information. in advance you can determine number of missing values in row nmiss , cmiss functions (nmiss numeric, cmiss character). if have list of of variables, should use list; if not, need deal fact number_missing missing (the -1 there). data want; set have; number_missing=nmiss(of _numeric_) + cmiss(of _character_)-1; run; then whatever want new variable.

web services - JAX-WS is not injecting WebServiceContext -

i created web-service using jax-ws , jboss 5.1.0 . @ top of service class put: @resource private webservicecontext context; but when try access context in of webservice methods, nullpointerexception because context null . has idea why jax-ws not setting correctly , how solve problem? me getting null. if using spring, add this: <import resource="classpath:meta-inf/cxf/cxf.xml" /> <import resource="classpath:meta-inf/cxf/cxf-servlet.xml" /> it worked me.

c# - How to smoothly navigate to a different panorama item -

in panorama application, have added couple of situations user navigated panorama item. done in 1 sudden movement. there way can action more smoothly, form of transition? or of like? this code worked me slidetransition slidetransition = new slidetransition(); slidetransition.mode = slidetransitionmode.sliderightfadein; itransition transition = slidetransition.gettransition(panorama_main); transition.completed += delegate { transition.stop(); }; panoramaitem pitem = (panoramaitem)panorama_main.items[3]; panorama_main.defaultitem = pitem; transition.begin();

javascript - JQuery disabling, and clearing other checkboxes, besides one labled "All" -

i refactoring existing checkbox selector. first option "all", , following individual selections. to, if "all" selected, disable other options being selected. if "all" not checked, other selections become available, and, if individual selections checked, user selects "all," code clear other ones out, , disabling them. i new jquery, have been able target functionality when "all" selected, on both 'click' , when page loads. <table id="ctl12" class="dyncheckboxlist"> <tr> <td><input id="ctl12_0" type="checkbox" name="ctl12$0" checked="checked"/><label for="ctl12_0">all</label></td> </tr> <tr> <td><input id="ctl12_1" type="checkbox" name="ctl12$1"/><label for="ctl12_1">bn</label></td> </tr> <tr> <td><in

android - Spinner images are not showing -

folks. i'm trying implement dynamic images custom spinner in android. went excpet images not show condition, it's appears default image in layout. can point me mistake? hereunder code. public class customspinneradapter extends simplecursoradapter { int layoutn; layoutinflater minflater; private final cursor mcursor; private final int mlayout; private final layoutinflater mlayoutinflater; private final context mcontext; int arr_images[] = { r.drawable.us, r.drawable.uk, r.drawable.eur, r.drawable.cn, r.drawable.ml, r.drawable.mr}; public customspinneradapter (context context, int layout, cursor c, string[] from, int[] to) { super(context, r.layout.spinnertext, c, from, to); this.mcontext = context; this.mcursor = c; this.mlayout = layout; this.mlayoutinflater = layoutinflater.from(context); } private final class viewholder { public textview title; public imageview flag; } @override public view getview(in

java - Loading map with keys that are not present, else load default -

here example method: public void loadstuff(map<string, object> somemap) { map<string, object> mymap = new hashmap<string, object>(); //i load defaults here first mymap.put("one", someobject); mymap.put("two", someobject); mymap.put("three", someobject); //now put entire somemap keys present in somemap overridden in mymap , others remain default. mymap.putall(somemap); } now, there better way of doing these redundant puts number of defaults in scenario lot. consider creating initial map defaults in, , use: // alternatively, use clone() map<string, object> mymap = new hashmap<string, object>(defaults); mymap.putall(somemap); aside else means can load "default map" properties file or whatever. if don't fact put each value twice, write loop check each key - i'd use above code. it's simple , should work fine.

vector - Replicate variable based off match of two other variables in R -

i've got seemingly simple question can't answer: i've got 3 vectors: x <- c(1,2,3,4) weight <- c(5,6,7,8) y <- c(1,1,1,2,2,2) i want create new vector replicates values of weight each time element in x matches y such produces following new weight vector associated y: y_weight <- c(5,5,5,6,6,6) any thoughts on how (either loop or vectorized)? thanks you want match function. match(y, x) to return indicies of matches, use build new weight vector weight[match(y, x)]