Posts

Showing posts from January, 2014

javascript - d3JS: Transitions between valuelines of different points counts -

there have been similar questions before, have not found altogether clear answer this: say have basic line graph composed of valuelinea 20 vertices. i want transition line valuelineb 256 vertices. the x domain remains same, y domain. assume valuelinea , valuelineb evenly distributed across x domain (time). how transition occur between valuelinea , valuelineb such there no horizontal animation? the code below transition between valuelinea , valuelineb , transitions squeezes valuelinea first 20 vertices of valuelineb . var trends=svg.append("path") .attr("class", "line") .attr("d", valuelinea(dataa)); trends .transition() .duration(3200) .attr("d", valuelineb(datab)) ; i've found few posts similar ( here , here ), it's still not entirely clear me how perform seems basic operation. there isn't easy solution, i'm afraid. here pointers

java - Application has stopped! GOOGLE API V2 - Map -

i have followed instruction on youtube create map/location application. first step show map stuck because of "unfortunately, mylocapp has stopped". codes followed. have been doing wrong? manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android": package="tri.mylocapp" android:versioncode="1" android:versionname="1.0"> <uses-sdk android:minsdkversion="14" android:targetsdkversion="14" /> <permission android:name="tri.mylocapp.permission.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="tri.mylocapp.permission.maps_receive"/> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission androi

unit testing - Drop test db in django after running each test file -

i have 2 different tests in app/tests/ directory: app/tests/tests.py , have added app/tests/tests_new.py running tests individually not throw error if run them older file tests.py fails tests values getting altered. any idea why happening ? need drop test database before running other tests ?

get field from json and assign to variable in bash script? -

i have json store in jsonfile { "key1": "aaaa bbbbb", "key2": "cccc ddddd" } i have code in mycode.sh : #!/bin/bash value=($(jq -r '.key1' jsonfile)) echo "$value" after run ./mycode.sh result aaaa if run jq -r '.key1' jsonfile result aaaa bbbbb could me? with line of code value=($(jq -r '.key1' jsonfile)) you assigning both values array . note outer parantheses () around command. can access values individually or echo content of entire array. $ echo "${value[@]}" aaaa bbbb $ echo "${value[0]}" aaaa $ echo "${value[1]}" bbbb since echoed $value without specifying value want first value of array.

javascript - Cannot get data in PHP from JQuery Ajax post with JSON -

i trying simple test learn jquery ajax post method , have setup little example on server. can't work. my javascript follows: javascript: var json = {"num string":"2","num":3,"num":11,"num":2,"num":"?"}; $.ajax({ type: "post", url: "samplejsonpost.php", data: json, //data post server contenttype: "application/json; charset=utf-8", datatype: "json", error: function (jqxhr, status, err) { console.log("error " + err + " " + status + " " + json.stringify(jqxhr)); //log error }, success: function (data, status, jqxhr) { console.log(json.stringify(data)); //log data returned $("span").text(data); } }); }; and here php: php: <?php $data = $_post["data"]; echo json_decode($data); ?> however gi

Is it possible to run selenium rc code in 2 different URLs? -

the aut contains login page validates user credentials. once successful, user needs hit new url in new tab access actual application. is possible automate above scenario using selenium rc? yes it's possible, i'd recommend using selenium webdriver it's current version. selenium rc old. using selenium webdriver: driver.navigate().to("http://aut/login"); driver.... // login logic setting user/pass clicking login. ... driver.navigate().to("http://somenewurl.com"); // continue testing here... if adamant on remaining selenium 1 (which understand if have big suite in it..): selenium.open("http://aut/login"); selenium... // login logic here ... selenium.open("http://somenewurl.com"); // continue testing here.

java - Error loading fxml file in a JavaFX project -

i have been working on desktop application, need use javafx. have created fxml file in javafx project on eclipse. build scene in scene builder.when trying run main java file, changes made using scene builder on fxml file not getting reflected on main window.and screen displayed blank. here code. public class main extends application { @override public void start(stage primarystage) { try { anchorpane root = new anchorpane(); scene scene = new scene(root,400,400,color.black); scene.getstylesheets().add(getclass().getresource("/application/sample.fxml").getpath()); primarystage.settitle("fxml welcome"); primarystage.setscene(scene); primarystage.show(); } catch(exception e) { e.printstacktrace(); } } public static void main(string[] args) { launch(args); } and sample.fxml file code: <?xml version="1.0" encoding="utf-8"?> <?import java.lang.*?> <?

cordova - How to get app installation directory using phonegap -

i want write on app installation directory using phonegap. i checked api, think doesn't have way app installation directory. @ max found filesystem.root give root directory. like this: http://developer.android.com/training/basics/data-storage/files.html please me out. similar question has been asked 2 or 3 times today... can't write neither "app installation directory" nor internal assets folder. but can write (and download) files application data folder. docs it: http://cordova.apache.org/docs/en/2.9.0/cordova_file_file.md.html

servicestack - Servicestck.Ormlite equivalent of .include -

given following example pocos: public class order { [autoincrement] public int id { get; set; } ... [reference] public list<item> items { get; set; } } public class item { [autoincrement] public int id { get; set; } .... } is there way select set of orders , include related items? akin .include() in entity framework. in terms of service stack api, multi-entity version of loadsinglebyid() eagerly load referenced fields.

Strategy: How do I exchange data directly between JavaScript and Google App Engine DataStore -

i new web development - google app engine , javascript/html development, have app deployed , working on google app engine , working ok. i user of app able store , retrieve serialization of app state in json using gae datastore. (note - user-initiated action - channels seem overkill) the examples provided google demonstrates 1 approach allows server-side python implementation this. https://developers.google.com/appengine/docs/python/gettingstartedpython27/usingdatastore . have working ok. but approach seems rather inelegant if "app" want store , retrieve serialized chunks of data asynchronously without reloading page/app each time (again, ever user-initiated). i have not been able find high-level guidance on approach (assuming possible). any suggestions/links/examples appreciated. thank you! jeff as many things, depends on specific needs. if want direct access datastore storage, datastore exposed independent service api . if instead want asse

openmp - Multiple Host threads launch CUDA kernels together -

i have encountered strange situation. here our code: #include <omp.h> #include <stdio.h> #include <stdlib.h> #include <cuda.h> void initcuda(int g) { cudadeviceprop prop; if(cudagetdeviceproperties(&prop, g) == cudasuccess) printf("mp cnt: %d ,concurrent kernels:%d , asyncenginecount:%d , thrdpermp: %d\n", prop.multiprocessorcount,prop.concurrentkernels,prop.asyncenginecount,192); cudasetdevice(g); } __global__ void cudajob(float *mem){ unsigned int tid=threadidx.x+blockidx.x*blockdim.x; mem[tid]=-1e5; while(mem[tid]<1.0e5){ mem[tid]=mem[tid]+1e-2; } } void wrapper(int n,int b){ float** dmem=(float**)malloc(n*(sizeof(float*))); cudastream_t* stream=(cudastream_t*)malloc(sizeof(cudastream_t)*n); dim3 grid=dim3(b,1,1); dim3 block=dim3(192,1,1);//2496/13=192 for(int i=0;i<n;i++) { cudamalloc((void**)&dmem[i],192*b*sizeof(float));

c++ - How can I return a value from a thread without using the future header? -

my current compiler doesn't support future header, , i'm unable update on android, compiler wrapped in app. because of this, decided try make own simple future class. have of laid out, can't figure out how return value thread (as seems beyond intended use). pass future class functor contains it's own return holder variable retrieved later, that's little limiting, because wanted pass have derived original functors class, , not function. is there way achieve this? i'm assuming standard future header doesn't use black magic it. use "different version" of threads allow receive value back? (it's not old not compatible threading, has issues future header reason) thanks i think writing own simple future class you're on right way. code like? i'm not sure if understand statement: i pass future class functor contains it's own return holder variable retrieved later, that's little limiting, because wanted pass ha

java - jsoup not fetching all images off a page -

tried fetch images off page . using code shown below fetches side images logo etc., doesn't fetch image in have shown data. public static void main (string args[]) { document doc; try { doc = jsoup.connect("http://www.wolframalpha.com/input/?i=hepatitis").get(); elements desc =doc.select("img[src]"); { (element link :desc) system.out.println("text :"+link.absurl("src")); } } catch (ioexception e) { system.out.println(e); } } } i tried fetch images using id this: elements desc =doc.select("#scannerresult_0300_1 img[src]"); but didn't return result. the website generates lots of content based on javascripts . nfortunately jsoup doesn't support those, scripts not executed, therefore no content generated. please see answer more informations: fetch contents(loaded th

sql server - Perfmon data collector set not putting data in SQL -

i have created perfmon data collector set store perf counter data in sql server. used instructions here . did steps, after starting data collector set doesn't seem data being put anywhere. have setup use localhost system dsn database remains empty. ideas? found it. looks dsn didn't have default database setup, new tables created in master .

OpenCV/NDK - zlib compiling issues in android makefile -

i have been trying compile shared library includes opencv libraries. sample android make files below: local_path := (call my-dir) include $(clear_vars) local_module := libopencvxxx local_src_files := libs/opencv/libopencvxxx.a include $(prebuilt_static_library) opencv_lib_type := static opencv_install_modules := on opencv_camera_modules := on local_module := libxxx local_cppflags := -std=c++11 -fexceptions local_cpp_features += exceptions local_cflags := -std=gnu++11 -fexceptions local_ldlibs := -llog -ldl local_src_files := xxx.cpp local_c_includes := <path opencv header files> local_static_libraries := stdc++ local_static_libraries += libopencvxxx include $(build_shared_library) however, keeps throwing below errors: [info] jni/libs/opencv/libopencv_core.a(persistence.cpp.o):persistence.cpp:function icvgets(cvfilestorage*, char*, int): error: undefined reference 'gzgets' [info] jni/libs/opencv/libopencv_core.a(persistence.cpp.o):persistence.cpp:function ic

java - ClassNotFoundException for applet on some computers but not others -- related to operating system? -

some users report classnotfoundexception error our java applet, others able use applet without issue. we have observed problem seems correlated system's operating system. the users can use applet have newer computers whereas ones cannot using windows xp home sp3. verified ability directly download applet typing applet url browser. firewall doesn't appear issue. we asked use chrome remove browser variable. do need sign applet in different way or reference applet differently within html? we know applet tag deprecated, doesn't explain why it's generating error users , not others. another relevant detail: if use ip address directly, not domain name, applet loads fine. reproduce: 1) visit http://www.cengraving.com/s/item?itemid=ch003 2) tap customize . 3) on xp machines, page generates classnotfoundexception error saying com.designapplet.ui.designapplet not found. (we have referenced com.designapplet.ui.designapplet.class fails.) 4) if try agai

visual studio 2012 - Role built for the platform is incompatible with windows azure compute emulator -

im trying run 32 bit appication on windows azure emulator changed project platfrom using configuration manager. im getting error: cannot start debugging. role built platform incompatible windows azure compute emulator. on system, compute emulator supports anycpu , x64. im running vs2012 in administrator mode. followed tutorial: link

php - csrf Token class -

can explain me how protect profile page wrong user editing url see other users profile page. using token class generate random number protect against cross site request forgery. reason doesn't work suggestion or other way also following error : undefined index: token in phpproject22_csrf\profile.php on line 12 <?php session_start(); require_once 'classes/token.php'; $tk = new token(); if(isset($_post['username'],$_post['product'],$_post['token'])){ $username = $_post['username']; $product = $_post['product']; if(!empty($product) && !empty($username)){ if(token::check($_post['token'])){ echo $_post['token'].'<br>'; $tk->get('username'); $_session['user'] = $tk->name(); echo 'process order'; } } } ?> <!doctype html> <html> <head> <meta http-equiv="content-type" content="text

javascript - $window.location.origin gives wrong value when using IE -

$window.location.origin returns wrong value on ie. the origin property returns protocol, hostname , port number of url. example url: http://localhost:8080/products/search chrome : $window.location.origin returns http://localhost:8080 ie: $window.location.origin returns http://localhost:8080/products/search how can have right value on ie? you may need port number. if so, can use polyfill if (!window.location.origin) { window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); } this polyfill part of modernizr .

node.js - Hosting Ghost blog without NginX or Apache -

i've decided take plunge , make next blog in ghost 0.4.1 rather wordpress. client has small amount of traffic, , easy never need load balanced across multiple servers. my question is: ghost can configured listen port, can use web server listening port 80? there problem doing this? followup question: every example shows hosting apache or nginx, there security or performance reason this? thanks in advance! you can run ghost on port 80 recommended run ghost on port 2368 , proxy requests through apache or nginx. you can checkout this article example of how install ghost , run on port 80. highly recommend reading through this article , proxying requests through nginx. ghost running on port 2368 can use low privileged user start ghost , therefore not have use higher privileged user start ghost.

ios - containerURLForSecurityApplicationGroupIdentifier getting nil value -

i making 2 ipad app communicate 1 file , fetches data 1 file. search , find "containerurlforsecurityapplicationgroupidentifier" can create group , store in that. have write code below. in entitlement file write <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.application-groups</key> <array> <string>$(teamidentifierprefix)com.xxx.catalogapp.coredata</string> </array> <key>keychain-access-groups</key> <array> <string>$(appidentifierprefix)com.xxx.catalogapp.coredata</string> </array> </dict> </plist> and in code write this nsfilemanager* filemanager

r - ggvis: add size property to a line -

Image
just getting started ggvis . not particularly interesting or general question i'm afraid, not obvious me how add size property line. in particular, how replicate following plot using ggvis ? library(ggplot2) df <- data.frame( id = c(1,1,1,2,2,2,2), x = c(1,2,3,1,2,3,4), y = c(2,3,4,1,1,2,3) ) ggplot(df, aes(x, y, colour = as.factor(id), size = id)) + geom_line() also, high enough reputation create ggvis tag? cheers. the following: library(ggvis) gg <- ggvis(df, props(~x, ~y, stroke = ~factor(id))) gg <- gg + layer_line(props(strokewidth := ~id*4)) gg produces: i had tweak multiplier strokewidth bit thicker, should starting point you. remember ggivs based on vega getting familiar terminology in new graphics grammar going requirement understand how " think " in ggvis . here's example of doing more (and more ggplot2 -like scale_quantitative : gg <- ggvis(df, props(~x, ~y, stroke = ~factor(id))) gg <- gg + laye

python - How to create a list within a list of duplicate files? -

i have section of code creates list of raster files within directory: import arcpy, os workspace = r'c:\temp' # list of files in subfolders rasters = [] dirpath, dirnames, filenames in arcpy.da.walk(workspace, topdown = true, datatype="rasterdataset"): filename in filenames: rasters.append(os.path.join(dirpath, filename)) which produces list of .tif files: [r'c:\temp\block1\filea.tif', r'c:\temp\block1\fileb.tif', r'c:\temp\block2\filea.tif', r'c:\temp\block2\fileb.tif'] how can generate list of lists contain duplicate file names, following example? [[r'c:\temp\block1\filea.tif', r'c:\temp\block2\filea.tif'], [r'c:\temp\block1\fileb.tif', r'c:\temp\block2\fileb.tif']] collect files in dictionary, keyed base name; collections.defaultdict() object makes easier: from co

How to implement ios like top down swiping features in android -

i beginner @ android programming. want implement swipe top swipe bottom well. found exact same functionality in ios. happens in ios 3 different views in main page. 1 having background on body. view in top part , last in bottom part. when click top part, top part needs down showing other information , top part need rest @ bottom. i want explain more. it's have main page big page @ top. (the top page hiding 85% , showing 15% of bottom part). similarly, big page @ bottom. (the bototm page hiding 85% , showing 15% of top part) i posting query here, can clear picture of sort of library need work on. searched google , not getting want. helping hands appreciated.

class - jQuery selector id not recognized issue -

<div class="ground"> <div class="row"> <div class="box" id="block1">&nbsp;</div> <div class="box" id="block2">&nbsp;</div> <div class="box" id="block3">&nbsp;</div> <div class="box" id="block4">&nbsp;</div> </div> </div> this html. $(document).ready(function(){ $('#block1').click(function(){ $(this).slideup(); }); }); this script. here, trying make division id thing when clicked. however, simple code won't work. when put div "block1" id outside div class=ground, works ok. whenever put in inside other tags, selector not recognize id , nothing happens when click it. to knowledge id should recognized regardless of belongs, isn't it?

ruby on rails - Why is gem environment different in RubyMine and in terminal -

my terminal gem environment not match rubymine one. in terminal gives: - executable directory: /users/george/.gem/ruby/1.9.3/bin - spec cache directory: /users/george/.gem/specs - rubygems platforms: - ruby - x86_64-darwin-12 - gem paths: - /users/george/.gem/ruby/1.9.3 - /users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1 whereas in rubymine gives: executable directory: /users/george/.rubies/ruby-1.9.3-p392/bin spec cache directory: /users/george/.gem/specs rubygems platforms: ruby x86_64-darwin-12 gem paths: /users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1 /users/george/.gem/ruby/1.9.1 there seems confusion gem location , dont know how fix it. i using chruby control ruby versions installed ruby-build application rails 3.2.17 the full output in terminal , rubymine below: terminal: rubygems environment: - rubygems version: 2.2.2 - ruby version: 1.9.3 (2013-02-22 patchlevel 392) [x86_64-darwin12.5.0] - installa

ios - How to block score to not go below zero? -

i'm making word game can't figure out how make 0 final point in basic scoring i've created. user must not exceed minus in or score, lowest score can zero... - (ibaction)btncheck:(id)sender { nsstring *answer = [_textbox.text stringbyreplacingoccurrencesofstring:@" " withstring:@""] if([answer isequaltostring:@""]){ } else if ([answer isequaltostring:@"q"]) { // string correct, resign keyboard _keyboard.hidden = yes; _textxclear.hidden = yes; //perfect button [_closeone sethidden:no]; [_wrongone sethidden:yes]; score = score +100; [scorelabel settext:[nsstring stringwithformat:@"score: %d", score]]; coins = coins +5; [coinslabel settext:[nsstring stringwithformat:@"%d", coins]]; } else { [_wrongone sethidden:no]; score = score -5 ; [scorelabel settext:[nsstring stringwithformat:@"score: %d", score]]; closeonechange.text = @"correct!";

Get parameter from exe in C++ -

as know query string in web. it's key/value go website url ex: abc.com? myname=stack for example in php, if want value of myname, $_get['myname'] so, in c++, how can it? in c# pass parametter *.exe file ( exe file c++ code ). in c++ code, how parametter value . have no idea situation, surely have realize parameters need? if need arguments command line, simple use char** argv variable. in complicated cases can use gnu getopt or boost::program_options (the last cross-platform); if trying access environmental variables, use standard getenv functions.

html5 - Web Audio Api working with Decibels -

i wish understand how work decibels in web audio api here have audio buffer connected gain node var mybuffer = context.createbuffersource()); mybuffer.buffer = buffer; //an audio buffer var gainnode=context.creategain(); mybuffer.connect(gainnode); gainnode.connect(context.destination); gain volume range 0(silent) n 1 default volume know, audio not related such range, volume measured in decibels (db) , operations made in db too. i have read interesting in answer it's far complete needs: is there way decibel levels audio file , transform information json array? i wonder how determine decibel audio node, how edit volume using decibels decibels interesting beast. decibels aren't measure of volume, per se - they're measure of gain or attentuation, described in http://en.wikipedia.org/wiki/decibel . number of decibels ten times logarithm base 10 of ratio of 2 power quantities. you can decibels out of 1 critical place in web audio api - realtimeanaly

here api - How to close an opened InfoBubble within event listener? -

in page, have markers , want show title on each marker on hover. simple in google maps using title parameter google.maps.marker() object. couldn't find in here maps , decided make simple, similar one. now have nokia.maps.map.container() has 1 infobuble, 1 marker , 2 events: mouseenter , mouseleave . can open infobubble in mouseenter event, can't close in mouseleave event. i'm trying use closebubble() , i'm unsuccessful. here fiddle of work far: http://jsfiddle.net/ffakx/ how can close opened infobubble when mouse leaves marker object? or there simple way title parameter of google.maps.marker() object? the documentation on infobubbles component can found here . if @ closebubble() method, can see takes bubble handle parameter. needs remembered previous openbubble() var infobubbles = new nokia.maps.map.component.infobubbles(), bubble; map.components.add(infobubbles); container = new nokia.maps.map.container(); container.addlistener(&quo

TCL- script to output a file which contains size of all the files in the directry and subdirectories -

please me script outputs file contains names of files in subdirectories , memory in bytes, arguement program folder path .output file should file name in 1st column , memory in second column note:folder contains subfolders...inside subfolders there files .i tried way set fp [open files_memory.txt w] set file_names [glob ../design_data/*/*] foreach file $file_names { puts $fp "$file [lindex [exec du -sh $file] 0]" } close $fp result sample: ../design_data/def/ip2.def.gz 170m ../design_data/lef/tsmc13_10_5d.lef 7.1m but want file name printed ip2.def.gz , tsmc13_10_5d.lef ..etc(not entirepath) , file memorry should aligned tcl the fileutil package in tcllib defines command fileutil::find , can recursively list contents of directory. can use foreach iterate on list , sizes of each of them file size , before producing output puts , perhaps this: puts "$filename\t$size" the $filename name of file, , $size how large i

iOS: How to install a configuration profile programmatically -

i install configuration profile in iphone receive through safari localhost (routinghttpserver) in device. i follow guidelines , tips found in website make possible, facing small issue, in final steps. able run localhost , create configuration profile, safari not allow me install file due "unknown error". i made research , found several possibilities "unknown error", of them related format of contents of file created. arrange in different ways, still same problem. my application concept solution, know if error because, mandatory sign , encrypt configuration file before sending through safari. thanks in advance no, not mandatory sign configuration profile. try following steps connect device laptop (windows/mac). open iphone configuration utility. create profile of need. try installing mobile. check console error. if installation succeeded export profile , place web-server , try installing profile ota. (note: uninstall installed profile).

ruby on rails - Different sort order for has_many :through relation -

i have following models set - product has_many categories through categorisations category has_many products through categorisations i'm wondering correct way put products in different orders in each category. example, product might first in 1 category , last in another. ordering based purely on item appropriate in each category, rather alphabetical etc. any suggestions welcome! in categorisation model add column 'sort_order'. also add following in categorisations model. default_scope order("sort_order asc")

r - Recode a subset of column and row -

i have data.frame , want recode specific column after selecting row value. data.frame this. first column id, second , third columns value use select specific rows, column 4 , above value store want recode. i have store column name want recode in vector -> list1 df <- data.frame(letters[1:10],letters[1:2],letters[3:4],rep(0:1,each=5),rep(1:0,each=5),rep(1:0,each=5),rep(1:0,each=5)) names(df)<-c("sample","cond1","cond2","ge1","ge2","ge3","ge4") df list1 <- c("ge1","ge3") what want get: when select cond1 == , cond2 == c can recode value of specific column (listed in vector) in case column ge1 , ge3. a.e if conditions meet ge1 , ge3 recode na. i have tried things : df$cond1[df$cond1 == "a" & df$cond2 =="c"] , many other fail! you're wanting set conditional rows of specific columns na ? df[df$cond1=="a" & df$cond2==&q

oracle - What does the following expression do <<EOF>tmp -

a shell script database connection using sqlplus contains line: sqlplus username/password@dbname<<eof>tmp. (here there select sql query) i know <<eof indicates start of command. have below doubts in >tmp part. 1)does indicate storing file? 2) if yes put results of sql query alone tmp file or query , results both. could please clear me on one? <<eof known " heredocs ". means next line in script, line says "eof", read in shell, , offered command on standard input. in case, sqlplus command being fed sql query if came standard input. then, output of sqlplus being saved file called tmp . the input , output separate. however, sqlplus command has habit of repeating input output, unless instructed otherwise set echo off .

Create a php page to detect if a user is logged into Facebook or not -

i need know if possible, , ideally links tutorials/code etc. ideal! so have page called "detect.php". user visits page , if logged facebook taken 1 url, if aren't go another so needs work if don't have facebook open in same browser, guess cookie related? i have spoken programmer it, , saying not possible unless first create app , allow facebook permissions user. doesn't make sense me if there no official facebook way, perhaps workaround or other ideas? thanks alot the programmer right, need create facebook app in order detect if user logged in facebook, creating facebook app easy , code user status should this: fb.getloginstatus(function(response) { if (response.status === 'connected') { // user logged in , has authenticated // app, , response.authresponse supplies // user's id, valid access token, signed // request, , time access token // , signed request each expire //redirect here var uid = respo

artificial intelligence - Looping through training data in Neural Networks Backpropagation Algorithm -

how many times use sample of training data in 1 training cycle? have 60 training data. go through 1st row , forward pass , adjust weights using results backward pass. using sigmoidal function below: forward pass si = sum of (wi * uj) ui = f(si) = 1 / 1 + e^ - si backward pass output cell = (expected -ui)(f'(si)), f'(si) = ui(1-ui) do go through 2nd row , same process 1st or go around 1st row until error less? i hope can please training network you should use each instance of training set once per training epoch. a training epoch complete cycle through dataset. after you've looped through dataset , calculated deltas, should adjust weights of network. may perform new forward pass on neural network , training epoch, looping through training dataset. graphical representation great graphical representation of backpropagation may found at link. single-step training there 2 approaches train network perform classification on dataset. easi

php - email sends to .com emails not .co.uk -

i have tried use simple contact form registration form. when recipient email .com receive email after 30 seconds 10 minutes later fine after if email recipient .co.uk email never receive email have tried on 3 emails .co.uk ending , have sent 10 emails in total .co.uk email addresses. i tested yesterday left 24 hours make sure wasn't coming through late have checked junk , spam mail boxes , there nothing blocking example firewall or anti-virus ideas appreciated code below , yes aware of myssql injection , other techniques or security not issue , sorted later on. <h2>feedback form</h2> <?php // display form if user has not clicked submit if (!isset($_post["submit"])) { ?> <form method="post" action="<?php echo $_server["php_self"];?>"> subject: <input type="text" name="subject"><br> message: <textarea rows="10" cols="40" name="messa

powershell - Determine recursively both COUNT and SUM of all extensions in a folder -

i able select remote folder , scan recursively file extensions. each extension discovered, need total count , sum individual file types. i've found script here works single file extension using -include switch, rather running script scores of times, nice run once , collect extensions. $hostname=hostname $directory = "d:\foo" $folderitems = get-childitem $directory -recurse -include *.txt $measurement = $folderitems | measure-object -property length -sum $colitems = $folderitems | measure-object -property length -sum "$hostname;{0:n2}" -f ($colitems.sum / 1mb) + "mb;" + $measurement.count + " files;" i think need use get-childitem $directory | group-object -property extension somehow list extensions, if that's helpful. the ideal output this: extension, size (mb), count jpg,1.72,203 txt,0.23,105 xlsx,156.12,456 i'm using powershell v4.0 on windows 7 machine remotely connect server, run script locally, has v3.0 win

c# - conflict with dropdownlist has a SelectedValue which is invalid because it does not exist in the list of items -

i've been having problem lately specific dropdownlists in site. use following class fill of dropdownlists public static void loadddl(string strdescription, string strvalue, datatable dtsource, dropdownlist objdropdownlist, bool blnaddselect) { objdropdownlist.datatextfield = strdescription; objdropdownlist.datavaluefield = strvalue; objdropdownlist.datasource = dtsource; objdropdownlist.databind(); if (blnaddselect) { objdropdownlist.items.insert(0, new listitem("select...", "-1")); objdropdownlist.selectedvalue = "-1"; } } the exception thrown when databind: 'ddlaccounttypes' has selectedvalue invalid because not exist in list of items. parameter name: value description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.argumentoutofrangeexception: 'ddlaccounttypes

emacs - (message "%S" load-path) and (describe-variable load-path) give different results -

(message "%s" load-path) , (describe-variable 'load-path) give different results. several more path "/users/updogliu/.emacs.d/elpa/flycheck-20140323.828" appeared in latter. how can make (require 'flycheck) use "describe" 1 load-path ? to setup flycheck properly, not need require flycheck. instead, enable global flycheck mode: (add-hook 'after-init-hook #'global-flycheck-mode) this enable flycheck supported languages. to make (require 'flycheck) work in init.el , need add (package-initialize) @ very beginning of init.el . (package-initialize) sets emacs' built-in package system, includes adding packages load-path . emacs calls automatically, after init.el has been processed, hence use of after-init-hook enable flycheck. if added message call init.el without calling (package-initialize) first, you'll hence see standard load-path without of packages. to make packages available in i

mysql - database normalization users and messages database -

i'm newbie databases , want create database have username varchar(16) membership status ( paid or free ) message text (most or should use else?) messages counter user 'to count total number of messages user (probably unsigned int). catagory of message varchar(60) date posted date now have layout database not sure how first , second , third normal forms. appreciated. thanks seems want user table: userid, username, member_status and message table: userid, category, date, message a category table: category, description you can total number of messages user query like: select count(*) message userid = 'someuser' so don't store that. hope gets started. have fun...

How to show a toast message when widget is clicked in android -

i created widget app , works perfectly. need show toast message while clicking on widget. possible tried below code. public void updateview(context context) { remoteviews thisviews = new remoteviews(context.getapplicationcontext().getpackagename(), r.layout.widget_layout); thisviews.setonclickpendingintent(r.id.relativelayout1, actionpendingintent(context)); thisviews.settextviewtext(r.id.widget_text, batterylevel); thisviews.setimageviewresource(r.id.imageview1, widgetimageframe); componentname thiswidget = new componentname(context, batterystatuswidgetactivity.class); appwidgetmanager.getinstance(context).updateappwidget(thiswidget, thisviews); } public static pendingintent actionpendingintent(context context) { intent intent = new intent(context,launchactivity.class); intent.setaction("launch_activity"); return pendingintent.getactivity(context, 0, intent, pendingintent.flag_update_current); }

sql - How to calculate sum of the years into a new column for Current to previouse years -

i using sql server 2012, how can achieve following(table 2) output table 1 sql script/tsql? table 1 :current scenario -------------------------------------------------- year referredeachyear activeeachyear -------------------------------------------------- 2014 297 179 2013 321 144 2012 354 123 2011 317 90 2010 292 72 -------------------------------------------------- table 2 : expected output ------------------------------------------------------------------------- year referredeachyear activeeachyear totalactiveinsystem ------------------------------------------------------------------------- 2014 297 179 608 2013 321 144 429 2012 354 123 285 2011 317 90 162 2010 292

php - Zurmo reports (Export to CSV) painfully slow -

so have xampp setup zurmo 2.6.5 running on it. works charm. speed @ pulls contacts, goes through pages, etc considerably fast. have 2 gb ram , web app runs on it. can call dedicated guess. problem arises when attempt export decent amount of data excel (csv option available). e.g, tried exporting 200-odd rows of data , timed out due max_execution_limit parameter. increased first around 300 600, , 1200. script keeps running though there no end :-/. surprisingly, when first apply filter (not many, one), takes around 10-15 seconds display first 10 records. indicates query executes within time limits. have memcached installed, suggest alleviate performance issues. i checked zurmo's forums , net in general, unfortunately did not single hit reference issue. can fellow zurmo developer / power user me resolved? much appreciated. thanks.

sql - MySQL procedure - how to improve performance of query? -

i have mysql procedure collecting data 3 tables: dossier courrier courrier_concerne_dossier simply can't use select * from... need every dossier_str separated (one dossier_str in each column , in 1 big result set). (select dossier_oid data.courrier_concerne_dossier courrier_oid = param_oid limit 1) 'dossier1_oid', (select concat(a.prefixe_numero, "-", cast(a.numero char), " - ",date_format(a.date_ouverture, '%e/%c/%y'), " - ", b.nom, " - ", a.intitule) data.dossier join data.client b on a.client_oid=b.oid a.oid = dossier1_oid) 'dossier1_str', (select dossier_oid data.courrier_concerne_dossier courrier_oid = param_oid limit 1,1) 'dossier2_oid', (select concat(a.prefixe_numero, "-", cast(a.numero char), " - ",date_format(a.date_ouverture, '%e/%c/%y'),

AngularJS array filtering according to another array -

suppose have array of objects: data = [{id:1, name="a"}, {id:2, name="b"}, {id:3, name="c"}, ....] and have 2 arrays: selecteddata = [{id:1, name="a"}, {id:3, name="c"}] and selecteddataids = [1,3] i want these 2 arrays bound each other. e.g. when selecteddataids = [1] then selecteddata = [{id:1, name="a"}] and vice versa. you put both of arrays service , control update of arrays through method calls. check out plunkr here . it's cursory attempt think use starting point.

android - How do I bind contact cursor data to a MultiAutoCompleteTextView with chips -

i have been @ 2 weeks now. believe have come close, can't quite final product work. have functionality similar email in app. instead of email addresses, uses phone numbers. gmail app on android able use multiautocompletetextview with chips display recipient email addresses. want do. through research , trials, able create multiautocompletetextview, without chips. there number of questions , answers here on same subject. invariably, none of ones find has example binds data user's contact book multiautocompletetextview. examples see use own made simple arrays, if final step trivial. final step stuck. each time try bind contact book multiautocompletetextview chips, code fails. question quite extremely specific: how bind contact book multiautocompletetextview chips? context, have read chips widget in android application , bunch of other articles , responses besides. aware of specific use case? gmail use case? edit following code use https://github.com/splitwise/tokenautoc

emacs - Open selection in different major mode. -

is possible select parts of text , open in different buffer different mode? fore example, if work in ess mode (syntax highlighting r), astring <- '<form> <input type="checkbox" id="foo", value="bar"> </form>' if text within single quotes selected, edit in new buffer html mode (similar org-src-lang-modes in orgmode ). here 1 method of handling issue using narrow-to-region -- example contemplates point (cursor) somewhere between single quotes when typing m-x narrow-to-single-quotes . simple two-line function can used exit -- (widen) (ess-mode) ; or, can fancy recursive-edit . of course, not same opening text in new buffer. similar functionality can used copy region new buffer, assuming original poster may want incorporate edited text primary buffer. (defun narrow-to-single-quotes () "when cursor (aka point) between single quotes, function narrow region whatever between single quotes, , change majo

ruby on rails - Carrierwave - development upload issues after adding S3/Fog for production -

i got production rails 3 app setup use fog/s3 storage while running on heroku. in process, made few changes /config/initializers/carrierwave.rb . here's looks like: carrierwave.configure |config| if rails.env.test? || rails.env.development? config.root = rails.root config.storage = :file else config.storage = :fog config.fog_credentials = { :provider => 'aws', # required :aws_access_key_id => env['my_id'], # required :aws_secret_access_key => env['my_key'] # required } config.fog_directory = 'my-app' # required config.fog_public = false # optional, defaults true #config.fog_attributes = {'cache-control'=>'max-age=315576000'} # optional, defaults {} end end here's image_uploader : class imageuploader < ca

android - How to programmatically bring up list of Wifi networks to connect to? -

i'm programming nexus 7. in program reach point want user select wifi network use (either preconfigured or choice create new one). how can bring dialog programmatically? in order access wi-fi list, may first need use wi-fi permissions. wi-fi must turned on first before wi-fi scan can provide list of results. my guess is: access_wifi_state i think easiest approach launch appropriate intent. action_pick_wifi_network http://developer.android.com/reference/android/net/wifi/wifimanager.html#action_pick_wifi_network (may wish see: action_wifi_settings)

Merging data sets in sas -

suppose have dataset a: id geogkey 1 1 b 1 c 2 w 2 r 2 s and dataset b: id temp date 1 95 1 1 100 2 1 105 3 2 10 1 how merge these 2 datasets 3 records each geogkeys id=1 , 1 record each geogkeys id =2? assuming want cartesian join, best off doing in sql, if it's not big: proc sql; create table c select * a,b a.id=b.id ; quit; the select * generate warning id variables overwriting; if that's concern, explicitly spell out select ( select a.id, a.geogkey, b.temp, b.date ).

Understanding some assembly code? -

i need deciphering means, put comments of think i'm not entirely sure. movl 12(%ebp), %eax //variable (x) moves eax register addl $4, %eax // add value 4 x movl (%eax), %eax //eax = *x; movl %eax, (%esp) //stack pointer = *x call strlen //calls gets length of string movl %eax, %edx //copy *x edx register, name *y movl %edx, %eax //copy *y eax sall $2, %eax //shift *x left 2 (eax) addl %edx, %eax //*x + *y = *x (x shifted 2, remember) movl %eax, (%esp) // move new *x string onto stack pointer call malloc // memory allocate string movl %eax, 28(%esp) //move string onto new variable, lets z movl $.lc1, %edx //move string in lc1 edx movl 12(%ebp), %eax //repeat @ top addl $4, %eax movl (%eax), %eax movl 28(%esp), %ecx // move z ecx register movl %ecx, 8(%esp) // move z closer stack pointer movl %edx, 4(%esp) // move y closest stack pointer movl %eax, (%esp) // set stack pointer x. stack goes: x, y, z call __i