Posts

Showing posts from April, 2011

c# - Mongo update response says no document updated, but the document is there -

i'm using mongodb 2.6.10 , using c# driver 1.9.2. server has replicaset of 2 servers. my documents of format. itemid unique. { "itemid": 2314, "favorites": [1, 24, 26, 34] } then have code remove favorite of form var query = query.eq("itemid", itemid); var result = collection.update(query, update.pull("favorites", favoriteidtoremove)); after each time, check result.documentsaffected equal 1. once in while, value comes 0. when go mongodb myself, can find document matching itemid, , can see favoriteid tried remove in array still there. result.ok true, , there's no error information. what cause fail? i'm no expert guess write concerns since there different levels of guarantee writing , updating documents in mongodb. see write concerns so instead of using method : mongocollection.update method (imongoquery, imongoupdate) it might better use method instead: mongocollection.update method (imong...

angularjs - Gather both first and lastname into a full name -

i started working first app angular such must have showcased full name when 1 has written both names first , last name. what mean few first name , last name , indicate full name overall. right problem such not add full name total @ all. userscreate.js - ( i'm sure fault lies around here ) var usercreatennow = angular.module('usercreatennow', []); usercreatennow.controller('createusernow', function ($scope) { //checking on first name , surname written. if ($scope.name != null && $scope.lastname != null) { //prints $fullname = "welcome " + $scope.name + " " + $scope.lastname; } }); create.cshtml <div ng-app="usercreatennow" ng-controller="createusernow"> <div class="form-group"> <div class="col-xs-12"> @html.labelfor(u => u.fornavn) @html.textboxfor(u => u.fornavn, new ...

android - Cardview in the recyclerview overlaps the collapsing toolbar -

i trying create recyclerview below collapsing toolbar cardviews inside recyclerview.how overcome overlapping of cardview inflated inside recyclerview. overlaps collapsing toolbar image . xml file <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fit...

How does connecting Namespaces work in C#? -

i new c# , trying print out number different namespace in main. provide code below. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapplication1 { class program { static void main(string[] args) { console.writeline("hello world" + x); console.readline(); } } } namespace applicaton { class program2 { public int test() { int x = 5; return x; } } } i want have x program2 class appear in main in program class. just call class. program2 p = new program2(); console.writeline(p.test().tostring()); and ever program2 have can call on it. or assign it. int num = p.test(); console.writeline(num); then print it.

bash - getting the pid of a subshell command -

i trying write init service script java program. have following in init script. $user = awesomeuser $program_cmd = "java -server com.test.testclass" $program_log = "/var/log/awesome_log" sudo -u $user nohup $program_cmd >> $program_log 2>&1 </dev/null & server_pid=$! echo $server_pid > $pidfile what happening getting pid of parent process want the pid of java process running within subshell. is there anyway can structure command subshell command pid back? thanks! instead of sudo -u $user nohup $program_cmd >> $program_log 2>&1 </dev/null & try this: sudo -u $user bash -c "nohup $program_cmd >> $program_log 2>&1 & </dev/null; echo "'$!' sudo spawns child process , calls exec in it. fork -ing can avoided proper config of sudo (see sudo(1) ). seems easier me set user , run shell. this approach seems better me obtaining pid of process ps | grep | blabla ...

replace - How to rename all files in winrar -

i have text files in winrar. how can remove first character name of each file, replace letters in name, , add character onto beginning of file name? for example, name-words : after removal, ame-words after replace ( "-w","l" ), ame-lords and after adding letter, same-lords

mandrill - Embedded images show as attachment -

i'm sending mail via mandrill smtp server. embedded images shows attachments. when using smtp host displayed inline expected. this how raw email sent via mandrill looks like, --_av-wpsilwanbd9ltkj6pvyncq content-type: application/octet-stream content-transfer-encoding: base64 content-disposition: attachment; filename="header.jpg" and same email sent via other smtp server, ------=_part_2_149158871.1452888744955 content-type: application/octet-stream; name=header.jpg content-transfer-encoding: base64 content-disposition: inline; filename=header.jpg content-id: <1.1452888744955@10.0.1.2> any ideas i'm doing wrong? or not possible mandrill? mails sent java application using javax.

How to get system calendar setting about the first day of a week in Javascript or Java? -

i trying implement feature can obtain user setting of day first day of week in his/her environment. tried java's getfirstdayofweek() method seems depend on locale. example, if user in return "sunday", , if he/she in france return "monday". however, windows allows user select day first day of week, regardless of locale. problem how personal setting code? struggling on issue while. knows how solve it?

html - How to align multi-line text after icon -

Image
in table indentation (tree data), need align second line first line. notice, text "tail" doesn't align "long" created similar example here div{ width:400px; } <div> <a href="">icon:</a> <span>this fight song. take life song. prove i'm alright song. power's turned on starting right i'll strong</span> </div> you can display: table; , display: table-cell; div{ width:400px; border: 1px solid black; display: table; padding: 10px; } a, span { display: table-cell; vertical-align: top; } <div> <a href="">icon:</a> <span>this fight song. take life song. prove i'm alright song. power's turned on starting right i'll strong</span> </div>

angularjs - What to use to set styling dynamically in Angular? -

i started working angular , creating "little" project. came templating issue. basically, try set colour elements dynamically angular. can't figure out best , "right" way it. is ok use if statements in scope? or better use directive? my main goal able set colors admin mode toolbar , icons. thank answers. https://docs.angularjs.org/api/ng/directive/ngclass you can use ngclass expression. if after coloring odd/even rows of table, use https://docs.angularjs.org/api/ng/directive/ngclassodd https://docs.angularjs.org/api/ng/directive/ngclasseven

active directory - JAAS Kerberos not adding keys from keytab as I expect -

so i'm trying implement sso/integrated security system aix server (so ibm jre). uses kerberos authenticate against ad. keep in mind data below sanitized. command ad admin used create keytab file on ad server (notice /kvno 2). ktpass /princ http/local.domain.com@localdomain.net /mapuser psldap@localdomain.net /pass <password> /crypto /ptype krb5_nt_principal /kvno 2 /out krb5.keytab my krb5.conf file: [libdefaults] default_realm = localdomain.net default_keytab_name = file:/keytabs/krb.keytab default_tkt_enctypes = rc4-hmac default_tgs_enctypes = rc4-hmac dns_lookup_kdc = true dns_lookup_realm = true [realms] localdomain.net = { kdc = localdc08.localdomain.net:88 kdc = otherdc08.localdomain.net:88 admin_server = localdc08.localdomain.net:749 master_kdc = localdc08.localdomain.net default_domain = localdomain.net } [domain_realm] .localdomain.net = localdomain.net ...

Android Scrollview Won't fill parent space -

Image
i have relative layout fills entire screen. want add scrollview in middle of wrap bunch of content can make pan when soft keyboard gets displayed. however, wrap in scrollview, bottom layout stops filling remainder of screen. here xml have scrollview commented out. <include android:id="@+id/top_bar_with_save_button" layout="@layout/top_bar_with_save_button"/> <framelayout android:id="@+id/log_entry_title_frame" android:layout_below="@id/top_bar_with_save_button" android:layout_width="match_parent" android:layout_height="wrap_content"/> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/log_entry_title_frame" android:layout_alignparentbottom="true"> <!-- <scrollview android:layout_width="match_parent" android:layout_height...

arguments - Can't return ifstream data? c++ -

this may simple question, don't understand wrong code. want program read character , return program binary file. don't understand why won't accept variables. here's code: int ncharf() { int neww; myfile.get(neww); return neww; } i checked similar questions, didn't help. missing something? here's error: severity code description project file line suppression state error c2228 left of '.get' must have class/struct/union also, wasn't doing before, it's saying myfile invalid identifier. the way work replacing "neww" "int", can't return value! int main() { return 0; //to stop unwanted execution char curchar[100000000]; ifstream myfile; myfile.open("befen.bin", ios::in, ios::binary); ofstream yourfile("enn.bin", ios::out); int = 1; if (myfile.is_open()) { int evar; while (!myfile.eof()) { int snchar[10000000...

php - My Slim API gives me a 404 error page -

i'm making api angular app allow me access database slim. followed tutorial http://anjanawijesundara.blogspot.ca/2015/04/crud-application-with-angularjs.html i have 'angularjs' folder. in it, have index.html file, 'api' folder api, 'app' folder, angular app, , 'assets' folder css, img , other js file. i installed slim in 'api' folder composer (it created vendor folder) , have 'index.php' file next vendor folder. my 'index.php' file (in api folder) looks far: <?php require 'vendor/autoload.php'; $app = new \slim\app; $app->get('/types', 'gettypes'); $app->get('/types/:id', 'gettypebyid'); $app->run(); function db_connection() { $dbhost = "localhost"; $dbuser = "kevdug_portfolio"; $dbpass = "*****************"; $dbname = "portfolio"; $dbh = new pdo("mysql:host=$dbhost;dbname=$dbname", $dbuse...

.htaccess - Rewrite QSA, understanding it better -

so, i'm having difficult time understanding qsa. since rewriterule ^search/(.*)$ search.php?s=$1 [nc,l,b,qsa] rewriterule ^search/(.*)$ search.php?s=$1 [nc,l,b] both give me same result. read qsa appends parameters passed (at least think that's understood it). it's not working me. currently have url http://localhost:8888/search/hey+i%27m+a+search+query&sortby=day which returns hey i'm search query&sortby=day i can set rewriterule ^search/(.*)&sortby=(.*)$ search.php?s=$1&sortby=$2 [nc,l,b,qsa] which return parameter, understand qsa, should automatically handled...right? i got information here - what $1 [qsa,l] mean in .htaccess file? basically, question is, why should use qsa? , kind of benefits provide in situation? (sorry being blunt, can't grasp of this) the problem example url has no query string. use ? designate query string: http://localhost:8888/search/hey+i%27m+a+search+query?sortby=day the ?sortby=day ...

android - Reliable, lightweight communication protocol for mobile -

i looking communication protocol use in mobile application. first target android, nice if supported in other platforms ios, osx , windows 8. main goals are: it has energy efficient , messages sending small , there no communication of time (it's sensing, , updates not frequent) it should support intermittent connectivity , guarantee message delivery important application not miss updates should able support encryption or messages of sensor data contain privacy sensitive information * should not require constant connection * application can put sleep when not in use. google cloud messaging works great when comes receiving messages server, problem having send clients without requiring keep connection active. the previous version using xmpp , json messages, think bad idea, since requires constant connection, , not meant energy efficient. i want use protocol buffers instead of json more compact representation , faster serialization, undecided on transport. mqtt came w...

Jquery HTTP POST -

i have jquery code appends field form. when submit form, fields appended not available php. there special have pick these fields up? here code: $(document).ready(function() { window.unique = 0; //hides alert $("hide").click(function(){ $("#alert").hide(); }); $(document).on('click', '#toggle_header', function(){ window.unique++ $("#header_list").append("<li><input type='text' name='header_name" + unique + "' placeholder='name'><input type='text' name='header_value" + unique + "' placeholder='value'><a href='#' id='toggle_header_remove'><i class='icon-remove'></i></a></li>"); }); $(document).on('click', '#submit_query', function() { $.ajax({ url: 'index.php', type: ...

javascript - Squaring each number in an array with dynamically added inputs -

i'm trying calculate standard deviation of set of data entered user form dynamically added inputs. far have been able calculate sum of elements in array, cannot figure out how square each element of array. have searched forum, trying suggestions applicable result ( square each number in array in javascript ) did not seem work. here snippet of code: $(".calcsd").click(function() { $("input[type=text]").each(function() { arr.push($(this).val().trim() || 0); sum += parseint($(this).val().trim() || 0); }); where .calcsd button user clicks perform calculation. moreover, length of array given var number = arr.sort().filter(boolean).length; script intended filter out inputs left blank. also, if make difference, inputs dynamically added array via: $('.multi-field-wrapper').each(function() { var $wrapper = $('.multi-fields', this); $(".add-field", $(this)).unbind('click').click(function(e)...

vb.net - Can't access encrypted sqlite database -

i used navicat premium create database file , selected encrypted put password. when try accessing database in vb.net program error saying... file encrypted or not database "data source=\\10.10.10.10\folder\database.db;password=pwd;version=3;", true the above connection string (please ignore network path =) ). anyway, can through opening connection when reading data error. tried creating database doesn't have password , worked fine. copy pasted password have in code navicat make sure typed correctly.

I don't understand the Dojo documentation -

i'm beginner in dojo. first of javascript based? example create form have use javascript or html tags? also cannot understand documentation , tutorials. it's confusing. there proper website (other dojo itself) has tutorials? you can use dojo's components's (widgets) in 2 ways. programmatic , declaritive. programmatic way (what talking about) defining widgets through use of javascript. declaritive can define them using html markup. david walsh has nice short writeup , if search "declaritive programmatic dojo" you'll find questions , answers on matter: https://davidwalsh.name/dojo-widget difference between programmatically vs declaratively created widgets in dojo? declarative coding or programmatic coding in dojo projects? declarative or programatic approach in dojo? if you're having trouble tutorials on dojo website, suspect you're better off, first diving basic beginner javascript tutorials before trying learn framework dojo...

javascript - Custom handlebars each helper with index -

i wrote helper loops on array, i'm stuck @ getting index available each iteration. wish in view print index of current item. helpers: { each_min: function(ary, min, options) { if(!ary || ary.length == 0) return options.inverse(this); var result = []; for(var = 0; < min; ++i) result.push(options.fn(ary[i])); return result.join(''); } } my template {{#each_min p.name 4}} {{#if this}} {{index}} {{this}} {{else}} <p>-</p> {{/if}} {{/each_min}} looking through handlebars docs found relevant info in block helpers section. block helpers can inject private variables child templates. can useful add information not in original context data. ... make sure create new data frame in each helper assigns own data. otherwise, downstream helpers might unexpectedly mutate upstream variables. based on made these changes: template : {{#each_min p.name 4}} {{#if this}} {{@index}} {{thi...

html - Font Awesome icon in input placeholder not working -

i trying use font awesome icons in input placeholder. i tried not working. <body> <input type="text" placeholder="&#xf002;" style="font-family:fontawesome"/> </body> what’s wrong this? getting weird number in placeholder instead of icon. you can add font awesome icon <input type="text" placeholder="&#xf002" style="font-family:arial, fontawesome" /> you can check out fiddle fiddle click here

flash - Create text file using PHP and AC2 -

so have php code, actionscript code. when run flash file, doesn't want write. i've been searching hours solution online, not permissions. (note, not hosted on server, in folder on computer, issue?) php <?php $fscrn = $_post['fscrn'] $saveto = "full=".$fscrn."&" file_put_contents("video.txt",$saveto) ?> and actionscript 2 var videoresponse = new loadvars(); videoresponse.onload = function(success) { if (success) { trace("successful") } } var videovar = new loadvars(); videovar.fscrn = "true"; videovar.sendandload("config/video.php",videoresponse,"post"); bonus: image of file structure where swf located https://gyazo.com/918b0d9bcdb51996089b5d45846d1fd2 where php located https://gyazo.com/e758818fe895183b003e5b0fa5741abf anyone know solutions? (it print "successful" when run though) tl:dr > doesn't create new text file when php runs ...

c - Customize output of event auditing in FreeBSD -

i want customize output of event auditing in freebsd. read audit kernel , daemon code, , found auditd_gen_record function in /usr/src/contrib/openbsm/libauditd/auditd_lib.c , , think function generates event auditing records. since wanted make sure function function want, wrote simple function , call in auditd_gen_record function, sample function wrote didn't work reason! sample function is: void test_audit(void) { int fd; int flags = o_wronly | o_append; char * path = "/root/testoutputdata"; char * msg = "audit gen rec\n"; fd = open(path, flags); write(fd, msg, strlen(msg)); close(fd); } if think i'm in wrong place or function, or should manipulate else, please tell me. how can manipulate freebsd event auditing creating custom logfile? thanks!

reactjs - Element is removed after transitionLeaveTimeout - but how come not inserted after transitionEnterTimeout -

i have issue, animation 1 or 0 items of animation page - http://facebook.github.io/react/docs/animation.html#animating-one-or-zero-items my component shows message initially. when gets next message, fades out "leaving" element in 1second. because set transitionleavetimeout 1second well, element removed after fade out completes. however, set transitionentertimeout 1second (and tried 2second), however, "entering" element inserted first child on start of "leaving". how come "entering" element not inserted after transitionentertimeout ? there way make happen? the reason ask because if both present, "leaving" element gets shifted down line-height. can't css tricks -100% line height , others css bit complex. here copy paste eample shows issue: <html> <head> <script src="https://fb.me/react-with-addons-0.14.4.js"></script> <script src="https://fb.me/react-dom-0....

java - Prompting user for input until an empty line -

here main method cypher program. i'm trying modify code prompts user input until empty line submitted public static void main(string[] args) { scanner kb = new scanner(system.in); system.out.println("enter "); string message = kb.nextline(); system.out.println("enter encryption key: "); string key = kb.nextline(); int shift = integer.parseint(key); string encrypted = encrpyt(message, shift); system.out.println("encrypted: " + encrypted); string decrypted = decrypt(message, shift); system.out.println("decrypted: " + decrypted); } just use while loop. string line = kb.nextline() while (!line.equals("")) { (your code here) line = kb.nextline(); } the while loop break when user enters empty line.

css - Adsense Responsive not always displayed -

yup, 1 problem google adsense , responsive ads. added total of 3 ads site, 2 'horizontal' , 1 'auto'. created css classes them since adsense couldn't figure out width. .adsidebar { margin: auto; max-height: 600px; width: 302px; } .adcontent { margin: auto; width: 300px; @media #{$small-break} { width: 320px; } @media #{$large-break} { width: 730px; } } ads included using these classes. <div class="adcontainer"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle adcontent" style="display:block" data-ad-client="ca-pub-123456789" data-ad-slot="987654321" data-ad-format="horizontal"></ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script> </div> about 50% of time 3 ads displayed correctly. however, i...

mysql - Codeigniter Data Retrieve -

Image
here database structure same subject may have many teachers. first database teacher field foreign database. when searching individual subject how full teacher details. try this select * subject full outer join teachers on subject.teacher = teachers.id subject.subject '$search'; why full outer join ?? how in ci? $query = $this->db->query("select * subject full outer join teachers on subject.teacher = teachers.id subject.subject '$search' "); $result = $query->result_array(); return $result;

excel vba - Group rows by value -

Image
how programmatically group following data values in column b ? note, there random values in columns a , c . like this: --> try this sub demo() dim r range dim v variant dim long, j long activesheet on error resume next ' expand groups on sheet .outline.showlevels rowlevels:=8 ' remove existing groups .rows.ungroup on error goto 0 set r = .range("b1", .cells(.rows.count, 2).end(xlup)) end r 'identify common groups in column b j = 1 v = .cells(j, 1).value = 2 .rows.count if v <> .cells(i, 1) ' colum b changed, create group v = .cells(i, 1) if > j + 1 .cells(j + 1, 1).resize(i - j - 1, 1).rows.group end if j = v = .cells(j, 1).value end if next ' create last...

objective c - How to make a curve in UITableView Section Header iOS 8 -

Image
i have made parallax view in there google map , table view. i using this parallax library. all want place curve image in section header make this. i have tried tableheaderview in case scrolled table view. then tried viewforheaderinsection . when reach @ top header become fixed , table scrolls. but issue can see cell behind curved image.

php - Success:1 still no notification in android -

i trying send push notification through gcm getting: { "multicast_id":4793018731783267982, "success":1, "failure":0, "canonical_ids":0, "results": [ { "message_id":"0:1452928098906665%a69ccee8f9fd7ecd" } ] } but still no notification coming. here code: //index.php code $app->get( '/notify',function () use($app) { $response = array (); $regid="device registration id"; //hard coded $message="hi everyone.this notify you" ; $registatoin_ids = array($regid); $message = array("price" => $message); $db = new dbhandler (); $result = $db->send_notification($registatoin_ids, $message); echorespnse ( 200, $result); } ); //dbhandler code public function send_notification($...

how to delete files and folders -

how delete files or folders start 2015 , 2014? this have far, deletes files , folders under c:\temp folder @title = @echo on set folder="c:\temp" cd /d %folder% /f "delims=" %%i in ('dir /b') (rmdir "%%i" /s/q || del "%%i" /s/q) pause you use for loops walk through directory tree; for /r /d enumerates subdirectories recursively, , for /r returns files: pushd "c:\temp" /r /d %%i in ("2014*" "2015*") ( rmdir /q "%%~fi" ) /r %%i in ("2014*" "2015*") ( del /q "%%~fi" ) popd or let dir /b /s return items, files , directories, , parse output for /f loop: pushd "c:\temp" /f "eol=| delims=" %%i in (' dir /b /s "2014*" "2015*" ') ( 2> nul rmdir /q "%%~fi" || del /q "%%~fi" ) popd the 2>nul redirection avoids error messages returned rmdir , if current ite...

javascript - EmberJS Data DS.JSONSerializer vs. DS.JSONAPISerializer -

i have emberjs project 2 model, both seams use different serializers. debugging inside emberjs data i've seen first model class of serializer "ds.jsonapiserializer" , other "ds.jsonserializer". both use same. i didn't override serializers , respective adapters empty , extend same adapter (generaladapter). the difference modela objects pushed ember server using request , adapter (using same adapter modelb) whereas modelb pushing store.pushpayload controller (without using adapter). is feature or bug or totally miss understanding something? edit: adapter code: app.applicationadapter = ds.adapter.extend(ds.buildurlmixin, { namespace: rabbit.common.baseurl + 'editor-jersey', defaultserializer: '-rest', headers: { accept: 'application/json' }, findall: function(store, type, sincetoken) { var adapter = this; var url = this.buildurl(type.modelname, null, null, 'findall');...

java - Where to find the main layer.xml file in Netbeans RCP maven project? -

Image
i trying dev application based on netbeans rcp, far good, change default menu (hide menu don't want / need). i found have edit layer.xml, don't know find default one. i can create new layer.xml, module. any ? thanks. short answer: there isn't one, need create manually , modify liking. longer answer: there no 'default' layer.xml 'app'. keep in mind, nbp app platform + bunch o' modules. there no 'main' module. each module can have (single) layer.xml file (rather, each module have layer.xml file, albeit generated). @ run-time, platform (module system?) merges layer.xml files modules bundled app. layer xml no longer necessary introduction of annotations (i think thats reason, mistaken). nbp build generates layer.xml annotations in module's source files. after building module, can see in output directory 'generated-layer.xml'. creating xml layer file: right click on module in project tree , select new -...

hadoop - How to find the actual IP address of a Cent OS virtual machine? -

Image
hi, have installed cent os inside vm ware. want know ip address. when try find using "ifconfig" in terminal, showing local address(127.0.0.1). might issue? want know actual ip address. you can try ip s or ifconfig -a what see if address of localhost interface, seems vm doesn't have ethxxx of emxxx interface configured

html - The three-column layout conundrum, this time sans header and footer -

i know 1 of web 1.0 newbie questions, alas, in position asking myself. sites not necessitate sort of layout , looking @ doing 1 friend three-column layout, fixed-width center column...with twist of no header or footer box elements , stip 3 columns stretch height-wise fit size of screen on viewed. further exacerbating issue body have 1 color or background image , center column have own background color or image. visually, page layout such: +----------+---------------+----------+ |nothing |only content |nothing | |here |will here |here | |just |w/a different |just | |body b/g |background |body b/g | |color or |color or |color or | |image |image |image | | | | | | |all 3 columns | | | |always fill | | | |screen height | | +----------+---------------+----------+ i have read interesting arguments against absolute positioning (adobe forum...

html - What does `//` in javascript's src attribute do? -

this question has answer here: is valid replace http:// // in <script src=“http://…”>? 12 answers can change http:// links //? 6 answers i'm using facebook's javascript sdk , has double forward slashes. mean? <script src="//connect.facebook.net/en_us/all.js"></script> i know single / means root directory, // ? telling source use http:// , path? this "protocol-relative" link. uses http or https depending on used load current page.

node.js - How to connect to gitHub api using nodejs from a secure network? -

i using below code repositories github. when use home network able retrieve list of repositories, if try fetch repo other network gives me error: 'connect econnrefused'. new nodejs, still wondering how go solving issue. any ideas? var https = require("https"); var username='xyz'; var options = { host :"api.github.com", path : '/users/'+username+'/repos', method : 'get' } var request = https.request(options, function(response){ var body = ''; response.on('data',function(chunk){ body+=chunk; }); response.on('end',function(){ var json = json.parse(body); var repos =[]; json.foreach(function(repo){ repos.push({ name : repo.name, description : repo.description }); }); console.log('the repos '+ json.stringify(repos)); }); }); request.on('error', function(e) { console.error('and error '+e); }); request.end(); ...

How get large size album pictures of facebook? -

i using facebook graph api, using login user, user allow permission user_photos , graph api getting list of albums, list of pictures album id, pictures of thumbnail size 130x130. please give code hint large image of album's upload pictures. following code using access albums , pictures $albums = $fb->get('/me/albums', $accesstoken)->getgraphedge()->asarray(); foreach( $albums $album_id => $album_data ){ $fbpictures = $fb->get("/".$album_data['id']."/photos?fields=picture&limit=12&type=normal", $accesstoken)->getgraphedge()->asarray(); } $fbpictures variable getting arrays of pictures of album, has picture id , url of small thumbnail, can't access large size image. please guide me how possible? thanks lot

Does Firebase have a timeout policy for write operations? -

there setvalue( ) save data firebase. happens if connection very slow. there timeout limit saving data? if timeout, retry? if retries, how many times? also, there timeout reading method ondatachange(datasnapshot snapshot) , updating methods? is there way set own timeout limits? when client first connects firebase (so when executes first new firebase(...) , establishes websocket connection server. after data transferred on pre-established connection. when call setvalue() or write operation, command sent on open socket server. when client adds listener (with addvalueeventlistener() or similar), server send updates on open socket client. since there no connection being established, time-outs don't come play here. when connection between client , server somehow lost, client try re-establish connection. uses exponential back-off here, tries reconnect , progressively less frequently. while there no connection server, client keep serving data received in memory...

Azure - Creating a queue keep returns "(400) bad request" -

i trying create new storage queue azure keeps crash without explanation, creating tables worked fine, relevant code: private cloudtable usertable; private cloudtable pettable; private cloudqueue healingqueue; public override bool onstart() { cloudstorageaccount storageaccount = cloudstorageaccount.parse(cloudconfigurationmanager.getsetting("connectionstring")); cloudtableclient tableclient = storageaccount.createcloudtableclient(); usertable = tableclient.gettablereference("users"); usertable.createifnotexists(); pettable = tableclient.gettablereference("pets"); pettable.createifnotexists(); // create queue: // cloudqueueclient queueclient = storageaccount.createcloudqueueclient(); healingqueue = queueclient.getqueuereference("healqueue"); healingqueue.createifnotexists(); // line ...

css - Get rid of lines in bootstrap dropdown navbar -

Image
does know how rid of these lines separating menu items? i've been looking under .dropdown-menu class in bootstrap css, can't find alter lines. the default nav bar drop down menu doesn't see example : https://getbootstrap.com/examples/navbar/ it may css file include in project cause effect

PHP DOM RemoveChild doesn't work -

i have following code: <?php $li = ('www.somesite.com'); $ht = file_get_contents($li); $dom = new domdocument(); libxml_use_internal_errors(true); $dom->loadhtml($ht); $divs = $dom->getelementsbytagname('section'); foreach ($divs $div){ if(preg_match('/\btresc\b/', $div->getattribute('id'))) { $chapter = $div->getelementsbytagname('div1')->item(0); $oldchapter = $div->removechild($chapter); echo $oldchapter; } } ?> i'm trying remove <div class="div1">.*</div> <section id="tresc">.*</section> however, following error: fatal error: call member function removechild() on non-object. know i'm doing wrong here? appreciated! don't include quotes in preg_match(), getattribute() give plain value without quotes: if(preg_match('/tresc/', $div->getattribute('id...

Scala: Dynamically generating match clauses for case classes -

i want use power of scala's pattern matching within set of `condition-action' rules. these rules not known in advance, rather generated @ runtime according complex critera. algorithmic generation mechanism can considered separate , not part of question, concerned how express via scala reflection/quasiquotes. concretely, i'm looking generate case definitions (of general form case v0@x(v1,_,v2): x => f(v1,v2) ) @ runtime. it presumably possible via toolbox.parse(str) string generated @ runtime. however, if possible seem desirable incorporate greater degree of type-safety this: more specifically, want case defs match against sealed case class hierarchy of terms ( term,var(name: char),lit(value:int),group(a: term,b: term,c: term) ). for example, generated case def in general, return function of none, or of v0,v1,v2: t match { case v0@group(v1@_,v2@var('a')) => group(v2,v0,group(v1,var('z'),lit(17))) // etc } i'm attempting fol...

requiredfieldvalidator - required field validator not working row updating gridview -

hi here below code on gridview rowupdating event. why required field validator not working? if (string.isnullorempty(txtkmstart.text) && string.isnullorempty(txtkmend.text)) { requiredfieldvalidator rfvs = new requiredfieldvalidator(); rfvs.controltovalidate = txtkmstart.id; rfvs.errormessage = "km start required!"; requiredfieldvalidator rfve = new requiredfieldvalidator(); rfve.controltovalidate = txtkmend.id; rfve.errormessage = "km end required!"; validationsummary vs = new validationsummary(); vs.showsummary = false; vs.showmessagebox = true; } and gridview below <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" autogenerateeditbutton="true" backcolor="white" bordercolor="#336666" borderstyle="double" borderwidth=...

ios - UITableViewCell swipe change content with nib file -

Image
can ios uitableview change or populate different uitableviewcell object's content different .xib files, when user swipes, content change @ current swiped row. two ways: 1) recognize swipe uiswipegesturerecognizer.use uiscrollview in each cell , write logic based on swipe handler. 2) use gallery-like library. example, gbinfinitescrollview ( github

python - Sorting numpy lists -

i having troubles working numpy arrays new numpy. have big input read sys.stdin , consisted of lines 2 values , space between them, representing point or 2 coordinates. save in list looks this: np.array([[1, 3], [5, 6], [7, 2], [9, 9]]) i want sort list sums , x-coordinate, not sure how this. i not sure how add sum third element of each sublist, in case wanted add it. relying on python's built-in sorted inefficient numpy-arrays, when these big. try instead: import numpy np l = np.array([[1, 3], [5, 6], [7, 2], [9, 9]]) ind = np.lexsort((l[:,0], l.sum(axis=1))) sorted_l = l[ind] ind contain indices of original array, sorted 2 arrays given lexsort . last array primary sort column lexsort . l[ind] selects these indices original array.

php - (Needle, Haystack) with 2 arrays, confused -

have been trying figure out simple problem 3 days , don't understand why function removes of values, leaves others in place. this function checks list of bad domains against list of domains, if finds bad domain, removes domains list. here's code: // check each bad domain, against each array in array list $bad_domains = array('youtube.com', 'facebook.com', 'google.com', 'twitter'); $good_domains = array( 'http://www.wufoo.com/', 'https://plus.google.com/u/0/b/105790754629987588694', 'http://studioduplateau.com/ss=', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=ka-boom', 'la...

c# - The entity type ApplicationUser is not part of the model for the current context after swapping server from local to external -

i have error after transfer whole data local external server. both databases have same tables etc. how fix this? work correctly before change server local external. data different register or login adding correctly. connecton string <add name="defaultconnectionentities" connectionstring="metadata=res://*/models.biuromodel.csdl|res://*/models.biuromodel.ssdl| res://*/models.biuromodel.msl; provider=system.data.sqlclient; provider connection string=&quot; data source=db-mssql;initial catalog=inzs9776; persist security info=true;user id=inzs9776; password=xxxxx&quot;" providername="system.data.entityclient" /> defaultconnectionentities class public partial class defaultconnectionentities : dbcontext { public defaultconnectionentities() : base("defaultconnectionentities") { } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { throw n...