Posts

Showing posts from February, 2011

Range of numbers repeating in an array matlab -

how can have range of numbers repeating in array in matlab number of times? for instance, if want range of numbers 1:5 repeated 100 times stored in 1 array; code it? a = [1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,........] thanks use repmat repeat vectors or matrices. n=5 m=100 a=repmat(1:n,1,m)

Getting traceback in custom error handler in R -

i have function stop loaded library lib . replace default error handler in r function using options(error = stop) . within function, traceback may display calls leading error being thrown. however, sys.calls not seem work within custom error handler. returns single element, is body of stop rather call. may have how r intercepts error handler stop . furthermore, traceback not work within stop . there way can proper traceback in custom error handler? this works me: > fun <- function(x) stop('hello') > stop <- function() print(sys.calls()) > options(error=stop) > fun(1) error in fun(1) : hello [[1]] fun(1) [[2]] stop("hello") [[3]] (function () print(sys.calls()))() this on r 3.1.2. doing different?

java - Nullpointer Exception reading in file line by line -

txt file reading program line line. goal display text no punctuations , in lowercase. far able display text in way code below keep receiving run-time error of nullpointer exception @ last line of "while" expression , not sure error is. believe problem may have been in boolean while expression , tried changing input != null reader.readline() != null no success. thank you! import java.io.filereader; import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.ioexception; public class binarytree { public static void main(string[] args) { string inputfile = "pg345.txt"; filereader filereader = null; try { filereader = new filereader(inputfile); } catch (filenotfoundexception e) { e.printstacktrace(); } bufferedreader reader = new bufferedreader(filereader); string input; try { input = reader.readline().tolowercase().replacea

c++ - OpenGL 3.0 to 3.2 -

i in process upgrading code opengl 3.0 3.3 (or maybe 4.x) missing something, since screen black. the closest answer problem triangle in opengl 3.1 nothing in 3.2 . solution here using compatibility profile. hint there on implementing proper using core profile "actually using proper core profile gl command sequence full vertex , fragment shaders." the problem have after sinking entire afternoon reading spec, tutorials , examples, don't see code doing wrong. working on demo recycles code use , can find entire demo, rendering triangle @ gitub . the juicy bits following: the vertex code is: #version 150 in vec3 avertex; void main() { gl_position = avertex; } the fragment code is: #version 330 core out vec4 ofragcolor; void main() { ofragcolor = vec4(1.0, 1.0, 1.0, 1.0); } compiling shader done follows : int status = 0; char logstr[256]; const glchar* vbuff[1] = {vertex_code.c_str()}; unsigned int vertex_id = glcreateshader(gl_vertex

osx - Vagrant, Docker, and Node.js on Mac OS X -

i've been banging head against wall entire day on this, help. running vagrant on mac os x, , want run docker container simple node.js 'hello world' server running inside. want able access server form browser. here vagrantfile.proxy (for running docker server): vagrantfile_api_version = "2" vagrant.configure(vagrantfile_api_version) |config| config.vm.box = "hashicorp/precise64" config.vm.provision "docker" config.vm.provision "shell", inline: "ps aux | grep 'sshd:' | awk '{print $2}' | xargs kill" config.vm.network :forwarded_port, guest: 8888, host: 8888 end here vagrantfile: # -*- mode: ruby -*- # vi: set ft=ruby : # vagrantfile api/syntax version. don't touch unless know you're doing! vagrantfile_api_version = "2" vagrant.configure(vagrantfile_api_version) |config| # tells vagrant build image based on dockerfile found in # same directory vagrantfile. con

Getting a weird percent sign in printf output in terminal with C -

Image
i have printf statement @ end of program: printf("%d", total_candies); total_candies int , , while expect work correctly, along actual number, i'm getting weird percent sign @ end. can tell me why happening? when (non-null) output program doesn't include trailing newline, zsh adds color-inverted % indicate , moves next line before printing prompt; it's more convenient bash's behavior, starting command prompt output ended.

c++ - error: cannot convert 'unsigned char*' to 'const int*' -

i'm writing function accept both unsigned char* , int*: int foo(const int * a) however when pass unsigned char * foo(), has compiling error. thought unsigned char automatically casted int? ( smaller range variable casted larger one). work array pointer also? sample code: #include <iostream> using namespace std; int average(const int * array, int size) { int sum = 0; (int = 0; <size; i++) sum+=*(array+i); return sum/size; } int main() { unsigned char array[5] = {0,1,2,3,4}; std::cout << average(array, 5); return 0; } what best way write function accepts both unsigned char* , int*? i thought unsigned char automatically casted int? an unsigned char automatically cast int unsigned char* not automatically cast int* . unsigned char c = 'a'; unsigned char* cp = &a; int = c; // allowed int* ip = cp; // not allowed if allowed, do: *ip = int_max; but there isn't enough space @

ios - PhoneGap stuck in (webView:identiferForInitialRequest: fromDataSource) kCFRunLoopDefaultMode -

i have ios/phonegap project have inherited requires connecting via websockets. application seems work of time. sometimes, after connection, following message appears in debug console. 2014-12-01 15:11:23.167 xxx[4156:1044391] void senddelegatemessage(nsinvocation *): delegate (webview:identifierforinitialrequest:fromdatasource:) failed return after waiting 10 seconds. main run loop mode: kcfrunloopdefaultmode 2014-12-01 15:11:33.169 xxx[4156:1044391] void senddelegatemessage(nsinvocation *): delegate (webview:identifierforinitialrequest:fromdatasource:) failed return after waiting 10 seconds. main run loop mode: kcfrunloopdefaultmode at point, entire application freezes. appears if main run loop waiting response 1 of many calls between js , native layer. never resolves , prints error every 10 seconds. i think may issue bug in js callback, or failure return proper result phonegap call. problem there dozen asyncronous phonegap calls happening on connect. i'm lookin

python - making a function as an else inside an __init__ -

how function inside if/else inside __init__ : class foo(object): def __init__(self, q, **keywords): if == "": print "no empty strings" else: def on_g(self, response): if response.error: print "check internet settings" else: self.bar() http_client.fetch("http://www.google.com/", self.on_g) because program dont read on_g() if put empty string! if use on_g() outside in parallel __init__() need declared variable, example: class foo(object): def __init__(self, q, **keywords): if == "": print "no empty strings" else: self.on_g() def on_g(self): print 'hello there' will return hello there self (the instance you're creating through __init__ ) doesn't have on_g method. functions class -es need defined @ class

django rest framework - DRF 3.0: UniqueTogetherValidator with a read-only field -

in process of upgrading django rest framework 3.0 2.4.4 , want have read-only user field, failing because 'user' being required uniquetogethervalidator (i think) i have model (excuse typos, simplified , code works fine irl): class examplemodel(models.model): some_attr = models.positivesmallintegerfield() other_attr = models.positivesmallintegerfield() user = models.foreignkey(user) class meta: unique_together = ('some_attr', 'other_attr', 'user') viewset: class exampleviewset(viewsets.modelviewset): queryset = examplemodel.objects.all() serializer_class = exampleserializer def perform_create(self, serializer): serializer.save(user=self.request.user) def perform_update(self, serializer): serializer.save(user=self.request.user) serializer: class exampleserializer(serializers.modelserializer): user = userserializer(read_only=true) class meta: model = examplemodel n

java - Performing loops for first time? Really simple? -

i have assignment loops need on. quite simple don't know how use loops. need print out 3 shapes using loops. shapes made of asterisks, i'm allowed print 1 asterisk @ time, must loops print shapes. first shape 10 asterisks in row 1 after another. second 1 ten lines 1 asterisk on each line. last 1 hardest one. shape has ten lines. , first line has 1 asterisk, second line has two, third 1 has 3 on , forth, tenth line has ten asterisks. tried doing past 3 hours using previous assignment isn't working out. here is: public class assignment9 { public static void main(string args[]) { (integer = *; >= *; i=i-*) { if ((i % *) == *) { system.out.println("i = " + i); } } } } i'm taking computer science class, science credit need. don't plan on being computer scientist. can see, not forte. here's how can reason third shape. should able figure out other two, after this, since simple

php array flip value as key and make it simple -

i have been troubling format array correctly have code: require('simple_html_dom.php'); $table = array(); $html = file_get_html('apc.html'); foreach($html->find('tr') $row) { $rack = ltrim($row->find('td',0)->plaintext); $location = ltrim($row->find('td',1)->plaintext); $usage = ltrim($row->find('td',2)->plaintext); $auk = ltrim($row->find('td',3)->plaintext); $cost = ltrim($row->find('td',4)->plaintext); $rack = rtrim($rack); $location = rtrim($location); $usage = rtrim($usage); $auk = rtrim($auk); $cost = rtrim($cost); $table[$rack][$usage][$auk][$cost] = true; } echo '<pre>'; print_r($table); echo '</pre>'; using simple_html_dom above can convert html table array follow: [rack01] => array ( [741,60] => array (

objective c - regionByIntersectionWithRegion: not working in Sprite Kit -

i'm trying use spritekit skregion class compute intersection, difference, union of closed cgpaths, doesn't seem working. here simple example expect work nothing rendered here. cgpathref = cgpathcreatewithellipseinrect(cgrectmake(0, 0, 100, 100), null); cgpathref b = cgpathcreatewithellipseinrect(cgrectmake(50, 0, 100, 100), null); skregion *ra = [[skregion alloc] initwithpath:a]; skregion *rb = [[skregion alloc] initwithpath:b]; skregion *rc = [ra regionbyintersectionwithregion:rb]; cgpathref c = [rc path]; cgcontextref context = (cgcontextref)[[nsgraphicscontext currentcontext] graphicsport]; cgcontextaddpath(context, c); cgcontextfillpath(context); rendering a , b works, nothing appears c although these circles overlap. other scenarios fail work well, such using basic rectangles , b, or using different skregion constructors don't operate on paths. any ideas? if try render ra.path, need use high values same size circles. used 3000 instead of 100 , w

javascript - E2E testing on multiple/parallel browsers in Protractor? -

using protractor how setup/add parallel browsers testing. example: test suites on not chrome , firefox ? there simple way of test mobile? ios8 safari or mobile chrome? question: how write exports.config object support chrome , firefox in parallel suite testing? exports.config = { multicapabilities: [ { 'browsername': 'chrome', 'chromeoptions': { args: ['--test-type'] } } ]} suites: { homepagefooter: 'protractor/homepage/footer.spec.js' }, using protractor how setup/add parallel browsers testing. you need list browsers in multicapabilities : multicapabilities: [{ 'browsername': 'firefox' }, { 'browsername': 'chrome' }] also there simple way of test mobile? ios8 safari or mobile chrome? one option use appium framework, here relevant documentation sections: setting protractor ap

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.lwjgl.DefaultSysImplementation.getPointerSize()I -

at first looks duplicate of 9 other questions, mine unique. , no amount of answers have fixed it. working jlwgl. exception in thread "main" java.lang.unsatisfiedlinkerror: org.lwjgl.defaultsysimplementation.getpointersize()i @ org.lwjgl.defaultsysimplementation.getpointersize(native method) @ org.lwjgl.sys.<clinit>(sys.java:113) @ org.lwjgl.opengl.display.<clinit>(display.java:135) @ renderengine.displaymanager.createdisplay(displaymanager.java:30) @ enginetester.maingameloop.main(maingameloop.java:11) no amount of googling has revealed cause. have followed several tutorials letter. natives folder set up. yes still bug! sooo frustrating! i had same issue today when trying run slick2d application. issue came up, think, because used 2 different versions of lwjgl. using maven, slick2d came dependency lwjgl 2.9.1 while natives provided came 3.0. downloaded 2.9.1 natives solved issue me.

logging - Throttle Python smtphandler emails -

i want use python's logger smtphandler send emails errors , whatnot. don't want inbox flooded thousands of emails same bug. is there way throttle amounts of emails sent? ideally, if keeps catching same exception, taper off amount of emails sent. i wound making own wrapper smtphandler. first draft not perfect. multiple instances of handler limit dupes separately. store self.logged in redis make shared resource. the parameter needs set intervals list of minutes (ints). suppose [0 10 30] passed in intervals. send email now. subsequent dupes ignored until after 10 minutes has passed. subsequent dupes ignored until after 30 minutes,. won't send emails after that. if want change counts dupe logs, modify _record_type requirements. import logging.handlers import datetime class smtphandler(logging.handlers.smtphandler): """ custom smtphandler logger. specify intervals emails sent. @ number of emails sent equal number

Java command line argument containing backslash -

i want run similar following: java myprogram c:\path\to\my\file when , output contents of first argument, outputs: c:pathtomyfile this works, however: java myprogram "c:\path\to\my\file" but want able first command instead of second. how can achieve this? the \ charecter used "escape" special characters. means tells program ignore them, or not special them. make work use \\ instead of \ . escapes \ . use c:\\path\\to\\my\\file

Proper syntax to Make type index form field sticky in PHP -

i have include form type=index fields in funciton eg. firstname, lastname. form uses separate handle.php page. can't figure out how make sticky (retain last value entered if refresh page). because refresh page form if there error input, , want see last input fields entries retained. have tried $_session['fname'] , $_post['fname']. neither seems work... this without sticky echo "<tr><td>first name:<input type='text' name='fname' value=''></td>"; this think works if not within php block <td>first name:<input type='text' name='fname' placeholder='first name' value="<?php if(isset($_session['fname'])) echo ;?>" ></td> you close! your example missing argument echo. try this: <?php if(isset($_session['fname'])) echo $_session['fname'];?> however, form never submit $_session default. if have <

.htaccess file makes page load indefinitely? -

i'm using following .htaccess pages preceded /cn/ load http (the rest loads https : <ifmodule mod_rewrite.c> rewriteengine on rewritebase / # http requests other /cn should become https rewritecond %{https} off rewriterule !^cn(/.*)?$ https://%{http_host}%{request_uri} [r=302,nc,l,ne] # https requests /cn should become http rewritecond %{https} on rewriterule ^cn(/.*)?$ http://%{http_host}%{request_uri} [r=302,nc,l,ne] rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . index.php [l] </ifmodule> php_value upload_max_filesize 110m php_value post_max_size 110m the strange thing page keeps loading forever. causing this?

git svn migration failing with svn 1.8 -

i'm following steps in: http://git-scm.com/book/en/v2/git-and-other-systems-git-as-a-client to move svn repository git. local svn version is: $ svn --version svn, version 1.8.10 (r1615264) compiled aug 25 2014, 10:52:18 on x86_64-apple-darwin12.5.0 git version: $ git --version git version 2.1.0 when clone repository error reading local file system format: $ git svn clone file:///tmp/test-svn -s initialized empty git repository in /private/tmp/test-svn/.git/ couldn't open repository: unable connect repository @ url 'file:///tmp/test-svn': unable open ra_local session url: unable open repository 'file:///tmp/test-svn': expected fs format between '1' , '4'; found format '6' @ /usr/local/cellar/git/2.1.0/lib/perl5/site_perl/git/svn.pm line 310 according svn release note fs format 6 introduced in svn 1.8: http://subversion.apache.org/docs/release-notes/1.8.html#revprop-packing could git 2.1 perl script isn't yet compati

javascript - setTimeout on mobile browsers doesn't work -

i trying run script in ios safari , android browsers doesnt work, works in desktop browser. case 4: if(estado == '1'){ alert('case 4!!'); $('#respuesta').empty(); $('#respuesta').append('well done!<br>that correct.'); $('#estado').val(2); document.getelementbyid('well_done').play(); //when audio finish, must wait 5 seconds play one. settimeout(function(){ document.getelementbyid('question_2').play(); },5000); } i repeat, works in desktop not in mobile. thanks help.

android - FragmentManager.put/getFragment vs findFragmentByTag -

more point, in oncreate/oncreateview calling fragmentmanager.findfragmentbytag() lookup existing instance of fragment, , seems find it. so point of putfragment/getfragment? save or cause additional lifecycle stuff happen? alternative findfragmentbytag() more or less same thing? because seems me fragment being automatically saved me without needing use fragmentmanager.putfragment(). so point of putfragment/getfragment? according current implementation, putfragment(bundle bundle, string key, fragment fragment) put index of fragment bundle parameter key. , getfragment(bundle bundle, string key) fragment @ same index can retrieved bundle same key. fragment has index in fragmentmanager after added it, putfragment() can called on fragment after added. does save or cause additional lifecycle stuff happen? it save index of fragment only, no more things else, nor cause additional lifecycle stuff. is alternative findfragmentbytag() more or less same thing?

ios - NSMutableArray property is not working in dequeueReusableCellWithIdentifier -

i have view controller has tableview embedded inside of it. have following code. @property (nonatomic, strong) nsmutablearray* eventarray; - (void)viewdidload { [super viewdidload]; self.eventtableview.delegate = self; self.eventtableview.datasource = self; if (!self.eventarray){ self.eventarray = [[nsmutablearray alloc] init]; } ... for(nsdictionary* dict in responseobject){ [self.eventarray addobject:[[event alloc] initwitheventname:[dict valueforkey:@"name"]eventdescription:[dict valueforkey:@"description"]]]; } [self.eventtableview reloaddata]; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { for(event* event in self.eventarray) { nslog(@"event name in numberofrows: [%@]", [event eventname]); } return [self.eventarray count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindex

android - ArrayIndexOutOfBoundsException at splitting string -

in android app have string value type yo_2014_rojo . need split string in 3 parts: part1 ="yo" part2="2014" , part3="rojo" . i trying follows: string s[] = dato_seleccionado.split("_"); string s1 = s[0]; string s2 = s[1]; string s3 = s[2]; but app crashes exception: arrayindexoutofboundsexception . any welcome. try this... string str = "yo_2014_rojo"; stringtokenizer token = new stringtokenizer(str , "_"); string part1 = token.nexttoken(); //yo string part2 = token.nexttoken(); //2014 string part3 = token.nexttoken(); //rojo

redis - Persist job results with Resque / Rails -

in rails app, i'm trying take working api calls , have them handled background workers. i have following in app/jobs/api_request_job.rb: class apirequestjob def self.perform(params) query.new(params).start end end the query class httparty requests being executed (there lots of methods different query types same basic format parks method: require 'ostruct' class query include foursquare attr_reader :results, :first_address, :second_address, :queries, :radius def initialize(params) @results = openstruct.new @queries = params["query"] @first_address = params["first_address"] @second_address = params["second_address"] @radius = params["radius"].to_f end def start queries.keys.each |query| results[query] = self.send(query) end results end def parks category_id = "4

sed - Executing edits in parallel rather than sequentially -

i want apply large number of edits file in parallel. don't want subsequent edit commands modify modified lines if pass through sed pattern space. any tips? this might work (gnu sed): sed 's/fred/wilma/g;t;s/wilma/betty/g' file use fact substitution has taken place way of preventing further substitutions on line. t command bail out if substitution has succeeded.

mql - How to export to a CSV file from an Existent MT4 Indicator code -

Image
i export results csv file. iexposure indicator (iexposure.mq4) mt4. there way know how export values csv this code tried use export csv. int h1; h1 = fileopen("data3.csv", file_csv | file_write | file_read, ','); fileseek( extsymbolssummaries[i][deals]=0, extsymbolssummaries[i], [buy_price]=0,extsymbolssummaries[i][sell_lots]=0 ,extsymbolssummaries[i] [sell_price]=0,extsymbolssummaries[i][net_lots]=0, extsymbolssummaries[i][profit]=0, seek_end); filewrite(h1, symbols[i]=symbolname, extsymbolssummaries[i][deals]=0, extsymbolssummaries[i] [buy_price]=0,extsymbolssummaries[i][sell_lots]=0 ,extsymbolssummaries[i] [sell_price]=0,extsymbolssummaries[i][net_lots]=0, extsymbolssummaries[i][profit]=0 ); fileclose(h1) this original code : //+------------------------------------------------------------------+ //| iexposure.mq4 | //| copyright © 2007, metaquotes software corp. | //|

R - Logistic Regression - Sparse Matrix -

i have dataset has 1000 features , 30,000 rows. of data 0's. storing information in sparse matrix. perform column wise logistic regression - each feature vs dependent variable. my question how perform logistic regression on sparse matrices.i stumbled glmnet package requires minimum 2 columns. here sample code require(glmnet) x = matrix(rnorm(100*1),100,1) y = rnorm(100) glmnet(x,y) this gives me error. wondering if there other package might have missed? any appreciated. all this more workaround solution. can add column 1s ( cbind(1, x) ) one-column matrix. new column used estimating intercept. therefore, have use argument intercept = false . glmnet(cbind(1, x), y, intercept = false)

VB6 to VB.net porting -

i porting vb6 project vb.net , getting error "'sorted' not member of 'system.windows.forms.listview'" system.windows.forms.sortorder.ascending .sort() 'upgrade_issue: mscomctllib.listview property lswfloorall_f.sorted not upgraded. click more: 'ms-help://ms.vscc.v90/dv_commoner/local/redirect.htm?keyword="076c26e5-b7a9-4e77-b69c-b4448df39e58"' .sorted = false in vb.net, there no " .sorted " listview. can use .sorting property instead, , optionally make listviewitemsorter property specify comparer class. it's lot messier in vb.net. http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.sorting%28v=vs.110%29.aspx http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.listviewitemsorter%28v=vs.110%29.aspx

Sync post between Facebook Group and Website using Graph API -

i have website , active facebook group. i need 2 way sync between website , facebook group.this means posted on website should automatically posted on facebook group , posted on facebook group should posted on website. at moment have figured out way post website using graph api. my question how do vice versa i.e whenever post gets posted on website automatically update on website. is there api ,some kind of push facebook or continuous polling way ?

java - Creating BaseDAO for Each Dao class -

i created spring application decided add basedao eliminate redundant create, update,delete,findbyid,and findall methods every dao. created basedao , every dao should extend basedao. basedaoimpl public class basedaoimpl implements basedao{ sessionfactory sessionfactory; public void setsessionfactory(sessionfactory sf){ this.sessionfactory = sf; } @override public void create(modelbase modelbase) { session session = this.sessionfactory.getcurrentsession(); session.persist(modelbase); } @override public void update(modelbase modelbase) { session session = this.sessionfactory.getcurrentsession(); session.update(modelbase); } @override public collection findall(class aclass) { session session = this.sessionfactory.getcurrentsession(); collection modelcols = session.createquery("from "+aclass.getsimplename()).list(); return modelcols; } @override

c++ - Checking a file against itself -

i trying write program checks how many words inside of other words. tell user word has words in it. reason, while loop breaking , cannot file reload. ideas? #include <iostream> #include <string> #include <fstream> using namespace std; struct finalword { string word; int number; }; ostream& operator<<(ostream& o, const finalword& f) { return o << f.word << ": " << f.number; } int main () { finalword f; string line, holder, line2; ifstream myfile("enable1.txt"); int counter; int holdlen; size_t found; if (myfile.is_open()){ while(getline(myfile,line)){ holder = line; while (getline(myfile, line)){ found = holder.find(line); if (found != string::npos){ counter++; } if (counter > holdlen) { f.word = line; f.nu

tcl - Error while selecting business object in eMatrix -

i trying run mql command on ennovia ematrix plm print bus type 'own design item' name 'rau1204038' revision * select *; but getting error error: #1900068: print business object failed error: #1500029: no business object 'error getting object name own design item name' found system error: #1500178: business type '0' not exist noman, first have search that,your business object name exist in matrix or not. to check business object name, use below command: list businessobject [vault vault_name]; if business object name exist, use below command: print bus 'own design item' 'rau1204038' * select ; note: must have administrator rights.

c++ - Local memory leak in constructor -

i intrigued when 1 static code analysis software didn't complained memory leak in constructor. inputs helpful. aware that, it's not class member. it's local pointer inside ctor class abc { public: abc() { int *p = new int[10]; //no delete invoked... } }; you don't need static analysis tool this. gcc has ported llvm's sanitizer , it's available of gcc 4.9. it's part of clang obviously. ✿´‿`) ~/test> g++-trunk -fsanitize=undefined,address,leak -std=c++11 test.cpp -g -wall -wextra -pedantic test.cpp: in constructor ‘abc::abc()’: test.cpp:6:18: warning: unused variable ‘p’ [-wunused-variable] int *p = new int[10]; ^ (✿´‿`) ~/test> ./a.out ================================================================= ==1713==error: leaksanitizer: detected memory leaks direct leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7f2535b07919 in operator

c# - how to set ServicePointManager.ServerCertificateValidationCallback in web.config -

how set in web.config file servicepointmanager.servercertificatevalidationcallback += (sender, cert, chain, sslpolicyerrors) =>true; try this; write code in application_start of global.asax . it should work..!!! or in config file; <configuration> <system.net> <settings> <servicepointmanager checkcertificatename="false" checkcertificaterevocationlist="false" /> </settings> </system.net> </configuration> you can visit msdn same.

extracting of string parameter value from java output -

this question has answer here: how extract parameters given url 6 answers hi getting following output java code: access_token=caaw2msimwaqbajslgf1yfu3rjzizzcfkb3zai9uazctwou52s9eeuxxnyv0nbdzapnphwwhgcdp9icvei7qlixrcc43ierm5oqbedplk3fzclpzbeawry2njkm4o3e4llciiujplddnophnoxczj9fmb2czcaqilbh2cdnid1i4qzbkkgwgtluikcz6ptt8zcl4wifagtfl5o6fgnbibgm89f&expires=5181699 how retrieve value of access_token? code below: string line; stringbuffer buffer = new stringbuffer(); bufferedreader reader = new bufferedreader(new inputstreamreader( conn.getinputstream())); while ((line = reader.readline()) != null) { buffer.append(line); } reader.close(); conn.disconnect(); string response1= buffer.tostring(); thank you. you can using split() method of string try this. stri

c# - Append multiple column values into single column by adding column values below in datatable -

am having datattable below 3 columns name,favourite1 , 2. name favourite1 favourite2 xxx eating cricket yyy books music my expected output is name favourites xxx eating yyy books xxx cricket yyy music how make ... :( use code in c#. merge function used merge 2 data tables. expected output in fav1 datatable. datatable fav1; fav1= threecolumntable.copy(); fav1.columns.remove("favourite2"); fav1.columns[1].columnname = "favourites"; datatable fav2; fav2= threecolumntable.copy(); fav2.columns.remove("favourite1"); fav2.columns[1].columnname = "favourites"; fav1.merge(fav2);

Installing signed APK does not install app on Android Wear -

when try install app on android wear installing signed apk on handheld, receive error on wear logcat: 0:34:06.143 1874-5212/? e/wearablepkginstaller﹕ error finding asset package: com.company.app com.google.android.wearable.gmsclient.wearableexception: getdataitem failed: status{statuscode=timeout, resolution=null} @ com.google.android.wearable.gmsclient.googleapiclienthelper.throwiffailed(googleapiclienthelper.java:98) @ com.google.android.wearable.gmsclient.datamanager.getdataitem(datamanager.java:153) @ com.google.android.clockwork.packagemanager.packagemanagerutil.getpackagefdforpackagewithname(packagemanagerutil.java:57) @ com.google.android.clockwork.home.provider.wearablepackageinfoprovider.openfile(wearablepackageinfoprovider.java:147) @ android.content.contentprovider.openassetfile(contentprovider.java:1213) @ android.content.contentprovider.opentypedassetfile(contentprovider.java:1393)

python - How to get tweets of a particular hashtag in a location in a tweepy? -

i wish obtain tweets of particular hashtag a particular location chennai analysing data. i'm new twitter api , tweepy. found search url : https://api.twitter.com/1.1/search/tweets.json?q=%23cricket&geocode=-22.912214,-43.230182,1km&lang=pt&result_type=recent how same in tweepy ? code far : import tweepy ckey = "" csecret = "" atoken = "" asecret = "" oauth_keys = {'consumer_key':ckey, 'consumer_secret':csecret, 'access_token_key':atoken, 'access_token_secret':asecret} auth = tweepy.oauthhandler(oauth_keys['consumer_key'], oauth_keys['consumer_secret']) api = tweepy.api(auth) crictweet = tweepy.cursor(api.search, q='cricket').items(10) tweet in crictweet: print tweet.created_at, tweet.text, tweet.lang you need use geocode parameter in tweepy. using lat/long/radius search url, cursor should defined so: tweepy.cursor(api.search, q='cricket&#

properties - Why to use @property in iOS app development -

this question has answer here: in objective-c, when should use property , when should use instance variable? 7 answers i searched on internet @property in ios , got answers such no need explicitly use setter , getter method. beside these answer can u explain me exact benefit of using @propert in ios app development. what benefit , when use? thank you. basics of oop(object oriented programming) - hide ivars / properties outside world. @property specific objective-c, creates ivars , given option either use compiler defined setter & getter, or create own @synthesize . few differences still valid objective-c , other oop languages ivars/properties private/protected/public. there ways set access-specifiers. if fancied ivars , properties 1 of major advantage of kvo (key value observer) helps minimize codes , self.property name suffice.

mysql - sql self join and many to many relationship -

i have tabled called category , record can have parent or child , category. category tables many-to-many relationship posts through post_category. category[id, name category_id] posts[id,title, body....] post_cats[id,post_id,category_id] sample data category id name category_id 1 xxxx 0 2 yyyy 0 3 zzzz 1 4 wwww 1 5 aaaa 2 6 bbbb 2 posts id title body 1 aaaaaaaaaa 2 bbbbbbbbbbbbbb 3 ccccccccccccccc 4 ddddddddddd post_cats id post_id category_id 1 1 3 2 1 4 3 2 5 4 2 6 5 2 3 category record 1 has post of 3 , record 2 has post of 2 want count posts belongs category name 'xxxx' or want count posts belongs each parent category child category counted. select post_id post_category group post_id having count(*) = (select count(*) category)

c# - Settings value empty when main program not running -

i have put program settings values in separate project called common in solution. have main project (let call a ), , other projects ( b , c ) , 1 common project. common added a , b , c 's references. have tried accessing common 's settings value using both: visual studio's settings.setting easy use tricky when comes reading other projects. a self-made ini file read , write to. and realized both acting same way , think missing important point. setting values accessible when main project running. when update settings, saved , works fine. but need access these values other projects while a not running. in case, project b triggered windows service. reads data database , executes batch file. needs access common 's settings. , empty strings! so if consider 2nd approach above (reading ini ) common has value in conf static object (that use read , write settings) called connectionstring . value accessed in main program calling common.conf.connectionstri

html - <div id> section not displayed on webpage -

im trying basic knowledge practicing free templates, , ran one https://www.freewebsitetemplates.com/preview/zerotype/index.html can open index in editor , explain me why adbox isnt displayed on page. i think because of adblock browser extension.

functional programming - Why can't I Implement Streams functionality in my JAVA project? -

i'm beginner of java programming. recently, tried use map & filter functionality of stream s following code shows. list<string> strlist = arrays.aslist("abc", "", "bcd", "", "defg", "jk"); long count = strlist.stream().filter(x -> x.isempty()).count(); system.out.printf("list %s has %d empty strings %n", strlist, count); however, compiler complains need "create local variable x". maybe lose basic steps easy find related discussions on google. my java compiler version j2se 1.5, , import java.util.stream.* file. thanks! stream s , lambda expressions java 8 functionality. upgrade compiler.

javascript - How to create master node in node.js -

i'm new cluster/child_process modules in node.js. can let me know how can create master node or how make node master? most of tutorials mention how verify if node master or worker (below code), not how create master. edit: var cluster = require('cluster'); var http = require('http'); var numcpus = require('os').cpus().length; if (cluster.ismaster) { // fork workers. (var = 0; < numcpus; i++) { cluster.fork(); } cluster.on('exit', function(worker, code, signal) { console.log('worker ' + worker.process.pid + ' died'); //cluster.fork(); ----------(2) }); } else { // workers can share tcp connection // in case http server //cluster.fork();-----------(1) http.createserver(function(req, res) { res.writehead(200); console.log("hello worldd"); res.end("hello worldd\n"); }).listen(8000); } edit: how can create proper child process runs continuously. if create ne

php - when i create docx file with use of file creation.after file i download i got like this please give some idea -

Image
<?php header("content-type: application/vnd.openxmlformatsofficedocument.wordprocessingml.document"); header("content-transfer-encoding: binary"); header('content-disposition: attachment;filename="myfile.docx"'); echo "<html>"; echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1252\">"; echo "<body>"; echo "<p style=font-family:'$s2';font-size:'$s1'>".$t1."</p>"; echo "<p style=font-family:'$s4';font-size:'$s3'>".$t2."</p>"; echo "<p style=font-family:'$s6';font-size:'$s5'>".$t3."</p>"; echo "</body>"; echo "</html>"; ?> unable open docx file in ms-office created using php. please me make possible. in advance

c# - Domain event being executed after transaction completes. How to get the concrete type. -

i wanted publish domain event after transaction completes. have followed article here: http://www.jayway.com/2013/06/20/dont-publish-domain-events-return-them/ , had @ post: should pass repository domain method fires event makes sense... confused how resolve interface collection concrete types. example in collection of ievent there maybe 2-3 different types of events. how figure out event added fire correct handler? i found answer in comment of following post: http://lostechies.com/jimmybogard/2014/05/13/a-better-domain-events-pattern/ i.e. domainevents.raise((dynamic) event)

java - What is the difference between Tracing and Logging? -

from terminology point of view , in general, difference between 'tracing' , 'logging' ? thanks! logging not tracing ! logging : when design big application need have , flexible error reporting perhaps across machines collect log data in centralized way. perfect use case logging application block configure remote trace listener , send log data central log server stores log messages in database, log file or whatever. if use out of process communication limited network performance in best case several thousand logs/s. tracing : besides error reporting need trace program flow find out performance bottlenecks , more important when error occurs have chance find out how did there. in ideal world every function have tracing enabled function duration, passed parameters , how far did in function.