Posts

Showing posts from May, 2015

python - TypeError: can only concatenate tuple (not "float") to tuple -

i'm new python, question might easy, anyway, patience: as trying call newton-raphson method calculate implied volatility in black-scholes formula call/put option pricing, first thing is, newton method in scipy.optimize seems calculate function's zeros, in black-scholes formula, want function's value option price, not zero. (i'm new here programming, i'm not sure techniques.) should write function things like: def f(sigma, price): return bsformula(s0,k,r,t,q,sigma) - price then, while calling newton method, takes args=() 1 parameter in function, write this: value = newton(bsprice2, 0.5, args=price) but error message: file "bs.py", line 36, in bsimpvol value = newton(bsprice2, 0.5, args=float(price)) file "/usr/lib/python2.7/dist-packages/scipy/optimize/zeros.py", line 143, in newton q0 = func(*((p0,) + args)) typeerror: can concatenate tuple (not "float") tuple could tell me why that? how fix it? apprecia...

how do I iterate though a java list in stringtemplate? -

i want iterate through hibernate query results inside stringtemplate. i've been looking examples can't find anything. can please help? thanks the syntax looks like <items :{ item | <item> }> putting in java: list<string> teams = arrays.aslist("cats", "birds", "turtles"); st s = new st( "<teams :{team | <team> }>"); s.add("teams", teams); system.out.println(s.render()); in example iterate on list , print each. result printed is: cats birds turtles we can explore syntax makes happen. before do, remember, default delimiters in stringtemplate less < , greater > . since didn't specify different delimiters use in our example. see more delimiters :{ } this set of symbols, colon : , open , closed brace {} can read "for each". in example template, code reads, each team in teams print team . left side of vertical pipe | indicates variable created each ...

MongoDB Exception caching while updating data -

hello every 1 i'm new mongodb. while updating table have return values in result . return undefined ,but in case of find , insert value in table works properly. bands.update({name:'hollywood rose'}, {$set:{year:2000}}, function(err, result) { console.log("result----"+result) // returns undefined if (!err) return context.sendjson(result, 404); }) ; this code work in case while update value in table in mongodb did code in playframe work java . hope in case. mongoclient mongo=new mongoclient("localhost",27017); /*mongo.setwriteconcern(writeconcern.journaled);*/ db db = mongo.getdb("webportal"); dbcollection coll=db.getcollection("userdb"); //objectid id= new objectid(userid); basicdbobject doc2 = new basicdbobject(); doc2.put("_id",userid); basicdbobject updatedocument = new basicdbobject(); updatedocument .append("$set", new basicdbobjec...

c# - SSRS with Custom DataSet (System.Data.DataSet) -

how create report dataset object? hers existing approach, create connection string. create query string. write rdl file manually using xmlwriter above details, like <datasources> <datasource name="mydatasource"> <connectionproperties> <dataprovider>sql</dataprovider> <connectstring>my connection string</connectstring> <integratedsecurity>true</integratedsecurity> </connectionproperties> <rd:securitytype>integrated</rd:securitytype> <rd:datasourceid>my data source id</rd:datasourceid> </datasource> </datasources> <datasets> <dataset name="mydataset"> <query> <datasourcename>mydatasource</datasourcename> <commandtext>my query string</commandtext> </query> <fields> <fi...

cakephp get data from two tables -

i have model class fooditem needs retrieve datas joining tables menu_food_item. code. $fooditems=$this->fooditem->find('all',array('joins'=>array(array('table'=>'menu_food_items', 'alias'=>'mfi', 'type'=>'inner', 'forignkey'=>false, 'conditions'=>array('mfi.food_item_id=fooditem.id','mfi.menu_id'=>$menu_id))),'fields'=>array('fooditem.id','fooditem.food_item_title','fooditem.active','mfi.menu_id'))); i want menu_id result.(from menu_food_item table) pr($fooditems); result array ( [0] => array ( [fooditem] => array ( [id] => b102 [food_item_title] => prown cocktail [...

asp.net - Exception of type 'System.OutOfMemoryException' was thrown. -

i got following problem description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.outofmemoryexception: exception of type 'system.outofmemoryexception' thrown. source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [outofmemoryexception: exception of type 'system.outofmemoryexception' thrown.] system.reflection.runtimeassembly._nload(assemblyname filename, string codebase, evidence assemblysecurity, runtimeassembly locationhint, stackcrawlmark& stackmark, boolean throwonfilenotfound, boolean forintrospection, boolean suppresssecuritychecks) +0 system.reflection.runtimeassembly.internalloadassemblyname(assemblyname assemblyref, evidence assemblysecurity, stackcrawlmark& stackmark, b...

can't start android virtual devices after eclipse pachages update -

i don't have experience eclipse, time ago, i've followed tutorials , have build 2 android applications. after 6 months of not using eclipse, when opened had make updates, virtual devices doesn't start. following message error: adb connection error:an existing connection forcibly closed remote host connection attempts: 1 i've tried following, end results same: - deleted , made new virtual device - reset adb ddms - adb kill-server cmd i assume didn't install right packages in android sdk manager. i not sure what's causing problem have tried downloading android sdk link ? includes eclipse , android sdk need develop applications. possible make work getting first eclipse , after install android sdk aswell. about error assume problem in system services when want start emulator must start aswell system process ... maybe that's not starting , in case can problem android sdk or gets blocked in background operating system (i'm not sur...

AdMob not working in windows phone 8 -

i using admob in windows phone 8 app, throwing exception - ad network not available and not showing banner because of problem. which variable missing or sdk issue? <google:bannerad adunitid="a1521709bd7f585" verticalalignment="bottom" height="60" name="adcontrol" isenabled="true" adfailed="intubeadfailedhandler" adleavingapplication="intubeadleavingapplicationhandler" adpresentingscreen="intubeadpresentingscreenhandler" adreceived="intubeadreceivedhandler"/> this can caused low ads inventory region , windows phone platform in admob. can use testmode integration settings development stage seen here .

.htaccess - Migrating to new cms. Old cms moving to another subdomain. Dealing with links with htaccess (IF/THEN) -

the situation following: i moving new cms. before complete migration old 1 new decided start beta version of new one. have: old -> http://www.myweb.com new -> http://beta.myweb.com but old 1 renamed http://old.myweb.com , new 1 http://www.myweb.com , so: old: http://www.myweb.com -> http://old.myweb.com new: http://beta.myweb.com -> http://www.myweb.com difference in links @ moment following: old -> http://www.myweb.com/content/crab-goes-home-5 new -> http://beta.myweb.com/stock-video/crab-goes-home-5-8523.html (*as see, new url has "stock-video" instead of "content". in end of new url addition "-8523" unique, dynamically generated id.) i want achieve following: don't want shut down old website(because of seo), because new web have 80% of old 1 website's content. so if user enters(after migrations) i.e. url " http://www.myweb.com/content/crab-goes-home-5 " , page missing, user m...

c - Format specifier %02x -

i have simple program : #include <stdio.h> int main() { long = 16843009; printf ("%02x \n" ,i); } i using %02x format specifier 2 char output, however, output getting is: 1010101 while expecting : 01010101 . %02x means print @ least 2 digits, prepend 0 's if there's less. in case it's 7 digits, no 0 in front. also, %x int, have long. try %08lx instead.

python - How to parse the following multi-dimensional xml-like data into a dataframe -

i have explored xml based api work-related things, comes warehouse data. ideally want analysis in python pandas. aggregate(aggregate_dimension_value_list=[ dateaggregatedimensionvalue(value=datetime.datetime(2013, 8, 28, 19, 30, tzinfo= utc )) , none, stringaggregatedimensionvalue(value=u'virtually_labeled_case') ], quantity=127) , aggregate(aggregate_dimension_value_list=[ dateaggregatedimensionvalue(value=datetime.datetime(2013, 8, 28, 19, 30, tzinfo= utc )) , stringaggregatedimensionvalue(value=u'pptransmergenoncon') , stringaggregatedimensionvalue(value=u'prime_bin_random_stow') ], quantity=15) aggregate(aggregate_dimension_value_list=[ dateaggregatedimensionvalue(value=datetime.datetime(2013, 8, 27, 21, 0, tzinfo= utc )) , stringaggregatedimensionvalue(value=u'pptransfra1') , stringaggregatedimensionvalue(value=u'prime_bin_random_stow') ], quantity=8) , the data looks above stream, after did find , replace in vim (i kn...

json - How to create a custom @jsonDeserializer class in java -

i have java class. related many other java classes. , want deserialize class. please me deserialize class. class this.. @entity @table(name = "a", uniqueconstraints = @uniqueconstraint(columnnames = { "name" })) @jsonidentityinfo(generator=objectidgenerators.intsequencegenerator.class, property="@_refid") @jsondeserialize(using=adeserializer.class) public class { @column(name = "name") private string name; @column(name = "description") private string description; // @manytomany(cascade={cascadetype.remove, cascadetype.merge},fetch=fetchtype.eager) @jointable( name="b", joincolumns={@joincolumn(name="aname")}, inversejoincolumns={@joincolumn(name="bname", unique=true)} ) @fetch(fetchmode.subselect) private set<c> cs; @manytomany(cascade={cascadetype.merge},fetch=fetchtype.eager) @jointable( name="d", joincolumns=@joincolumn(name=...

php - simple message posting / getting back as JSON object for Android app -

i'm working java android , absolutely have 0 knowledge of php. know how send data php or receive data in json in android, got 0 knowledge php. all need simple "message board" - no discussion threads, name, message , time when posted - send android app php, should store , when app asks - should give me json data name/message/time of messages there on server. well, don't know if it's simple task or not. way see - should simple once again don't know php -maybe it's 1000 lines code) want feature in app :) if it's not simple , needs lot of code - :) if there's not code - please me that. tried google - there solutions large scale message boards, etc thank you

libmicrohttpd ./configure: pthreads not supported (osx) -

after downloading , untarballing libmicrohttpd gnu archive, did usual: ./configure . however, configure stopped reporting error. here last few relevant lines: checking pthread_create in -lpthread... no checking if compiler supports -pthread... no checking if compiler supports -pthreads... no checking if compiler supports -threads... configure: error: system not supporting pthreads! i searched online, , sure enough, appears osx * does * have pthreads , not find on configure reporting errors no pthreads on osx. here top level ls of /usr/include : http://sprunge.us/dggy and here tree of same: http://sprunge.us/fvbv on os x it's easier use homebrew instead of trying build scratch - checked , have formula libmicrohttpd . note default homebrew puts headers , libraries under /usr/local/include , /usr/local/lib - gcc find libraries , headers here default, or can add paths explicitly if prefer ( -i include paths, -l library paths).

php - How to validate html for WCAG in a Continuous Integration environment? (Jenkins) -

we using jenkins our ci. our code in php (zend framework), , validate every commit comply wcag standards. alternatively, validate html using customs rules (no img tag without alt attribute, no html tag without lang, etc). does know plugin might useful or have lead implement solution? thank you if don't want code checks have @ html_codesniffer sources on github. can call via jenkins "execute shell" or in build scripts.

javascript - Jquery rollover but not the same child? -

what want when rollover .mainmenu .submenu fade in, problem both of them not parent , child related, how can make .submenu remain visible when move cursor .mainmenu .submenu? http://codepen.io/vincentccw/pen/lnvje my html: ////////////////////////////////////////////// <div class="mainmenu">this text</div> <div class="submenu">this text2</div> ////////////////////////////////////////////// js: ////////////////////////////////////////////// $( document ).ready(function() { $(".mainmenu, .submenu").mouseenter(function(){ $(".submenu").stop(true,true).slidetoggle(); console.log('slide down'); }).mouseleave(function(){ $(".submenu").stop(true,true).slidetoggle(); console.log('slide up'); }); }); //////////////////////////////////////////////// $(document).ready(function () { $(".mainmenu").mouseenter(function () { $(".submenu").stop(tr...

How to filter data and print out string using python beautifulsoup? -

i have code: import urllib bs4 import beautifulsoup url = 'http://www.brothersoft.com/synthfont-159403.html' pagehtml = urllib.urlopen(url).read() soup = beautifulsoup(pagehtml) in soup.select('div.updated.coleft ul a[href]'): print a.string but give me output: kenneth rundt what need whole information inside updated coleft class. should do? get li elements: >>> li in soup.select('div.updated.coleft li'): ... print ' '.join(li.stripped_strings) ... last updated: dec 27, 2012 license: freeware free os: windows 7/vista/xp requirements: no special requirements publisher: kenneth rundt (4 more applications)

xml - Magento 1.7 - Allowed memory size exhausted - SimpleXML -

i have error on 1.7 magento installation. when try manage products, error: allowed memory size of 4294967296 bytes exhausted (tried allocate 523800 bytes) in [...]/src/lib/varien/simplexml/config.php on line 667 occurs. thing did update factfinder extension. reverted code changed since error occures, no changes. on second installation have same code, no error occures in backend. most confusing fact: config.php has 604 lines ... have no idea debug error. i had same sort of problem when trying import/export products , customers when migrating installation of magento. error, found, server-side. need contact hosting provider , ask them increase memory limit in php.ini. max_execution_time = 120 ; maximum execution time of each script, in seconds max_input_time = 240 ; maximum amount of time each script may spend parsing request data memory_limit = 1024m above values needed change solve memory size exhaustion error. hope helps.

C# WCF ChannelFactory BadRequest 400 Error -

i have created simple webservice server, call methods service class in same project i've created webchannelfactory proxy. it's working fine until move project(or exe version) machine. can't figure out what's going on! i'm getting error message: the remote server returned unexpected response: (400) bad request. with stacktrace: server stack trace: @ system.servicemodel.channels.httpchannelutilities.validaterequestreplyresp onse(httpwebrequest request, httpwebresponse response, httpchannelfactory factor y, webexception responseexception, channelbinding channelbinding) @ system.servicemodel.channels.httpchannelfactory.httprequestchannel.httpcha nnelrequest.waitforreply(timespan timeout) @ system.servicemodel.channels.requestchannel.request(message message, times pan timeout) @ system.servicemodel.dispatcher.requestchannelbinder.request(message messag e, timespan timeout) @ system.servicemodel.channels.servicechannel.call(string action, boolea...

sql - mysql: truncating a field and aggregating the data in another table -

i have table has date in form of date time. mysql> select * topsmsspammers_hour limit 1; +---------------------+------+---------+-------+--------------+---------------------------------------------+-------------+--------+----------------+ | date | spam | suspect | clean | spammer | spam_campaign_id | messagetype | policy | issenderpolicy | +---------------------+------+---------+-------+--------------+---------------------------------------------+-------------+--------+----------------+ | 2013-06-11 23:00:00 | 1 | 0 | 0 | +12073708065 | notset|message35392herbisreallyworkingrealy | 4 | 1 | 1 | +---------------------+------+---------+-------+--------------+---------------------------------------------+-------------+--------+----------------+ 1 row in set (0.00 sec) mysql> i want use data in table populate aggregate day date table exact same column names date truncated (and counts chang...

java - struts2 populate "value" object of map from Form post -

i'm using struts 2. have object contains booleans. have hashmap contains many of previous objects defined key. in jsp table populated radio buttons. 1 line each key of map etc. when post form want save options set user. map not seem populated. my code like: myobject ( 2 boolean parameters ) private map<string, myobject> ... (with getter & setter ). in jsp html generated is: <input type="radio" name="mymap[123].booleanparameter1" id="someid" checked="checked" value="true"> etc can on how "name" of radio button should set struts can populate map? public class myobject implements serializable{ private boolean booleanparameter1; private boolean booleanparameter2; getters & setters here } map<string,myobject> mymap ... in action jsp... <s:iterator ...iterates default map values> <s:radio label="parameter1" name="mymap[...

c - For loop flow with a variable name as a condition. -

what following loop do? when program break out of loop? for (c = 0; n; c++) { /* . . . */ } here example of such loop in answer on so . the loop break when n becomes 0 (in other words, loop not stop until n becomes 0 ). can happen within loop (the loop body sets n 0 eventually), or possibly happen because of external event. examples of external events shared memory update, or modification signal handler. c variable incremented many times loop body entered for loop. c variable initialized 0 . technically, code fragment not for loop, controlling construct of for loop statement. fragment missing loop body. that's okay, since question title "this for -loop structure". question title , post has since been modified. you link function in different answer, seem understand purpose of function count number of set bits in number.

android - How to store the arraylist in ormlite database -

i trying save arraylist of class objects ormlite database , giving error , java.lang.illegalargumentexception: no fields have databasefield annotation in class java.util.arraylist my code is @databasetable public class managemodeldetails { @databasefield(generatedid = true) private int id; @databasefield(foreign = true, foreignautorefresh = true) private arraylist<modeldetails> listmodeldetails; // =============================================== public managemodeldetails() { super(); } // =============================================== public managemodeldetails(int id, arraylist<modeldetails> listmodeldetails) { super(); this.id = id; this.listmodeldetails = listmodeldetails; } // =============================================== public void setid(int id) { this.id = id; } public int getid() { return id; } public void setmodellist(arraylist<modeldetails> listmodeldetails) { this.listmodeldetails = listmodeldetails; } public ...

Trying to condense my javascript (jquery) -

i'm relatively new javascript , jquery. rather using foundation or bootstrap i've decided roll , maintain own solution. i'm not worried individual components i've built of them before, responsive rows/columns bit of worry me. this bit of code directly sets percentages col1-col-12 , mob1-mob12(12 columns, mob mobile only). i have bit of css i'm playing goes hand in hand this. i'm relatively happy functionality of this, don't know how condense solutions further other datastructures or programmatic methods. thanks in advance advice: $(document).ready(function(){ var colelements = ".row, .col1, .col2, .col3, .col4, .col5, .col6, .col7, .col8, .col9, .col10, .col11, .col12"; var col1 = "8%"; var col2 = "16%"; var col3 = "25%"; var col4 = "33%"; var col5 = "41%"; var col6 = "50%"; var col7 = "58%"; v...

dns - Windows Azure VM cannot access microsoft.com -

i have 2 vm's on windows azure, connected virtual network, including "dns" component linked virtual network. the first machine ad controller (with dns), , dns virtual network (in azure) pointed machine (10.0.0.4). the 2 vm's can talk each other, , second vm domain joined ad controller on first machine. the problem is, on both vm's, cannot access/browse related microsoft.com (like visualstudio.com, etc). other sites (even bing.com) work without problem. what reason. need change dns settings on first vm microsoft.com "excluded" or something. suppose "internal" microsoft traffic? thanks! solved! need add google dns list of dns servers in management portal, , link virtual network.

php - Function unpack() shows different results -

i'm trying unpack hex 4-bytes float: var_dump(unpack("f", "\x3c\x6b\x2c\x45")); but when execute in cli , via web different results. via cli: float(2758.7021484375) via web: float(3.3106399961764e+21) phpversion() returns 5.3.10-1ubuntu3.7 why?

BlackBerry SQLite supported devices -

we can create sqlite database on 5.0, 6.0 , 7.0 devices. knows blackberry devices supports creating , managing sqlite databasse on internal memory (emmc memory)? as of i've come know blackberry 9700 , 9650 not support creating sqlite database on internal memory ( ///store path). apart this, there other device out there? and also, heard device has less 1gb internal memory not support creating sqlite database in internal memory; true? there no documents available explain (?) only following list of bb devices supports sqlite database in device memory has @ least 1 gb of emmc memory. blackberry bold 9000 torch 9800 blackberry storm 9500 blackberry storm 2 9550 blackberry storm 2 9520.

cuda - The behavior of stream 0 (default) and other streams -

in cuda, how stream 0 related other streams? stream 0 (default stream) execute concurrently other streams in context or not? considering following example: cudamemcpy(dst, src, sizeof(float)*datasize, cudamemcpyhosttodevice);//stream 0; cudastream_t stream1; /...creating stream1.../ somekernel<<<blocks, threads, 0, stream1>>>(dst);//stream 1; in above code, can compiler ensure somekernel launches after cudamemcpy finishes or somekernel execuate concurrently cudamemcpy ? cudamemcpy call (in particular case) synchronous call. host thread running code blocks until memory transfer host. cannot proceed launch kernel until cudamemcpy call has returned, doesn't happen until copy operation completed. more generally, default stream (0 or null) implicitly serializes operations on gpu whenever operation active in stream. if create streams , push operations them @ same time operation being performed in default stream, concurrency in streams lost ...

oop - Unit Testing with Moq in Visual studio 2012 -

i using moq library (moq) in visual studio 2012 (microsoft.visualstudio.testtools.unittesting) , know how write unit test class below employee class using moq. publc class employee { private deparment _objecta; //class protected imanager _objectb; //interface public employee(deparment objecta, imanager objectb) { _objecta=objecta; _objectb=objectb; } internal void empmethod1() { } internal void empmethod2() { } internal void empmethod3() { } } } public interface imanager { manager getmanager(int id); void addmanager(mgrname); } this duplicate from: how mock internal method of class? also there workaround described in following article using attributes projects: mocking internal types moq you can consider using non-proxy mocking library typemock, justmock or microsoft fakes.

sybase - Develop User based Applications using SMP -

can user based apps developed using smp(sap mobile platform) aware platform targeted towards enterprises, wonder if there chances develop user apps smp. yes, consumer apps can created sup/smp mobile applications consumers sap mobile platform @ sap community network - includes examples, tutorials , whitepapers - geared towards enterprise apps, it's still resource.

jquery - How do you position the labels in jqPlot stacked bar charts? -

Image
i can't figure out how position labels within bar chart. there way centre them within it's respective bar when stacked? in picture below of them seem reasonably in middle except there 1 sinks right bottom. have no idea how change this. i've tried adding margin in css seems have no effect. i've tried playing x/ypadding in pointlabel option seems move across not or down. var s1 = [31, 10, 20, 44], s2 = [15, 4, 7, 16], ticks = ['may', 'june', 'july', 'august']; $.jqplot('graph_pnl2', [s1, s2], { stackseries: true, seriescolors:['#73c774', '#c7754c'], seriesdefaults:{ renderer:$.jqplot.barrenderer, rendereroptions: {filltozero: true}, pointlabels: { show: true, location: 'e', xpadding: 25, ypadding: 25}, }, legend: { ...

javascript - Function call with additional sub functions -

i'm asking myself if it's possible call function in js, while having additional subfunction inside it fn(s); fn.subfn(s); for example make utils this var s = "123"; string(s) // true string.blank(s) // false i think it's possible this: function string(s) { if(s) return typeof(s) === "string"; return { blank: function(s) { return s.trim().length === 0; } } } but every time call string(s) i'm redefining blank fn, possible poor performances , poor code, or i'm wrong? thanks. functions objects, yes, can add properties them: function string(s) { return typeof(s) === "string"; } string.blank = function(s) { return s.trim().length === 0; } this allow make calls string(s); string.blank(s); just shown in example. comments code: the function defined returns object when call string , require call function string().blank(s); which different form example showed @ beginning. ...

Unable to change css values in Chrome developer tools -

Image
i've been testing latest project chrome few days now. working should. had no warnings or errors in console , able tweak css attributes on fly take effect in browser window. normal behaviour. yesterday updated chrome latest version , reason css warnings in console , i'm unable update css on fly. read 2 related, if have css warnings cannot edit css values. issue there no warnings before , there are. the warnings "invalid css property value". i'm wondering if i've changed setting no longer ignores invalid css. these warnings: anyone experienced same thing?

javascript - Codeigniter and jQuery - Validate form data -

i lots of own coding codeigniter+jquery combo. current project has lot's of different kind of inputs, , when data different, have handle differently. 1 field can email field, 1 field can number field has allow numbers , comma etc. got point. i made easy example how have been doing things. when submit pressed check every input's data regex match , if wrong, change color of input, , inform on field whats wrong. quite simple. this method works, when have lots of inputs gets messy , hard maintain, , mean have have php fallback if user have disabled javascript. have same checks on jquery , php side. other thing security. think i'm paranoid exploits/xss attacks, , remove unwanted characters regex , after check other regex if remaining data valid. i grateful if tell if there better way achieve data handling/validating between codeigniter , jquery. application/controllers/example.php <?php if ( ! defined('basepath')) exit('no direct script access allo...

ios - Filter dates which are earlier than today? -

in application have list of nsdate instances. @ 1 point need seperate dates past today ie [nsdate date] (earlier morning 12) , have used logic below. feel there must better logic this, me if there better solution. i pass date instance argument method return bool value corresponding requirement. -(bool)checkifpast:(nsdate *)date { nsdate *today=[nsdate date]; nsuinteger dateflags = nsyearcalendarunit|nsmonthcalendarunit|nsdaycalendarunit; nscalendar *gregoriancalendar = [[nscalendar alloc] initwithcalendaridentifier:nsgregoriancalendar]; nsdatecomponents *components1=[gregoriancalendar components:dateflags fromdate:today]; nsdatecomponents *components2=[gregoriancalendar components:dateflags fromdate:date]; if (components2.day-components1.day<0) { return yes; } else { return no; } } bool checkiftodayorfuture(nsdate *date) { nsdate *now = [nsdate date]; nsuinteger dateflags = nscalendarunitera | nscalend...

apache - php - "an error occurred while processing this directive" while calling fwrite more than 1000 times -

i have php script opens file in w mode , writes text using fwrite . fwrite() used in loop , fwrite() should called 2000 times . the script runing 15 minutes or , doesn't write data file , stops after ~900 loop . , after script ends error error occurred while processing directive . by runing loop 300 times don't error , data writen file . can see after 900+ loop fwrite stop , error . any ideea on how debug error ? here code : $handle = fopen("rankings_update_output.txt", "w"); $listings_updated = array('updated'=>array() , 'failed'=>array(), 'same_values'=>array()); foreach($result_array $obj) { $alexa_int = $alexa_ranking_class->get_rank($obj->prefix.$obj->redirect); $google_int = $google_ranking_class->get_google_pagerank($obj->prefix.$obj->redirect); $google_int = ($google_int == null || !is_int($google_int)) ? 0 : $google_int ; $alexa_int = ($alexa_int == null || !is_i...

hadoop - Issues with zookeeper -

i have issues zookeeper. 1) not able create zookeeper_server.pid in datadir. have tried suggestion of manually creating myid in datadir plus rwx permission given recursively. but, still getting following error while stopping zookeeper: datadir = datadir=/usr/local/hadoop/zookeeper/snapshot error: not find file /usr/local/hadoop/zookeeper/snapshot 2) trying manage zookeeper manually while installing hbase . due previous issue not able launch single instance. 2013-08-26 12:29:28,908 - info [main:quorumpeerconfig@310] - defaulting majority quorums 2013-08-26 12:29:28,917 - fatal [main:quorumpeermain@83] - invalid config, exiting abnormally org.apache.zookeeper.server.quorum.quorumpeerconfig$configexception: error processing /home/ubuntu/zookeeper/bin/../conf/zoo.cfg @ org.apache.zookeeper.server.quorum.quorumpeerconfig.parse(quorumpeerconfig.java:110) @ org.apache.zookeeper.server.quorum.quorumpeermain.initializeandrun(quorumpeermain.java:99) @ org.apache.zook...

django - tastypie custom authorization read_detail not being used -

i have custom authorization class have subclassed tastypie.authorization.authorization , writing unit tests. in testing read_detail() method, i've discovered particular request read_detail() method not being consulted , status code of 200 being returned (with correct payload. i've ensured none of other *_detail or *_list methods being executed instead. how can go debugging issue? edit: disabling simplecache made problem go away....

How to split List in Scala? -

how split list l (or other collection) 2 lists, first 1 contains 80% of l , second 1 contains rest? val (first80pct, rest) = l.splitat(l.size * 4 / 5) you want careful of using on collection without definite length (eg. streams).

java - JNLP file auto update issue -

i have jws based application. being deployed on web server , client downloads file browser , runs it. creates desktop shortcut , applications runs perfectly. now if change properties in jnlp file on server , run installed application ( on client machine ) desktop shortcut or downloaded jnlp file itself, it doesn't gets updated . i have verified on jdk version 1_6_30 , 1_7_21 . these 2 releases seems have resolved previous bug related whitespaces in cache path. issue remains on windows xp/7/8. original jnlp file : <?xml version="1.0" encoding="utf-8"?> <jnlp codebase="path/to/filelocation" spec="1.0+" href="demo.jnlp" > <information> . . . <offline-allowed/> <shortcut online="false"> <desktop/> <menu submenu="demo"/> </shortcut> </information> <update check="always" policy="always"/> ...

c - how do compilers assign memory addresses to variables? -

i teach course students ask questions programming (!): got question: why machine choose variables go in memory? can tell store variable? i don't know say. here's first attempt: the compiler (not machine) chooses store variables in process address space automatically. using c, cannot tell machine store variables. but "automatically" anticlimactic , begs question... , i've realized don't know if it's compiler or runtime or os or assignment. maybe can answer student's question better me. the answer question quite complex since there various approaches memory allocation depending on variable scope, size , programming environment. stack allocated variables typically local variables put on "stack". means compiler assigns offset "stack pointer" can different depending on invocation of current function. i.e. compiler assumes memory locations stack-pointer+4, stack-pointer+8, etc. accessible , usable pr...

css - Align <ul> <li> elements to the left -

i'm having trouble aligning li elements left on tabs, centered. wondering if me out. i've tried few things end breaking code. also, plus, effects fadein on divs don't seem work on opera , firefox. here's jsfiddle: http://jsfiddle.net/guisasso/6f6py/ css .tabs { border-bottom:3px #f2f2f2 solid; } .tabs li { list-style:none; display:inline; color:#08c; } .tabs { padding:5px 20px; display:inline-block; background:#ffffff; text-decoration:none; color:#08c; top: 3px; font-size: 22px; line-height: 140%; padding-top: 10px; background: #ffffff; box-sizing: border-box; position: relative; border-radius: 4px 4px 0 0; margin-bottom:3px; -webkit-transition: 0.2s ease-in-out; -moz-transition: 0.2s ease-in-out; -o-transition: 0.2s ease-in-out; transition: 0.2s ease-in-out; } .tabs a.active { background: #ffffff; border-bottom:3px orange solid; color:#000000; top:0px; } .tabs a:hover { background: #f2f2f2; top: 0px; border-bottom:3px orange solid; -webkit-transition:...