Posts

Showing posts from April, 2011

dataframe - How to transform particular rows into columns in R -

i'm new r , question might seem easy of you. have data this > data.frame(table(dat),total) ageintervals mytest.g_b_flag freq total 1 (1,23] 0 5718 5912 2 (23,26] 0 5249 5579 3 (26,28] 0 3105 3314 4 (28,33] 0 6277 6693 5 (33,37] 0 4443 4682 6 (37,41] 0 4277 4514 7 (41,46] 0 4904 5169 8 (46,51] 0 4582 4812 9 (51,57] 0 4039 4236 10 (57,76] 0 3926 4031 11 (1,23] 1 194 5912 12 (23,26] 1 330 5579 13 (26,28] 1 209 3314 14 (28,33] 1 416 6693 15 (33,37] 1 239 4682 16 (37,41] 1 237 4514 17 (41,46] 1 265 5169 18 (46,51] 1 230 4812 19 (51,57] 1 197 4236 20 (57,76] 1 105...

eclipse - android development how to learn advise -

i new android development , downloaded bundle eclipse juno https://developer.android.com/sdk/index.html using sdk manager downloaded required api's , installed. since new , have 8 years background of asp.net development want learn android development. know how should go it? , appreciate if guys can recommend best book learn , start development using little little tasks. would appreciate help try smoke the busy coder's guide android development best book me.

Saving the content of data into csv - AngularJS -

hi i'm trying save content of data came webserver csv file. i'm trying code came various question here in stackoverflow. .success(function(data, status, headers, config) { console.log(data); if (data.success) { console.log(data); var saving = document.createelement('a'); saving.href = 'data:attachment/csv,' + encodeuricomponent(data); saving.download = 'summary.csv'; saving.click(); } }) .error(function(data, status, headers, config) { console.log('error in downloading!'); }); but content of data doesn't save summary.csv , gave me [object object] . can me this? the first problem encodeuricomponent() requires string, , giving object, calls .tostring() on it, why [object object] . instead, need convert data array csv string yourself. if using d3.js can use d3.csv.format(rows) , nice. or can find js csv library. or can use following simplistic implementation wrot...

Chrome Extension to fetch URL of current tab and open new tab based on re-writing URL -

i want use more complex re-write of url simplicity right want accomplish more basic. if i'm on https://www.google.com , click button extension, want open new tab http://www.google.com/images i found separate questions fetching url , opening new tab, haven't been able find combining two. this have right now: manifest.json: { "manifest_version": 2, "name": "rewrite", "version": "0.1", "browser_action": { "default_icon": "icon.png" }, "background": { "scripts": ["background.js"], "persistent": false }, "permissions": ["https://*/*", "http://*/*", "tabs"] } background.js: var currenturl; chrome.tabs.query({ currentwindow: true, active: true }, function (tabs) { currenturl = tabs[0]; }); chrome.browseraction.onclicked.addlistener(function(activetab) { var newurl = curren...

Convert PHP array string into array -

if execute var_dump(array($output)) shows array(1) { [0]=> string(573) " __(developer’s must have gray cardigan|:89.77,gravityforms), __(polka dots blue dress|:55.45,gravityforms), __(classic brown leather bag orange details|:66.84,gravityforms), __(cycling pack steel blue|:360.00,gravityforms), __(classic brown leather bag orange details|:,gravityforms), __(the black cat winter jacket|:254.45,gravityforms), __(split slit gold threading cardi|:165.74,gravityforms), __(slim fit pants|:85,gravityforms), __(get complete wordpress developer outfit|:65.55,gravityforms), __(biodiesel cardigan dreamcatcher|:175.00,gravityforms)," } but want this array(10) { [0]=> string(44) "developer’s must have gray cardigan|:89.77" [1]=> string(28) "polka dots blue dress|:55.45" [2]=> string(52) "classic brown leather bag orange details|:66.84" [3]=> string(31) "cycling pack steel blue|:360.00" [4]=> string(47) "classic bro...

c# - ASP.NET vNext EF7 dbContext issues -

i starting vnext project, , i'm having issues kicking off ground. have added table applicationdbcontext class, , created table in db (which in case in azure). however, can't seem correctly instantiate dbcontext use in controllers. in experience previous asp.net ef projects, instantiate applicationdbcontext class without passing parameters, in case of vnext however, seems expect number of things ( iserviceprovider , , ioptionsaccessor<dbcontextoptions> ). have tried creating parameter-less constructor, app breaks due not knowing connection strings use. code below -- see in onconfiguring(dbcontextoptions options) override, force connection string in via dbcontextoptions , that's not ideal, , feel i'm not understanding 2 iserviceprovider , , ioptionsaccessor parameters need come from. thanks help! namespace project.models { // add profile data application users adding properties applicationuser class public class applicationuser : identityuser ...

android - Using accelerometer and magnetic sensor to detect the directions -

i working on android project need detect exact directions when user turns (i.e. left or right or bottom or top). have found directions using accelerometer magnetic sensor, couldn't fix maximum values turned. the problem face this: unable make detect center point/position. when user turns phone left central position, detects left turn. however, when return position central position, phone detects 2 movements: both left. understanding this: if sensor had got central position (point of origin) correctly fixed, movements correctly detected. but, because central position not fixed, not happening. kindly guide me in fixing it. let me know if need further clarifications. my code below public void onsensorchanged(sensorevent event) { azimuth = event.values[0]; // azimuth pitch = event.values[1]; // pitch roll = event.values[2]; // roll if (pitch < -45 && pitch > -135) { // top ...

ruby on rails - Building a record with polymorphic assocation with FactoryGirl -

i know why getting error when building record using factorygirl. comment model belongs user , commentable through polymorphic association. my factory looks this: factorygirl.define factory :comment text "some text" user_id 1 association :commentable, factory: :feedback end end when i'm build comment record using factorygirl, get: activemodel::missingattributeerror: can't write unknown attribute `commentable_type' i have no problem creating , manipulating comment object in console. can set , save commentable_type attribute freely. also, commentable_type exists in comments table. any thoughts on why error occurs? i ran migrations again using rake db:reset , error has disappeared. before that, have tried rollback related migration , migrate again, did not make change. i still not know caused error, now, fixed.

ios - Xcode 5.1 Simulator missing (Unity developed game) -

i've developed simple pong game in unity, , want port ios. when try , run in xcode get: "no provisioned ios devices available compatible ios version. connect ios device recent enough version of ios run application or choose ios simulator destination." i've searched online, , fix choose ios simulator destination. but, i'm given 'ios device' option. any appreciated, thank in advance. :) if wanna use simulator should go build settings >select player settings>other settings>optimization>sdk version , select simulatorsdk :p hope helped..

eclipse - Android SDK Manager installed only API 20 -

Image
i downloaded android sdk developer.android.com. i clicked on android sdk manager link in eclipse. see api 20 installed. don't find other apis. this screenshot can please tell me how can install other apis. unchecked filter "installed". still not able see other apis screenshot of this information shown in log window in advance. try 1 ] open sdk manager-->tools-->manage add-on sites-->user defined sites 2 ] choose new use url " http://developer.lge.com/sdk/android/repository.xml "

html5 - Javascript: how to get seleted option value that is in the datalist with inside select -

on below code, trying value of selected 'option' 'select' element in 'datalist' element. have tried something, but, couldn't. expecting solution in javascript. of now, alerts first option value change option value. should alert actual option value when change option value on input box. example if select 'blueberry' should omit 'bluberry'. <html> <head> <title>html 5 test elements</title> </head> <body> <div> <label>your favorite fruit: <datalist id="fruit"> <select name="fruits"> <option value="blackberry">blacskberry</option> <option value="blackcurrant">blackcurrant</option> <option value="blueberry">blueberry</option> </se...

Android : Service restarting automatically -

i'm working service saves gps latlng's continiously but many times service getting restarted automatically, results in data loss... so there way can restrict service restarting. or idea clear issue. you can create new process service mentioning in manifest file as android:process=":newservice" inside service tag

Function to use in Google Sheet. Sum with IF condition -

assume have 2 rows below b c expendicture whom <total cost mr x> 500 mr x <total cost mr y> 300 mr y 463 mr y 764 mr x 63 mr y whats functions find cost of x , y separately , paste in column c? assume columns , b infinite. juse use sumif, same in excel can specify infinite range more easily: =sumif($b$2:$b, "mr x", $a$2:$a) https://docs.google.com/spreadsheets/d/1bxmf_wtht6bxztsmpqvp18yob9jcksnidbjq1j44ad0/edit?usp=sharing

node.js - mongoose - divide and round -

hey question simple can't figure out: have huge mongoose collection player field money . how can divide value 100 , have round number (no decimal) i tried players.update({}, {$mul: {'money':.01}}, {multi: true}).exec() it works dividing 100 don't know how round it? by way, why isn't there documentation $mul operator on official mongoose documentation ? http://mongoosejs.com/docs/3.0.x/docs/api.html thanks folks currently mongodb doesn't have in-built operators support math.ceil() or math.floor() functions. need on application server or write javascript function resides on database server , same. implementing in application code: players.find().foreach(function(doc){ var updated = math.ceil(doc.money/100); players.update({"_id":doc._id},{$set:{"money":updated}}); }) implementing server side javascript function: db.system.js.insert({"_id":"updatemoney","value":function(num){ ...

phpstorm - configure jshint enabled (and other options) as defaults for each new project -

Image
is there way configure jshint options (and possibly other options) applied each new project? have jshint enabled project, when create project not enabled there. file | default settings -- settings available there applied future new projects (created on computer). in phpstorm v8.0.2 / webstorm v9 -- special symbols:

maven - intellij idea specify repository for downloading sources -

Image
it seems question can related how automatically attach source code dependency in intellij? it`s not in full manner. in debug mode i'm getting decompiled file , idea ask me download or set path sources. for resolving i'm using nexus repository aggregates different vendors public jars (proxy repositories,reuploaded jars , etc). unfortunately contains jars doesn't contain sources or javadocs. but @ same time vendors' repositories contain sources. after clicking "download" button - can see idea try find sources in "oss.sonatype.org" repository. so ability set list of repositories idea can search sources? check settings of intellij idea "settings-->maven-->repositories there 2 sections: index maven repositories artifactory or nexus service urls

php - I can't seem to find why this IPN code is not updating database -

i ran code without errors database not updating. receiving variable data paypal correctly. verify post data added 2 lines @ beginning of script write variables text file. server uses php 5.4. hope guys can find problem. <?php /* checking post variables & writing text file */ $posted_data = print_r($_post,true); file_put_contents('ipn_data.txt',$posted_data); /* database config here */ /* connect database */ $conn = new mysqli($db_host, $db_user, $db_pass, $db_database); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } //read post paypal system , add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_post $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } //post paypal system validate $header = "post /cgi-bin/webscr http/1.1\r\n"; $header .= "content-type: application/x-www-form-urlencoded\r\n";...

javascript - Jquery click event inside an anchor tag -

i using bootstrap css styling , responsive site. i created default panel bootstrap , entire panel made clickable anchor tag open in new tab. however, there needs close icon dismiss panel; , using javascript same. problem arises when click on close icon - though panel dismissed, having new tab opened due anchor tag. there way avoid new page opening. code looks this: <div class="panel panel-default"> <div class="panel-body"> <a href="#" target="_blank"> <p>basic panel example</p> <button type="button" class="close" id="close">&times;</button> </a> </div> </div> so have javascript dismiss panel id="close". clicking same though, results in anchor redirect. 1 possible way use css relative positioning of closing icon outside anchor tag. getting messed requirement smaller size screen. how can accomplish javascript...

rdf - How to query dbpedian and local ontology at the same time? -

i'm trying query remote dbpedia triple-store , local rdf triple-store within single sparql query.is possible ? if it's how? configured vitruoso server locally. research sparql's service feature.

scala binary tree, adding an element -

i trying change end nodes in binary tree. how make methods change_right_tree , change_left_tree? the compiler complaining reassigning val. when change things var, covariant errors. sealed abstract class tree[+t] { } case object end extends tree[nothing] { override def tostring = "." } case class node[+t](var question: string, left: tree[t] = end, right: tree[t] = end) extends tree[t] { override def tostring = "t(" + question.tostring + " " + left.tostring + " " + right.tostring + ")" def set_question(str : string) = {question = str} def get_answer(answer : boolean) = { if (answer){ left }else { right } } // unclear on need make work def change_left_tree( new_tree : tree[t]) = {this.left = new_tree} def change_right_tree( new_tree : tree[t]) = {this.right = new_tree} } solution: if remove '+' node class declaration code compile. explanation: when declare class covar...

c# - EF6 Code First: when inserting initialize column that occures in multiple tables -

i'm new entity framework. have multiple tables have 'sortorder' column. column declares ordering in rows should appear when rendered. whenever insert happens through application dbcontext 'detect' sortorder column exists, , have automatically fill/overwrite value max(sortorder) in specific table + 1. what best way of achieving this? have experimented using database triggers, apparently not work ef. apart can think of nasty reflection, or coding logic in every insert in application (or @ least once every tabel). thanks, try add attribute sorderorder columns [databasegenerated(databasegeneratedoption.identity)] read entity framework auto incrementing field, isn't id

javascript - Datatables add a new row with alignment as center -

Image
i have html page method create , display datatable: <script type="text/javascript" language="javascript" class="init"> var table; var socket; $(document).ready(function() { table = $('#example').datatable(); socket = io.connect('http://127.0.0.1:80'); socket.on('message', function (data) { var rownode = table .row.add( [ data.id, data.name, data.dispensed, data.amt, data.balance, data.ppm, data.avail] ) .draw() .node(); $( rownode ) .css( 'color', 'red' ) .animate( { color: 'black' } ); } ); }); </script> the scripts gets called when backend scripts in nodejs sends message on web socket. issue data displayed in table not center aligned in temporary row (new data - color red, old temp data - black): is there way can center align values? try adding alignment part of .css in following block: $( rownode ) .css( 'color'...

c# - When and where to use NotifyPropertyChanged -

could explain use of notify property changed , in cases should using it? for example: have in silverlight application domain data source loads data , event loadeddata set lists (list) content of entities domain context , bind lists girds. do need use notyfipropertychanged on lists? thanks, i think getting concepts confused here... there 2 relevant notification interfaces use xaml binding technologies. inotifycollectionchanged - notifies listeners when collection of items changes (as in add/remove/replace/reorder actions). inotifypropertychanged - notifies listeners content of object has changed (as in values have been set , , other properties have changed). in case, if want notify contents of list have changed, need use inotifycollectionchanged enabled collection (i.e. not list - typically observablecollection ). if wanted notify item within list has changed object type contained in list should implement inotifypropertychanged .

.net - Entity Framework custom config file -

my application based on wcf services architecture, , 1 of services data access. service have entity framework infrustructure(such dbcontext, configuration file, poco classes..) , set console app. services have config file (app.config), need avoid it. service start single wcf-service. means request database need wcf-calls data access , call database, if rid of service , reference project referencing dll, not wcf calls, , can call database @ once. puprose need refactor current approach of getting config values app.config one. want save config file, other name "db.config". services want use database, have file in output directory, i'am not sure approach good. give me recommendation or solution task. from understand, have base dll data access , wcf projects call data access logic first dll, passing database connection string in way base dll. what move database specific settings properties/settings of base dll, , add config section in calling services app.config...

javascript - Discount calculation based on type of buyer -

i'm learning javascript , working on javascript function calculate discount based on type of buyer i.e retailer/wholesaler & if it's cash or check payment. here function <script> function sell() { var gross,net,tax,discount,unitprice,quatity,select2,select3; unitprice=parseint(form9.unitprice.value); quantity=parseint(form9.quantity.value); select3=parseint(form9.select3.value); select2=parseint(form9.select2.value); gross=parseint(form9.gross.value); gross=unitprice*quantity form9.gross.value=gross; tax=0.16*gross form9.tax.value=tax; if(select2='cash' && select3='retailer') discount=0.07*gross; else if(select2='cash' && select3='wholesaler') discount=0.1*gross; else if(select2='check') discount=0*gross; form9.discount.value=discount; net=(gross-(discount+tax)); form9.net.value=net; ...

c# - How can I generate PDF from Printdocument? -

[language: c#] have wrote code printdocument , preview microsoft's controls built-in (system.windows.forms.printpreviewcontrol, system.drawing.printing.printdocument). how can convert in pdf file print code: string filename="c:\\file.prt"; printdialog dlg = new printdialog(); dlg.document = this; dlg.allowselection = this.listview.selectedindices.count > 0; dlg.allowsomepages = true; dlg.printersettings.printtofile = true; dlg.printersettings.printfilename = filename; i don't want print virtual pdf printer software, because there "save as" dialog... can convert in pdf ghostscript, 1 want postscript file, don't work "printfilename" format type. how can convert printfile postscript ps, or in pdf? thanks. i have resolved this: http://www.nathanpjones.com/wp/2013/03/output-to-pdf-in-wpf-for-free/ the format xps.... thanks.

javascript - jquery json php html does not show results -

i'm trying use jquery json , returning results replacing div class alert. know js uses alert im gonna change later. im kinda stuck here, post seconds file (offerte2.php) doesnt show results. i'm not sure if java or php fault. has ideas? script.js: $(document).ready(function() { var form = $('#form'); var submit = $('#submit1'); var page1 = $('.page1'); form.on('submit', function(e) { e.preventdefault(); $.ajax({ url: '******/shop/templates/euphoria-art/offerte2.php', // form action url type: 'post', // form submit method get/post datatype: 'json', // request type html/json/xml data: form.serialize(), // serialize form data beforesend: function() { page1.fadeout(); }, success: function(result) { if(result.error){ page1.html(result.html).fadein(); console.log(e) }else{ page1.html(result.html).fadein(); form.trigger('reset'); } } }); }); }); ...

android - eclipse NullPointerRxception -

can pls me: don't find i've done wrong in activity. this error logcat: 11-27 10:37:25.551: e/androidruntime(26862): fatal exception: main 11-27 10:37:25.551: e/androidruntime(26862): process: pack.coderzheaven, pid: 26862 11-27 10:37:25.551: e/androidruntime(26862): java.lang.runtimeexception: unable instantiate activity componentinfo{pack.coderzheaven/pack.coderzheaven.bestellung}: java.lang.nullpointerexception 11-27 10:37:25.551: e/androidruntime(26862): @ android.app.activitythread.performlaunchactivity(activitythread.java:2231) 11-27 10:37:25.551: e/androidruntime(26862): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2363) 11-27 10:37:25.551: e/androidruntime(26862): @ android.app.activitythread.access$900(activitythread.java:161) 11-27 10:37:25.551: e/androidruntime(26862): @ android.app.activitythread$h.handlemessage(activitythread.java:1265) 11-27 10:37:25.551: e/androidruntime(26862): @ android.os.handler.dispatchmessage(h...

ios - UIWebView AVPlayer Error -

i'm trying make video book in html/css/javascript, pages loaded in ajax (i have 10 pages). in each of page there 2 or 3 videos illustrate. on ios7 works charm, problem on ios8 after while videos stops working until refresh page. following exemple on site managed make observer catch events thrown. , found : 2014-11-27 10:16:30.658 acdsm[840:331837] notification name: failedtobecomereadyforplayback 2014-11-27 10:16:30.659 acdsm[840:331837] notification info: { result = "-12983"; } i have -12983 error. it seems me old videos not released correctly or not released @ if don't reload page entirely. what think? there way access avplayer used uiwebview , release instances? edit : in addition when pause app, see lot of thread in "com.apple.coremedia.player.async" in semaphore_wait_trap .. time time terminated, when videos starts working again. there way release them manualy ?

How to get list of all branches created off a GIT branch (get all sub branches of a branch) -

is there way list of branches created off branch in git. for e.g. if have rel2 branch created off master, , have sp1, sp2 , sp3 created rel2 branch. is there command in git sp1, sp2 , sp3 output if give rel2 input ? just take commit want , do git branch --contains commitid in case can do git branch --contains rel2 this list branches have given commit in history. to list remote branches do git branch -r --contains commitid

c# - Add an object to WPF Combo box Items collection, but only show specific property to the client -

if have class like: public class product { public int productid { get; set; } public string productname { get; set; } } and have collection of products (stored in products variable) foreach (var product in products) { productcombobox.items.add(product.productname); } this adds product names combo box, that. there way this: foreach (var product in products) { productcombobox.items.add(product); } but when combo box opened, show product names (but store entire product object in combo box? thanks. you can use displaymemberpath property this. <combobox displaymemberpath="productname"/>

java - Implementing bitwise XNOR -

i saw question finding non repeatitive number set contains 1 distict number , rest numberes can repeated number of times. constraint there need find number in single pass using constant memory. {assume positive numbers}. acheived making function private static int nonrepeatingelement(int[] set) { int element = 0; (int = 0; < set.length; i++) { element = (element ^ set[i]); system.out.println(element); } return element; } and working fine. because of curiosity thought change problem similar constraints. problem1 thought of set contains elements can occur odd number of time except 1 element occures no of time. for example {2,5,7,5,7,1,2,7,1,5,2} consereding logic xnor gives 0 every odd occurence of 1 changed code little like (int = 0; < set.length; i++) { element = (element ^ set[i]); system.out.println(element); } return ~element; ...

android - How to read list of all apps installed on iOS -

twitter on news wanting collect list of apps installed on users ios , android. is there recent api i'm no aware off allows them that? or scanning app url schemes registered? piece of code bring list of activities/applications installed on android : final intent mainintent = new intent(intent.action_main, null); mainintent.addcategory(intent.category_launcher); final list pkgappslist = context.getpackagemanager().queryintentactivities( mainintent, 0); for more information, take look: how list of installed android applications , pick 1 run

sql server - Is it possible to create an SQL query that displays results like this? -

Image
background i have database hold records of assets in office. each asset have condition, category name , age. a conditionid can be; in use spare in circulation categoryid are; phone pc laptop and age field called aquireddate holds records like; 2009-04-24 15:07:51.257 example i've created example of inputs of query explain better need if possible. nb. inputs in orange in above example. i've split example 2 separate queries. count output question is type of query , result set possible using sql alone? , if start? easier use ms excel also? yes possible, orange fields can e.g. where categoryid ='phone' , conditionid in ('in use', 'in circulation') for yellow 1 datediff of days of accuired date , divide 365 , floor value, last 1 (6+ years category) need take minimum of 5 , calculated value 0 between 0-1 year old etc. until 5 has above 6 years. when group calculated column , select additional count desire....

sql - Check if number in varchar2 is greater than n -

i've got varchar2 field holds 2 alphabetic characters (such zh , sz , ai ,...). let's call foo . certain datasets save a or a1 - a9 same field. need select rows except those. used function substr separate number a . far good, < or > don't seem work correctly "number-string" . how can achieve without converting number? there easier solution? i haven't found on internet , reached limit trying myself. this where clause far: where (substr(foo, 0, 1) != 'a' or (substr(foo, 0, 1) = 'a' , substr(foo, 1, 1) > '9')); it returns rows without restrictions. the solution found: where (foo not in ('a', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9')); but not optimal if, somewhere in future, there a1 - a50 . have add 51 strings where clause . and, since query in source code, code readability worse. the solution should work ...

Constrain what files you can see with angularjs ng-flow -

i'm trying implement flow file uploader can't see how make user can select image files. copied example have <div data-flow-files-submitted="$flow.upload()" flow-file-added="!!{png:1,gif:1,jpg:1,jpeg:1}[$file.getextension()]" name="introduction-picture-upload"> but still see files available in upload window, not images. appreciated - thanks! seems it's <button flow-btn flow-attrs="{accept:'image/*'}"> not documented !

java - No such file or directory found, image path to file -

i have nexus 5 android 5.0. want send image amazon s3 error: 11-27 11:29:52.687 21423-21423/com.laurenswuyts.witpa e/upload amazons3﹕ com.amazonaws.amazonclientexception: unable calculate md5 hash: /document/image:2810: open failed: enoent (no such file or directory) @ com.amazonaws.services.s3.amazons3client.putobject(unknown source) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadcallable.uploadinonechunk(unknown source) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadcallable.call(unknown source) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadmonitor.upload(unknown source) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadmonitor.call(unknown source) @ com.amazonaws.mobileconnectors.s3.transfermanager.internal.uploadmonitor.call(unknown source) @ java.util.concurrent.futuretask.run(futuretask.java:237) @ jav...

jquery - Upload from mobile an image in java with ajax -

first of all, don't use jquerymobile. want upload image on tomcat7 server. in desktop-app works fine, when im going mobile, cause error: no signature of method: org.springframework.security.web.servletapi.httpservlet3requestfactory$servlet3securitycontextholderawarerequestwrapper.getfile() applicable argument types: (java.lang.string) values: [file] this java-code: // file upload def uploadfileinput = 'file' multipartfile sourcefile = request.getfile(uploadfileinput) this ajax: $.ajax( { url : createlink( {controller: 'filemanager', action: 'upload', id: location.params.id, params: {domain: location.controller, profile: true}} ), data : new formdata( form[0] ), cache : false, contenttype: false, processdata: false, success : function( data ) { [...] }, error : function() { console.log( 'upload canceled errors' ) } } ); this html: <form enctype=...

Postgresql List foreign data wrappers? -

this explains how create foreign data wrapper. so how list existing foreign data wrappers ? many fdws listed in postgres wiki: https://wiki.postgresql.org/wiki/foreign_data_wrappers psql has useful commands know fdws defined, e.g. \dew[+] : http://www.postgresql.org/docs/current/static/app-psql.html

reporting services - Limit resources for SSAS Proccessing -

on ms sql server 2008r2 run daily olap processing tasks in ssas. during processing ssas takes lots of cpu , ram. result, users of reporting services ( access relational database based reports experience poor performance while opening reports. is there option limit ssas resources? or priorize reporting server higher ssas, report generation not affected ssas processing? you can limit memory , number of threads analysis services uses changing configuration settings. easiest way right-clicking on server node in object explorer in management studio, , selecting "properties". the properties documented @ http://msdn.microsoft.com/en-us/library/ms174556(v=sql.105).aspx . purposes, memory , thread pool properties want change settings, depending bottleneck. you can reduce parallelism of processing in processing request changing server settings, using (or not using) parallel element, possibly including maxparallel attribute. see xmla different settings, can right c...

mysql - Zend Framework: Select query -

i'm newbie on zend framework , created dbtable , primary key id , , table name user : <?php class application_model_dbtable_user extends zend_db_table_abstract { protected $_name = 'user'; protected $_primary = 'id'; } after ,i reviewed abstract.php (db/table/abstract.php) , found out had use insert(array $data) , created model: ( register.php ) <?php class application_model_register { public function createuser($array) { $dbtableuser = new application_model_dbtable_user(); $dbtableuser -> insert($array); } } and , in controllers , created indexcontroller.php <?php class indexcontroller extends zend_controller_action { public function init() { /* initialize action controller here */ } public function indexaction() { $register = new application_model_register(); $register-> createuser(array( 'username'=>'test')); }...

php - Print Barcode from ID database -

after last barcode question i'm another. barcode script: http://www.shayanderson.com/php/php-barcode-generator-class-code-39.htm works fine static number, or static variable: $reparationid = uniqid(); // include barcode39 class include "barcode39.php"; // set barcode39 object $barcode = new barcode39("$reparationid"); // display new barcode $barcode->draw(); bu, want $reparationid out of database, last added entry.i tried this, , works without barcode: $reparationid = "select reparationid reparation order added desc limit 1"; $result = $link->query($reparationid); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { print($row ["reparationid"]); } } else { echo "0 results"; } as asked, reparationid shown number, works. wanted merge 2 scripts, point goes wrong. doesn't work @ all. tried this: if ($result->num_rows > 0) { while ($row = $result-...

intellij idea - Scala Binary tree, setting next "node" when navigating -

i have binary tree. ask user question, if says yes, give him left branch, otherwise give him right branch. (method: get_answer2) but when this: var current_node = node("test") current_node.set_left = node("end node") current_node = current_node.get_answer2("y") i expression of type tree[nothing] not conform to expected type tree[nothing] (from intellij) sealed abstract class tree[+t] { } case object end extends tree[nothing] { var left = "blah" var right = "blah" override def tostring = "." } case class node[t](var question: string, var left: tree[t] = end, var right: tree[t] = end) extends tree[t] { def get_answer2(answer: string) ={ if (answer == "y"){ right }else{ left } } def change_left_tree( new_tree : tree[t]) = {left = new_tree} def change_right_tree( new_tree : tree[t]) = {right = new_tree} } sugested solution: var current_node = node(...

mysql - Return column names where they meet a specific value in sql -

i've user table has "access role" defined in table itself. schema: userid, username, access_1, access_2, access_3, .... access_10 here values access_columns 1 or 0 objective: need users , allowed accesses in 1 column 'access_allowed'. userid, access_allowed 1, (access_1, access_3, access_4, ...) 2, (access_2, access_3, access_5, access_10, ...) regards, yugal thanks strawberry... i've used concat_ws here... select userid, username, concat_ws(', ', if(access1 = 1 ,'access1', null), if(access2 = 1 ,'access2', null), if(access3 = 1 ,'access3', null), if(access4 = 1 ,'access4', null), . . if( accessn = 1 ,'accessn',null) access_allowed usertable

floating point - How can I convert a 16-bit floatingpoint to a binary number? -

i have 2 following mini-floats: 1 11010 0100010111 0 10111 0010001100 i want covert these 2k number hand. question is, can give me "hint" how can double check results? maybe quick conversion program can find online? depending on language want use, can like: int sign = val >> 15; int exp = (val >> 10) & 0x1f; int significand = val & 0x3ff; float value = (1 - 2*sign) * (significand / 1024.0) * (1 << exp); // display value.

Parsing unsigned integer from JSON dictionary in Swift -

i'm trying write code parse json value (which string or integer in json) optional unsigned integer (i.e. uint? ), being tolerant value being missing or not being parsable - want result have value if source data contains legitimate positive value: convenience init(jsondictionary: nsdictionary) { ... var numlikesunsigned: uint? if let likesobj: anyobject = jsondictionary.valueforkey("likecount") { let likes = "\(likesobj)" if let numlikessigned = likes.toint() { numlikesunsigned = uint(numlikessigned) } } self.init(numlikesunsigned) } this seems incredibly unwieldy. hard? you can this: var numlikesunsigned = (jsondictionary["likecount"]?.integervalue).map { uint($0) } since nsstring , nsnumber both has integervalue property, can access .integervalue no matter type that. let dict:nsdictionary = ["foo":42 , "bar":"42"] let foo = dict["f...

c# - ASP.NET: Modelbinder only delegating -

i'm facing problem ith custom modelbinder. i have 2 models (inheriting base class) displayed editortemplates. base-class: public abstract class questionanswerinputmodel { public guid questionid { get; set; } } modelclass 1: public class ratingquestioninputmodel : questionanswerinputmodel{ [required] [range(1,4)] public int? rating { get; set; } } modelclass 2: public class freetextquestioninputmodel: questionanswerinputmodel{ [required] public string freetext { get; set; } } to bound implemented custom modelbinder: public class questionanswermodelbinder : defaultmodelbinder { public override object bindmodel(controllercontext controllercontext, modelbindingcontext bindingcontext) { questionanswerinputmodel model; if ((typeof(questionanswerinputmodel) != bindingcontext.modeltype)) { return null; } modelbindingcontext context = new modelbindingcontext(bindingcontext); ...

oauth - google+ api signin for both android app and server -

my app has android client communicating own back-end server. want use google api handle user authorisation me (using google+ account), user not need sign separate account app. by following docs here https://developers.google.com/+/web/signin/server-side-flow my understanding of authentication flow shown below. not sure correct, because sounds hijecking google api purpose user login on android android client 1 time access code , send server. my server exchange refresh token , access token. (if exchange successful, user authenticated) if user authenticated, generates access token on server, gives android client. android client can subsequently use token call server's api. especially, doubtful point 3. exchange access code google refresh token , access token, never use them. purpose of exchange check whether user has been authorised google. not sounds quite correct? if not , way it? this may others. after receive access_token in server, execute curl/netw...

Android studio with libgdx and android libraries -

i'm trying import eclipse project android studio libgdx. project has multiple library dependencies. structure follows: androidlib1 -> androidlib2 -> appproject i'm not using libgdx multi-platform in eclipse added resources androidlib1. need libraries , project familiar libgdx resources. in eclipse works great. in android studio once run app , start libgdx activity receive exception: 11-27 13:49:26.170 14721-14721/? e/rpc-﹕ caused by: com.badlogic.gdx.utils.gdxruntimeexception: couldn't load shared library 'gdx' target: linux, 32-bit 11-27 13:49:26.170 14721-14721/? e/rpc-﹕ @ com.badlogic.gdx.utils.sharedlibraryloader.load(sharedlibraryloader.java:117) 11-27 13:49:26.170 14721-14721/? e/rpc-﹕ @ com.badlogic.gdx.utils.gdxnativesloader.load(gdxnativesloader.java:34) 11-27 13:49:26.170 14721-14721/? e/rpc-﹕ @ com.badlogic.gdx.backends.android.androidfragmentapplication.<clinit>(androidfragmentapplication.java:48) 11-27 13:49:26.170 14721-1472...

asp.net - Getting Page can't be displayed error after Response.Redirect on submit button click -

Image
i getting weird error on asp.net web form page. have legacy page built full functionality. has got several data controls on page. after performing required operations when click on submit button, internet explorer goes blank. says page can't displayed. my code old enough, works on few production sites. have deployed on new production site. if browse same page using internal url , perform same operation, not show error message , works smoothly. to give background issue, when click on submit button calls web service on backend , comes web services result. once gets results back, uses response.redirect() same page (by creating url - request.url.absolutepath)with additional parameters in querystring. if refresh page shows same page correctly. page in ie - page in chrome - issue not in code, expected in production setup configuration. in production configuration public url www.test.com redirected www.test.com:7500. when user request website url, being redirected 7500...