Posts

Showing posts from July, 2011

visual c++ - C++ Need help converting string to tchar, tried some things from other posts, but not working -

this first c++ program have written, no means c++ programmer, please kind. needed able connect database, link , download file link. works except have hardcode link rather use link have saved in string. need convert string tchar , have tried few things, it's not working. need tchar url[] have value in string dotnetlink, instead of hard coded url in there. thank help. string dotnetlink; //request url download send(socket,"post /getdotnetlink.php / http/1.1\r\nhost: www.domain.com\r\nconnection: close\r\n\r\n", strlen("post /getdotnetlink.php / http/1.1\r\nhost: www.domain.com\r\nconnection: close\r\n\r\n"),0); char buffer[10000]; int ndatalength; while ((ndatalength = recv(socket,buffer,10000,0)) > 0){ int = 0; while (buffer[i] >= 32 || buffer[i] == '\n' || buffer[i] == '\r') { //link download stored in string dotnetlink = dotnetlink + (buffer[i]); += 1; }

java - How to filter a backspace keyboard input -

i have code gives message when key number pressed: txtvalueofclause.addeventfilter(keyevent.key_typed, new eventhandler<keyevent>() { @override public void handle(keyevent t) { char ar[] = t.getcharacter().tochararray(); char ch = ar[t.getcharacter().tochararray().length - 1]; if (!(ch >= '0' && ch <= '9')) { system.out.println("the char entered not number"); t.consume(); } } }); now if press on wrong button , press backspace remove it, error message. how can add backspace input if statement? i have found answer: txtvalueofclause.addeventfilter(keyevent.key_typed, new eventhandler<keyevent>() { @override public void handle(keyevent t) { char ar[] = t.getcharacter().tochararray(); char ch = ar[t.getcharacter().tochar

c++ - comma separated stream into struct -

i have structure int , 2 strings. when reading in file comma seperated first 2 values , last value terminated newline. third argument empty however. ex data: 7, john doe, 123-456-7891 123 fake st. i want make program grab first number , put in int, find comma , put second number in struct's string etc. first question should use class instead? have seen getline(stream, mystring, ','); arguments different data types can't throw them vector. my code: struct person{ int id;//dont care if unique string name; string extrainfo; }; int main(int argc, char* argv[]){ assert( argc ==2 && "invalid number of command line arguments"); ifstream inputfile (argv[1]); assert( inputfile.is_open() && "unable open file"); } what best way of storing information , retrieving file comma separated first 2 , ends newline? want program ignore blank lines in file. i'd read file line-by-line using normal ge

html - Border-box breaks the container of the responsive image -

Image
i have <div> , fixed height , padding. border-box property applied on whole page. inside <div> have <img> max-width:100% , , max-height:100% properties. problem container wider excepted (i think because of padding ). what best solution add padding around image without breaking design or how fix it? i saved jsfiddle ( http://jsfiddle.net/4eo6bebj/ ) , added question. *, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } #responsive-image { height:150px; border:1px solid red; display:inline-block; float:left; padding:15px; } img { max-width:100%; max-height:100%; } <div id="responsive-image"> <img src="http://lorempixel.com/400/200/sports/"> </div> update: problem visible in firefox. you remove padding div , add inner elements. http://jsfiddle.net/6ux1wjlc/ *, *:befor

php - Convert a full wordpress site to HTTPS -

i'm trying wordpress site https, try gives me redirect loop. i've edited htaccess, i've set in php, i've downloaded wordpress plugin convert it, every method gives me redirect loop error. know has redirecting https http, don't know what. here .htaccess file without of https settings in it: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress and here's php i'm trying use in header php file conver page https: if($_server["https"] != "on") { header("location: https://" . $_server["http_host"] . $_server["request_uri"]); exit(); } you don't need blanket redirect in .htaccess or in php. go dashboard >> settings , change urls https. save permalinks. you may want find/replace http urls in post/

Unit Testing a PHP Script -

i have php scripts run cronjobs. no classes , few functions. id test script phpunit make sure working appears need rewrite php class, dont want (or know how to). for example if had script , function add 1 , 2 together, <?php $a=1; $b=2 $c=$a+$b; ?> how test $c==3 phpunit? thanks, don for example, don't test $c = 3. but because example little simplistic. variable $c stops existing after script executes. fact exists doesn't matter. want test code does, not how things. i modify example little bit: job.php <?php $a=1; $b=2 echo $a + $b; ?> now have output , behavior. test like: public function testjob() { require('job.php'); $this->expectoutputstring('3'); } phpunit has ability assert against stdout. make sure code outputs expect. tests these types of files check did correct. since php's require statement execute file @ point, can run script , check output. if file has functions, inc

javascript - JQuery change CSS style of table cells which contain disabled elements -

with jquery, how can select , change css style of text elements inside table cells contain disabled "input" and/or "select" elements? i need iterate on cells in table, see if there disabled "input" and/or "select" elements in there, , if case, text in particular cell should "dimmed" setting css property opacity=0.5. the solution must work in reasonably modern browsers. use jquery :has() , :disabled pseudo-selectors on td elements: $('td:has(:disabled)').css('opacity', .5); if need more specific disabled elements (probably not needed), use :input ( :input covers both select , input): $('td:has(:input:disabled)').css('opacity', .5);

python - Split User input into different Variables -

i'd take user input (like ip address) , split parts separate variables for example 255.255.255.0 now, split string decimal points , save each part own variable. 255 variable1, 2nd 255 variable2, 3rd 255 variable3 , 0 variable 4 integers. how can this? you do: a, b, c, d = input().split(".") the split() method, default, splits string @ each space list. but, if add optional argument, split string character/string. can read more @ official documentation you can check make sure input in proper ipv4 format. if re.match("\d+[.]\d+[.]\d+[.]\d+", input()): print("ipv4 format")

excel - Copy a range from one sheet to the first empty row from another sheet -

in excel sheet have inserted button executes macro. code macro: sub button1_click() ' ' button1_click macro ' ' keyboard shortcut: option+cmd+y ' range("a17:i34").select selection.copy sheets("items control").select range("a7").select selection.pastespecial paste:=xlvalues, operation:=xlnone, skipblanks:= _ false, transpose:=false range("a3:i9").select end sub the source sheet "orden de compra" , sheet want copy selected range "items control". what need copy not empty rows selected range first empty row end sheet, , not range have in current code. thank you would work? sub button1_click() 'this select whole range of cells starting in a17 sheets("orden de compra").select range(range("a17"), range("a17").end(xldown).end(xltoright)).copy 'now need find first free row in next sheet, assuming rows have

java - How to delete an object that are written into file? -

in program, user gives inputs , added arraylist. arraylist object written file. have created method writing , read file (using file-i/o & object-i/o stream). now if want delete particular object file, how do that? this part of workin on: case 4: bankaccounts2=(list<bankaccount>)rw.readfromfile();//method calling; bankaccount class settre , getter iterator<bankaccount> it=bankaccounts2.iterator();//bankaccounts2 arraylist reading file system.out.println("enter account want delete:"); deleteacc = sc.nextint(); while (it.hasnext()) { bankaccount next = it.next(); if (next.getaccnum() == deleteacc) { it.remove(); } } break; the easiest solution in mind read objects file arraylist . remove 1 want delete aforementioned list. finally, overwrite initia

ruby on rails - Accessing instance method from class method -

i have rails 4 app has alert model , tests associated each alert. when new alert created have after_create filter uses instance method create new test: class alert < activerecord::base has_many :tests after_create :create_test private def create_test #bunch of code using external api data test.create end end i have cron job want use create new test each alert. plan have class method that: def self.scheduled_test_creation @alerts = alert.all @alerts.each |a| a.create_test end end that won't work because instance method private. know can around using send example. or can make methods public. or can rewrite bunch of api code in instance method. i not sure best way be. don't want write same code twice , want make sure practice. maybe in case methods don't have private - know difference between public/private/protected don't understand when methods should private/protected.

javascript - Number-count-up animation in a non-blocking way -

i trying count number target value in animation-like style. environment titanium on ios. follows. function countnumberup(label) { label.currentval = label.currentval ? label.currentval : 0; settimeout(function() { if (label.currentval < label.targetval) { label.currentval += 1; label.settext(label.currentval); countnumberup(label); } }, 5); } label instance of ti.ui.label . first problem see label.settext()-method veeery slow. cool if number counts in rush it's 5 steps per second if vary second parameter of settimeout(). the other thing animation totally blocks die main/ui thread of ios , ui hardly accepts actions until animation has finished. seems settimeout not run in seperate thread. does of know better way this? btw. have tried setinterval() doesn't seem better. try example: function countnumberup(label){ var interval = setinterval(function(){ i

including python code in php -

i want include following python code php. name of python file hello.py. contents print "hello world" want call python script in php , show same in webpage not possible that. use exec or passthru run python in terminal , return results. best option separate call python script , combine them on client.

sql server - Why does this query take so long in Entity Framework, when it's so fast in SQL? -

i have table named geographicallocations, contains 57k rows. if run following query in sql server management studio, takes 1-2 seconds complete... select * geographicallocations active=1 if equivalent in linqpad, takes 2-3 seconds... geographicallocations.where (gl => gl.active) however, same code in repository uses ef4 takes 10-11 seconds... list<geographicallocation> geographicallocations = new salestrackercrmentities() .createobjectset<geographicallocation>() .where(g => g.active) .tolist(); by way, we're stuck ef4 moment, please don't suggest upgrading. i'd love to, there other factors stopping moment. any idea how can speed up? users complaining slow response. it's not database, sql query fast. looks ef, don't know what. i ran sql profiler on it, , see sql sent. took less second run in ssms, profiler showed 10 second gap between start , end of batch. not sure what's going on here, have thought ef pull out data, ma

php - Wordpress IF IS MOBILE without tablets -

right if mobile = true means contant shows on smartphones & tablets, want mobile = smartphones only, mean this: <?php if (wp_is_mobile() === true) { ?> content smartphones <?php } ?> <?php if (wp_is_mobile() === false) { ?> content tablets & pc <?php } ?> of course, have code on function.php beacuse cant edit "if mobile" code on theme & plugins.

How to use navtitle from parent topicref instead of child one during generating pdf by dita-ot -

i'm using dita-ot tool convert dita pdf. i have parent ditamap file this: <topicref href="111.ditamap" navtitle="parent title 111" format="ditamap"> ... </topicref> <topicref href="222.ditamap" navtitle="parent title 222" format="ditamap"> ... </topicref> and 2 child ditamap files 111.ditamap: <topicref navtitle="child title 111" format="ditamap"> child content 111 </topicref> 222.ditamap: <topicref navtitle="child title 222" format="ditamap"> child content 222 </topicref> in result pdf have somth. this: ... child title 111 child content 111 child title 222 child content 222 ... but i'd have this: ... parent title 111 child content 111 parent title 222 child content 222 how can achieve it? a reference dita map transparent in table of contents, not add title , level it. want achi

Android Realm Migration version number based on what? -

i'm doing first realm migration , started thinking version number. on version number based? because if based on over phone, how handle if new person installs app , gets migration? because update fields set because of fresh install. christian realm here. migration api still in experimental state , kinda ugly, right version number start 0, , way changing through migration. this means if want fresh install different version other 0, have like: // pseudo code public class realmhelper() { private static sharedpreferences prefs; public static realm getinstance() { if (!prefs.getboolean("versionset", false)) { string path = new file(context.getfilesdir(), realm.default_realm_name).getabsolutepath(); realm.migraterealmatpath(path, new realmmigration() { @override public long execute(realm realm, long version) {

osx - How to define two aliases for one command in one statement -

i know how configure aliases in bash, there way map alias 2 possible shortcuts in 1 statement? here 2 line version alias "gac"="git add . && git commit -am " alias "gitac"="git add . && git commit -am " i imagine solution, if possible, this: pseudo code: alias "alias1 || alias2"="command" is possible aliases or have use function , if how? $ alias {gac,gitac}="git add . && git commit -am " $ alias gac alias gac='git add . && git commit -am ' $ alias gitac alias gitac='git add . && git commit -am '

c# - Web service asp.net POST method -

based on tutorial ( http://www.codeproject.com/articles/405189/how-to-access-sql-database-from-an-iphone-app-via ) i try webservices in asp.net. method works... post method don't. (i verify app of chrome "postman") , have , error: error 404, no found end not found i hope u can me that, i'm started web services. code asp.net the interface namespace jsonwcfservice { [servicecontract] public interface igetemployees { [operationcontract] [webinvoke(method = "get", responseformat = webmessageformat.json, bodystyle = webmessagebodystyle.wrapped, uritemplate = "json/employees")] list<employee> getallemployeesmethod(); } [servicecontract] public interface ipostemployees { [operationcontract] [webinvoke(method = "post", responseformat = webmessageformat.json, requestformat = webmessageformat.json, bodystyle = webmessagebodystyle.wrapped, uritemplate = &q

Parsing html links by html agility pack in c# -

i'm new in c#. need pars link category , subcategory. i have category, when try take subcategory have error: "object reference not set instance of object". my code: foreach (var link in xpathlinks) { okno.text += link.attributes["href"].value + "\n"; string doc2 = htmlpage.downloadstring("htmlpage" + link. attributes["href"].value); dokument2.loadhtml(doc2); htmlnodecollection xpathlinks2 = dokument2.documentnode. selectnodes("//ul[@class='category-nav']//li//a"); foreach (var link in xpathlinks2) { okno.text += link.attributes["href"].value + "\n"; } } } i'm usin htmlagilitypack. error in xpathlinks2.

forms - How can I validate select2 elements with using jquery validation plugin? -

i use select2 3.5.2 , jquery validation 1.13.1 .i add error class select2 elements using validation plugin "highlight" method when select value can't remove error class. how can solve this? html <form id="test" class="frm"> <div> <input type="text" name="name" /> </div> <div> <label for="singleselect"></label> <select class="sl" id="singleselect" name="singleselect"> <option></option> <option value="val1">val-1</option> <option value="val2">val-2</option> </select> </div> <div> <label for="multipleselect"></label> <select class="sl" id="multipleselect" name="multipleselect" multiple="multiple">

oop - Is there anything wrong with this approach to calling super() in javascript? -

i'm working on project , decided best way implement functionality wanted override method. @ time didn't realize javascript had no notion of calling super() started doing research. i found article ( http://blog.salsify.com/engineering/super-methods-in-javascript ) describes several methods of calling super methods. i wan't super happy ofthose options though , came following. available on fiddle @ https://jsfiddle.net/fpgm8j9n/ . var food = function( name ){ this.name = name; } food.prototype.sayname = function(){ console.log( 'i ' + this.name ); } var fruit = function( name, color ){ food.call( this, name ); this.color = color; this.super = object.getprototypeof( object.getprototypeof( ) ); } fruit.prototype = object.create( food.prototype ); fruit.prototype.sayname = function(){ console.log( 'i fruit , color ' + this.color ); } var orange = new fruit( 'apple', 'red' ); // runs overridden method in oran

database - Can prime attributes depend on each other? -

i have relation r{id, building, floor, sequence, capacity} where: (building,floor,sequence) -> id id -> (building,floor,sequence) (building,floor,sequence) -> capacity id -> capacity it seems doesn't violate normal form. however, ok id depend on (building,floor,sequence) , vice versa though id primary key? if no, can done? in relation multiple candidate keys, there'll inevitably cyclic dependencies between them - since candidate key can uniquely identify each tuple , each tuple has value each candidate key. the fact 1 key selected being "more equal" others , named primary key irrelevant. (when we're talking abstractly, here. database products may have features indeed make primary key "more equal" alternate keys)

android - Issues with Showcase View on small screen -

Image
i'm using great showcase view library in app , it's amazing unfortunately layout messed on smaller screens on small screens, guess it's problem in implementation couldn't figure out how fix this. and code in 1 of activities follow: if(showcase_flag == 1){ mplusbutton.setclickable(false); guide.setvisibility(view.invisible); final relativelayout.layoutparams lps = new relativelayout.layoutparams( viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content); lps.addrule(relativelayout.align_parent_bottom); lps.addrule(relativelayout.align_parent_left); lps.setmargins(40,0,0,160); mviews1 = new showcaseview.builder(this) .setstyle(r.style.customshowcasetheme3) .setcontenttitle("welcome listo") .setcontenttext("the best way share to-do lists\nand manage t

Portable ctypes.c_char_p for python 2.x and 3.x -

from ctypes documentation of python 2.x , have: >>> printf("string '%s', int %d, double %f\n", "hi", 10, 2.2) and ctypes documentation of python 3.x , have: >>> printf(b"string '%s', int %d, double %f\n", b"hi", 10, 2.2) so in 1 case argtypes c_char_p requires str input, while in second case requires bytes . how should write function handle both python 2.x , python 3.x ? typical scenario is: my_c_func.argtypes = [ c_char_p ] if __name__ == '__main__': import sys filename = sys.argv[1]; my_c_func( filename ) those types equivalent. in c strings arrays or pointers char type (each char represented 1 byte). in python 3 closest data type bytes . strings in python 3 encoded using utf-8, each char not guaranteed 1 byte. whereas, in python 2 strings typically encoded using latin-1 (depends on locale believe) -- 1 char, 1 byte. to write code works regardless of interpreter versio

javascript - AngularJS - Apply directive instantly, formating currency -

ok have following directive on various input elements. of elements on modals current method doesn't work how want, should apply right before modal opens. crtpromodir.directive('ngformatcurr', ['$filter', function($filter) { function link(scope, element, attrs) { element.blur(function() { element.val($filter('currency')((element.val() || 0), '', 2)); }); }; return { link: link }; }]); so how can apply filter instantly , every time changes? solution mccainz: crtpromodir.directive('ngformatcurr', ['$timeout', '$filter', function($timeout, $filter) { return { link: function(scope, element, attrs) { $timeout(function() { element.val($filter('currency')((element.val() || 0), '', 2)); }); element.blur(function() { element.val($filt

java - I am unable to save clob data in mysql hibernate -

i using hibernate , mysql , using following code insert data clob: session session=factory.getcurrentsession(); string updateavatar="update contact set avatar=:rawcontent id =:id"; query updatequery = session.createsqlquery(updateavatar); updatequery.setstring("rawcontent", data); updatequery.setlong("id",id); updatequery.executeupdate(); session.gettransaction().commit(); factory.getcurrentsession().begintransaction(); in servlet filter start transaction on currentsession. in order able handle other issues commit close transaction , session,, start again after commit keep single session page being rendered. but nothing saved in database. prior code using following code: session session=factory.opensession(); string updateavatar="update contact set avatar=:rawcontent id =:id"; query updatequery = session.createsqlquery(updateavatar); updatequery.setstring("rawconten

javascript - Issue with tabletool of datatable with pdf, csv, xls and copy options -

stable = $('#s').datatable({ "bvisible":"true", "dom": 't<"clear">lfrtip', "tabletools": { "sswfpath": "https://cdn.datatables.net/tabletools/2.1.1/swf/copy_csv_xls_pdf.swf", "abuttons": [ "copy", "csv", "xls", "pdf", "print", "select_all", "select_none" ] } }); buttons showing fine, copy,csv,xls,pdf not working, not getting 404 , have checked in browser console, loading total datatable , buttons 's container dynamically filter button. may cause problem,, please me . your browser adobe flash player plug-in disabled, disabled particular page or not installed @ all. enable flash

php - How do I delete duplicate rows in SQL? -

this question has answer here: remove duplicate rows in mysql 12 answers i trying delete duplicate rows using sql, whilst leaving 1 of rows behind. the table trying delete duplicate rows called table "a" made of: a.aid, a.bid, a.aname, a.atype, a.aprice. in table have number of duplicate rows of data same apart a.id. i trying create query duplicates , remove duplicate making sure 1 of rows left behind. using phpmyadmin , mysql. delete member id in (select * (select id member group member_id, quiz_num, question_num, answer_num having (count(*) > 1) ) ); use group , count

css - Aligning Media objects in boostrap, so as to swap text around image -

Image
i using twitter boostrap example make text of media object wrap around image. not working can seen in image below. the site can accessed @ http://cfcmelbourne.org/ how make text wrap around image when screen width shrinks ? insert image under media-body element set float:left; .media-body { float: left; margin-right: 15px; margin-bottom: 2px } <div class="media"> <div class="media-body"> <a href="https://www.youtube.com/watch?v=-5iymtbitc8" style=" float: left; "> <img class="media-object" alt="64x64" style="width: 164px; height: 100px;" src="https://img.youtube.com/vi/-5iymtbitc8/0.jpg" data-holder-rendered="true"> </a> <h4 class="media-heading" id="media-heading">

Convert A String to List in Prolog -

i prolog newbie , stuck @ parsing string list. have string of form. want read polynomial string , convert string. want convert input string 2x^3 + x^2 - 4x^1 - 8 to [[2,3], [1,2], [-4, 1], [-8, 0]] how can achieve functionality? this problem solved in 2 steps: lexical analysis / tokenizer: convert string list of tokens represent each of possible elements of expression: numbers, variable names , operators. representations maybe, instance, terms number(v) , vname(n) , op(op) ; may wish use different terms additive operators separate monomials , exponent operator. syntactic analysis / parser: apply grammar rules list of tokens identify monomials , convert them required representation. in case each rule have form of clause inspects appears @ beginning of tokens list find monomial , convert it. sample rules be monom([number(n),vname(x),op(exp),number(e)|ts],[[n,e]|ms]) :- !, monom(ts,ms). monom([number(n),vname(x),op(+)|ts],[[n,1]|ms]) :- !, monom([op(+)

java - redeployment of ear file on application server undergoes server restart or not -

i have application server , deploy ear file. if changes on jsp, automatically takes changes , see activity on console (i using eclipse) , changes reflected. question is, when above change, app server listening changes , doing redeployment. during process server stopped , started again server ? i read when application redeployed multiple times, converts small leakage big leakage looks not undergoing stop/start. server redeploys ear, , not restart itself.

c# - Parsing a string with json -

this question has answer here: deserializing json dynamic keys 3 answers http://ddragon.leagueoflegends.com/cdn/5.7.2/data/en_us/item.json how json data looks like. parse it. problem in "data" section, each object ( 1001, 1004, 1006) "basic" type : how parse c# question. first create class: public class foo { public list<basic> basic{get;set;} public string type{get;set;} public string version{get;set;} } then use newtonsoft , jsonconvert.deserializeobject<foo>(inputstring)

javascript - Why does gulp-useref does not seem to work with a comment in the replacement section? -

i trying build gulp pipeline – want inject css index.html (this works fine) , grab other links source index.html , replace them in outputted version. i noticed useref call mangling output if templated section replace includes html comment (see example below line comment ). it’s easiest demonstrate code: index.html (source file) <!-- build:css styles/app.css--> <!--comment--> <link rel="stylesheet" href="/.tmp/styles.css"> <!-- endbuild --> gulpfile.js task gulp.task('optimizereplace', function () { var assets = $.useref.assets({ searchpath: './' }); return gulp .src('./src/client/index.html') .pipe(assets) .pipe(assets.restore()) .pipe($.useref()) //this problem line; if inject not run first mangled .pipe(gulp.dest('./wwwroot/')); }); output ( index.html ) </style> <link rel="stylesheet" href="styles/lib.css"

android - Selector drawable in RadioGroup -

i have customized radiogroup work "tab holder". each "tab" radiobutton . i have set android:button=@null because using text , have set selector background. when radiobutton checked or unchecked selector works properly, however, when try add pressed state doesn't work. it seems recognizes checked or unchecked states. ideas? thank in advance. try using state_selected in xml selector , change radiobutton selected state code.

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

this code i'm using find latitude , longitude of place: function coords($address){ echo $url="http://maps.googleapis.com/maps/api/geocode/json?address=".$address; $json = file_get_contents(urlencode($url)); $data = json_decode($json, true); print_r($data['results'][0]['geometry']['location']['lat']); print_r($data['results'][0]['geometry']['location']['lng']); } however returns warning: failed open stream: http request failed! http/1.0 400 bad request if use above code in simple procedure works fine not in function. note: have tried curl_init()... method produced same result? instead of encoding whole url encode address part. following code work fine $add='jamshoro phase 2'; $url="http://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($add); $json = file_get_contents($url); $data = json_decode($json, true); print_r($data['r

add icon to html code title -

this not favicon others had corrected post. this how expedia page source code looks: <title data-sctid="title" data-sct-hidden="true">🏨 atlantic city hotels: find 122 cheap hotel deals in atlantic city, nj | expedia</title> the result page in google shows http://goo.gl/yejujq i tried insert 🏨 $this->set('title_for_layout', "🏨 atlantic city hotels: 28 cheap hotel deals atlanticcity.com"); but can not save since error text encoding western (iso latin 1) isn’t applicable. that's because character (probably) not part of latin 1 code page. should encode page in unicode (utf-8 what's being used) work.

Changing Theme in Android Studio -

i noticed default theme when creating android application in theme.appcompat.light.darkactionbar which, me, plain. my question how use holo light theme ? because when tried in giving me error underlining statement. can me? if show you're doing in styles.xml file isn't working helpful. otherwise, think you're looking along lines of <style name="apptheme" parent="android:theme.holo.light"> . key android provided theme , found using android:theme

mysql - Alternative of Natural Join -

what alternative or syntax natural join in sql server. as far know there no natural join in sql server. check sql server - lack of natural join / x join y using(field)

android - How to draw anchor part of google map infowindow? -

Image
i able customize infowindow setting drawable infowindowadapter's view's background. don't have idea how draw anchor part of infowindow. this did. infowindowadapter public class markerinfowindowadapter implements googlemap.infowindowadapter { private context context; private pelicanapplication appstate; public markerinfowindowadapter(context context,activity act) { this.context=context; appstate = ((pelicanapplication)act.getapplication()); } @override public view getinfowindow(marker marker) { layoutinflater inflater = layoutinflater.from(context); view v = inflater.inflate(r.layout.custom_infowindow, null); return v; } @override public view getinfocontents(marker marker) { return null; } } infowindow view <?xml version="1.0" encoding="utf-8"?> <frame

android - How to convert the response from Okhttp into inputstream -

code: public static string getrequestnopayload(string urlstring, string loginapi, string musername) throws exception { response response; try{ client.setconnecttimeout(20, timeunit.seconds); // connect timeout client.setreadtimeout(20, timeunit.seconds); // socket timeout request request = new request.builder() .url(urlstring) .addheader("username",loginapi) .addheader("password",musername) .build(); response = client.newcall(request).execute(); }catch(exception e){ throw e; } return response.body().string(); } what trying do: trying convert response.body() inputstream . how achieve this you can inputstream through bytestream() e.g. inputstream = response.body().bytestream(); to return have change method's signature. string inputstream

javascript - getElementsByTagName is not a function -

this question has answer here: what queryselectorall, getelementsbyclassname , other getelementsby* methods return? 8 answers i struggling this. wanting change src attribute of img tag , error message getelementsbytagname not function. following test markup <html> <body> <div class="logo"> <img src="/a.jpg"> </div> <script> document.getelementsbyclassname('logo').getelementsbytagname('img')[0].src ="/b.jpg"; </script> </body> </html> any advice appreciated. getelementsbyclassname return collection. have : document.getelementsbyclassname('logo')[0].getelementsbytagname('img')[0].src ="/b.jpg";

java - How to store multiple objects from a hashmap that has the same key? -

edit i've tried hashmap multiple values under same key , , hashmap looks hashmap<string, list<place>> placemap = new hashmap<>(); also tried put object instead of place(place superclass). when create subclasses , wants add them hashmap get: the method put(string, list) in type hashmap<string,list<place>> not applicable arguments (string, namedplace) and the method put(string, list) in type hashmap<string,list<place>> not applicable arguments (string, descplace) here adding created error: namedplace p = new namedplace(x,y,answer,col,cat); placemap.put(answer, p); descplace dp = new descplace(x,y,answer, desc, col, cat); mp.add(dp); placemap.put(answer, dp); namedplace , descplace both subclasses place, , want them both in same hashmap.. op i'm working on little project here. thing need use hashmap instead of arraylist on part of project because hashmap

c++ - Correct way to wait on a std::atomic<int> in Windows? -

the following code works has problem: #include <atomic> #include "windows.h" std::atomic<int> foo; dword winapi baz(void *) { sleep(10000); foo.store(1); return 0;} int main() { foo.store(0); handle h = createthread(null, 0, baz, null, 0, null); while ( !foo.load() ) { sleep(0); } waitforsingleobject(h, infinite); closehandle(h); return 0; } the program uses maximum cpu while waiting. if change sleep(0); sleep(1); uses 0% cpu, worried couple of things: this introduces unnecessary delay program: waste microseconds if flag set in between polls this might still consuming more system resource necessary, in order wake , call load() every millisecond. is there better way? background: have code working using win32 events wake thread , using waitformultipleobjects , i'm wondering if can use std::atomic flags instead, aim of perhaps making code simpler, faster, and/or more portable. idk how os impleme

php - Laravel fresh install login issues -

resolved appearantly truncating passwords set column size password low yesterday started using php framework laravel , happy it, except 1 small part, part being standard login provided framework. i created new project in netbeans , placed in xampp htdocs folder access site browser immediately. i used commands composer create-project laravel/laravel --prefer-dist cd laravel composer install this seems work fine, created database using migrations came clean install of laravel , registered user worked without hitch. however when try log in gives me error message whoops! there problems input. -these credentials not match our records. i thought might have been changed in routes wasn't using correct routes login post created project scratch , changed nothing except database settings in .env file still gives me same message. if give me hints in code problem grateful it possible because manually created database, managed miss detail or two. immediate t

SQL server error The media set has 2 media families but only 1 are provided -

Image
sql server error media set has 2 media families 1 provided. trying restore 200 mb database sql 2008 , getting error "the media set has 2 media families 1 provided. members must provided you getting error because database backup striped , backup stream split 2 destination files. trying restore single backup file. need both files restore database. for more information on error, refer here

javascript - Angular pass dynamic scope to directive -

i have directive takes attribute value http call so: controller app.controller("homecontroller", function($scope){ $http.get("/api/source").then(function(res){ $scope.info = res.data }); }); html <div ng-controller="maincontroller"> <ng-mydirective data-info="{{info}}"></ng-mydirective> </div> directive: app.directive("ngmydirective", function(){ return { restrict: "e", templateurl: "/partials/info.html", link: function(scope, element, attrs){ scope.info = attrs.info; } } }); i'm trying pass info variable controller, directive, through attribute. doesn't work because variable value created asynchronous http call, @ time directive created, there no value. is there way this? you can observe attribute's value: link: function(scope, element, attrs){ attrs.$observe('info', function(val) { scope.inf

android - Error: Index 0 requested, with a size of 0. How can I resolve? -

this code: package com.dev.paolo.sicinf; import android.content.intent; import android.database.cursor; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.view; import android.widget.listview; import java.math.biginteger; import java.sql.sqlexception; import java.util.linkedlist; import java.util.list; public class keysettings extends actionbaractivity { public void generatekey(view view) { intent rsa = new intent (this, rsa.class); startactivity(rsa); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_key_settings); listview listview = (listview)findviewbyid(r.id.list_keys); list list = new linkedlist(); managerdb db = new managerdb(this); cursor c= null; string textd,texte,textn; biginteger d,e,n; try { db.open(); } catc

node.js - Requeue message on timeout -

i'm using rabbitmq queue, i'm using in node.js / express app, i'm using wascally library consume , publish messages. my scenario is, after consumer finalizes handling message requeue's message again, task being done in cycle. example message initiates task of downloading data api , after it's finished publishes same message again data download performed again. the problem if consumer app crashes message stays in queue "unacked". should message queue if consumer not respond time (for example 30 seconds)?

java - JEE7 + WildFly (HornetQ) - Pause queue from application -

we using wildfly + hornetq our application server , jms message queue, , have requirement able pause/resume queues application. possible? this can done using jmx or using hornetq core management api. for purposes of example, wildfly 8.1.0.final used running standalone-full-ha profile. required maven dependencies: <dependency> <groupid>org.hornetq</groupid> <artifactid>hornetq-jms-client</artifactid> <version>2.4.1.final</version> </dependency> <dependency> <groupid>org.wildfly</groupid> <artifactid>wildfly-jmx</artifactid> <version>8.1.0.final</version> </dependency> here test class demonstrating use of jmsqueuecontrol via jmx: package test.jmx.hornetq; import org.hornetq.api.jms.management.jmsqueuecontrol; import javax.management.*; import javax.management.remote.jmxconnector; import javax.management.r

html - Non-negitive number button in angular -

i creating counting app using ionic framework. have positive button predefined number (in services.js) , corresponding negitive number same predefined number subtract number. template code; <a class="item list-inset item-thumbnail-left item item-button-right"> <img ng-src=" {{ menu.imgsrc1 }} "> <h2>{{ menu.fooditem1 }}</h2> <p>{{ menu.data1 }}</p> <button id="plus" class="button button-icon icon round-button" ng-click="count = count + {{ menu.calories1 }} "> {{ menu.calories1 }} </button> <button id="minus" class="button button-icon icon round-button" ng-click="count = count - {{ menu.calories1 }} "> - </button> </a> this services code; var menus = [ { title: 'breakfast&

javascript - Google Maps display geoJSON from variable instead of file -

so have geojson saved in variable or parsed object: // geojson object var segment = segment; // geojson json string var json = json.stringify(segment); how able display on google map? it's valid , json string stored in json visible when paste validator http://geojsonlint.com/ . sadly, doesn't work: mymap.data.loadgeojson(json); and can't find other documentation google maps tells me how import geojson data directly without file. the method load data directly geojson-object called addgeojson you'll find description in methods-section of google.maps.data

get xml values with jquery -

what i'm trying achieve values contain "/photovit_action" , each of values used in img tag display images using link provided. this xml: pastebin link and jquery: $.ajax({ url: "http://test.be", type: "post", datatype: "xml", data: soapmessage3, crossdomain: true, contenttype: "text/xml; charset=\"utf-8\"", processdata: false, success: function (xml) { $(xml).find('item').each(function () { var url = $(this).find("value:contains('/photovit_action')").text(); alert(url); $('#test').append('<img src="http://test.be/' + url + 'canvash(180)w(186)">'); }); } }); any ideas on how this? thanks in advance. in case there no value element selector wrong $(xml).find('item:contains("photovit_action")').each(function () { var url = $(thi

how to find last selected character in shell script -

i have assigned following string variable. line="/remotepath/mypath/localpath/common/location.txt" if want access common location (/remotepath/mypath/localpath/common) how can split in last "/" ? in unix-style operating systems, there's program called dirname you: $ line="/remotepath/mypath/localpath/common/location.txt" $ dirname "$line" /remotepath/mypath/localpath/common the command of course available shell, since it's not part of shell per-se, though might need assign variable differently. example, in csh/tcsh: % setenv line "/remotepath/mypath/localpath/common/location.txt" % dirname "$line" /remotepath/mypath/localpath/common if want strip off file using shell commands alone, you'll need specify shell you're using, since commands vary. example, in /bin/sh or similar shells (like bash), use "parameter expansion" (look in man page, there's lots of stuff): $ line=