Posts

Showing posts from June, 2014

sql - VB.net Checking if database exists before connecting to it -

i found following query in order find out if database table created or not: if db_id('thedbname') not null --code mine :) print 'db exists' else print 'nope' now wanting use same query within vb.net application. code have elsewhere connects database (that wanting see if there before doing this): dim cn sqlconnection = new sqlconnection("data source=davidsdesktop;" & _ "initial catalog=thedbname;" & _ "integrated security=true;" & _ "pooling=false") dim sql string = "if db_id('thedbname') not null " & vbcrlf & _ "print() 'exists' " & vbcrlf & _ "else " & vbcrlf & _ "print() 'nope'" dim cm

c# - How to specify dependencies on other projects with .NET CLI? -

it common break large solution multiple projects question of organization of code base , done in earlier versions of .net framework inside visual studio. how same can done .net cli? suppose have following simplified scenario example: - solution folder - global.json - src - libproject - consoleproject suppose consoleproject depends on libproject . intuitively belive means in consoleproject project.json have contain dependencies section this: "dependencies": { "microsoft.netcore.app": { "type": "platform", "version": "1.0.0-*" }, "libproject": "1.0.0-*" } but if this, when try restore dependencies consoleproject or when try build can't it. when try restore message unable resolve 'libproject (>= 1.0.0)' '.netcoreapp,version=v1.0'. i understand reason. when restoring, nuget trying find package on specified feed

How to get the title of the thickest book from XML-file via Xquery? -

i have xml-file next structure: <books> <book topic="databases" ebook = "available"> <pablisher>wrox</pablisher> <title>microsoft sql server 2008 integration services: problem, design, solution</title> <authors> <author>erik veerman</author> <author>jessica m. moss</author> <author>brian knight</author> <author>jay hackney</author> </authors> <isbn>978-0-470-52576-0</isbn> <pages>480</pages> <publicationdate>november 2009</publicationdate> <price>49.99</price> </book> </books> there lot of books , have return title of thickest one. thing know how find max num of pages: max(for $x in doc("c:\xmlfile1.xml")/books/book/pages return $x) but next step absolutely unclear me. thank in advance. what want take max value ,

c - Return an array of files -

i trying create function returns array of files couldn't find way access array outside of function. here's tried: file* *arquivoescrita(int k) //gerar nome de arquivo { char filename[sizeof("file1000000000000.txt")]; static file* arquivos[2]; (int = k; < k+2; ++i) { sprintf(filename, "file%d.txt", i); arquivos[i] = fopen(filename,"r"); } return arquivos; } and i'm calling function inside main this: file* psaidas[2]; psaidas = arquivoescrita(0); and error error: array type 'file *[2]' not assignable psaidas = arquivoescrita(0); how can access kind of array? there 1 issue in returning file ** array of open file stream, need know how many open. have couple of choices, (1) pass pointer function , update pointer reflect number of files opened, or (2) makes more sense, pass file * array parameter function , return number of files opened use index in calling function. (you check stream before a

c# - What to use: .aspx or .html -

i creating website in .aspx, , while adding more pages saw can choose .aspx-extension , .html-extension. i bit confused @ moment. using .aspx one, difference between them , of them guys prefer me use? thank much. this biggest challenge beginners. aspx pages , asp.net webservercontrols machines spit out html. if want logic spit html on page according logic use .aspx or webservercontrols on page. if don't have serious decisions make programmatically , need straight forward html not change based on events use .html pages. if on asp.net means may have make decisions based on data server in case .aspx requirement option.

html - Unexplained gap appearing between two divs -

Image
i have unexplained gap appearing between 2 div s. here image of situation: it gap above red div want gone. i want red div red way image is. how can that? code: <script type="text/html" id="product-template"> <div class="col-sm-6 col-lg-2 clickable" style="margin-top:20px; padding: 25px;"> <div style="border-radius: 10px; border: 1px solid white;height: 270px;overflow: hidden;"> <div style= "height: 200px; border: 1px solid white; border-top-left-radius: 10px; border-top-right-radius: 10px; color: white; background: center no-repeat; background-image: url(../../the_vegan_repository/product_images/alpro_custard.jpg); background-size:cover;"> </div> <div style="height: 70px; backgro

java - Why is my view object reference still null (Android dev)? -

fiddling android development. have experience in java, i'm pretty new android dev, please bare me. if i'm interpreting error message below correctly, "view" object seems null reason. looking online, people had similar problem created reference before setting content view. however, can see code, not case. i'm not sure problem is. here error message when trying run app (using own phone debugging medium, if matters): 04-24 20:54:03.848: e/androidruntime(13773): fatal exception: main 04-24 20:54:03.848: e/androidruntime(13773): process: com.example.fiddle, pid: 13773 04-24 20:54:03.848: e/androidruntime(13773): java.lang.runtimeexception: unable start activity componentinfo{com.example.fiddle/com.example.fiddle.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'void android.widget.relativelayout.setontouchlistener(android.view.view$ontouchlistener)' on null object reference 04-24 20:54:03.848: e/androidruntime(13773): @

Why do my uploaded files not exist in my filesystem and are not returned by my PHP commands? -

i'm having trouble creating form upload , store images. after uploading (submitting form), print_r($files) function: array ( [image] => array ( [name] => 4hfoetn.jpg [type] => image/jpeg [tmp_name] => c:\windows\temp\php151f.tmp [error] => 0 [size] => 70107 ) ) however, when navigating c:\windows\temp\ in file browser, file not exist. furthermore, when run: $tmp_image_dir = basename($_files['image']['tmp_name']); echo "<img src=\"" . $tmp_image_dir . "\">" . "<br>"; no image shows up. also, when run: $image_dir = "/images/"; $image_dir = $image_dir . basename($_files['image']['name']); if(move_uploaded_file($_files['image']['tmp_name'], $image_dir)) echo "image uploaded successfully" . "<br>"; i not readout of "image uploaded successfully" then, pretty obviously, when run: echo "<img sr

php - autoload pagination not working been urls been cleaned through htaccess -

i using auto load pagination method on page , when using htaccess clean url pagination stops working , data not appear . if remove pagination method fine , or if remove htaccess works fine . <script src="js/jquery-1.11.1.min.js"></script> <script type="text/javascript"> var busy = false; var limit = 10 var offset = 0; function displayrecords(lim, off) { $.ajax({ type: "get", async: false, url: "getresult.php", data: "limit=" + lim + "&offset=" + off + "&city=<?php echo $_get['city'] ; ?>", cache: false, success: function(html) { $("#results").append(html); window.busy = false; } }); } $(document).ready(function() { // start load first set of data if (busy == false) { busy = true; // start load first set of data displayrecords(limit, offset);

c++ iteratively destroying a binary tree -

i trying write code iteratively destroys binary tree. know recursion easier, thought try iteratively (albeit using c notation , using structures, no need classes). thinking following: void delete_tree (node *p_tree){ node *local_node; node *parent; int left_or_right; while (p_tree->p_left != null || p_tree->p_right != null){ parent = p_tree; if (parent->p_left != null){ local_node = parent->p_left; left_or_right = 1; } else { local_node = parent->p_right; left_or_right = 2; } while (local_node->p_left != null || local_node->p_right != null){ if (local_node->p_left == null){ parent = local_node; local_node = local_node->p_right; left_or_right = 2; } else if (local_node ->p_right == null){ parent = local_node; local_node = local_node->p_left; left_or_right = 1; } else { parent = local_node;

c# - Get largest column name that come before a given column name in a list of Excel columns string -

please consider lists: var list1 = {}; var list2 = {"a"}; var list3 = {"ae"}; var list4 = {"a", "b", "f", "h", "aa", "ac", "ae"}; this lists excel columns. want find column name come before given column name, example if want find column come before "n" want results lists: null // list 1 "a" // list 2 null // list 3 "h" // list 4 how can write linq query returns result me? thanks assuming list ordered, 1 possible way : yourlist.takewhile(o => exceltonumber(o) < exceltonumber("n")) .lastordefault(); exceltonumber() method convert excel column name integer, mentioned in this post . included method definition below easy reference, credit 100% contributors of linked post : int exceltonumber(string x) { return x.aggregate(0, (s, c) => s * 26 + c - 'a' + 1); }

why cant i turn off led's on arduino using android and esp8266 -

i have tried make android application turn on or off led's using arduino. esp8266 esp-01 provides access point . but cant turn off led's using there error also when see data in serial monitor partially gibberish i have taken code allaboutee.com/2015/01/20/esp8266-android-application-for-arduino-pin-control/ but modified me because not working me on 2 , 3 pins i have used arduino uno. the circuit diagram this the code arduino follows: #include <softwareserial.h> #define debug true softwareserial esp8266(10,11); // make rx arduino line pin 2, make tx arduino line pin 3. // means need connect tx line esp arduino's pin 2 // , rx line esp arduino's pin 3 void setup() { serial.begin(115200); esp8266.begin(115200); // esp's baud rate might different pinmode(2,output); digitalwrite(2,low); pinmode(3,output); digitalwrite(3,low); pinmode(4,output); digitalwrite(4,low);

How do i authenticate facebook login with IOS using node.js + Passport -

currently want authenticate user using facebook on ios platform. want use node.js custom authentication, make more flexible. theory right use node.js , passport-facebook via token, questions right now 1) need use facebook ios sdk node.js /passport? or serve via node.js/passport https://developers.facebook.com/docs/ios 2) if user installed facebook on iphone, how access token? this first time on creating iphone app + facebook login, advice highly appreciated. project i'm working on right now thank you you can authenticate user on phone ios sdk. way user native "login facebook" flow , application hold of facebook token. take token, pass node backend (together email address of user), , can use passport/nodejs verify token belongs email address. if so, user authenticated , can store token email (and other user related custom data) in node node application use later on , fetch existing user in node application when log in again. rest of authentication can

angularjs - ng-if date comparison using the == operator -

ng-if="{{(date | date:"dd/mm/yyyy") == (question.datetimeend | date:"dd/mm/yyyy")}}" i have expression $scope.date = new date() . i parser error . wondering if can achieved using == operator in mustache expression itself. try this. don't need {{}} in ng-if , "" in date format. ng-if="(date | date:'dd/mm/yyyy') == (question.datetimeend | date:'dd/mm/yyyy')" var app = angular.module('app', []); app.controller('mainctrl', function($scope) { $scope.date = '20160313t00:00:00'; $scope.datetimeend = '20160313t00:00:00'; }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="app" ng-controller="mainctrl"> <p ng-if="(date | date:'dd/mm/yyyy') == (datetimeend | date:'dd/mm/yyyy')" ng-bind="datetim

mysql - mysqldump --single-transaction -

i'm testing --single-transaction (st) on test server backups of mariadb server. started dump cmd st option , on parallel terminals ran 2 create table, 2 delete table ,1 insert statements test result. result : insert statement successful in original db , dump. 2 create table statements not successful.available in database not in dump file. 1 delete successful in database , dump 1 delete not successful in database records in dump. as per manual consistent backup i'm not suppose use create,alter,delete,rename,truncate statements. wanted decide go st or no? goal consistent backup doing exercise. in advance...!

php - Get Simple CMS - Control Page Content -

i using cms adding page content easy: <div> <?php get_page_content(); ?> </div> ...which spit out , body of cms admin edit page. but when want add , control smaller bits? example, employee bio's on company team page. http://get-simple.info/start/team/ in html like: <div id="employees-bios"> <div class="employee"> <img src="employee1.jpg"> <p>employee seasoned designer.</p> </div> <div class="employee"> <img src="employee2.jpg"> <p>employee seasoned architect.</p> </div> </div> do need components? done similar how sidebars implemented in getsimple cms?

php - Method [all] does not exist in Laravel 5.2 -

just issues bothering me. error in code after validator::make in update function. badmethodcallexception in controller.php line 107: method [all] not exist. this full code bookscontroller <?php namespace app\http\controllers; use illuminate\http\request; use illuminate\support\facades\validator; use illuminate\support\facades\input; use illuminate\support\facades\redirect; use app\http\requests; use app\http\controllers\controller; use app\book; class bookscontroller extends controller { /** * display listing of resource. * * @return response */ public function index() { $book = bookscontroller::all(); return view('book.index')->with('book', $book); } /** * show form creating new resource. * * @return response */ public function create() { return view('book.create'); } /** * store newly created resource in storage. * * @return respon

php - Session start on an empty page causes an error; session_start(): Cannot send session cache limiter -

Image
hi have php file empty , line of code in there <?php session_start(); ?> no html mark-up or php code besides code above. on localhost doesn't trigger error, when it's on server , visit page, new line printed on error log says [25-apr-2016 05:43:34 utc] php warning: session_start(): cannot send session cache limiter - headers sent (output started @ path/to/file.php:1) in /path/to/file.php on line 1 the server running apache , php 5.6 if that's relevant, i've tried deleting .htacces file in case what's causing problem still no luck. can point me in right direction see may causing issue? thanks! problem : there invisible characters inside code file. solution : if want fix error here quick way : sure must using sort of code editor save php file encoding "utf-8 bom" , upload saved file site , access file , have no problem..! screenshot better guidance : reference url : how fix "headers sent" error in

if else short hand failed in PHP -

this question has answer here: troubleshooting “unexpected t_echo” in ternary operator statement 4 answers <input type="submit" value="<? get_the_category( $id )[0]->name == 'english' ? echo 'find' : echo 'encontrar'; ?>"> not sure problem here, have problem doing shorthand of if else condition. please ensure can't use echo way since has no return type. you can try either of these: <?php echo (get_the_category( $id )[0]->name == 'english') ? 'find' : 'encontrar'; ?> or <? get_the_category( $id )[0]->name == 'english' ? print 'find' : print 'encontrar'; ?>

ios - How to fetch Birthday Label from CNContactPickerViewController in objective-c? -

i know in swift how pick birthday label cncontactpickerviewcontroller, little bit confuse in objective-c here use code like:in objective-c how can pick birthday label in "didselectcontactproperty" method. can please me out.. -(void)presentcontacts { cncontactpickerviewcontroller *picker = [[cncontactpickerviewcontroller alloc] init]; nsarray *propertykeys = @[cncontactbirthdaykey, cncontactphonenumberskey, cncontactgivennamekey, cncontactfamilynamekey, cncontactorganizationnamekey]; nspredicate *enablepredicate = [nspredicate predicatewithformat:@"birthday != nil"]; picker.displayedpropertykeys = propertykeys; picker.predicateforenablingcontact = enablepredicate; picker.delegate = self; [self presentviewcontroller:picker animated:yes completion:nil]; } - (void)contactpickerdidcancel: (cncontactpickerviewcontroller *) picker { nslog(@"didcancel"); } - (void)contactpicker: (cncontactpickerviewcontroller *) picker

turkish character encoding in android -

i have problem turkish characters in android studio. clicked file > settings. default encoding, ide , project encoding windows-1254. still wrong characters in code. my wrong code : public void showalertexit() { alertdialog.builder alertbox = new alertdialog.builder(this); alertbox.settitle("��k��"); alertbox.setcancelable(false); alertbox.setmessage("��k�� yapmak istedi�inize emin misiniz?"); alertbox.setnegativebutton("hay�r",new dialoginterface.onclicklistener() { public void onclick(dialoginterface arg0, int arg1) { arg0.cancel(); } }); alertbox.setpositivebutton("evet",new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int arg1) { intent = new intent(getapplicationcontext(),login.class); startactivity(i); } }); alertdialog alert = alertbox.create(); alert.show(); } i clicked "inv

javascript - Input field not updating with ng-keydown event -

in piece of code want add validation input field, if value 0 don't know why not able update , enter new value in input field. not able change input field value. value remain same if delete existing value , add in existing value. here html code: <input ng-model="lineitemdetailsctrlas.lineitems.orderedquantity" type="text" class="col-md-6 text-right panel-row-spacing" ng-keydown="valuechanged($event)" required /> and angular code is: $scope.valuechanged = function (event) { var quantityrequire={}; if (event.keycode === 48 || lineitemdetailsctrlas.lineitems.orderedquantity == 0) { quantityrequire = { "messageid": "ordered_quantity", "params": [], "severity": "error" }; lineitemdetailsctrlas.errormessages.push(quantityrequire); } else{

win universal app - Background Task does not run in UWP -

i have uwp application want add background task support doing things while application in background. doing mentioned here: https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-a-background-task i have 1 separate project background tasks , in package manifest file have declared app uses background tasks (but "timer" task since using timertrigger). code: backgroundtaskbuilder backgroundtaskbuilder = new backgroundtaskbuilder { name = "notificationupdater", taskentrypoint = "namespaceofmybackgroundtaskinterfaceimplementation.backgroundtask"}; backgroundtaskbuilder.settrigger(new timetrigger(15, false)); backgroundtaskregistration backgroundtaskregistration = backgroundtaskbuilder.register(); now, when launch app (via visual studio), , use lifecycle events dropdown suspend app, never executes run() method in backgroundtask class (implementation of ibackgroundtask interface). code inside backgroundtask class: namespace

java - Use of Akka Framework in a non-concurrent environment -

i building web service in java. business logic has no concurrency requirements. simple rest call input json expected , after processing output json thrown back. request can in millions planning bring in load balancer. my question have read few articles using akka make development faster , give performance boost well. true in case of application has no concurrency requirement? thanks in advance. even without concurrency requirements, akka great framework use. can use actors encapsulate single responsibilities, send them messages react on , respond message. this has benefit can model errors inside domain, means, sending message error sender, can decide how deal it, e.g. retrying n times. exception modelling akka. even better, whenever actor fails exception, parent actor can decide, do, e.g. restart actor, propagate error higher in hierarchy etc. so in conclusion, akka helps develop solid reactive domain based on messages. makes easy make concurrent later, or pass

listview - How to add the text at the particular position in custom adapter in android -

Image
i creating android app populates list of gps co-ordinates entered user using custom adapter selection lat long distance ------------------------------------------------- checkbox1 123.4546 456.48751 text checkbox2 123.4546 456.48751 text checkbox3 123.4546 456.48751 text checkbox4 123.4546 456.48751 text if user selects check-box 1 have find distance check-box 1 lat long check-box 2,check-box 3,check-box-4 lat long .here need display result text in field of text respective position here getting result @ last position can tell me how achieve fyi:[![enter image description here][2]][2] sc explain in detail. if check 1 value updating result @ last value need update , display result whole data code check_locations.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { i

sql server - Find maximum and minimum days between several dates in SQL -

i want find max. , min. days between several records in table. example, in following table have max. , min. days due date field each id. i'm using ms-sql 2013 i know there dateiff finding days between 2 dates now, want find maximum , minimum days between several dates. id date 10 2016/01/13 10 2016/01/10 10 2016/11/01 10 2015/12/28 11 2015/12/11 11 2016/02/01 11 2015/01/01 now, how can find max. , min. days between dates each id? can please me have query in sql? ok, i've re-read answer, looking below; creating temp table , inserting data; create table #datatable (id int, date datetime) insert #datatable (id, date) values (10, '2016-01-13') ,(10, '2016-01-10') ,(10, '2016-11-01') ,(10, '2015-12-11') ,(11, '2015-12-11') ,(11, '2016-02-01') ,(11, '2015-01-01') select statement retrieve data; declare @startdate datetime; set @startdate = '2015-12-01' declare @enddate datetime; set @enddat

Windows 10 IoT Raspberry Pi 2 Bluetooth to Windows Phone 8.1 - Element Not Found -

environment: i have windows phone 8.1 lumina raspberry pi 2, csr bluetooth dongle windows 10 iot core 10.0.14322.1000 i create windows phone 8.1 app , windows 10 iot app raspberry pi send , receive messages using bluetooth. no success until now! i able go web interface pi , pair windows phone successfully. on phone able deduct pi's dongle , connect it. but app when tried connect send , receive messages following error system.exception: element not found. (exception hresult: 0x80070490) i have tried various suggestions adding capabilities phone's manifest (proximity, bluetooth, etc) <capabilities> <capability name="internetclientserver" /> <devicecapability name="proximity" /> <m2:devicecapability name="bluetooth.rfcomm"> <m2:device id="any"> <m2:function type="serviceid:00001101-0000-1000-8000-00805f9b34fb"/> </m2:device> </m2:devicecapability

joomla - How can i make custom form module joomla3.x -

<select name="a"> <option value="1">volvo</option> <option value="2">saab</option> </select> <select name="b"> <option value="1">test1</option> <option value="2">test2</option> </select> <input type="submit" > after submit, want show result , b. example: if($_post['a']==1 && $_post['b']==2){ echo 'true'; }else{ echo '0'; } is possible in joomla? you have enclosed input fields form tag. example <form method="post"> <select name="a"> <option value="1">volvo</option> <option value="2">saab</option> </select> <select name="b"> <option value="1">test1</option> <option value="2">test2</option> </sel

Invalid incremental change record with Android Studio's Instant Run -

when building app error: error:execution failed task ':app:transformclasses_enhancedwithinstant+reloaddexfordebug'. java.io.ioexception: invalid incremental change record : changed,c:\users\gingo\documents\dropbox (skoumal, s.r.o.)\work\myproject\myproject\app\build\intermediates\transforms\instantrun\debug\folders\4000\5\enhanced\com\android\tools\fd\runtime\apppatchesloaderimpl.class the way rid of build -> rebuild project . the culprit , (comma) in project path. remove , go. let me explain little bit deeply. reason found in changerecords.java file. in method load(file file) parses change records file , uses , (comma) divider line-fields. see whole code of method: /** * load change records persisted file. */ @nonnull static changerecords load(file file) throws ioexception { changerecords changerecords = new changerecords(); list<string> rawrecords = files.readlines(file, charsets.utf_8); (string rawrecord : rawrecords) {

angularjs - Ionic Side Menu under status bar -

Image
i want ionic side-menu under statusbar , gmail app. any suggestion ? edit(1) use cordova-statusbar plugin along cordova translucent statusbar plugin enable immersive mode on apps. refer article step step solution this. let me know if works.

javascript - Incrementing the result of Map.get() -

i following error when trying increment value obtained map in console in chrome (50.0.2661.86): uncaught referenceerror: invalid left-hand side expression in postfix operation(…) and similar in node (4.4.3): referenceerror: invalid left-hand side expression in postfix operation @ repl:1:3 @ replserver.defaulteval (repl.js:262:27) @ bound (domain.js:287:14) @ replserver.runbound [as eval] (domain.js:300:12) @ replserver.<anonymous> (repl.js:431:12) @ emitone (events.js:82:20) @ replserver.emit (events.js:169:7) @ replserver.interface._online (readline.js:211:10) @ replserver.interface._line (readline.js:550:8) @ replserver.interface._ttywrite (readline.js:827:14) the offending code is: var m = new map() m.set(1, 0) m.get(1) var n = m.get(1)++ // uncaught referenceerror: invalid left-hand side expression in postfix operation(…) the following fail: var n = ++m.get(1) var n = ++(m.get(1)) a bug in v8 maybe? or misunderstandi

jsf - Smaller operator gives error in javascript code -

this question has answer here: error parsing xhtml: content of elements must consist of well-formed character data or markup 4 answers i have javascript code in xhtml file. here is: <h:head> <h:outputstylesheet library="css" name="styles.css" /> <script> function datatableselectoneradio(radio) { var id = radio.name.substring(radio.name.lastindexof(':')); var el = radio.form.elements; (var = 0; < el.length; i++) { if (el[i].name.substring(el[i].name.lastindexof(':')) == id) { el[i].checked = false; } } radio.checked = true; } </script> </h:head> the problem ist, inside loop gives error "<" operator s

python - Generating cpps with Cython and then installing a C extension in one setup.py -

i have .cpp s need generate .pyx s , .pxd s prior installing c/c++ extension in setup.py (through pip local install-- pip install path/to/my_pkg ). used have .cpp s generated separately, that's gotten annoying development , means have commit generated .cpp s, bloat repo, , i'd rather not do. i used generate cpp s gen_cpp.sh file so: cython src/*.pyx src/*.pxd -a --cplus --include-dir ../ and once generated, i'd run setup.py install c/c++ extension so: setup( name="mypkg", version="0.1.9", description="some description", author='me', author_email='me@me.com', url='http://www.myurl.com'', ext_modules = [ extension( "something", sources = glob.glob('src/*.cpp') + glob.glob('lib/b64/*.c'), include_dirs=['lib'], language = "c++", ) ] ) all want have gen_cpp.sh file ru

Android emoji issue(convert "\uD83D\uDE04" to 0x1F604) -

Image
i can display emoji in textview way how set emoji unicode in android textview , how convert "ud83d\ude04" code point 0x1f604("ud83d\ude04" represent 0x1f604)? i find way:java.lang.character.tocodepoint(char high, char low) int ss1 = integer.parseint("d83d", 16); int ss2 = integer.parseint("de04", 16); char chars = character.tochars(ss1)[0]; char chars2 = character.tochars(ss2)[0]; int codepoint = character.tocodepoint(chars, chars2); string emojistring = new string(character.tochars(codepoint));

python 2.7 - How to modify a pyramid template on the fly before rendering -

please working on site scrap website's html table source code , append template before rendering page. have written script stores html code in variable don't know how appendix it. kindly suggest. if you're using jinja, try this: <div class="html-content">{{scraped_html|safe}}</div>

java - duplicate guava.jar in classpath -

i use storm-0.10 put data hbase-1.0.1, , storm use guava-12.0 hbase use guava-18.0, both load classpath, leads job fail. how ensure storm , hbase use correct version jar? here pom.xml: <dependencies> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase-client</artifactid> <version>1.0.0-cdh5.4.5</version> <exclusions> <exclusion> <groupid>com.google.guava</groupid> <artifactid>guava</artifactid> </exclusion> </exclusions> </dependency> <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-hdfs</artifactid> <version>2.3.0</version> </dependency> <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-common<

Rearrange a cell with multiple values alphabetically [Excel] -

i have excel file have cell multiple values, split comma. instance: new york, chicago, los angeles. want rearrange cell in alphatical order, like: chicago, los angeles, new york. there easy way this? try this. following code read values in column a , give desired result in column b . sub sortstring() dim myarray variant, varswap variant dim long, min long, max long, lastrow long dim str string dim myrange range dim isswapped boolean lastrow = cells(rows.count, "a").end(xlup).row set myrange = range("a1:a" & lastrow) each cell in myrange myarray = split(cell.value, ",") min = lbound(myarray) max = ubound(myarray) - 1 isswapped = false = min max if myarray(i) > myarray(i + 1) varswap = myarray(i) myarray(i) = myarray(i + 1) myarray(i + 1) = varswap iss

c++ - Need clarification on #ifndef #define -

the code working has multiple headers , source files different classes face.cc, face.hh, cell.cc, cell.hh edge.cc edge.hh , headers contain includes this, #ifndef cellincluded #define cellincluded #ifndef faceincluded #define faceincluded i saw through http://www.cplusplus.com/forum/articles/10627/ , saw way write include guard #ifndef __myclass_h_included__ #define __myclass_h_included__ so in above code working on, compiler automatically understands looking face.hh or cell.hh files? better question : writing __cell_h_included__ same cellincluded ? #ifndef __myclass_h_included__ #define __myclass_h_included__ so in above code working on, compiler automatically understands looking face.hh or cell.hh files? no, compiler doesn't automatically understand mean. what happens that, when compiling translation unit , compiler holds list of globally defined macros. , so, doing defining macro __myclass_h_included__ if doesn't exists. if mac

javascript - C# Reading text or source code from tab in a browser - need an idea -

i want make small application read title current opened youtube video firefox or chrome browser , save in .txt file on computer. i need idea on how accomplish this. somehow possible access tabs opened in firefox or chrome via c#? do understand me? want somehow parse data browser seleceted tab , save .txt file. would have use greasemonkey scripts this? if tab active this string browser = "firefox"; //or change chrome/iexplore var browserproc = process.getprocessesbyname(browser) .where(b => b.mainwindowtitle.contains("youtube")) .firstordefault(); if (browserproc != null) { string maintitle = browserproc.mainwindowtitle; } you can parse relevant parts of maintitle if need to.

ios - Json response is successful in browser but displays error message in simulator -

i have server sends json web response using browser. when same url passed through simulator throws error message. code below: nsstring *poststring = [nsstring stringwithformat:@"username=\"tango\"&password=\"charlie\""]; nslog(@"%@",poststring); //encode post string in supported encoding format in post data postdata = [poststring datausingencoding:nsasciistringencoding allowlossyconversion:yes]; if(connection) return yes; else return no; [nsmutablerequest sethttprequest:urlstring]; the header part follows: [request seturl:url]; //set http method post [request sethttpmethod:@"post"]; //set http header field length of post data [request setvalue:postlength forhttpheaderfield:@"content-length"]; //set encoding value http header field [request setvalue:@"application/x-www-form-urlencoded" forhttpheaderfield:@"content-type"]; //set http body or url request postdata [request sethttpbod

function - How to create more than one matrix in a row using matlab -

i trying series of vectors come same original, make easy example, suppose vector v= (1,2,3,4,5,6,7,8,9,10) (of course mine bigger) the first vector has this: r1=(1,3,5,7,9)= v(1:1:end) second vector: r2=(2,4,6,8,10)=v(2:1:end) third vector: r3=(3,5,7,9)=v(3:1:end) fourth vector: r4=(4,6,8,10)=v(4:1:end) ... r8=(8,10)=v(8:1:end) so questions are: is there easier way result? how can know total number of ri vectors distance = 1 can obtained v ? use matlab's cell object can hold vector in every cell. use loop fill cell object gradually. code example: %initialize v v= [1,2,3,4,5,6,7,8,9,10]; %initialize empty cell of size [10,1] r= cell(length(v)-2,1); %fill cell ii=1:length(r) r{ii} = v(ii:2:end); end %prints results ii=1:length(r) r{ii} end results (each row different vector): 1 3 5 7 9 2 4 6 8 10 3 5 7 9 4 6 8 10 5 7 9 6 8 10 7 9 8 10

utf 8 - Rails force input to encode in windows-1250 -

i'm making app on existing database in firebird charset windows-1250. , im getting lot of troubles because of encoding, cant change it. my biggest error when im making form input object called notification this: form |f| panel iconv.conv('windows-1250', 'utf-8', 'opis zgłoszenia:'), :class=> 'panel_dodaj_new' f.input :opis_zgloszenia, label:false end end try save text in utf-8, want save in windows-1250. how force :opis_zgloszenia save in different charset utf-8? i find way change encoding in controller. in create method add: @notification.opis_zgloszenia = iconv.conv('windows-1250', 'utf-8', @notification.opis_zgloszenia) also need change update method: if @notification.update(notification_params) @notification.opis_zgloszenia = iconv.conv('windows-1250', 'utf-8', @notification.opis_zgloszenia) if @notification.save redirect_to request.url end end

Seller Admin Panel for E-Commerce Website? -

i developing e-commerce website, identify there 3 high-level users: admin seller end user i understand flow of admin , end user want more clarification on seller admin panel, if knows please share comment or link me. thanks.

unix - sftp: cannot copy directory from remote to local -

i trying copy folder remote local encountered problem using below command: sftp user@100.54.9.23:/the/folder expect "password:" send "****\n"; send "get -r folders\n" i got error : invalid flag -r. also, try mget .i want recursively copy directory remote. try scp -r user@100.54.9.23:/the/folder /local/dir and try also scp user@100.54.9.23:/the/folder /local/dir but hang after entering password both. is there method can used copy directory remote?