Posts

Showing posts from August, 2013

c# - How to get EmbeddedResource from different assembly? -

i have assembly, mainlib.dll, resource retrieve with: string resourcepath = string.format("mainlib.{0}", "embeddedresource.txt"); var assembly = assembly.getexecutingassembly(); stream inputstream = assembly.getmanifestresourcestream(resourcepath); this works fine. need move embeddedresource.txt it's own lib, resourcelib.dll. how retrieve resourcelib.dll , use in mainlib.dll in separate dll? you need resourcelib assembly embedded resource - var assembly = assembly.getassembly(typeof(classnameinthatassembly)); or var assembly = assembly.loadfrom("resourcelib");

php - Invalid argument when passing checkbox array from GET to POST -

php novice here. goal to: a) display table of booking options (fitness classes) dynamically database records, allow user select multiple options checkboxes against each row - bit's working. b) pass checkbox selection table listing selected data on confirmation page. i'm getting error here: invalid argument supplied foreach(). c) update database when user hits second page's 'confirm' button. research far uncovered this advice on using $_get , $_post achieve array. my checkbox code on initial page: echo '<form action="makebooking.php" method="get">'; echo '<td><input type="checkbox" name="class_id[]" value=' . $row['class_id'] . '</td></tr>'; the foreach statement error comes code generates table of choices on second page: //check if set classes.php if (isset($_get['class_id'])) { // grab score data foreach($_get['

How to show regex output in pair in c++? -

i dont know if makes sense or not here is there way can 2 words regex result each time? supose have text file contains string such following : alex fenix engineer works ford automotive company. personal id <123456>;etc.... basically if use \w list of : alex fenix engineer , etc they separated white space , punctuation marks asking , whether there way have list such : alex fenix engineer works ford automotive company personal id 123456 how can achieve such format? possible or should store first results in array , iterate through them , create second list? way please note item alex fenix abstraction of map or container that. reason asking trying see if there way can directly read file , apply regex on , second list without further processing overhead (i mean reading map or string , iterating through them , creating pairs of tokens , carry on ever needed ) try regex \w \w it match word followed space , word. although can achieve such fo

java - Which code snippet executes faster? -

i can same thing 2 types of code snippet. first way: string makedate = integer.tostring(now.year) + integer.tostring(now.month) + integer.tostring(now.monthday); or second way: string makedate = now.year + "" + now.month + "" + now.monthday; my question is: which method preferable [first way or second way]? which code snippet execute faster? the 2 snippits show identical. a string in java immutable ; can't changed. when using concatenation operator ( + ) compiler generates code using stringbuilder for example second snippit becomes: string makedate = new stringbuilder() .append(now.year) .append("") .append(now.month) .append("") .append(now.monthday) .tostring(); you can @ generated bytecode see this. java comes program javap allows @ compiled .class . i created simple main() provide minim

Form still shows despite PHP condition with session -

<?php if(!isset($_session['login'])) { ?> <div id="login"> <form method="post" action="login.php"> username: <input type="text" name="nm" /> <br /> password: <input type="password" name="pass" /> <br /> <input type="submit" name="go" value="login" /> </form> </div> <?php } else echo 'hi'; ?> even though session set (value test) shows form instead of 'hi'.

android - How to set delay between main activity and a new activity -

i want welcome screen appear , after delay of few seconds start new activity. ex. have mainactivity.java , second activity.java. main activity displays welcome message , second activity work. using intent start second activity main. main not start instead directly second loaded. help!!! use handler example private handler handler; private runnable delayrunnable; handler = new handler(); delayrunnable = new runnable() { @override public void run() { // todo auto-generated method stub add intent here second activity intent = new intent(getapplicationcontext(), secondactivity.class); startactivity(i); } }; handler.postdelayed(delayrunnable, 3000);

c++ - How to copy an integer from vector<char> -

i working on wav files, tring parse them. don't wanna use libraries . open wav file fstream , read data vector. want parse wav file header . example want filesize between 4th , 8th bytes. want assign integer . accomplish memcpy .but since c++ don't wanna use memcpy. solution end : std::vector<unsigned char>::iterator vectorite = soundfiledatavec.begin(); vawparams.totalfilesize = 0; //since little endian used reverse_copy std::reverse_copy(vectorite + 4, vectorite + 7, (unsigned char*)&vawparams.totalfilesize); i not happy (unsigned char*) cast integer pointer .i suspect there better way do. can please advice me better way? vectors use contiguous storage locations elements, elements can accessed using offsets on regular pointers elements. if don't want memcpy trivial solution is: int header = *reinterpret_cast<const int*>(&soundfiledatavec[4]); this reads 4 bytes (that may need convert 1 endianness another).

asp.net mvc 4 - Get ip address from a request mvc -

i'm trying ip address of device making request. should work in both self hosted or hosted on server internet access. i've tried this: //get visitor ip address method public string getvisitoripaddress() { string stringipaddress; stringipaddress = request.servervariables["http_x_forwarded_for"]; if (stringipaddress == null) //may http_x_forwarded_for null stringipaddress = request.servervariables["remote_addr"]; //we can use remote_addr else if (stringipaddress == null) stringipaddress = getlanipaddress(); return stringipaddress; } //get lan connected ip address method public string getlanipaddress() { //get host name string stringhostname = dns.gethostname(); //get ip host entry iphostentry iphostentries = dns.gethostentry(stringhostname); //get ip address ip host entry address list system.net.ipaddress[] arripaddr

android - OpenCV Error: Bad argument in CvANN_MLP -

i'm using opencv4android , i'm trying make little example of neural network work out arithmetic mean. so, i've decided use cvann_mlp create network. goes when train it, fails next exception: opencv error: bad argument (output training data should floating-point matrix number of rows equal number of training samples , number of columns equal size of last (output) layer) in cvann_mlp::prepare_to_train i've checked output training , type cv_32fc1. number of rows , columns correct. don't know error is. this code , hope can me. thanks! int train_sample_count = 10; float td[][] = new float[10][3]; //i've created method populate td populatetrainingdata(td); mat traindata = new mat(train_sample_count, 2, cvtype.cv_32fc1); mat trainclasses = new mat(train_sample_count, 1, cvtype.cv_32fc1); mat samplewts = new mat(train_sample_count, 1, cvtype.cv_32fc1); mat neurallayers = new mat(

linux - bash command to create custom named file -

simple task buy can not seem find command on http://faculty.plattsburgh.edu/jan.plaza/computing/help/commands.html basically have string of text know , have set in variable on bash file. i need save text file called foo.conf in desired directory. here have far: #!/bin/bash stringforfile='port=6000 username=user password=password' mkdir '~/.foo' # need save file foo.conf .foo directory many in advance why not use echo $stringforfile > ~/.foo/foo.conf after mkdir command?

ios - Is there a way to add a device to a provisioning profile without using Apple developer portal? -

Image
apple developer portal down since more day, there way add device provisioning profile without using http://developer.apple.com/iphone/ ? i wondering if xcode 4.5 has functionality allows this, however, apple's guide not seem possible. edit: tried using xcode 4.5 add device profile clicking "use device development" should, believe, add device wildcard provisioning profile. not seem work , following: i believe error might caused server being down because not list of "xcode supported ios versions". there other questions tackling believe different use case because dealing situation apple developer server down , hence might xcode works fine. i tried check updates in preferences->downloads->components section no update seem available. normal? here can see tab find strange there no ios 6.0 simulator available... seems iike developer server down since thursday due hacking attack . looks have wait "while" , there no way around

php - Display 'prev' and 'next' pagination, even when inactive, in Modx Revolution's Articles? -

i have blog set in modx revolution using articles addon, i'm having trouble configuring parts of pagination. current call pagination looks this: [[!+page.nav:notempty=`<nav>[[!+page.nav]]</nav>`]] i've added following listing parameters getpage call, removes [[+first]] , [[+last]] template pagination, , insert static "back top" link: &pagenavoutertpl=`[[+prev]]<a href="#header">back top</a>[[+next]]` however, 1 thing still doesn't work intend. default previous , next links disappear if there no previous or next page. i'd rather display them , make them inactive in such case. way pagination looks same, inactive parts can grayed out. it seems include.getpage.php contains following lines (which prevent prev , next links shown when there no pages navigate to): // lines 16 - 18 if (!empty($pageprevtpl) && ($page - 1) >= 1) { $nav['prev'] = getpage_makeurl($modx, $properties, $page -

windows - Putting quotation marks in Sublime Text configuration files -

i trying run java class file new cmd window. want add pause command @ finish view result, edit file javac.sublime-build this: { "cmd": ["javac", "${file}"], "working_dir": "${file_path}", "selector": "source.java", "shell": true, "variants": [ { "name": "run", "cmd": ["start cmd /c", ""java ${file_base_name} & pause""] } ] } but doesn't work, "cmd": ["start cmd /c", ""java ${file_base_name} & pause""] mean wanna process command start cmd /c "java ${file_base_name} & pause" sublime-text doesn't understand "" . anyone can solve this? sublime text configuration files json format. json string escape rules can read here example escape: '{"a":5,"b":"a \\"kitty\\" mighty odd&q

javamail - Maximum number of recipient in Java Mail -

i working on project involves sending emails using java. using javamailx module( had imported). i know maximum number of recipients whom can send our email ( mime message consisting of message, subject , attachments ) in 1 go. limit on number of recipients can emailed together. have searched online , on stackoverflow , there no clear answers. using gmail smtp server send emails gmail accounts , yahoo smtp server send mails yahoo accounts. do maximum number of recipients depend upon these smtp servers ? if default limits on them ? personal experience can tell academic email allows sending mails multiple people in 1 go ( whole mailing lists consisting of 200-300 people). not sure how works in end, if go in small groups of recipients or in total. no limits specified in api documentation, limits inherent in implementation (i.e. memory). also, sending and/or receiving smtp server limits reached before limits imposed implementation.

google api - Error with SupportMapFragment in Android Studio on a Fragment -

i have searched many hours , days find answer this, still cannot. using android studio (latest ver) ide i trying create map view (using google maps api) fragment part of fragmentactivity. androidmanifest updated necessary permissions , google key. as can see @ output, latlng class google map api working creating instance. lib imported on libs folder please !! edit: found instructions how build google play services (google maps) under android studio fragment_mapview_gmaps.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".showactivity" > <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map"

express - How to write to response from HTTP Client Node.JS -

i have following... var request = require('request'); exports.list = function(req, res){ res.send("listing"); }; exports.get = function(req, res){ request.get("<url>", function (err, res, body) { if (!err) { res.send(body,"utf8"); } }); }; this fails following.... typeerror: object #<incomingmessage> has no method 'send' how do this? update tried use write instead of send but... /users/me/development/htp/routes/property.js:9 res.setheader('content-type', 'text/html'); ^ typeerror: object #<incomingmessage> has no method 'setheader' also writing out console instead works fine. problem scope of variables, response output same name response object got in callback. changing around (resp vs res) made work.... exports.get = function(req, res){ request.get("<url>", function (err, resp, body) { if (!err) { res.send(body);

ios - How to show uidatepicker from uitableviewcell -

how can show uidatepicker uitableviewcell, , have datepicker have toolbar @ top lefts resign it? there tutorials on how this? i've had exact same thing. insert uitextfield uitableviewcell (you may need create custom uitableviewcell depending whether want appear on every dynamic cell of uitableview or on single static cell). create properties uidatepicker , uitoolbar , , uitextfield , in ib hook uitextfield property uitextfield created in step 1 (if you're using custom uitableviewcell class, that's uitextfield property need go): @property (strong, nonatomic) uidatepicker * datepicker; @property (strong, nonatomic) uitoolbar * datepickertoolbar; @property (strong, nonatomic) iboutlet uitextfield *textfield; ... @synthesize datepicker, datepickertoolbar, textfield; setup uidatepicker , uitoolbar , , uitextfield : - (void)viewdidload { // initialise uidatepicker datepicker = [[uidatepicker alloc] init]; datepicker.datepickermode = u

format - How to display a nested collection with .ps1xml file in powershell -

i have hierarchical object structure this: public class department { public string name { get; set; } public string manager { get; set; } public employee[] employees { get; set; } } public class employee { public string name { get; set;} public string speciallity { get; set; } } how can create custom .ps1xml file let me display department(s) follows: department : testers manager : p.h. boss name speciallity ---------- ----------------------------- employee .net employee biztalk yet powershell ... ... department : developers manager : wally name speciallity ---------- ----------------------------- employee .net employee biztalk yet powershell ... ... the main problem i'm having how can define <view> item selected departm

objective c - Follow an NSStatusItem with a window - incorrect position when switching to a taller display -

the problem: have follow app's nsstatusitem popup/window right beneath it. the general solution (like it's suggested here or here ) add custom view nsstatusitem , view's window's frame (statusitem.view.window.frame), , connect move event through nswindowdidmovenotification notification of statusitem.view.window. this solution works 99% unless user connects external display taller previous display (for example mac book user connects external monitor), in case statusitem.view.window.frame incorrect, x coordinate correct y coordinate same in smaller screen! i've checked , of menubar apps have popup window when click status item misplaced i've described. my solution don't use y coordinate frame use corresponding nsscreen's visibleframe's height this: nsscreen *screenwithmenubar = [[nsscreen screens] objectatindex:0]; if( screenwithmenubar ) { // correct top position 'screen menubar's height // workaround: witho

unity3d - Unity 3d. What size graphics for iOS? -

i preparing design assets game ios. these assets imported unity3d. i have been testing using photoshop canvas layout @ 1024 x 768 @ 72dpi. seems ok when viewed on iphone5. when view on ipad 3 graphics quite rough. fluffy @ edges. can confirm correct photoshop canvas size , resolution should using thanks lot

share parent TRIGGER between INHERITS childs Postgresql 9 -

create table parent(...); create table child1(...) inherits parent; create table child2(...) inherits parent; create table child3(...) inherits parent; i want create trigger 'parent' , when insert on child1 or child2 or child3 trigger must automatically executed. seems didn't work, must create trigger each child. solution postgresql 9 ? you need trigger each child table. the maintenance burden mitigated fact triggers can point same function: create trigger trig1 after insert on child1 each row execute procedure trigproc(); create trigger trig2 after insert on child2 each row execute procedure trigproc(); ...

c# - Convert "iso-8859-1" to "utf-8" with HTML Agility Pack and xpath -

i'm trying piece of web page, have problem special characters. how convert data obtain correct reading? website use iso 8859-1 , must use utf 8. string url = "http://www.ta-meteo.fr/troyes.htm"; htmlweb web = new htmlweb(); htmldocument doc = web.load(url); htmlnode bulletinmatin = doc.documentnode.selectsinglenode("//*[@id='blockdetday0']/div[1]/p[1]"); messagebox.show(bulletinmatin.innertext); thanks. i solved problem string url = "http://www.ta-meteo.fr/troyes.htm"; encoding iso = encoding.getencoding("iso-8859-1"); htmlweb web = new htmlweb() { autodetectencoding = false, overrideencoding = iso, }; htmldocument doc = web.load(url); htmlnode bulletinmatin = doc.documentnode.selectsinglenode("//*[@id='blockdetday0']/div[1]/p[1]"); messagebox.show(bulletinmatin.innertext);

monit - upstart script for logstash, writing the pid file that deals with the fork -

i using example upstart script logstash having trouble writing pid file monit use @ /var/run/logstash.pid when use "echo $$ > /var/run/logstash.pid" writes wrong pid value file, think value before fork. there solution this? # logstash - agent instance # description "logstash agent instance" start on virtual-filesystems stop on runlevel [06] # respawn if process exits respawn respawn limit 5 30 limit nofile 65550 65550 expect fork # need chdir somewhere writable because logstash needs unpack few # temporary files on startup. chdir /home/logstash script # runs logstash agent 'logstash' user echo $$ > /var/run/logstash.pid su -s /bin/sh -c 'exec "$0" "$@"' logstash -- /usr/bin/java -jar logstash.jar agent -f /etc/logstash/agent.conf --log /var/log/logstash.log & emit logstash-agent-running end script

python - Alfred Workflow not working at all -

this kind of specific question, directed mac users use alfred + powerpack & familiar workflow development. i trying create alfred workflow , failing miserably reason. workflow supposed password generator based on gist made . copies whole python script trying run instead of password. can't figure out why happening. here's download link workflow: download here follows python script using. thanks in advance. ps: aware alfred's website has it's own forum discussing topic have register & hate registering stuff use once in lifetime. #!/usr/bin/env python import string import random q = {query} try: pattern = list(q) password = "" x in pattern: if x == "a": password += random.choice(list(string.lowercase)) elif x == "a": password += random.choice(list(string.uppercase)) elif x == "%": password += random.choice(list(string.digits))

python - Why aren't my @property decorators working? -

i'm working on little class, playing @property decorators. reason it's not working right. class card: def __init__(self, rank, suit): self.rank = rank self.suit = suit @property def rank(self): return self._rank @rank.setter def rank(self, value): valid_ranks = ["2", "3", "4", "5", "6", "7", "8", "9", "j", "q", "k", "a"] if valid_ranks.index(value): self._rank = value @property def suit(self): return self._suit @suit.setter def suit(self,value): self._suit = value def show(self): print "{}{}".format(self.rank, self.suit) i initialize object so: card("cheese", "ball") , , presumably should throw error. python happily rolls though , assigns "cheese" rank. what's going on here? other calls ra

floating point - Rounding values less than 1 in C? -

i coding graphical program in c , cartesian values in between [-1,1], having trouble rounding off values can use them plotting , further calculations. know how round values greater 1 decimals haven't done before. so how go rounding values? example, .7213=.7 .7725= .8 .3666667=.4 .25=.2 or .3 .24=.2 any suggestions gladly appreciated. :) in languages, people implement such rounding in ad hoc way using *10 , integral rounding, , /10 . example: $ cat round.c #include <stdio.h> #include <stdint.h> int main() { fprintf(stderr, "%f\n", ((double) ((uint64_t) (10*0.7777))) / 10); return 0; } $ gcc round.c [tommd@vodka test]$ ./a.out 0.700000

javascript - Is there an IDE for jquery similar to Visual Studio in that I can see where the definition of a function is via hotkey? -

is there ide jquery similar visual studio in can see definition of function via hotkey? i'm wondering if there easier way of doing type of development goes beyond using notepad++. wonderful if see class defined right clicking instance , doing goto definition, etc. typescript supports auto-completion variety of javascript libraries, including jquery. available visual studio 2012 plugin . alternatively try jetbrains webstorm , can auto completion or without typescript. note javascript dynamic language , instance cannot deduce precise data typing before runtime. thus, ides cannot provide full autocompletion. particularly q&a discussion on topic can found here: https://softwareengineering.stackexchange.com/questions/131561/ides-for-dynamic-languages-how-far-can-you-get

java - XML Parsing Error: syntax error in Spark framework -

java: package com.test; import spark.request; import spark.response; import spark.route; import spark.spark; public class helloworldsparkstyle { public static void main(string[] args){ spark.get(new route("/") { @override public object handle(final request request, final response response) { return "hello spark"; } }); } } running code giving following error @ localhost:4567 : xml parsing error: syntax error location: http://localhost:4567/ line number 1, column 1: hello spark ^ example taken http://youtu.be/uh-vd_ypal8 try adding response.type("text/plain"); or change response value valid xml viewing in client.

How do I open up a text file and use it in this code to sort ip adresses python -

so instead of setting ips sort through have plethora of them in text file need sort though how open , see ones occurred most? #!/usr/bin/python import iplib ips = [] ip in ["192.168.100.56", "192.168.0.3", "192.0.0.192", "8.0.0.255"]: ips.append(iplib.ipv4address(ip)) def ip_compare(x, y): return cmp(x.get_dec(), y.get_dec()) ips.sort(ip_compare) print [ip.address ip in ips] and text file looks this 113.177.60.181 - - [05/jul/2013:03:27:07 -0500] "get /email/13948staticvoid.gif http/1.1" 200 17181 "http://www.bereans.org/email/index.php" "mozilla/4.0 (compatible; msie 8.0; windows nt 5.1; trident/4.0)" 113.177.60.181 - - [05/jul/2013:03:27:07 -0500] "get /email/13948staticvoid.gif http/1.1" 200 17181 "http://www.bereans.org/email/index.php" "mozilla/4.0 (compatible; msie 8.0; windows nt 5.1; trident/4.0)" from collections import counter open('pa

c# - Add custom editor windows to Visual Studio window panes -

Image
my problem i'm trying build extension visual studio allows code edited on per-function basis, rather per-file basis. i'm attempting display code in similar fashion microsoft debugger canvas . i'm wondering how host multiple visual studio editors within single window (i believe windows implementing ivswindowframe). functionality i'm after can seen below: each editor window retains typical functionality , interacts third-party extensions expected. (for example, vsvim functions correctly within these windows). what i've tried i've spent 2 weeks researching , trying stuff , i'm having lot of trouble figuring out services, interfaces , classes i'm going using. reading through msdn first off, of documentation discusses how edit single editor window , add adornments, tags, margins etc. doesn't discuss possibility of spawning multiple editors within window pane. i've looked through documentation on vast number of interfaces of inte

css how to fix layout in table -

i trying few images in table looking alright there empty input on 3rd row , 1st column. input image types bigger? edit: forgot mention has has work ie7 , up. fiddle: http://jsfiddle.net/486ex/ style input { border: 1px solid black; } .emptyicon { width: 37px; height: 37px; float: left; font-size: 8px; border: 1px solid grey; } .sizewidth { width: 19px; height: 10px; padding: 5px 3px 8px 3px; margin: 2px; } .showborder { border: 2px solid red; } #product { border: 1px solid #c1c1c1; } .sizebtn { margin: 2px; height: 31px; width: 37px; } .icons { width: 213px; float: left; padding: 2px; } .icons div { padding: 2px; float: left; } .icons input { padding: 0; cursor: pointer; text-align: center; background: #fff; color: #000; display: block; height: 37px; width: 37px; line-height: 37px; font-size: .6em; overflow: hidden; } .sizes { float: left; width:

C API mysql not returning result set -

i have situation making serial select queries table on lamp box using c api. first query select single record (an order header). second query uses returned record number first query select line items indexed order header record number. first query works fine, second query returns 0 rows (either checking mysql_fetch_numrows() or while loop doing mysql_fetchrow()). print out sql on console , copy , paste mysql client. returns expected 3 records see in db. leads me conclusion sql statement correct. i mysql_free_result() call after each query. since don't have ton of experience using c api i'm wondering if there else have close or free up. sequence of events is: mysql_init() mysql_real_connect() mysql_query() mysql_store_result() mysql_fetch_row() mysql_free_result() mysql_query() mysql_store_result() mysql_fetch_row() <--- fails, no error code, 0 rows returned the global variable involved in connection handle.

curl - automating the login to the uk data service website in R with RCurl or httr -

i in process of writing collection of freely-downloadable r scripts http://asdfree.com/ people analyze complex sample survey data hosted uk data service . in addition providing lots of statistics tutorials these data sets, want automate download , importation of survey data. in order that, need figure out how programmatically log uk data service website . i have tried lots of different configurations of rcurl , httr log in, i'm making mistake somewhere , i'm stuck. have tried inspecting elements as outlined in post , websites jump around fast in browser me understand what's going on. this website require login , password, believe i'm making mistake before login page. here's how website works: the starting page should be: https://www.esds.ac.uk/secure/ukdsregister_start.asp this page automatically re-direct web browser long url starts with: https://wayf.ukfederation.org.uk/ds002/uk.ds?[blahblahblah] (1) reason, ssl certificate not work on website.

svn - Eclipse Subclipse icon with red plus sign -

Image
what icon (a red plus sign) in subclipse mean? do if want whatever repository regarding file? this merge conflict icon , more tree conflict , file has been created twice. blog post explains how resolve them . a tree conflict occurs when developer moved/renamed/deleted file or folder, developer either has moved/renamed/deleted or modified.

opengraph - Facebook's Lint is crawling root URL rather than the given URL -

there previous posts on web, none of proposed solutions work scenario. i have children pages have own unique og tags, , parent root domain page own og tag, crawled facebook people can see descriptions/images when posted. however, when post child url in box, results blatantly proof facebook crawled parent page instead. "see our scrapper sees" page confirms because parent template being shown. here link fb's scrapper: https://developers.facebook.com/tools/debug here og tags in root domain html template: suppose parent www.me.com suppose 1 child www.me.com/path/path <head> ... <meta name="keywords" content="..."> <meta name="description" content="..." /> <meta property="fb:app_id" content="..."/> <meta property="og:site_name" content="..." /> <meta property="og:type" content="website" /> <meta pro

php - Creating a container for cURL'd content -

i'm using curl page. problem is, i'm trying have own "header" div curl content @ bottom. css curl messing formatting though. how contain curl'd content without putting in iframe? public function curl ($url, $options) { $handle = curl_init($url); curl_setopt_array($handle, $options); ob_start(); $buffer = curl_exec($handle); ob_end_clean(); curl_close($handle); return $buffer; } you can try this: $content = curl($url, $options = array()); preg_match('/<body>(.*?)</body>/is', $content, $matches); if(!empty($matches)) { $body = $matches[0]; //header css echo $header; //parsed content echo $body; //footer echo $footer; } note: code not tested. hope helps.

objective c - Error at ABPeoplePickerNavigationControllerDelegate - XCode -

i'm following tutorial accessing contact list. i`m getting error on following line @ viewcontroller.h @interface viewcontroller : uiviewcontroller <abpeoplepickernavigationcontrollerdelegate> why abpeoplepickernavigationcontroller getting error? error message "cannot find protocol declaration" you need add: #import <addressbookui/addressbookui.h> to .h file , add addressbookui framework project.

c# - Can I sort list of Enum as I sort the list of string? -

Image
if have list of enum example public enum color { red, blue, yellow, green, black } and have list list<color> testlist; for example, in testlist, have red, yellow , black can sort testlist , hence black, red , yellow use sort() list of string? and if use switch statement, there performance consideration switch string or enum? 1 faster? thanks you can order them this: public enum color { red, blue, yellow, green, black } enum.getvalues(typeof(color)) .oftype<color>() .orderby(x => x.tostring()); result: note: purposely left out detail regarding performance issues.. there won't noticeable performance issues in switch .. don't worry :)

How do you export PLC register values from Visilogic? -

i using visilogic 9.4.0 observe register values of plc unit resides in our robot. capture snapshots of register values (particular mb, mi, , ml registers) before , after particular set of events. is there way export register values? csv or excel outputs ideal, open reasonable result set. can before , after comparison in visilogic ide manually inspecting registers, in particular case chasing bug result of 1 of thousands of registers being different. easier diff 2 csv files manually comparing thousands of individual registers. i think easiest way achieve require write registers , bits require datatable, done write column command , should not take program. write successive columns each time wanted capture registers , export whole datatable excel via 'export excel' button. let me know if need more help.

c++ - How to check if a tree is a subtree of another tree? -

so, have obvious brute-force algorithm, goes follows int issubtree (bintree *s, bintree *t) { if (s == null) return 0; return (isequal (s,t) || issubtree (s->left, t) || issubtree (s->right, t)); } int isequal (bintree *s, bintree *t) { if (s==null && t==null) return 1; if (s==null || t==null) return 0; if (s->val == t->val) return isequal(s->left,t->left) && isequal (s->right,t->right); else return 0; } but o(n²) approach. i have approach goes follows , o(n) we, traverse first tree in inorder fashion , store in array. traverse second tree , store in inorder fashion. if second array subarray of first, go ahead , repeat same procudure preorder traversal too. if both queries result true, tree subtree of first tree. otherwise, not. can tell me whether following algorithm work or not? and there more space optimized solution problem? note: need 2 arrays, since storing tra

sql server - A simple help needed about creating table -

i totally new in sql , sql server without prior knowledge. try learn sql server love of it. question simple. having problem creating table using sql code. want create table named new_table table old_table . code is: create table new_table (select * old_table) but giving following error: msg 102, level 15, state 1, line 2 incorrect syntax near '('. i have done many things not figure out problem. can 1 please guide me problem? select * new_table sourcetable new_table must not exist. ref . in response comment: select * dbo.new_table (select distinct col1 old_table) tmptable

get value from json php codeigniter -

i have json object like [ [ { "class":"com.ehealth.data.sample_data", "collectedby":"2013-07-21", "collecteddate":"kamal", "orderid":2, "sampleid":2.897033553e9 }, { "class":"com.ehealth.data.order_data", "doctorusername":"kamal", "duedate":"2014-01-02", "orderdate":"2013-12-12", "orderid":2, "patientid":"p0001", "prority":1, "status":"complete", "testtype":"fasting blood sugar" } ], [ { "class":"com.ehealth.data.sample_data", "collectedby":"2013-07-22", "collecteddate":"kamal", "orderid":3, "sampleid":5.978956192e9 }, {

javascript - Add class to HTML element when is dragged over another element in IE8 -

i need add class 1 element when dragged on element. in html5 http://jsfiddle.net/neaut var draggeddiv = document.queryselector('.draggeddiv'); draggeddiv.draggable = true; var draggedover = document.queryselector('.draggedover'); draggedover.ondragover = function(){this.classname = 'red'} but don't know how work in ie8.

algorithm - How to draw a precision-recall diagram? -

Image
precision , recall metrics evaluation algorithms, , defined this: precision = true_positive / (true_positive + false_positive) recall = true_positive / (true_positive + false_negative) so, think every algorithm have 1 number precision , 1 number recall, see there diagram evaluating according precision , recall, want know how can draw diagram 1 point?(one precision , 1 recall every algorithm) you draw histogram precision , recall each algorithm. it's still bit difficult read because each algorithm there 2 values. need decide important characteristics: recall or precision? have considered using f-measure tries combine both measures? http://en.wikipedia.org/wiki/f1_score edit: my suggestion use histogram: but solution plot this: both done using libreoffice.

c++ - Using a static std::map<int,MyClass*> inside MyClass causes unresolve external symbol -

this question has answer here: unresolved external symbol on static class members 3 answers i want keep track of instance of myclass , have add private static variable std::map<int,myclass*> inside myclass. problem causes unresolved external symbol, don't know how debug. how can resolve this? note: i'm seasoned java programmer , novice c++ programmer, , i'll using jni dll , why need keep track instances of myclass . you haven't provided implementation: myclass.h: class myclass { private: static std::map<int, myclass *> m_instances; ... }; myclass.cpp: #include "myclass.h" // add std::map<int, myclass *> myclass::m_instances;

c# - Unity: NullReferenceException -

nullreferenceexception: object reference not set instance of object tower.ongui () (at assets/tower.cs:100) relevant line is: if(main.gold >= towers.u[stage]) the variables in towers defined so, doing wrong? using unityengine; using system.collections; using system.collections.generic; public class towers : monobehaviour { public static float[] d; public static float[] r; public static float[] s; public static float[] u; // use initialization void start () { d = new float[10]; d[0] = 1f; d[1] = 3f; d[2] = 5f; d[3] = 7f; d[4] = 9f; d[5] = 11f; d[6] = 13f; d[7] = 15f; d[8] = 18f; d[9] = 21f; d[10] = 23f; r = new float[10]; r[0] = 5f; r[1] = 9f; r[2] = 13f; r[3] = 17f; r[4] = 21f; r[5] = 25f; r[6] = 29f; r[7] = 33f; r[8] = 37f; r[9] = 41f; r[10] = 4