Posts

Showing posts from January, 2013

apache - Wordpress custom folder as homepage -

in wordpress have folder name custom custom script. visit myexample.com/custom script work. wish use myexample.com script instead of myexample.com/custom . want replace custom script rather displaying default homepage of wordpress. just add template comments in top of main file under custom folder. <?php /* template name: example template */ ?> how create page template: http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-page-in-wordpress/ create new page select page template page template dropdown , set page home page.

jsontemplate - Can I insert content after every third item in a Squarespace JSONT repeated loop? -

how can add new row after 3 items in repeat loop? repeat loop is: <div class="row"> {.repeated section items} <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 gallery-item"> {.image?}<img class="img-responsive loading" {@|image-meta} />{.end} </div> {.equal? @index 3} </div><div class="row separator"> {.end} {.end} </div> i can add row after first 3 items, want add after each third element {.equal? @index 3} </div><div class="row separator"> {.end} edit: don't find information in docs . as far know there's not built in way "every third item". you're on right track. can preset intervals depending upon intended page size. keep template bit simplified can use block partial: blog-separator.block </div><div class="row separator"> blog.list {.equal? @index 3} {@|apply blog-s

entity framework - Lambda Grouping to Generic Repository EF with order by C# -

i have query repository base, , here have generic implementation return records & aren't paged, , need implement grouping in generic death of system. a pagedresult object returned of specific type: public class pagedresult<t> : pageddata { public ilist<t> results { get; set; } } pageddata object has random return fields... the method of doom in question following: public virtual pagedresult<tentity> getpagegrouped(int pageindex, int pagesize, func<iqueryable<tentity>, iorderedqueryable<tentity>> orderby, expression<igrouping<object,tentity>> groupby, expression<func<tentity, bool>> filter = null, params expression<func<tentity, object>>[] navs) { iqueryable<tentity> query = this.context.set<tentity>(); if (filter != null) { query = query.where(filter); } foreach (var nav in navs) { query =

ruby - require: command not found -

which ruby - /usr/local/bin/ruby .bash_profile has above path i have not left trailing spaces before #!/usr/bin/env ruby in ruby script when try run sh ruby_script , gives require: command not found . not able recognize of ruby commands. i checked other posts getting same error, , fixed accordingly. else missing? running sh ruby_script wrong. must run ruby ruby_script instead. if file executable run ./ruby_script .

Call to undefined function hash_equals() in Facebook/Helpers/FacebookRedirectLoginHelper.php -

i'm trying basic info facebook user. i'm following official docs. don't know how rid of error. session_start(); require_once 'facebook/autoload.php'; $fb = new facebook\facebook([ 'app_id' => 'xxxxx', // replace {app-id} app id 'app_secret' => 'xxxxxxxxxx', 'default_graph_version' => 'v2.2', ]); $helper = $fb->getredirectloginhelper(); //get access token try { //access token account $access_token=$helper->getaccesstoken(); } catch (facebook\exceptions\facebookresponseexception $e) { echo 'graph returned erorr'. $e->getmessage(); exit; }catch(facebook\exceptions\facebooksdkexception $e){ echo 'graph returned erorr'. $e->getmessage(); exit; } echo '<h3>access token</h3>'; var_dump($accesstoken->getvalue()); $loginurl = $helper->getloginurl('https://startup-sarathjasrin.c9users.io/login/&

java - Loading from object file -

i want load information object file array of type "song" public class song { string name; string singer; public void setname(string name) { this.name = name; } public void setsinger(string singer) { this.singer = singer; } public string getname() { return name; } public string getsinger() { return singer; } @override public string tostring() { return getname() + "\t" + getsinger() + "\n"; } and how try read did not work private void loadfromobj(file f) { objectinputstream ois = null; fileinputstream fis = null; try { song[] s = new song[100]; object obj; fis = new fileinputstream(f); ois = new objectinputstream(fis); while ((obj = ois.readobject()) != null) { (int = 0; < s.length; i++) { s[i] = (song) obj; } } ois.close(); fis.close(); // refreshtable(s); } catch (

java - PrintWriter writes something strange to txt -

i wanted program write utf-8 letters in .txt file result have numbers , other non-sense chars. me solve it? have no idea how make in print writer. i'll appreciate help. here's code. //all imports public class main extends application { stage okno; tableview<produkt> tabela; textfield nazwawejscie, iloscwejscie; public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) throws exception { okno = primarystage; okno.settitle("stwórz listę zakupów"); // kolumna nazwa tablecolumn<produkt, string> kolumnanazwa = new tablecolumn<>("nazwa"); kolumnanazwa.setminwidth(200); kolumnanazwa.setcellvaluefactory(new propertyvaluefactory<>("nazwa")); // kolumna ilosc tablecolumn<produkt, double> kolumnailosc = new tablecolumn<>("ilość"); kolumnailosc.setmin

html5 - How can I keep my two sections on the same line? -

so i'm working on website design 2 sections stand right next each other, reason 1 section goes under other one. can me find problem? thanks! html code: <section id="sec1"> <img src="https://tse1.mm.bing.net/th?&id=oip.mbd6b4f30000f7e872ca4c55c2cedd6fao0&w=300&h=215&c=0&pid=1.9&rs=0&p=0&r=0" id="img1"> <h6 class="bodytext">watershed definition</h6> <p class="bodytext">a ridge or area of land separates waters flowing different rivers, basins, or seas</p> </section> <section id="sec2"> <img src="http://www.nature-education.org/estuary.gif" id="img1"> <h6 class="bodytext">estuary definition</h6> <p class="bodytext">an arm or inlet of sea @ lower end of river or body of water.</p> </section> css code: #sec1 { background-color: #75c776; width: 400px; h

ios - Could not install Cocoa pods in OSX 10.11 -

please me , guid. error show on terminal ssmac100s-mac:~ ssmac100$ sudo gem install cocoa pods password: error: while executing gem ... (gem::remotefetcher::fetcherror) errno::etimedout: operation timed out - connect(2) ( https://rubygems.org/quick/marshal.4.8/cocoapods-1.0.0.gemspec.rz ) try worked me. sudo gem install -n /usr/local/bin cocoapods

Finding executable in PATH with Rust -

in python can: from distutils import spawn cmd = spawn.find_executable("commandname") i tried code below, it assumes you're on unix-like system /usr/bin/which available(also involves execution of external command want avoid): use std::process::command; let output = command::new("which") .arg("commandname") .unwrap_or_else(|e| /* handle error here */) what simplest way in rust? i'd grab environment variable , iterate through it, returning first matching path: use std::env; use std::path::{path, pathbuf}; fn find_it<p>(exe_name: p) -> option<pathbuf> p: asref<path>, { env::var_os("path").and_then(|paths| { env::split_paths(&paths).filter_map(|dir| { let full_path = dir.join(&exe_name); if full_path.is_file() { some(full_path) } else { none }

javascript - Hide a div that is currently opened and show the div thats clicked,and vice versa -

i want create product listing page using jquery, page: https://losangeles.sharegrid.com/browse/ here code: $(function(){ $('.link').click(function(){ $(this).next('ul').toggle(); var id = $(this).attr("rel"); $('#'+id).show(); }); }); .container { width: 100%; height: auto; } .eighty-percent { width: 80%; margin: 0 auto; } .categories { width: 20%; float: left; ul { li { ul { display: none; } } } } .products-list { width: 80%; float: right; display: none; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="container"> <div class="eighty-percent"> <div class="categories left"> <ul> <li> <a href="#" class="link" id="main-category&quo

c++ - QThread interthread communication: strange behavior connecting to &QThread::quit vs connecting to a lambda [&thread] { thread->quit();} -

i have following setup: int main(int argc, char *argv[]) { qcoreapplication a(argc, argv); // create dbmanager live entire // duration of application auto dbmanagerthread = std::make_unique<qthread>(); auto dbmanager = std::make_unique<dbmanager>(); dbmanager->movetothread(dbmanagerthread.get()); dbmanagerthread->start(); // initialization of application, create // inithelper object utilize dbmanager auto inithelper = new inithelper(); auto inithelperthread = new qthread(); inithelper -> movetothread(inithelperthread); // wire inithelper , thread qobject::connect(inithelperthread, &qthread::started, inithelper, &inithelper::run); qobject::connect(inithelper, &inithelper::finished, [&inithelperthread] { inithelperthread->quit();}); qobject::connect(inithelper, &inithelper::finished, inithelper, &inithelper::deletelater); qobject::connect(inithelperthread, &qth

vba - How can I Extract only the text from cells which are formatted in a specific way. (excel) -

hi wonder if can help. importing html file places text first column of spreadsheet. text appear formated in various ways example may of colour or in italics, bold or combination. is there way extract various text column based upon it's format , copy text column vba? please see example below of achieve. many in advance. link shows screen shot of excel , achieve you may start code option explicit sub main() dim cell range dim word variant, coloff variant dim coloffstrng string worksheets("mysheet") '<~~ change "mysheet" whatever name sheet has each cell in .range("a4:a" & .cells(.rows.count, 1).end(xlup).row).specialcells(xlcelltypeconstants, xltextvalues) '<~~consider cells in column row 4 last non empty cell containing text values each word in split(worksheetfunction.trim(cell)) '<~~ check each word in cell. space assumed words separator, multiple spaces considered 1 sp

c# - Convert browser blur pixel value to ImageProcessor Library GaussianBlur kernel equivalent -

im tring write image editor can edit image on client , make changes on server (lite version of paint). filtering, crop resize , ... problem: imagine choose 10px of blurness in editor, when pass value 10 factory.gaussianblur(value); invalid result. please let me know how can convert px value gaussianblur kernel value the sample code is private static bool blurfilter(string sourceimage, string destinationimage, int value = 100) { try { if (string.isnullorempty(destinationimage)) destinationimage = sourceimage; imagefactory factory = new imagefactory(); factory.load(sourceimage); factory.gaussianblur(value); factory.save(destinationimage); factory.image.dispose(); factory.dispose(); factory = null; return true; } catch (exception ex) { exceptionlogger.log(ex); return false; } }

javascript - Masonry: Images overlapping above each other -

i'm new js. i'd achieve effect showcasing photos: kristianhammerstad.com i'm using masonry, see code: http://codepen.io/kiks/pen/ywznjr images have same width different height. that's rule. the problem shown on video simulation: jmp.sh/mmcu1bb – images have different height, grid broken , images placed on each other. when have same height of linked images, grid ok. funny thing issue see in video on website (chrome, safari) it's working nicely in codepen (after first load, if resize browser window, ok). can explain this? special codepen include there? this code. tell me i'm missing , where? i'm learning, please have patience. thank you /* masonry magic */ .container { width: 96% !important; margin: 0 auto; } * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } #masonry { margin: 0 auto; width: 100%; position: relative; /*z-index:2001;*/ } .item { width: 460px; height: auto; background: invisible;

android - java.lang.IllegalArgumentException: Illegal character (d83d) -

while saving xml data file in android app, exception when user puts emoji character. d83d character one, understand: http://apps.timwhitlock.info/unicode/inspect?s=%f0%9f%98%84 - smily 😄 character. the relevant stack-trace: java.lang.illegalargumentexception: illegal character (d83d) @ org.kxml2.io.kxmlserializer.reportinvalidcharacter(kxmlserializer.java:144) @ org.kxml2.io.kxmlserializer.writeescaped(kxmlserializer.java:130) @ org.kxml2.io.kxmlserializer.attribute(kxmlserializer.java:465) the overarching question is : how fix it, users don't have app crashing on emojis... the follow-up questions are: is kxmlserializer supposed support emoji/unicode? is there updated version somewhere? couldn't find far. lib actively maintained? who maintaining kxmlserializer? http://kxml.org/ ? couldn't find there... wouldn't updated version, if put on class-path, collide android built-in one? what other xml-writing lib should/could use replace kxmlserializer?

Laravel 5.2 method to check is view exists? -

is there method check if view exists? like php file_exists, using internal laravel method convenience i want code this: if(__ifviewexist__($view)){ return view($view)->render(); } return "page tidak ditemukan"; yes, exists() method available. if(view()->exists($view)){ return view($view)->render(); } return "page tidak ditemukan";

android - Create a custom gradient with 2 shapes -

i want create gradient background in android. i've used angrytools.com generate these 2 shapes. not sure how implement them. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:type="linear" android:centerx="100%" android:startcolor="#7f000000" android:centercolor="#ffffffff" android:endcolor="#ffffffff" android:angle="90"/> </shape> ------------------------------------------------- <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:type="radial" android:centerx="50%" android:centery="50%" android:startcolor="#7f000000" android:centercolor="#ffffffff" android:endcolor="#ffffffff" android:gradientradius="100"/> </shape> try use layer-l

angular - Converting mysql date to js date works in chrome but not safari -

i using pipe in angular2 convert mysql date js date format here code: export class datetoiso { transform(value) { let date = new date(value); let str = (date.getmonth() + 1) + '.' + date.getdate() + '.' + date.getfullyear() return str; } } in html use {{ post[2] | datetoiso}} show converted date. in chrome correct datetime not in safari. returns nan.nan.nan . i had similar problem currency pipe , internationalization issue. wrote here http://blogs.msmvps.com/deborahk/angular-2-getting-started-problem-solver/ install international package: npm install intl@1.1.0 –save include following in index.html: (i'm using touch device , pasted code doesn't work. please see link)

Pre-calculated JOIN queries as map in ignite -

i new ignite , pocing currently. have question regarding ways store/load data in map. it's bit tricky , strange requirement. example: i have employee, department, project [tables in database] + [entity classes in application]. don't want store each of these in separate map in memory rather want store pre-calculated join results in designated map. dynamic query : select employeeid,employeename,departmentname,projectname,projectstart,projectend employee,department,project $join i know @ least before hand that, key fields , value fields. above example, can denote "map" shown below, key : set (employeeid,departmentid) value : list (employeename,value),(departmentname,value),(projectname,value),(projectstart,value),(projectend,value) so can see every pair of (employeeid,departmentid) having multiple values associates it. dilemma don't have domain model/entity pojos before hand. such dynamic views/maps can added flexibly don't have go , change

knockout.js - Table not updated when ko.observablearray changes -

i'm binding ko.observablearray table. each object (called 'group') in array bound table. each group holds (non-knockout) array of codes. each code bound row. each code has boolean, bound checkbox. if none of booleans true in group, want checkboxes group enabled. if @ least 1 of booleans true in group, want false checkboxes group disabled, , true checkboxes enabled. when page loaded, works expected; however, when check or uncheck box, enabled/disabled status of boxes not change. looking @ debugger, observablearray being updated, data in table not. page: <table data-bind="foreach: {data: groups}"> <thead> <tr> <th colspan="3" data-bind="text: groupname"></th> </tr> </thead> <tbody data-bind="foreach: {data: codes}"> <tr> <td data-bind="text: codeid"></td> <td data-bind=

Adding elements to the diagonal of a matrix that is not square in R -

i want able add value (in code nug ) i,j entry of matrix = j (so kronecker delta function). easy when matrix square (see code below) not sure how in 1 line when matrix not square nug = 2 r = tau + diag(nug,nrow(tau)) the above code works when tau square matrix imagine tau not square. how add nug each of i,j elements of tau = j? m <- matrix(1:6, ncol = 2) m [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 diag(m) <- diag(m) + 1:2 m [,1] [,2] [1,] 2 4 [2,] 2 7 [3,] 3 6

dom - Javascript: Replace Element vs Change Element Property -

while reading image lazy loading script, noticed there such operations(comments added me): function loadimage (el) { var img = new image() , src = el.getattribute('data-src'); img.onload = function() { if (!! el.parent) el.parent.replacechild(img, el) // replace element else el.src = src; // change element property } img.src = src; } why not change element property? simpler. why create new element , replace old element (both elements images,anyway)? advantages? function loadimage (el) { src = el.getattribute('data-src'); el.src = src; // change element property } it done way provide off-screen loading , browser efficiency purposes (though specific implementation flawed in regard). it seems lazy loading wants actual loading of image happen "out of view". so, reason, new image object created , .src set on that. then, once new image has been loaded, more efficient browser use

python - Attribute system similar to HTTP Headers for local files -

i in process of writing program , need guidance. essentially, trying determine if file has marker or flag attached it. sort of attributes http header. if such marker exists, file manipulated in way (moved directory). my question is: should storing flag/marker? files have system similar http headers? don't want access or manipulate contents of file, kind of property of file can edited without corrupting actual file--and must rather universal among file types potential domain of file types unbound. have experience web apis familiar http headers , json. similar system exist local files in windows? interested in has professional/industry knowledge of common techniques programmers use when trying store 'meta data' in files in order access them later. or if knows of point me, unsure should researching. for record, going write program windows using golang or python. , files going manipulate potentially common ones (.docx, .txt, .pdf, etc.) thanks in advanced!

function - c++ program for address and variables -

the output code : 9 and i'm not sure change in function add1 , &n mean , when assign i &n #include <iostream> using namespace std; int add1(int &n){ n++; return n; } int main(){ int m = 0; (int = 0; < 5; i++){ m += add1(i); } cout << m ; cout << "\n\n"; return 0; } when & used in parameter list, cause parameter passed reference function. what means n in function add1 , point same space in memory i in main function. changes n reflected in i , act different names same thing.

hadoop - What affects amount of data shuffled in spark -

for example im executing queries on spark, , in spark ui can see queries have more shuffle , , shuffle seems amount of data read locally , read between executors. but im not understanding 1 thing, example query below loaded 7gb hdfs suffle read + shuffled write more 10gb. saw other queries load 7gb hdfs , shuffle 500kb. im not understanding this, can please help? amount of data shuffled not related in data read hdfs? select nation, o_year, sum(amount) sum_profit ( select n_name nation, year(o_orderdate) o_year, l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity amount orders o join (select l_extendedprice, l_discount, l_quantity, l_orderkey, n_name, ps_supplycost part p join (select l_extendedprice, l_discount, l_quantity, l_partkey, l_orderkey, n_name, ps_supplycost partsupp ps join (select l_suppkey, l_extendedprice, l_discount, l_quantity, l_partkey, l_ord

android - Jackson + Gson + Retrofit Expected BEGIN_OBJECT but was BEGIN_ARRAY -

i know has been asked lot but, none of question i've found solve especific problem. here json [json url][1] [ { "unit":"imeca", "value":29, }, { "unit":"imeca", "value":43, } ] this dto zona.java public class zona { private string unit; private int value; public string getunit() { return unit; } public void setunit(string unit) { this.unit = unit; } public int getvalue() { return value; } public void setvalue(int value) { this.value = value; } @override public string tostring() { return string.valueof(unit) + ": " + string.valueof(value); } } and interface api.java public interface api { @get("/data/heatmap_stations.json") call<zona> getzona(); } i kind of understand why happens , because json array response jackson + gson expecting single json object. i tried creating pojo this: zon

html - Font not working on Chrome and Firefox, but on Safari -

Image
i have created popup kind of div using css. here code. @import url(https://fonts.googleapis.com/css?family=oswald:400,300,700); .popups-right { background: #f57b20 none repeat scroll 0 0; border-radius: 40px; font-family: 'oswald', sans-serif !important; color: #fff; font-size: 26px !important; text-transform: uppercase !important; font-weight: bold !important; right: -120px; padding: 15px; position: absolute; text-align: center; width: 33%; line-height: 40px; } .popups-right::after { border-left: 0px solid transparent; border-right: 54px solid transparent; border-top: 20px solid #f57b20; bottom: -12px; content: ""; display: block; height: 0; position: absolute; width: 0; } here html code <div class="popups-right"> <h3 style="color: #34213e;">ready fixed?</h3> <h3 style="color: #fff;">dont forget include <b

parallel data warehouse - override default script for initialization of flyway metadata table -

i'm working microsoft parallel data warehouse appliance , attempting use flyway handle table migrations in environment. issue i'm running default script establishing schema_version table fails. here default script far can tell being executed upon calling baseline(). create table [dbo].[dbresult_migration] ( [installed_rank] int not null, [version] nvarchar(50), [description] nvarchar(200), [type] nvarchar(20) not null, [script] nvarchar(1000) not null, [checksum] int, [installed_by] nvarchar(100) not null, [installed_on] datetime not null default getdate(), [execution_time] int not null, [success] bit not null ); alter table [dbo].[dbresult_migration] add constraint [dbresult_migration_pk] primary key ([installed_rank]); create index [dbresult_migration_s_idx] on [dbo].[dbresult_migration] ([success]); specifically microsoft parallel data warehouse (ms pdw or aps known) doesn't support expressions default constraints. m

java - invoke RMI method from servlet -

i'm writing servlet make rmi call. i've write rmi server , tested java swing client, , goes fine. have problem using servlet. when user open main web page, servlet automatically call rmi method retrieve information on database, build web page show. when user click link fired servlet invoke rmi method, obtain error: java.rmi.connectexception: connection refused host: 192.168.1.101; nested exception is: java.net.connectexception: connection refused @ sun.rmi.transport.tcp.tcpendpoint.newsocket(tcpendpoint.java:619) @ sun.rmi.transport.tcp.tcpchannel.createconnection(tcpchannel.java:216) @ sun.rmi.transport.tcp.tcpchannel.newconnection(tcpchannel.java:202) @ sun.rmi.server.unicastref.newcall(unicastref.java:340) @ sun.rmi.registry.registryimpl_stub.lookup(unknown source) @ project.remoteclass.getengine(remoteclass.java:33) @ project.mainservlet.processrequest(mainservlet.java:57) @ project.mainservlet.doget(mainservlet.java:176) @ javax.servlet.http.httpservlet.service(ht

cordova - Ionic get installed apps on android device -

i'm new @ ionic framework , mobile apps, there plugin or method list of installed apps on android devices? there indeed readymade cordova plugin available gives list of installed apps in device. applist plugin should out. infact gives app icon well.

Count dates inside an array PHP -

i have array : array ( [0] => array ( [x] => 2016-04-19 ) [1] => array ( [x] => 2016-05-25 ) [2] => array ( [x] => 2016-05-26 ) [3] => array ( [x] => 2016-05-27 ) [4] => array ( [x] => 2016-05-28 ) [5] => array ( [x] => 2016-05-29 ) [6] => array ( [x] => 2016-05-29 ) [7] => array ( [x] => 2016-06-02 ) [8] => array ( [x] => 2016-06-03 ) [9] => array ( [x] => 2016-06-07 ) [10] => array ( [x] => 2016-06-10 ) [11] => array ( [x] => 2016-06-17 ) [12] => array ( [x] => 2016-06-24 ) ) i'm trying count how many days duplicates , number in variable. example can see there 2 same dates: 2016-05-29 i've tried array_count_values() says can count strings , integers. that's correct because date variable. it's code: $eventdates = $object->get("date"); $result = $eventdates->format("y-m-d"); $data[] = array("x"=>$result); any idea of how c

Linux -OpenWrt- (Unwired One) python wlan interface scan error -

the thing trying achive, want android app list of available wlan connections within range of device wlan (at point device access point). want tell device network connect. far good. i trying access wlan module on openwert device via python. using [1] python module. when execute following example code python iwlist.py wlan0 scanning i error interface not support scanning then started dig inside of code, , real error message one: argument list long and error comming module (from file iwlibs.py). exact code snippet (class iwrange, update()) comming : buff, s = iwstruct.pack_wrq(640) print "now comes error" status, result = iwstruct.iw_get_ext(self.ifname, pythonwifi.flags.siocgiwrange, data=s) i dont know if of help, checked buff variable , says 0x00 (i guess there should other stuff bcz indicating address in memory, of course wrong , buffer being initialized there). so, not sure prob

Makefile: for each .x file, create a .html file -

( similar question here ). every .x file in directory want run command generate html file. command works fine, it's makefile i'm having trouble with. here's came with: all: $(objects) objects := $(patsubst %.x,%.html,$(wildcard *.x)) %.html: %.x generate $< > $@ the objects variable meant contain html files need generate. invoking make states nothing done 'all' , , there no html files in directory. turns out make sensitive order of variable definitions. makefile works when first 2 lines switched!

python - Opaque text with transparent background in wxpython -

in wxpython, can change transparency of frame using 'settransparent()' function. there sample app shows use of transparent frames here . however, text fades transparency changes (predictably). possible make text remains opaque while background changes transparency?

Getting META tag Attributes PHP From URL -

hi having issue when scraping meta tags url, code works on php fiddle on server return data appears different file, number of tag properties different. example 'og:url' meta tag returns tld (domain) without path passed. in browser , phpfiddle same code returns full url, including path desired. appears treating request server differently. ideas appreciated. $dom = new domdocument(); @$dom->loadhtmlfile($url); foreach( $dom->getelementsbytagname('meta') $meta ) { echo $meta->getattribute('property'). "=>" .$meta->getattribute('content').";\n"; } try http://php.net/manual/de/function.get-meta-tags.php may works. should work curl too, havent enough experience curl. hope you.

python - Wired behavior evaluating tuple -

when have list of tuples , try evaluate type each of elements of list in function see behavior in [348]:def f2(x): if x[0]==tuple: return true else: return false in [349]:w=[(0,1)] in [350]:f2(w) out[350]: false but when evaluate elements indvidually expected result in [351]:type(w[0])==tuple out[351]: true you forgot call type in if condition: def f2(x): if type(x[0])==tuple: return true else: return false note, however, since each branch of if - else returns boolean, can remove , return condition's evaluation: def f2(x): return type(x[0])==tuple

mongodb - How to script a schema change for one of my Mongo collections within Meteor -

right now, structure of programs collection is: { name : 'jane doe', year : 'c16', campyear: 'ssipc16', roomwk1 :'21a', roomwk2: '22a', roomwk3: '33b', roomwk4: '33b', roomwk5: '25b' week1: '1' ... } i want change to: { name: 'jan doe', year: { 'c16': { roomwk1: '21a', roomwk2: '22a', roomwk3: '33b', roomwk4: '33b', roomwk5: '25b' } } campyear: 'ssipc16', ... } the change nest roomwk1 - roomwk5 under year field. how this? should done within mongo shell in meteor? if there aren't lot of program documents, can this: import { meteor } 'meteor/meteor'; import { mongo } 'meteor/mongo'; const programs = new mongo.collection('programs'); meteor

C sockets close connection if no response -

i have small problem waiting response client. code looks this: num_bytes_received = recv(recvfd, line, max_line_size-1, 0); if(line[0] == 'r') { do_something(); } if(line[0] == 'p') { do_another_thing(); } is there simple way wait message let's 30 seconds , if there's no message execute do_another_thing(); function? it's not connection problems situation (like clients disconnect etc.). it's own limitation create. you can use select() timeout. int ret; fd_set set; struct timeval timeout; /* initialize file descriptor set. */ fd_zero(&set); fd_set(recvfd, &set); /* initialize timeout data structure. */ timeout.tv_sec = 30; timeout.tv_usec = 0; /* select returns 0 if timeout, 1 if input available, -1 if error. */ ret = select(recvfd+1, &set, null, null, &timeout)); if (ret == 1) { num_bytes_received = recv(recvfd, line, max_line_size-1, 0); if(line[0] == 'r')

Python Pandas: Get index from column value -

very simple question: have pandas dataframe. 1 of columns looks this. date 2016-04-15 2016-04-14 2016-04-13 2016-04-12 2016-04-11 2016-04-08 how index of particular value assuming values unique. for example, "2016-04-13" return 2 use df.index.get_loc('2016-04-14') integer location requested label. return 1 intital starts 0 . can add 1 index value 2

c# - Entity Framework 6 Can't find error column -

i using mvc entity framework , gets following error. the specified cast materialized 'system.int64' type 'system.string' type not valid. error quite understandable , easy resolve , issue facing in sql query have plenty of columns, error details can't see column having specific issue , have go through columns 1 one. string query= "select id,claim_no,emp_id,dept_id,location_id staff"; var ctx = new tiaentities() ctx.database.sqlquery<orm>(query).tolist() i have viewed details in watch also, can't find column name. model:- public class orm { public int64 id { get; set; } public string claim_no { get; set; } public int64 emp_id { get; set; } public int64 dept_id { get; set; } public int64 location_id { get; set; } } you can use these solutions: var query = o in ctx.orm select new { id = o.id,

OpenMP optimization with c -

i'm supposed optimize code below make run atleast 16x faster using openmp , memory blocking. far can think of collapsing loops simple statement below. makes run 3 times faster. ideas on making closer 16? int i,j; #pragma omp parallel collapse(2) //my inserted code (i = 0; < msize; i++) (j = 0; j < msize; j++) d[i][j] = c[j][i]; when declare inner loop index in outer scope, must use private clause give each thread own copy. collapse may interfere simd vectorization.

javascript - Isolating JS files to be view specific in Rails -

in rails app, have number of js files available, , have placed them in app/assets/javascripts/globals , compiling them application.js via //= require_tree ./globals . however, have js files view specific, , prefer if implemented views or controllers. they're compiled in config/initializers/assets.rb via rails.application.config.assets.precompile += %w( foo.js bar.js ) , , accessed via <%= javascript_include_tag "foo/bar", "data-turbolinks-track" => true %> in respective views. i've wrapped essential functions in foo.js & bar.js in conditionals such if $("#foo").length > 1 ... , prevents functionality if required divs aren't present. as result, js files aren't "active" until after view visited. however, after being visited, js code "active" after visiting view. there control mechanism ensure js code being read correlating views? http://brandonhilkert.com/blog/page-specific-javascri

java - javax.sound.sampled.UnsupportedAudioFileException playing OGG files with javazoom -

i'm attempting play ogg audio files using answer question here: playing ogg files in eclipse using javazoom library downloaded , configured project, attempting use xav 's answer code: import java.io.file; import javax.sound.sampled.audioformat; import javax.sound.sampled.audioinputstream; import javax.sound.sampled.audiosystem; import javax.sound.sampled.dataline; import javax.sound.sampled.sourcedataline; import javazoom.spi.propertiescontainer; public class oggplayer { public final string filename; public boolean muststop = false; public oggplayer(string pfilename) { filename = pfilename; } public void play() throws exception { muststop = false; file file = new file(filename); audioinputstream audioinputstream = audiosystem.getaudioinputstream(file); if (audioinputstream == null) { throw new exception("unable audio input stream"); } audioformat baseformat = audioinputstream.getformat(); audioformat decodedformat

WPF Autogenerated DataGrid Cell changed event when bound to ItemSource -

i have simple datagrid has columns autogenerated , bound item source. item source updated @ intervals , can't find how fire event single cell changed. want change color of cell based on if update data source changed previous value of cell. i looked @ highlighting cells in wpf datagrid when bound value changes http://codefornothing.wordpress.com/2009/01/25/the-wpf-datagrid-and-me/ still unsure how go implementing this. example code helpful started on right path. if you're binding datatable, don't think productive path go down. doing kind of styling based on contents of datatable bound datagrid impossible in wpf. there several suggestions on stackoverflow, pretty hacky, event-driven (which bad news in wpf), , maintenance nightmare. if however, itemssource binding observablecollection, rowviewmodel class represents data in single row of datagrid, shouldn't bad. make sure rowviewmodel implements inotifypropertychanged, , update individual rowviewmodels