Posts

Showing posts from January, 2011

php - Variable 'innodb_lock_wait_timeout' is a read only variable -

i want change innodb_lock_wait_timeout mysql variable. tried using command set innodb_lock_wait_timeout=900; but when ran got following error: error 1238 (hy000): variable 'innodb_lock_wait_timeout' read variable default @@innodb_lock_wait_timeout 50 want change 900. how can this? innodb_lock_wait_timeout can set @ runtime set global or set session statement. changing global setting requires super privilege , affects operation of clients subsequently connect. client can change session setting innodb_lock_wait_timeout, affects client. you may change config file my.cnf , add innodb_lock_wait_timeout=900.

c# - Filter with Multiple String Values -

i need pass array of string (product id) values parameters not available in rdlc parameters. not sure how results without passing array parameter. example : product id | name | stock ------------------------- abc0000001 | name1 | 50 abc0000002 | name2 | 60 abc0000003 | name3 | 15 abc0000004 | name4 | 50 abc0000005 | name5 | 60 abc0000006 | name6 | 15 above report returns data. need give client option pick specific ids, generate report , save pdf/excel/etc.. is there way achieve without parameters? or how can pass array of strings parameter?

node.js - Authentication always failing when connecting to MongoDB -

i using node/express node_modules = "mongodb": "2.0.33", "mongoose": "3.8.15", mongo shell version: 3.0, , mongo 3.0 i'm able connect mongodb fine, if pass in authentication parameters, fail: ```connection error: { [mongoerror: auth failed] name: 'mongoerror', ok: 0, errmsg: 'auth failed', code: 18 } ``` the following shows in logs when happens: 2015-06-13t15:10:09.863-0400 access [conn8] authenticate db: mydatabase { authenticate: 1, user: "user", nonce: "xxx", key: "xxx" } 2015-06-13t15:10:09.863-0400 access [conn8] failed authenticate user@mydatabase mechanism mongodb-cr: authenticationfailed usernotfound not find user user@mydatabase i've done quite few patterns try work. here's happens when show users command in mongo shell while on appropriate database: { "_id" : "mydatabase.user", "user" : "user", ...

swing - Is it possible to design UI of a desktop apllication with HTML5 and CSS3 and coding it's event handling in pure java? -

i student started studying swing 2 days ago , wondering if design the whole ui of desktop application using html5 , css3 , instead of javascript if code in pure java application's event handling. yes can, need way embed web browser swing application. latest version of java can use javafx have @ link: http://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm there other solution older version 1 eclipse: http://download.eclipse.org/rt/rap/doc/2.3/guide/reference/api/org/eclipse/swt/browser/browser.html hope helps

How can i integrate php to html table -

my friend made new design table couldnt integrate old table php code new design. how can make it? thanks this old table; <table align="center" width="1200" height="370" cellpadding="7"> <tr> <th>id</th> <th>name</th> <th>sex</th> <th>country</th> <th>age</th> <th>twitter</th> <th>instagram</th> <th>snapchat</th> <th>details</th> </tr> <?php foreach($db->query('select * uyeler order rand()limit 20') $row) { echo "<tr><td>" .$row['id'] . "</td>"; echo "<td>" .$row['fname'] . "</td>"; ...

html - How to make two divs of a total of 100% width fit in the screen -

here a fiddle i want 2 divs side side occupying width of window. use display:inline-block on them behave horizontally. <div id="left" class="horizontal">hello</div> <div id="right" class="horizontal">world</div> the problem when set width equal 100% (left @ 20% , right @ 80%) take larger screen, , div on right gets pushed under other one. i around setting width smaller 100% (19% , 79%) has minor problems later on, putting unwanted spaces not want it. what missing make divs along horizontally while using 100% of screen? i have seen tricks listed here , in this question ... , of them ugly still prefer using less 100% width. * { padding:0; margin:0; border:0; border-spacing:0; box-sizing: border-box; -moz-box-sizing: border-box; } html { height:100%; } body { height:100%; } #left { background-color: red; width:20%; height:100%; } #right { background-color: gre...

c# - Entity Framework Migration: Why does it ignore snapshot and take __MigrationHistory into account? -

i'm using ef 6.0.0 , .net 4.5. i face confusing problem. me , 1 of colleagues working on domain model section of our project on 2 different clients. problem is: 1- me , colleagues start absolutely identical project , synced source control. 2- when change model example add property add-migration froma update-database works great. generated code file contains 1 command add column. 3- meanwhile, after db updated , before check in source control, colleague adds property , add-migration froma update-database . , guess what? generated code file has command drop column newly added!!! i added column using native sql, , fortunately column not going deleted. i deleted __migrationhistory table , remove column didn't generated. i turned off initializer database.setinitializer<mycontext>(null) , no success. so, guess ef migrations compares current model last 1 stored in __migrationhistory table not last local snapshot stored in .resx file. right? way sol...

ios - Swift: Facebook SDK, checking missing permissions after successful login -

i trying check missing permissions once user has logged app. func checkuserpermission() { let loginresult: fbsdkloginmanagerloginresult = fbsdkloginmanagerloginresult() var missingpermissions: [string] = [] if !loginresult.grantedpermissions.containsobject("public_profile") { missingpermissions.append("public_profile") } if !loginresult.grantedpermissions.containsobject("email") { missingpermissions.append("email") } if !loginresult.grantedpermissions.containsobject("user_friends") { missingpermissions.append("user_friends") } if !loginresult.grantedpermissions.containsobject("user_likes") { missingpermissions.append("user_likes") } println(missingpermissions) } this function ran when app state changes make sure have permiss...

java - MySQL Select and Tables -

i learning mysql java integrate 1 of projects. main reason behind because i'm using files store data, causing lag. after speaking few people of them said switching mysql rather files handle data fix issue. anyways, i'm confused on few things in mysql , hoping answer them me. firstly, called select method, how work? if this: resultset res = statement.executequery("select * tokens playername = "" + name + "';"); res.next(); will me results tokens db under name column? if that's case how actual token amount? how create different databases, example players score, tokens, kills, deaths, etc. thank you, , wasn't nooby of question :p

javascript - Pros & Cons of using requirejs (-m amd) for typescript+angular projects -

for angular 1.x project uses typescript , pros , cons of using amd ? meaning, running tsc params -m amd , using requirejs , versus using /// <reference path="..." /> internal modules , wrapping in module (s). which- makes more sense angularjs ? (if think 1 better other in particular case). is better large scale angular apps? would better @ minification + obfuscation of large code base? makes more sense angularjs? angular1 : --module amd angular2 : --module system the angularjs team uses internally . is better large scale angular apps? yes. --out , reference comments are bad idea . more : https://github.com/typestrong/atom-typescript/blob/master/docs/out.md would better @ minification+obfuscation of large code base? it same. main advantage dev time readability , maintainability.

mod rewrite - .htaccess redirect to url with trailing slash -

please me redirect in .htaccess need redirect url trailing slash www.example.cz/about--> www.example.cz/about/ www.example.cz/index.php?path=about --> www.example.cz/about/ and last www.example.cz/index.php --> www.example.cz #my .htaccess <filesmatch "\.phtml$"> order deny,allow deny </filesmatch> errordocument 404 /404/ rewriteengine on rewritebase / rewritecond %{http_host} ^example.cz$ rewriterule (.*) http://www.example.cz/$1 [r=301,qsa,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?path=$1 [l,qsa] i solved trailing slash , index.php duplicates :) <filesmatch "\.phtml$"> order deny,allow deny </filesmatch> errordocument 404 /404/ rewriteengine on rewritebase / rewritecond %{http_host} ^example\.cz$ rewriterule (.*) http://www.example.cz/$1 [r=301,l] rewriterule ^index.php$ http://example.cz/$1 [r=301,l] rewritecond %{request_f...

ruby on rails - Socialization likes -

i start use socialization gem. so, created user model devise: class user < activerecord::base has_many :posts devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable acts_as_follower acts_as_followable acts_as_liker end then created post scaffold: class post < activerecord::base belongs_to :user acts_as_likeable end and want allow user posts. don't know how create view button, dont know how write methods likes. please give me little example. i'm new in rails i create link in veiw/posts/show.html.erb . <%= link_to "like", like_post_path(@post), :method => :post, :class => 'btn btn-primary btn-xs' %> and method in app_contoller: def @post = post.find(params[:id]) current_user.like!(@post) end how write route this? you can test in console see how works first: rails c user = user.first post =...

node.js - JavaScript/Node + cURL -

i have line of curl: curl -x post --form "file=@calvin harris - thinking (tez cadey remix)_165299184_soundcloud.mp3" https://api.idolondemand.com/1/api/async/recognizespeech/v1 i'm building hybrid mobile app meteor/ionic framework. therefore, have access node library leverages curl. can anyone: 1) suggest 1 of many node-curl libraries 2) show me how output above curl line in context of right library? my primary issue stopping me --form flag. i've poured on several libraries/docs , none explicitly reference how use form flag. cannot drop flag, it's requirement of api. you use node's fs , https apis var fs = require('fs'); var https = require('https'); var rs = fs.createreadstream( 'calvin harris - thinking (tez cadey remix)_165299184_soundcloud.mp3' ); var req = http.request({ hostname: 'api.idolondemand.com', path: '/1/api/async/recognizespeech/v1', method: 'post' }, function...

xml - Java read a w3c.Document from different thread -

i'm trying read xml document multiple threads. documents large! program works if use sinlge thread if use worker thread errors. single thread takes 30-40 seconds load. multiple threads takes 5 seconds. advantage clear. can't work. if can shed light on i'd love know. here code. not have (removed lot of comments , try-catch blocks , stuff doesn't relate problem) import org.w3c.dom.*; import java.net.url; private static documentbuilder getbuilder() { try { documentbuilderfactory dbfactory = documentbuilderfactory.newinstance(); return dbfactory.newdocumentbuilder(); } catch (parserconfigurationexception ex) { string err = "error initializing api interface: \n" + ex.getmessage(); system.out.println(err); joptionpane.showmessagedialog(null, err, "loading error", joptionpane.warning_message); system.exit(1); } ...

c++ - Moving command line application to Windows Forms -

i using simplified version of project ma looking idea of how in windows forms i have working command line application. simple school assignment program. main player of application database class: database.h class database{ public: database(string name); void add(...) void remove(...) //and on more methods , other stuff } i can use in main.cpp: include "database.h" int main(){ database db("test"); . . . } three dots simple example represent different thing can database. db object available in main scope. how can make instance of database, available windows in windows form project? where/how should instantiate database object available forms? i include excising database.h file, instantiate object out of , able use in different windows in application. i using vs 2010 ultimate.

R: Appending values from row values specified by other row values to a list -

i have data frame 2 columns - group number , name: group name 1 4 b 2 c 3 d 4 e i want make list containing names have groups in common. i have tried loop: myfun <- function(x,g1,g2,g3,g4){ (j in 1:nrow(x)){ if (x[1,j] == 1){ list(g1, list(c=x[2,j])) } else if (x[1,j] == 2){ list(g2, list(c=x[2,j])) } else if (x[1,j] == 3){ list(g3, list(c=x[2,j])) } else if (x[1,j] == 4){ list(g4, list(c=x[2,j])) } } } where g1, g2, g3 , g4 empty lists. error error in if (x[1, i] == 1) { : argument of length zero . have right approach? edit: how can search , extract level value in list (lets want group name b in it? you can simplify code (avoiding loops) using apply function ( dat data) res <- lapply(unique(dat$group), function(g) unique(dat[dat$group==g, "name"])) names(res) <- unique(dat$group) res[[...

javascript - IndexedDB: Can you manually initiate a version change transaction? -

i writing chrome extension utilizes indexeddb store information client side in idbobjectstore within idbdatabase . the nature of data such need users able modify object store @ whim. (add new objects modify existing ones etc.) accomplishing through settings page , fine , dandy far. the caveat comes when want release new version of (default) object store. if didn't care overwriting users' data, handle onupgradeneeded event same way handle when fired in reaction fresh install. like: var request = window.indexeddb.open(db_name, current_db_version); request.onupgradeneeded = upgrade; function upgrade(event){ var db = event.target.result; var objectstore = db.createobjectstore("domains", {keypath: "id", autoincrement: true}); objectstore.createindex("domain", "domain", {multientry: true }); for(var i=0; i<tags.length; i++){ objectstore.add(tags[i]); console.log("added " + tags[i]["domain"] + ...

object - JavaScript Saving this. variable inside of image.onLoad -

this question has answer here: how access correct `this` inside callback? 5 answers function infoimage(path,title){ this.path = path; this.title = title; this.color = undefined; this.maxpixels = undefined; this.init = function(){ var canvas = document.queryselector("canvas"); var img_color = new image_processing_color(canvas); var img = new image(); img.onload = function () { img_color.init(img); this.color = img_color.getdominantcolor(); //this doesnt work this.maxpixels = img_color.getdominantcolorpixels(); }; img.src = path; }; this.init(); } with example, how can save variables infoimage variable? know using this there affect image , not infoimage... if i'm understanding right, usual answer use variable refer this , init c...

Problems launching the emulator in Android Studio. -

when try launch virtual device on android studio, following error: "c:\users\kill me\appdata\local\android\sdk\tools\emulator.exe" -netdelay none -netspeed full -avd apukapappu not wglgetextensionsstringarb creating filesystem parameters: size: 69206016 not wglgetextensionsstringarb block size: 4096 not wglgetextensionsstringarb not wglgetextensionsstringarb blocks per group: 32768 inodes per group: 4224 not wglgetextensionsstringarb inode size: 256 not wglgetextensionsstringarb journal blocks: 1024 not wglgetextensionsstringarb label: not wglgetextensionsstringarb getgles1extensionstring: not find gles 1.x config! blocks: 16896 failed obtain gles 1.x extensions string! block groups: 1 not initialize emulated framebuffer reserved block group size: 7 created filesystem 11/4224 inodes , 1302/16896 blocks emulator: error: not initialize opengles emulation, use '-gpu off' disable it. how c...

javascript - Angular. How to chenge json response to jsonp response? -

i using openweathermap api json data, bu need , use jsonp data it, how in angular service ? app.factory('forecast', ['$http', function($http) { this.sendapirequest = function(city){ return $http.get('http://api.openweathermap.org/data/2.5/forecast/city?q='+city+'&units=metric&mo') .success(function(data) { return data; }) .error(function(err) { return err; }); }, https://docs.angularjs.org/api/ng/service/ $http#jsonp demonstrates proper way use angular receive jsonp objects. the $http service call (from angulardocs) like: $http({method: 'jsonp', url: $scope.url, cache: $templatecache}) .success(function(data, status) { $scope.status = status; $scope.data = data; })... while markup binding functionality is: <div ng-controller="fetchcontroller"> <select ng-model="method" aria-label="request method...

python - str object is not callable when inserting into SQLite database -

Image
i working on temperature sensor network using onewire temperature sensors runs on raspberry pi 2. following this tutorial , going along, realized setup 1 temperature sensor, whereas setup needs work multiple sensors. as result of having multiple sensors, need able differentiate sensors 1 another. this, want have 3 columns in sqlite table. encountering error when execute python script supposed log readout sensor, date , time, , sensor name. here problem, when configuring python script write 3 values table, error. here code getting error when executing #!/usr/bin/env python import sqlite3 import os import time import glob # global variables speriod=(15*60)-1 dbname='/var/www/templog.db' # store temperature in database def log_temperature(temp): conn=sqlite3.connect(dbname) curs=conn.cursor() sensor1 = 'sensor1' curs.execute("insert temps values(datetime('now'), (?,?))" (temp, sensor1)) # commit changes co...

OpenMP startup code for benchmarking? -

i'm attempting benchmark speedup openmp aware code. i'm using crypto++ library, , rabin-williams signature class . class implements bernstein's tweaked roots , , has following code: modulararithmetic modp(m_p), modq(m_q); #pragma omp parallel sections { #pragma omp section m_pre_2_9p = modp.exponentiate(2, (9 * m_p - 11)/8); #pragma omp section m_pre_2_3q = modq.exponentiate(2, (3 * m_q - 5)/8); #pragma omp section m_pre_q_p = modp.exponentiate(m_q, m_p - 2); } from crypto++'s perspective, need following: rwss<p1363_emsa2, sha256>::signer signer(...); signer.precompute(); // ready sign after perform precompute() , crypto++ ready go. can sign away. i understand openmp has startup, , has things dynamic teams. tried reference previous benchmarking papers, performance evaluation of openmp benchmarks on intel's quad core processors , don't call out did. grepped sources epcc openmp micro-benchmark suite , not ...

ios - Can someone help me fix this error in Swift "Apple Mach-O Linker Error? -

"linker command failed exit code 1(use -v invocation)". i don't understand means , not sure go fix it. looked @ solutions in stackoverflow none of them working me. cleaned project still not getting rid of error. please help. edit ld: warning: directory not found option '- l/users/welch/downloads/flurry' ld: warning: directory not found option '-liphone' ld: warning: directory not found option '-lsdk' ld: warning: directory not found option '-lviphone' ld: warning: directory not found option '-l6.4.0' ld: warning: directory not found option '-l(1)/flurry-ios-6.4.0/flurry' ld: warning: directory not found option '-l(1)/flurry-ios-6.4.0/flurryads' ld: warning: directory not found option '-f(1)' ld: warning: directory not found option '-f/users/welch/downloads/ios-inapp' ld: warning: directory not found option '-fsdk-inapp-2.4.2' ld: library not found -lflu...

swift - Downcasting and optional: is this code idiomatic? -

i want make sure getting syntax right in both cases class super or derived class? issues following code? class { } class b : { var y = 42 } // #1 func test(x: a?) -> string { return (x as? b!)?.y == 42 ? "yes" : "no" } let a: a? = a() print(test(a)) let b: b? = b() print(test(b)) example of code using syntax (datataskurl): objc: if ([response iskindofclass:[nshttpurlresponse class]] && [(nshttpurlresponse *)response statuscode] != 200) { swift objc-like: if response.iskindofclass(nshttpurlresponse.self) && (response as! nshttpurlresponse).statuscode != 200 { better swift? if (response as? nshttpurlresponse!)?.statuscode == 200 { this swift way (it both safe , nice): if (response as? nshttpurlresponse)?.statuscode == 200 { it uses conditional casting , optional chaining both test class nshttpurlresponse , statuscode 200 . note don't need ! after nshttpurlresponse . if response clas...

Getting the parameters of a data ellipse produced by the car package in R -

Image
i using dataellipse function car package in r elliptic confidence region data. example: datapoints_x = c(1,3,5,7,8,6,5,4,9) datapoints_y = c(3,6,8,9,5,8,7,4,8) ellipse = dataellipse(cbind(datapoints_x, datapoints_y), levels=0.95) the output 2 vectors x , y corresponding points define ellipse: head(ellipse) # x y # [1,] 12.79906 10.27685 # [2,] 12.74248 10.84304 # [3,] 12.57358 11.34255 # [4,] 12.29492 11.76781 # [5,] 11.91073 12.11238 # [6,] 11.42684 12.37102 but rather interested in length of ellipsis axes , center. there way without carrying out pca myself? from ?dataellipse read these functions plotting functions, not functions designed give fitted ellipse. reading source code of dataellipse , becomes clear function used fit ellipse cov.wt stats package. function should able give center , covariance matrix used specify ellipse location , shape: set.seed(144) x <- rnorm(1000) y <- 3*x + rnorm(1000) (ell.info <- cov.wt(cbind(x, y))...

objective c - Game State Implementation Using Protocol And Base Class -

from i've read far, seems objective c not have abstract classes. i'm trying implement game state manager similar apple announced in gamekit (gkstate , gkstatemachine). my solution far involves creating base state class called basegamestate , adheres protocol i've created called gamestate . each state need gameplay, i'm going subclass basegamestate class. basegamestate class there can subclass , not anything, want state machine work 1 type. class controls state i'm in called gamestatemachine , contain array of objects subclassed basegamestate. to me, seems horrible solution , i'm wondering if there's standard method doing outside of using gamekit classes (which cannot use because need app target yosemite). you don't need base class, if doesn't provide implementation. more flexible gives user freedom use different base class or extend existing class implementation of protocol. just have gamestatemachine store array of object confor...

Unable to connect to azure sql server -

Image
i created new azure mobile app , set sql server database it. use email address username, , assigned password. once mobile app , sql server db setup completed, able ios app target , use azure authentication services without issue. inserted data in table in ios app, without errors. now, want open database , verify data. anytime try connect server using ssms or visual studio 2015, told login failed. i use email address johnathon@mycompany.com. when sign-in fails, says: login failed user 'johnathon'. is email address login causing issues? isp blocks port 1433, thought maybe issue initially. instead of using vs or ssms, moved web-designer on azure portal. when sign in there, receive same error. has occured across 3 different app services setups. tried using older mobile services, , had issue. moved newly released mobile app service have same issue. each time deleted database , recreated , server. i have added client ip azure sql server firewall. i'm @ loss ...

Dynamically converting a list of Excel files to csv files in R -

i have folder containing excel (.xlsx) files, , using r automatically convert of these files csv files using "openxlsx" package (or variation). have following code convert 1 of files , place in same folder: convert("team_order\\team_1.xlsx", "team_order\\team_1.csv") i automate process files in folder, , removes current xlsx files, csv files remain. thanks! you can try using rio, since seems that's you're using: library("rio") xls <- dir(pattern = "xlsx") created <- mapply(convert, xls, gsub("xlsx", "csv", xls)) unlink(xls) # delete xlsx files

Unable to load data from csv file to MySQL table using Python -

i wrote following code dumping large data of earthquake records in .csv file mysql table using python: import mysqldb import os import string db = mysqldb.connect (host="111.100."123.134",port=3306,user="root",\ passwd="****",db="mydb") print "\nconnction db established\n" cursor=db.cursor() sql = """load data local infile 'all_week.csv' \ table eq_records \ fields terminated ',' \ optionally enclosed '"' \ lines terminated '\r\n' \ ignore 1 lines;;""" try: cursor.execute(sql) db.commit() print "data loading complete.\n" except: print "error in loading data\n" this code executing fine table eq_records in mysql workbench empty. please let me know solution this. i executed same code , got data mysql table. disconnected client connection , connected again , refreshed db...

c - How to successfully print out deck of 52 cards and 5 hands of non-repeating cards? -

i want fill , print out deck of 52 cards, , print out 5 hands of 5 non-repeating cards successfully, doesn't work. how able fix that? code: #include <stdio.h> #include <stdlib.h> #include <time.h> /* handy typedefs */ typedef unsigned char card; typedef unsigned char pairs; /* arrays names of things */ static char *suits[4] = {"hearts","diamonds","clubs","spades"}; static char *values[13]= {"ace","two","three","four","five","six",/ "seven","eight","nine","ten","jack","queen","king"}; static char *colour[]= {"black","red"}; int main() { card deck[52][24],*deckp; int s, c, a; (s = 0; s < 4; s++) { for(c = 0; c < 13; c++) { sprintf(deck[(s * c) + c], "%s of %s", values[c], suits[s]); } } ...

html - Javascript Adding two input values together and displaying answer in third when button clicked -

i need add 2 values , display answer in 3rd textbox keep getting nan in 3rd text box. ? here code: <head> <meta charset="utf-8" /> <title></title> </head> <body> <h1></h1> <form name="calcultor" method="get" id='form1'> first number: <input type="text" name="fnum" size="35" id="first"> + second number: <input type="text" name="snum" size="35" id="sec"><br> <br> answer:<input type="text" name="ans" size="35" id="ans" /> <button type="button" onclick="calculate();">calculate</button> </form> <script lang="javascript"> function calculate() { var first = document.getelementbyid('first').value; ...

how to setTag for int Array in Android -

i'm learning android , can appropriate not question , 'd appreciate help i'm trying make memory game , have 2 arrays named imgback imageview array of buttons , int array of images called imgface i need settag() int array called imgface when try settag() int array (imagesface) not possible because belongs view , if make array of imgface imageview array can not setimageresource() cardimg (becouse required int) i add section of code thank again answer for (int = 0; < 12; i++) { imgback[i].setimageresource(r.drawable.icon); final int imagesface = imgface[position[i] - 1]; final imageview cardimg = imgback[i]; //cardimg.settag(i); cardimg.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { cardimg.setimageresource(imagesface); imageview cardthatwasclicked = (imageview) v; in...

mysql - How to sum duplicated values in SQL -

the sum of acquisition price of works of art each year (for example, if there 2 works of art purchased $1500 , $1000 in 2007, , 1 work of art purchased $500 in 2008, sums $2500 , $500, 2007 , 2008 respectively). assuming table contains field containing year, , field containing price, use: select acquisitionyear, sum(price) totalprice mytable group acquisitionyear if table contains date field, you'd need extract year field using year() function: select year(acquisitiondate), sum(price) totalprice mytable group year(acquisitiondate)

asp.net - set image in email body using html c# -

i know thats not new question want know when set image in email body using below c# code, why image not show on mail smtpclient client = new smtpclient(); mailmessage mymessage = new mailmessage(); string body = "<img src=\"images/logo2.png\" style=\"width:75px; height:75px;\" />"; mymessage.to.add(new mailaddress(txtemail.text)); mymessage.subject = "subject"; mymessage.body = body; mymessage.isbodyhtml = true; try { client.send(mymessage); } catch (exception ex) { response.write("unable send email" + ex); } i using asp.net c#. email opened in email client , doesn't know web-application access image. image src shouldn't relative application. change src include full url: <img src=\"http://www.somedomain.nl/images/logo2.png\" test url in browser taking src value , try browsing it. if doesn't work, src value isn't retrievable.

node.js - Npm install just spinning on Ubuntu -

i can't install npm seems on ubuntu 15.04. npm install -g gulp / just spinns ever , nothing happens, tried sudo , without.. nodejs -v v0.12.4 and npm -v 2.10.1 i have tried *reinstall nodejs *clearing cahce globally , locally. *removing nodejs manually *tried installing different npm packages (gulp, browserfiy ..etc) *chainging ownership of ~/.npm recursivly me instead of root but nothing gives, feel thing left me reinstall ubuntu.. do have suggestions? appreciated! my suggestion develop using ubuntu 14.04. lot of virtual server providers let use 14.04 if choose ubuntu (such digitalocean). lot of service providers (such docker , many others) use ubuntu 14.04 standard base ubuntu image develop services. , easier code, test, ship in same environment others do.

Insert into mysql database through php -

i try insert information user gives error no database selected (im using phpmyadmin , xampp btw) code: <?php $username = $_post['username']; $name = $_post['name']; $password = $_post['password']; $cpassword = $_post['cpassword']; if($password == $cpassword) { mysql_escape_string($username); mysql_escape_string($name); mysql_escape_string($password); mysql_escape_string($cpassword); $md5pass = md5($password); mysql_select_db("users"); mysql_query("insert users (id, username, name, password) values (default, '$username', '$name', '$md5pass'") or die(mysql_error()); } else { die("passwords don't match"); } ?> you haven't established connection mysql database. use following code make connection server. $link = mysql_connect('your servers address', 'mysql_user', 'mysql_password'); if (!$link) { die('could no...

java - obtain URL from a local WSDL in Maven Project -

good morning everybody. new in web service. under eclipse, have maven project. project written in java. have copied wsdl in src/main/resources. first, want access physical address of local wsdl. second, want create url wsdl local address. need url of wsdl, call distant web service. web service run under jboss , soap webservice. want call web service, and, this, need obtain url local wsdl of web service (wsdl located in project, in src/main/resources). thank in advance help. thomas ps: question trivial you, probably, new in web service , in calling ws, , want learn. thank understanding here pom.xml (i have not written pom, update project svn) => <?xml version="1.0"?> -<project xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://maven.apache.org/pom/4.0.0"> <modelversion>4.0.0</modelve...

ios - iOS9 Xcode 7 - Core Data - avoiding duplicated objects -

Image
as described in wwdc2015 presentation video , in new xcode7 can set objects uniqueness directly in xcode model editor. trying implement code, not working expected. when try save duplicated object, xcode rejects save, table updates duplicated cell. so have set unique attributes startdate , enddate. then have modified save function handle error , inform user uialertcontroller. func addcontract() { { let appdelegate: appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let context: nsmanagedobjectcontext = appdelegate.managedobjectcontext let entity = nsentitydescription.entityforname("contract", inmanagedobjectcontext: context) let newcontractdata = contract(entity: entity!, insertintomanagedobjectcontext: context) newcontractdata.startdate = dateformatter.datefromstring(startdatetextfield.text!)! newcontractdata.enddate = dateformatter.datefromstring(enddatetextfield.text!)! newcontra...

triggers - Get Account name from contact object -

please want account.name account object contact (after iupdate) trigger. below trigger.but giving null c.account.name.. trigger contactcallout on contact (after update) { map<id, string> m = new map<id, string>(); (contact c : trigger.new) { if(c.recordtypeid == '012d0000000bafa'){ contact old = trigger.oldmap.get(c.id); if (c.email != old.email||c.firstname!=old.firstname||c.lastname!=old.lastname||c.phone!=old.ph one||c.title__c!=old.title__c||c.account.name!=old.account.name) { webservicecallout.sendnotification(c.id,c.email,c.firstname,c.lastname,c.phone,c .title__c,c.account.name); } } } } parent fields values not accessible trigger.new, need retrieve them soql. check trigger below: trigger contactcallout on contact (after update) { map<id, string> m = new map<id, string>(); (contact c : [select id, email, firstname, lastname, phone, title__c, account.name ...

java - How to change the delay of sleep/timer thread in android during runtime? -

what trying decrease timer delay every time counter becomes multiple of 5. but, code entered if block, stopped incrementing timer. can't understand happening. this code thread=new thread(){ public void run(){ try{ if(count%5==0) timre--; else{ //do nothing } //*******progress update********// for(t=0;t<=100;t++) { sleep((timre) / 100); progress.setprogress(t); t += 1; } //****progress update over****// } catch (interruptedexception e) { e.printstacktrace(); } { finish(); } }//run ends };//thread ends thread.start();//timer starts threads (and sleep() ) tricky in android. try using countdowntimer instead countdowntimer counter; starttimer(); counter.start(); private void starttimer() { counter = new countdowntimer(4000, 5...

android - Track another device without Internet connection -

i'm working on personal app , want know if it's possible track device without internet connection. example, track friend's device. idea have 2 apps, 1 on device , other on friend's device. know how internet connection (the phone want track sends it's location server , phone tracking location by, example, rest service , display on map). there way without server side? don't want depend on internet. thanks. get sms packages there many sites provides sms packages library integration can use send message other device track it. , when sending messages 1 device other device put unique code can identify message other device when received.

javascript - assigning new value to an object in object array in jquery -

i have array of objects object in below format var newuserdetail={"age":"21","name":"vicky","userid":"198303"}; now trying compare userid , replace values //userslist contains array of newuserdetail kind of objects jquery(userslist).each(function(){ if(this.userid==newuserdetail.userid){ this=newuserdetail; } }); but throws error invalid left-hand side in assignment set array entry: jquery(userslist).each(function (i) { if (this.userid == newuserdetail.userid) { userslist[i] = newuserdetail; return false; //if want break loop } });

javascript - React tutorial error rendering CommentForm and CommentList -

i started official react tutorial , seem stumbling upon error prevents browser showing content, it's stupid typo, can't seem find it. in var commentbox when remove <commentlist /> , <commentform /> , element <h1>comments</h1> appears, when add them nothing appears in browser, <h1>comments</h1> . overlooking, ideas? thanks! my code <div id="content"></div> <script type="text/jsx"> var commentbox = react.createclass({ render: function () { return ( <div classname="commentbox"> <h1>comments</h1> <commentlist /> <commentform /> </div> ); } }); react.render( <commentbox />, document.getelementbyid('content') ); var commentlist = react.createclass({ render: function () { r...

android combination of autocomplete and spinner with countries list -

i have list of countries user should choose. can show them in spinner, user must scroll , scroll (the list contains 200 countries) can use autocomplete, shorten number of entries significantly, user still input different. how make combination on 1 hand shortens number of elements in drop-down, , on other hand prevents user inputting illegal? i thinking of having edittext , interrupt user-input after has typed 2 or 3 characters , show spinner instead. i dont know how interrupt , it seems complex any ideas? i think need identify users language, or ip , go there.

Launch PDF Windows Phone 7.1 without Component One -

i have pdf file in assets folder in windows phone 7.1. want open pdf file. uptil have found many examples using component 1 controls. dont want use component one. know can't open pdf in application using native libraries. there way open pdf assets in web browser or can launch installed pdf reader application? any idea? windows phone 8 : you can write following code in order open pdf files (you need pdf reader app): private async void button1_click(object sender, routedeventargs rea) { // access file. in case, local folder storagefolder local = windows.storage.applicationdata.current.localfolder; // access pdf file storagefile file = await local.getfileasync("your_filename.pdf"); // launch query. windows.system.launcher.launchfileasync(file); } windows phone 7 : there no way without third party library componentone or telerik.

html - Navbar item moves down when resizing -

i'm creating first responsive website. have navbar inside container centered horizontally. has size percentage (is there term this?). navbar scales down when resize window correctly. last list item (navbar item) move down. i have tried lot min-width stuff, , know has this. solutions on internet should give navbar (or ul?) fixed width (xxxx px). don't want because want scale. html: <body> <div id="container"> <nav> <ul> <li><span class="navbaritem">test1</span></li> <li><span class="navbaritem">test2</span></li> <li><span class="navbaritem">test3</span></li> <li><span class="navbaritem">test4</span></li> <li><span class="navbaritem">test5</span></li> </ul> </nav> </div> </body> css: @charse...

hash - extendible hashing - destructor C++ -

so... have implemented version of exendible hashing...my question destructor. i used in hash class array of pointers point on buckets class bucket. problem there can multiple pointers on same bucket. in destructor of hash class have delete every bucket , array, have careful not delete same bucket twice (i think that'll result in error). in order used bool vector memorize whether or not bucket has been deleted. my question now: there way know if bucket has been deleted without using more memory (the bool vector) ? le: solved destructor problem using nullptr (seems working now), but...another question: how can go through every bucket 1 time (for finding min , max elements, example). can't use nullptr time (the pointers need stay - on buckets) just iteratively use erase function while (size ()) { erase(begin()); }

java - convert arrayList multimap to json string? -

i have following code: public static void posthttpstream(arraylistmultimap<string, string> fcmbuildproperties){ httpclient client = new httpclient(); gson gson = new gson(); system.out.println(fcmbuildproperties); string jsonstring = gson.tojson(fcmbuildproperties); system.out.println(jsonstring); } where fcmbuildproperties arraylistmultimap. try convert json here: string jsonstring = gson.tojson(fcmbuildproperties); returns empty array. need instead? this input fcmbuildproperties contain : {build.name=[test_project], build.timestamp=[1425600727488], build.number=[121]} i need convert json. key/values. use arraylistmultimap#asmap() string jsonstring = gson.tojson(fcmbuildproperties.asmap()); gson considers arraylistmultimap map , ignores internal state manages multimap. asmap returns corresponding map instance can serialize expected.