Posts

Showing posts from June, 2012

ios - Why PHAsset fetchAssetsWithOptions doesn't return all assets? -

there 75 photos in photo stream , 1 photo in camera roll(not in photo stream). totally have 76 photos. follow code returns 51 photos: phfetchoptions *options = [[phfetchoptions alloc] init]; options.sortdescriptors = @[[nssortdescriptor sortdescriptorwithkey:@"creationdate" ascending:yes]]; assetsfetchresults = [phasset fetchassetswithoptions:options]; i know: if method called app linked on or after ios 8.1, results not include photos synchronized device itunes or photos stored in icloud shared photo stream. but none of photos above icloud shared photo stream. not beautiful, try following assets: nsmutablearray *_assets = [nsmutablearray new]; phfetchresult *fr = [phassetcollection fetchmomentswithoptions:nil]; (phassetcollection *collection in fr) { phfetchresult *_fr = [phasset fetchassetsinassetcollection:collection options:nil]; (phasset *asset in _fr) { [_assets addobject:asset]; } }

sql - TSQL: Prevent Nulls update over existing data -

i have 2 tables: orders (table update , want keep existing data, , prevent overwriting nulls) wrk_table (this table identical orders can not guarantee columns have data when running update) pk column 'master_ordernum' there many columns in tables, wrk_table have pk, data in other columns can not counted on. i want wrk_table update orders actual data , not nulls. thinking along line: update [orders] set [status] = case when s.[status] not null s.[status] end [wrk_table] s [orders].[master_ordernum] = s.[master_ordernum] the existing data in orders being updated nulls does help? update orders set name = work.name orders inner join work on orders.id = work.id , work.name not null not same col / table name should idea edit your sql, not tested update orders set [status] = wrk_table.[status] [orders] inner join wrk_table on [orders].[master_ordernum] = [wrk_table].[master_ordernum] , wrk_table.[status] not null if want test , undo data (a

assembly signing - strong name internalsvisibleto 32bit .net 4.0 -

i given 3 dlls (api external system) , can use executable on windows 7 32bit .net 4. then need sign executable strong name. it mandates api dlls signed same strong name, if understand correct. and i've seen posts how (ildasm/ilasm, or brutal developer, or crypto obfuscator) , tried put hands on. yet still getting "strong name signed assemblies must specify public key in internalsvisibleto declaration". anyone been there , managed out safely? regards, oren ps 1, did manage make work on windows 7 64bit (there 3 api's dlls signed crypto obfuscator done previous developer). started investigate when did not work in 32bit , have realized using signed dlls. i've located original dlls, able run without "strong name" in neither assemblies nor api. other combination, when assemblies not signed (or signed best of knowledge), did not work. ps 2, have dll of mine, works nicely executable (i sign both, have total of 5 assemblies, 2 mine , 3 given), i

android - Saving an Editable object to file -

how can save editable object medittext.gettext(); file? have tried following code , works @ end ioexception , ioexception.getlocalizedmessage(); , ioexception.getmessage(); both displays following string. e/error:(5223): android.text.spannablestringbuilder here code tried with: try { spannablestringbuilder ssb = new spannablestringbuilder(mmainedittext.gettext()); //create file object user entered file name... file outputfile = new file(getdocstoragefolder(), muserenterfilename + ".msd"); log.e("path:", "" + outputfile.getabsolutepath()); toast.maketext(mainactivity.this, "" + outputfile.getabsolutepath(), toast.length_long).show(); fileoutputstream fos = new fileoutputstream(outputfile); //create fileoutputstream here objectoutputstream oos

Segmentation fault after linking Rust staticlib with C -

i'm trying link statically against library written in rust: #![crate_type = "staticlib"] #[no_mangle] pub extern "c" fn foo() { println!("bork!"); } using following code in c: void foo(); int main() { foo(); return 0; } compile lib rustc: rustc foo.rs compile binary , link library: gcc -g bar.c libfoo.a -ldl -lpthread -lrt -lgcc_s -lpthread -lc -lm -o bar run inside debugger: (gdb) run starting program: /home/kykc/rusttest/bar [thread debugging using libthread_db enabled] using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". program received signal sigsegv, segmentation fault. 0x00007ffff72117df in __cxa_thread_atexit_impl (func=<optimized out>, obj=<optimized out>, dso_symbol=0x0) @ cxa_thread_atexit_impl.c:67 67 cxa_thread_atexit_impl.c: no such file or directory. gcc: gcc-4.8.real (ubuntu 4.8.2-19ubuntu1) 4.8.2 rustc: rustc 1.0.0-beta (9854143cb 2015-04-02) (bui

javascript - How to send HTML content to ASP.NET MVC JSON function? -

this jquery code , next json function hanlde jquery code named insertmatlabjson . the problem no text comes in .net json function. . . function insert() { var url = '<%=url.content("~/") %>' + "matlab/insertmatlabjson"; var text = document.getelementbyid('maincontent_freetextbox1').value $.ajax({ url: url, type: 'get', data: { text: text}, contenttype: 'application/json; charset=utf-8', success: function (response) { //your success code alert("opk"); }, error: function () { //your error code alert("no"); } }); } , json function in asp.net mvc public jsonresult insertmatlabjson(string text) { } this should it [allowhtml] public jsonresult insertmatlabjson(string text)

javascript - Adding an EventListener to button -

i have input[type="text"] when press down key, adds focus button. if(e.keycode == 40 && document.getelementsbyclassname('list-item').length > 0){ document.getelementsbyclassname('list-item')[0].focus(); console.log(document.activeelement); } i want know if it's possible me add eventlistener keyboard events on button, if button input[type="button"] or <button> tag. i've added 2 events worked, , 2 events relative keyboard not working. possible? collection[i].addeventlistener('click', function(e){ console.log('click'); }); collection[i].addeventlistener('focus', function(e){ console.log('focus'); }) collection[i].addeventlistener('keyup', function(e){ console.log('keyup'); }) collection[i].addeventlistener('keypress', funct

C++ Array Error: Access violation reading location 0xC0000005 -

for reason, when try print out array of strings has error: unhandled exception @ 0x0f767ea6 (msvcp120d.dll) in project1.exe: 0xc0000005: access violation reading location 0x73f6b6ff. here code generates error: #include <iostream> #include <string> using namespace std; int main() { const int numitems = 6; string itemnames[numitems] = { "boots", "swords", "helmets", "kittens", "poleaxes", "leggings" }; cout << "*** welcome item shop! ***\n"; (int = 0; < numitems; i++) { cout << itemnames[numitems] << endl; } cout << "**********\n\n"; cout << "what buy?\n"; system("pause"); return 0; } i using visual studio 2013, way. for (int = 0; < numitems; i++) { cout << itemnames[numitems] << endl; } you may want cout << itemnames[i] << endl; . oth

java - How to create custom Validation Messages based on an annotation property? -

i'm using hibernate @notnull validator, , i'm trying create custom messages tell user field has generated error when null. this: notnull.custom = field {0} can't null. (this in validationmessages.properties file). where {0} should field name passed validator way: @notnull(field="field name") there way can that? if requirement can satisfied interpolating hibernate messages, can create/name *property file that: validationmessages.properties and inside that: javax.validation.constraints.notnull.message = customized message when notnull violated! hibernate default searches resourcebundle named validationmessages . locale might involved: validationmessages_en , validationmessages_de , <..> hibernate provide customized message through interpolatedmessage parameter, constraintviolationexception relevant information (included message ) showed. message part of real exception. unwieldy information provided! if want make custom exc

python - Horizontal alignment of widgets in ipython notebook -

consider following example: %pylab inline ipython.html import widgets ipython.html.widgets import interact import matplotlib.pyplot plt def f(values): data = { 'foo': ([1, 2, 3], [1, 4, 9]), 'bar': ([1, 2, 3], [9, 4, 1]), 'baz': ([1, 2, 3], [2, 2, 2]) } item in values: plt.plot(*data[item]) __ = interact(f, values=widgets.selectmultiple( height=1000, # going long list description=' ', options=['foo', 'bar', 'baz'])) having got selectmultiple widget , inline plot below it. can see selectmultiple list may long, obvious intention place plot hbox. pyplot not notebook widget. are there ways solve problem without tricky workarounds? thank you.

jquery - Radiobutton within the Popover not be checked via javascript -

Image
i have query fill html table records database. in 1 of columns of each row, there options how edit, delete, add photos , option opens popover. this popover bootstrap 3, when open popover line shows 3 radiobuttons , onclick run script in database without refreshing page. want selected radio checked without having refresh page, i'm not getting. follow code: <td class="col-small center"> <div class="action-buttons"> <a class="popover-dw" href="#" data-popover="true"> <i class="fa fa-cog bigger-130" data-toggle="tooltip"></i> </a> <div class="popover-content" style="display:none"> <form class="marcarcomovendidoalugado"> <div> <p> anúncio: <%=rsanuncios("id")%> </p> <p> <input <%=checknone%> type="ra

java - Unable to use appcompat-v7 in eclipse for material design -

Image
i have imported appcompat-v7 following instruction both eclipse(luna) , android developer tools. https://developer.android.com/tools/support-library/setup.html now appcompat-v7 library looks in project explorer. after importing have created new project , added appcompat-v7 library it. but after clicking ok if again go option looks different. if put following code styles.xml shows error. <style name="appbasetheme" parent="theme.appcompat"> </style> now, should develop material design app using eclipse. can give me complete guideline develop material app using eclipse? nb: have installed support library , have api 21, 22 both. i faced problem , solved placing app compact v7 library folder , project in same directory. go property , check library , appcompact in same directory. can follow tutorial solving problem. https://www.youtube.com/watch?v=cg_hxvv44zm

How to increment a value in HTML every time a selenium test case is ran -

i testing registration page website, beginner in html scrip. struggling automate script register there validation on email address unique. can tell me how increment value in code below. <tr> <td>type</td> <td>id=maincontent_email</td> <td>validtestemail@test.com</td> you can use selenium-webdriver execute script can change text of 1 of cells. ((ijavascriptexecutor)driver).executescript("var cellvalue = $('td1').text(); cellvalue = cellvalue + 1; $('td2').text(cellvalue)"); something similar javascript in above example. another way format string within selenium running code , increment way: string scripttorun = string.format("var cellvalue = {0}; cellvalue = cellvalue + 1; $('td2').text(cellvalue)", incrementingvalue); ((ijavascriptexecutor)driver).executescript(scripttorun); the script selectors above need improved , match html.

java - How to raise a BigInteger to the power of something without pow() -

my java professor wants me write program user gives value x , value y, , computes value of x^y (x power of y), , prints console. i'm not allowed use pow() method this. x , y int values. my code, after user gives x , y values: biginteger solution = biginteger.valueof(0); (int i=0; i<y; i++) { solution = solution.add(biginteger.valueof((x+solution.intvalue())*x)); } but never works properly. answer gives waaaay off. if has code correct problem, assistance appreciated! you need multiply x y times. biginteger solution; if (y == 0) { solution = biginteger.valueof(1); } else if (y > 0) { solution = biginteger.valueof(x); (int i=0; i<y-1; i++) { solution = solution.multiply(biginteger.valueof(x)); } } else { // negative powers left exercise reader }

python - ImportError: No module named db when using chatterbot -

i trying buid chatbot. installed chatterbot package. python code following: from chatterbot import talkwithcleverbot talk = talkwithcleverbot() talk.begin() but getting following error: traceback (most recent call last): file "c:\users\jerin\desktop\bottobot.py", line 2, in <module> talk = talkwithcleverbot() file "c:\python27\lib\site-packages\chatterbot\__init__.py", line 157, in __init__ super(talkwithcleverbot, self).__init__() file "c:\python27\lib\site-packages\chatterbot\__init__.py", line 4, in __init__ jsondb.db import database importerror: no module named db i tried installing jsondb , db packages, there no good. please me your error highlighting issue -- there's no db object import jsondb call in __init__.py . def __init__(self, name="bot", logging=true): jsondb.db import database ^^ doesn't exist i found source 'chatterbot' module on github , appe

javascript - Is it possible to crawl directly through a site tree a site tree remotely or locally? -

i'm n00b web development , have n00b question. suppose there's site is, example, like index.php page1.php page2.php page2-1.php page2-2.php page3.php is there way can try go directly every subpage starting index, without knowledge of subpage names? in concrete terms, possible in, say, javascript, construct function works like console.log(printsitetree("stackoverflow.com"); /* prints: stackoverflow.com stackoverflow.com/questions . . . stackoverflow.com/questions/29633992 . . . stackoverflow.com/questions/29633992/is-there-any-tool-to-calculate-the-distance-between-a-program-point-and-a-execut . . . stackoverflow.com/tags . . . */ without relying on undue brute force? theory you can list of links on site, if site wants let have them. done via site map: htt

C program read input file and output with "\n" new line every 50 characters -

void filecopy(file *ifp, file *ofp) { int c; while((c = getc(ifp))!= eof) putc(c,ofp); } so, have try: void filecopy(file *ifp, file *ofp) { int c; int count = 0; while((c = getc(ifp))!= eof) if(count == 50){ putc("\n",ofp);//this didnt work count = 0; } putc(c,ofp); } am supposed use type of pointers? im not c pointers, know? thank you. your putc attempting output string, pointer. putc takes initial 8 bits char of variable, not \n in case. you want (note single quotes): putc('\n', ofp); if using windows, may need output \r\n desired result. finally, loop isn't testing every 50 characters, it's outputting value on each loop iteration. assume have done test.

cakephp - Could not load configuration file public_html/app/Config/facebook.php -

Image
iam trying implement basic facebook functionality in cakephp project. iam getting following error: i did bit of digging , turns out /public_html/app/config/facebook.php wrong location cakephp-facebook-plugin. cakephp located in /public_html/app/plugin/facebook//config/facebook.php funny thing cant clue cakephp getting wrong location. also iam using cakephp-facebook-plugin ver 3.1.3 (latest) cakephp framework version 2.5.4 (old) i running on hostinger free subdomain account , people suggested curl issue free accounts seems enabled on php configuration settings. solved, had move facebook.php file app/config/

sqlite - Count items in column SQL query -

let's have table looks like, id 2 2 3 4 5 5 5 how like, id count 2 2 3 1 4 1 5 3 where count column count of each id in id column? you want use group operation select id, count(id) table group id

r - Generating and Summing Matrix -

i'm relatively new r, forgive me believe relatively simple question. i have data in form 1 2 3 4 5 0 1 1 0 0 b 1 0 1 0 1 c 0 1 0 1 0 d 1 0 0 0 0 e 0 0 0 0 1 where a-e people , 1-5 binaries of whether or not have quality. need make matrix of a-e cell a,b = 1 if sum of quality 1-5 & b sums 2. (if share @ least 1 quality). simple 5x5 be: b c d e 1 b 1 1 c 1 0 1 d 0 1 0 1 e 0 1 0 0 1 i need sum entire matrix. (above 9). have thousands of observations, can't hand. i'm sure there easy few lines of code, i'm not experienced enough. thanks! edit: i've imported data .csv file columns (1-5 above) variables, in real data have 40 variables. a-e unique id observations of people, approximately 2000. know how first convert matrix, in order execute great answers have provided. thanks! you can use matrix multiplica

geolocation - How to retrieve the location of another android device? -

first of mention done consent of users! that being said, trying create application users see location , location of other connected users (latitude , longitude). i pretty sure best way send data server , have each device retrieve data know if there exist other ways of doing this. or perhaps point me in right direction on how create such system server retrieving , sending data android devices ? gps coordinates you. can coordinates , save in server coordinates of particular device can retrieved connected device. we have location , locationmanager in android shall job you. read more these in android developers

oracle11g - Beginner Oracle 11g SQL - Create Pivot Table from joining multiple tables -

i have multiple tables, each fk relationships connect them 1 another. need create pivot table using details out of of tables. region table region_id|region_description state table state_id|state_description|region_id_fk order table order_id|order_date|state_id_fk category table category_id|category|description|order_id_fk i joining tables using natural join, based on fks. i need determine how many orders in each category each region. the resulting table should this: category|region1|region2|region3|total sporting 1 0 3 4 etc 0 2 1 3 select c.category, count( case r.region_id when 1 1 else null end ) region1, count( case r.region_id when 2 1 else null end ) region2, count( case r.region_id when 3 1 else null end ) region3, count( case r.region_id when 4 1 else null end ) region4 region r inner join state s on (r.region_id = s.region_id_fk) inner join

c++ - How to get cursor to next line after using ">>" operator when reading from file -

i trying read information .txt file looks shown below.to read first 2 lines of integers use ">>" operator read them array. problem want read next line(in entirety) string can convert stream , parse it, when try use getline doesn't read string got me thinking cursor hasn't moved next line , wondering how or other method serve save purpose. structure of txt file below: 2 10 10 10 10 10 10 20 20 20 15 15 15 15 15 15 15 20 30 20 15 15 10 10 10 765def 01:01:05:59 enter 17 abc123 01:01:06:01 enter 17 765def 01:01:07:00 exit 95 abc123 01:01:08:03 exit 95 my code show below: #include<iostream> #include<fstream> #include<string> #include <sstream> using namespace std; int main() { int arr[24]; int milemarker; int numberofcases; ifstream file; file.open("input.txt"); file >> numberofcases; (int = 0; < 24; i++) { file >> arr[i]; } (int = 0; < 24; i++) {

R Shiny: fast reactive image display -

i'm trying display images in shiny app reactively. i've done in server.r script with: output$display.image <- renderimage({ image_file <- paste("www/",input$image.type,".jpeg",sep="") return(list( src = image_file, filetype = "image/jpeg", height = 520, width = 696 )) }, deletefile = false) but it's very slow . however, very fast embed 1 of images ui.r script so: tabpanel("live images", img(src = "img_type1.jpeg")) why there such difference? there way make reactive images appear faster? hi can use conditionalpanel this, embed images 1 have true condition displayed : tabpanel("live images", conditionalpanel(condition = "input.image_type == 'img_type1'", img(src = "img_type1.jpeg") ), conditionalpanel(condition = "input.image_type == 'img_type2'",

Swift - Is it possible to select a video from the library on the iOS simulator? -

all shows when use uiimagepickercontroller library of photos. have mp4 video saved simulator library, never shows in list when access simulator library programmatically uiimagepickercontroller. there i'm doing wrong? based on swift 2.2 your code may this: @ibaction func selectimagefromphotolibrary(sender: uibarbuttonitem) { let imagepickercontroller = uiimagepickercontroller() imagepickercontroller.sourcetype = .photolibrary imagepickercontroller.delegate = self imagepickercontroller.mediatypes = ["public.image", "public.movie"] presentviewcontroller(imagepickercontroller, animated: true, completion: nil) } actually can answers apple document: uiimagepickercontroller class reference the useful method class func availablemediatypesforsourcetype . you can try this: let types = uiimagepickercontroller.availablemediatypesforsourcetype(.photolibrary) print(types) then know videos types named public.movie , not kutt

email - Gmail API Limits Per IP Address -

i have saas based app launching , want make sure understand gmail api limits: if go here: https://developers.google.com/gmail/api/v1/reference/quota i see 100000000 quota units per day my app utilizes api send emails on someones behalf gmail account. lets assume emails google rest api coming single ip address. my current understanding able send 1mm emails day total , ~2 emails second per user, free out cc. is correct ? partly. send 1,000,000 emails per day gmail, need in aggregate across many different gmail accounts. a user account allowed send 500 emails per day, maximum of 100 recipients. what's more, may find if repeatedly hitting limit, google close account because it's being abused. gmail not smtp mailing service - use sendgrid, mandrill or amazon ses that.

sql - INTERSECT on a particular column or excluding a column -

been while since i've played in sql world , use hand trying solve 1 haven't been able work out how yet. i have query joining lot of results using union , removing using intersect such as: (query 1 union query 2 union query 3) intersect query 4 my problem have computed column in each of queries 1-3 denotes query came from. i.e. col 1 | col 2 | col3 .... q1 | | b .... q2 | | d .... q3 | e | d .... the union of these fine, when want intersect query cannot seem find way ignore column. so question is: how can ignore column when doing intersect, or intersect on specified column? note: incorporate q4 each of other queries seems lot of unnecessary duplication. you can use inner join instead of intersect : select q.col1 uq, x.col1 iq, q.col2, q.col3 ( select * (values ('q1', 'a', 'b')) q(col1, col2, col3) union select * (values ('q2', 'a', 'd')) q(col1, col2, col3) union

go - Golang, unable to have value pushed into 'global' channel when handling HTTP requests -

currently working on application can take anywhere few seconds 1 hour + process. because of using channel block requests while others processing seems fit. following example of im trying accomplish, having issue seems program stalling when trying add data said channel (see below). package main import ( "net/http" "github.com/gorilla/mux" ) type request struct { id string } func constructrequest(id string) request { return request{id: id} } var requestchannel chan request // <- create var channel func init() { r := mux.newrouter() r.handlefunc("/request/{id:[0-9]+}", processrequest).methods("get") http.handle("/", r) } func main() { // start server http.listenandserve(":4000", nil) requestchannel = make(chan request) // <- make channel , assign var go func() { { request, ok := <-requestchannel if !ok{ return

sql - Loading data in the file (which is in FTP over SSH) using SSIS -

i have ssis package loading data file. file in network drive , manager want file in ftp on ssh server. don't see task ssis can this. know ftp task not work here. can 1 please me out. how execute process task, depends on using connect if winscp here example

apache - Get error description with .htaccess/PHP -

i'm running apache server, , want custom php error page display error number , error description. example, have in .htaccess: errordocument 404 /?e=404 and in error page: <?php $e = $_get['e']; if($e === 404){ ?> error: <?=$e?> <?php } ?> so display: error: 404 want show description too, such as error: 404 not found without having pull database etc. in php. possible pass parameter or .htaccess? as far know, there no magic can translate error code in description you. doesn't mean can't continue on path took: errordocument 404 /?e=404&desc=not%20found now errorcode in $_get['e'] , description in $_get['desc'] .

android - Update previous fragment after back button is pressed inside view pager -

imagine have activity fragment , has list of contacts , button create new contact. when press button, second fragment placed (with .addtobackstack(null) , replace() ) 2 fields contact creation , button save it. i create new contact , press button. edit being more specific, project structured this: mainactivity | | containerfragment | | |_ _ _ tab | |_ _ _ fragment 1 | | | |_ _ _ fragment 2 | | | |_ _ _ fragment 3 | | | |_ _ _ ... | |_ _ _ tab b | |_ _ _ fragment 4 | | | |_ _ _ fragment 5 | | | |_ _ _ fragment 6 | | | |_ _ _ ... | |_ _ _ tab c | |_ _ _ fragment 7 | | | |_ _ _ fragment 8 | | | |_ _ _ fragment 9 | | | |_ _ _ ... my problem fragment 2 able change things shown in fragment 1 , after changing button, fragment 2 disappears, nothing being called on fragment 1 . no onresume() or oncreateview() . doing wr

c++ - Reading a comma delimited file part by part -

i have assignment school , have read comma delimited file , put each value in char*. ex) file contains: 5,justin,19,123-4567,etc.. char * firstvalue = 5; char * secondvalue = justin; char * thirdvalue = 123-4567; etc.. i cannot use std::string since haven't learned yet. supposed ifstream or other file streams. have no idea how this for homework assignments iterating on char array in loop , every time comma encountered splitting string work (i won't give code because exercise try work out yourself). real world use should aware csv format considerably more complex. consider multiline entries or entries escaped comma , how break above solution. recommend using libcsv real world csv parsing.

json - How to access Oanda's API in Python -

i'm looking current rate oanda's api. how in python? have following credentials , have tried far has been bust. streaming rates not work cannot parse correctly. here appreciated. curl -x "https://api-fxpractice.oanda.com/v1/instruments?accountid=12345&instruments=eur_usd" under normal circumstances work, however, require "token" passed call , have no idea how implement that. here have in documentation: curl -h "authorization: bearer 12345678900987654321-abc34135acde13f13530" https://api-fxtrade.oanda.com/v1/accounts (not access token way, on site) any great! in addition here of streaming code have tried adapt: import requests import json optparse import optionparser def connect_to_stream(): """ environment <domain> fxtrade stream-fxtrade.oanda.com fxtrade practice stream-fxpractice.oanda.com sandbox stream-sandbox.oanda.com "&

sql - ActiveRecord regular-expression search by whole word -

i want search activerecord model product keyword, want match whole words in description instead of arbitrary substrings. say have string 'the packaging may vary' as product 's description , search using keyword 'aging' should not match, search 'packaging' should match. match words, beginning or end of string. want this: product.where("description ~* ?", "regexp") what should replace regexp with, "%[^|| ]#{string}[$|| ]%" ? product.where("description ~* ?", "\m#{string}\m") \m matches @ beginning of word , \m matches @ end of word. more info here: http://www.postgresql.org/docs/9.0/static/functions-matching.html

SQL command using parameters syntax error -

hi new sql , c# queries. using select statement , puttin @ parameters in using sql. string cmd = "select (firstname, lastname, address, city, postalcode, country, username) values (@firstname, @lastname, @address, @city, @postalcode, @country, @username) [customer];"; it doesnt sql can tell me why? says incorrect syntax can not spot where? thanks dom the select statement used select data database. if want retrieve data don' t have add values keyword: select column_name,column_name table_name; with query: string cmd = "select firstname, lastname, address, city, postalcode, country, username customer;"; in case wanted retrieve data parameters syntax: select column_name,column_name table_name column_name operator value; with query: string cmd = "select firstname, lastname, address, city, postalcode, country, username customer firstname=@firstname , lastname=@lastname , address=@add

r - reliably extract srclines and srcfile from a function -

i need extract exact lines of source parsed create r function, use in coverage analysis. deparse not accurate enough because in doing coverage analysis package covr exact line numbers matter. if there srcfile, need filename. if there isn't, e.g. function created in console, need create equivalent temporary file have been, line line, source file function. i see several function extract src information function, getsrcfilename or getsrcref , none source code. getsrclines looked promising, doesn't take functions arguments. tried use attributes srcref , information way, doesn't seem stored consistently -- missing something. sometimes attributes(body(cover.fun))$srcfile works , attributes(attributes(cover.fun)$srcref)$srcfile) does, , in srcref found source in srcfile$lines or srcfile$original$lines , of course these experiments , not right way implement this. i need takes care of functions created in package, source or interactively. if filename avail

java - Strange dead-lock with Streams API -

i working program, , decided use new streams api java 8. however, program stopped working when introduced .parallel() . here's relevant code: import java.math.biginteger; import java.util.objects; import java.util.stream.stream; import com.google.common.cache.*; public class alg196 { public static void main(string[] args) { // add .parallel() suitable long c = stream .iterate(biginteger.valueof(101), -> i.add(biginteger.one)) .limit(100000000).map(biginteger::tostring).map(alg196::alg196) .filter(objects::nonnull).count(); system.err.println(c); } private static final string reverse(string n) { return new stringbuilder(n).reverse().tostring(); } private static final boolean ispalindrome(string s) { (int = 0, j = s.length() - 1; < j; ++i, --j) { if (s.charat(i) != s.charat(j)) return false; } return true; }

c# - Setting ImageSrc for each template -

so in confusing situation right now, have listview itemtemplate contains image element: <asp:listview id="listview1" runat="server"> <itemtemplate> <asp:image id="image1" class="main" runat="server" imageurl='<%# eval("photo1") %>' /> </itemtemplate> </asp:listview> in click event have following code: protected void btn_search_click(object sender, eventargs e) { var img = listview1.items[0].findcontrol("image1") image; var lbl = listview1.items[0].findcontrol("lbl_id") label; string image = img.imageurl; foreach (listviewitem item in listview1.items) { if (img.imageurl == "defaultcar.jpg") { img.imageurl = "images/defaultcar.jpg"; } else { img.imageurl = "images/" + "44/" + image; }

c++ - C++11 aggregate initialization for classes with non-static member initializers -

is allowed in standard: struct { int = 3; int b = 3; }; a{0,1}; // ??? is class still aggregate? clang accepts code, gcc doesn't. in c++11 having in-class member initializers makes struct/class not aggregate — changed in c++14, however. found surprising when first ran it, rationale restriction in-class initializers pretty similar user defined constructor counter argument no 1 expects adding in-class initializers should make class/struct non-aggregate, sure did not. from draft c++11 standard section 8.5.1 aggregates ( emphasis mine going forward ): an aggregate array or class (clause 9) no user-provided constructors (12.1), no brace-or-equal initializers non-static data members (9.2), no private or protected non-static data members (clause 11), no base classes (clause 10), , no virtual functions (10.3). and in c++14 same paragraph reads: an aggregate array or class (clause 9) no user-provided constructors (12.1), no private or pr

Intellij IDEA reformat scala code -

if have scala method declaration long fit in single line, separate in several lines, , reformat expectations is: protected def prunefilterproject( relation: logicalrelation, projectlist: seq[namedexpression], filterpredicates: seq[expression], scanbuilder: (array[string], array[filter]) => rdd[row]) = { prunefilterprojectraw( relation, projectlist, filterpredicates, (requestedcolumns, pushedfilters) => { scanbuilder(requestedcolumns.map(_.name).toarray, selectfilters(pushedfilters).toarray) }) } but after reformat code( control + alt + l ), output is: protected def prunefilterproject( relation: logicalrelation, projectlist: seq[namedexpression], filterpredicates: seq[expression], scanbuilder: (array[string], array[filter]) => rdd[row]) = { prunefilterprojectraw( relation, projectl

php - How to change the href (url) in a link (a) element? -

here full link. <a href="http://localhost/mysite/client-portal/">client portal</a> i want above link following. <a href="#popup">client portal</a> i don't know how work preg_replace done. preg_replace('\/localhost\/mysite\/client-portal\/', '#popup', $output) if link can achieve goal str_replace() : <?php $link = '<a href="http://localhost/mysite/client-portal/">client portal</a>'; $href = 'http://localhost/mysite/client-portal/'; $new_href = '#popup'; $new_link = str_replace($href, $new_href, $link); echo $new_link; ?> output: <a href="#popup">client portal</a> if want can use dom : <?php $link = '<a href="http://localhost/mysite/client-portal/">client portal</a>'; $new_href = '#popup'; $doc = new domdocument; $doc->loadhtml($link); foreach ($doc->geteleme

ios - Issue AppSubmit None of valid provisioning profiles allowed the specified entitlements Watchkit -

Image
i have 2 days around trying solve problem. when try submit app, have 2 issues no matching provisioning profiles found "applications/myapp.app none of valid provisioning profiles allowed specified entitlements: beta-reports-active, com.apple.security.application-groups. and same in watchkit extension.appex the bundles com.mycompany.myapp , com.mycompany.myapp.watchkitapp the app-group active in app , apple watch app group.com.mycompany.myapp in .entitlements com.apple.security.application-groups have item 0 app group any idea problem? this problem looks similar question. no matching provisioning profiles found watchkit extension when submitting app store and question: submit watchkit provisioning error i had same problem. here solution worked me. technical q&a qa1830 beta-reports-active entitlement q: how resolve "beta-reports-active" code signing error? https://developer.apple.com/library/ios/qa/qa1830/_index.html i had regener

c++ - 'stack::n' : cannot access private member declared in class 'stack' -

class stack { int n;//problem char a[100];//problem int top; public: bool isempty() { return top == -1; } stack() { top=-1; } bool push(const char &c) { if(top == 100) { return false; } top++; a[top] = c; return true; } bool pop(char &c) { if(top == -1) { return false; } c = a[top]; top--; } char get_top()const { return a[top]; } }; c:\users\tri\documents\visual studio 2010\projects\assignment01\assignment01\code.cpp(73): error c2248: 'stack::n' : cannot access private member declared in class 'stack' 1> c:\users\tri\documents\visual studio 2010\projects\assignment01\assignment01\headerfile.h(20) : see declaration of 'stack::n' 1> c:\users\tri\documents\visual studio

ios - Two buttons in UINavigationBar not aligned -

Image
i have following code in viewdidload add 2 buttons on right of uinavigationbar - omitted code of left "cancel" button. uibarbuttonitem *donebuttonitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem: uibarbuttonsystemitemdone target: self action: @selector(done:)]; uibarbuttonitem *addbutton = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem: uibarbuttonsystemitemadd target: self action: @selector(add:)]; nsarray* buttons = @[addbutton, donebuttonitem]; self.navigationitem.rightbarbuttonitems = buttons; works great, doesn't good, "+" symbol seems bigger word "done" , appear off center

javascript - Image manipulation on the server or client side? -

i'm developing web application based on django , need online image manipulation. want allow user upload images, manipulate them (crop, filters, re-order, etc) , send them server. my question is: should manage image manipulation on server using or on client-side? you can example website: printstudio.io thanks in advance. i can see need user able manipulate images, more efficient allow them so, client side. for client-side : there few javascript libraries available. fabricjs , camanjs use <canvas> element provide image manipulation capabilities. camanjs should sufficient needs. it recommended not image processing server-side, here libraries purpose, information's sake. for server side : use pillow server side, fork of pil - python imaging library. it 1 of best image manipulation tools, can perform cropping, making thumbnails, etc website requires. i have used in on server , uploaded s3.

c# - Looping through a ASP.NET Listbox with Javascript not working -

i'm trying loop through asp.net listbox javascript, i'm getting null object or undefined when hits lboxright variable in loop. here's have. function save() { var containstypea = false; var containstypeb = false; var containstype = false; var lboxright = $get('<%=lboxright.clientid %>').value; if (lboxright != null) { (var = 0; < lboxright.options.length; ++i) { if (lboxright.options[i].value == "type a") { containstypea = true; } if (lboxright.options[i].value == "type b") { containstybeb = true; } } containstype = true; } } there's onclick event mapped when save button pressed calls function. doing right way @ listbox , tell me if has specific value in it? intention listbox contain type a value , when loops through listbox, if finds value within list set variable true other logic. visual studio seems complain loop line, doing wrong here? using exact same loop

html - Trouble Centering -

i'm developing webpage , followed tutorial " https://www.youtube.com/watch?v=1tdrozm__k0 ". thing trying change centering text. , i've haven't been able right. it's been close, ocd won't allow it. appreciated. thanks body { width: 100%; margin: auto; font-family: helvetica; } .header { background: #383838; width: 100%; top: 0; position: fixed; } .container { width: 960px; margin: 0 auto; } .logo { float: center; font-size: 15; color: white; } <doctype html> <html> <head> <title>website</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <!-- ignore this! livereload --> <script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>&

c# - Write data to textbox row by row from database -

Image
i want display data database row row in table how write data database each textbox row wise (i.e) date activity1,activity2 etc next row date activity1,activyt2 etc.. how write proper loop the code have tried getting data first row: private void getactivity() { try { con = new oracleconnection(connection); con.open(); oraclecommand command1 = new oraclecommand("select activityid,to_char(activitydate,'dd-mon-yyyy') activitydate,title,starttime,endtime,activitytime timetaken daily_activities1 activitydate= (select min(activitydate) daily_activities1)", con); oracledatareader reader = command1.executereader(); int count = reader.fieldcount; if (reader.hasrows) { while (reader.read()) { if (date1textbox.text == "") { date1textbox.text = re

php - i edit my file in localhost it perfectly worked.but after up my site it shows error and not working properly -

i'm working in php codeigniter . when edit file on localhost works perfectly. but after having uploaded site, showing error (as shown below) , not working properly. severity: warning message: cannot modify header information - headers sent (output started @ /home/innofeast014/public_html/caremykiddie.com/demo/hospital/controllers/patient_register.php:664) filename: libraries/session.php line number: 688 a php error encountered severity: warning message: cannot modify header information - headers sent (output started @ /home/innofeast014/public_html/caremykiddie.com/demo/hospital/controllers/patient_register.php:664) filename: helpers/url_helper.php line number: 542 any idea concerning error please? this error might come if have spaces before first php tag. can post index.php file or whatever works entry file

java - error: the left-hand side must be a variable -

eclipse giving me error "the left-hand side must variable" @ part of code: else { for(int i=0; i>=cellphonearr.length; i++) {if (cell_1.equals2(cellphonearr[i])) system.out.println(cellphonearr[i]); else (cell_1.equals3(cellphonearr[i])); ---> error system.out.println(cellphonearr[i]); } the method equals3 following: public boolean equals3(cellphone phone) { if (brand.equals(phone)); } i've been trying figure 1 out, way invoked 2 other methods equals 1 , 2 both worked object cell_1. try as: else { for(int i=0; i>=cellphonearr.length; i++) {if (cell_1.equals2(cellphonearr[i])) system.out.println(cellphonearr[i]); else if(cell_1.equals3(cellphonearr[i])) system.out.println(cellphonearr[i]); } and method equals3 must return boolean values as: public boolean equals3(cellphone phone) { if (brand.equals(phone)) return true; else return false; }

jsf - set content of tinymce with a string of html -

i have jsf renderer uses responsewriter generate jsf page . in class create string contains html code , : string s = "<b>hello</b> <i>world</i>" . when create tinymce editor , set value of responsewriter : responsewriter.writetext(value, null); it show same string (showing html tag) instead of html format of it. i know it's wrong use writetext writing html don't know use instead. try setcontent. responsewriter.setcontent(s); more information here: http://www.tinymce.com/wiki.php/api3:method.tinymce.editor.setcontent

javascript - Cannot append DOM element to DIV node: Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node' -

using dom parser parsed string , , tried append object container, so: var newcategory = "<div class=\"column-expenses-left\" id=\"newcategory"+ expensecategorycssname +"\">" + "<hr />" + "<div style=\"text-align: center;\">" + "<?php echo $budgetexpense[\'expensecategory\'][\'cssname\']; ?>&nbsp;" + "<span>" + "<a href=\"#\" class=\"delete-category\"><img alt=\"\" src=\"/theme/all/img/trash_can_small.png\" style=\"width: 15px; height: 15px; float: right;\" id=\"\" alt=\"delete\"/></a>"+ "</span>" + "</div>" + "<hr />" + "<p class=\"pointer\" style=\"text-align: cent

c++ - Eclipse Formatter: Enums and Constructor -

Image
i try apply guidelines code formatter in eclipse, have problem 2 things: @ first, enum classes: what expect after formatting: enum class type : uint8_t { first = 1, second = 2, third = 3 } what after formatting: enum class type : uint8_t { first = 1, second = 2, third = 3 } the second thing constructors: again, expect: example::example(int x) : _x(x) { } and get: example::example(int x) : _x(x) { } so have change line break of enums , indention of assigment list of constructors. sadly dont find options.. can help? you can control formatting options using project properties->c/c++ general->formatter tab: using edit following window options pops up: regarding enum declarations seems line wrapping options can controlled: