Posts

Showing posts from July, 2013

html - adding strings in javascript -

i working on creating page using html , javascript. have json file proves inputs of contents need. im trying have address variable setup google map api can displayed on page. <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>google maps javascript api v3 example: geocoding simple</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var geocoder; var map; var address = cmpyjson[jobcmpyid].company_name+" company, "+locjson[joblocid].location_name; function initialize() { geocoder = new google.maps.geocoder(); var latlng = new google.maps.latlng(-34.397, 150.644); var myoptions = { zoom: 11, center: latlng, maptypecontrol: true

apiblueprint - Trying to describe the request and response using Data Structures in API Blueprint -

i'm trying document endpoint api blueprint, using new attributes , datastructures sections of spec. my request payload looks this: { "url": "http://requestb.in/11v7i7e1", "active": true, "types": [ { "name": "sales", "version": "2.0" }, { "name": "products", "version": "2.0" } ] } my response payload looks that: { "data": { "id": "dc85058a-a683-11e4-ef46-e9431a15be8c", "url": "http://requestb.in/11v7i7e1", "active": true, "types": [ { "name": "products", "version": "2.0" }, { "name": "sales", "version": "2.0" } ] } } i tried follo

Having some trouble to delete a file using FileStreams in C# -

i'm writing program uses text files in c#. use parser class interface between file structure , program. class contains streamreader , streamwriter , filestream . use filestream common stream reader , writer, else these 2 conflict when both of them have file open. the parser class has class variable called m_path , path file. i've checked extensively, , path correct. openstreams() , and resetstreams() work perfectly, after calling closestreams() in delete() function, program goes catch clause, file.delete(m_path) won't executed. in other situations closestreams() function works perfectly. goes wrong when i'm trying close streamreader (m_writer) , give exception (file closed). /** * function close streams. */ private void closestreams() { if (m_streamopen) { m_fs.close(); m_reader.close(); m_writer.close(); // goes wrong m_streamopen = false; } } /** * deletes f

c++ - Printing Multiple Strings to a File -

i working on phone book, , have far been able have user input info, save string, save string file, , search string using keyword. however, functional first contact inputted. when new contact inputted, overwrites previous string saved in file. how can make print next line, , develop list of contacts can searched through. appreciated. here code: #include <iostream> #include <string> #include <ostream> #include <fstream> using namespace std; struct person { string name; string address; string phonenumber; string email; }; int main() { resetuserselection: vector<person>contactlist; int userselection = 0; cout << "press 1 add contact" << endl; cout << "press 2 search contact"<<endl; cout << "what want do? "; cin >> userselection; if(userselection == 1) { person newperson; cout << endl; cin.ignore();

javascript - HTML/CSS Panel icon shows panel but doesn't close it -

ive created panel using html , css only. want panel on bottom div of screen , when tap image (that used replace default text) panel rises bottom. i've got down part, however, rather new panels can't figure out how use same image close panel well. i'm not against using javascript or jquery, im learning two, skills not quite of yours! here html , css <nav id="nav" role="navigation"> <ul> <li> <a class="findme" href="#" aria-haspopup="true"><img src="assets/whitegearicon.png" /></a> <ul> <li ><a href="#"><img class="thedudeabides" src="assets/tools/timericon.png" /></a></li> <li><a href="#"><img class="obviouslyyourenotagolfer" src="assets/tools/flashicon.png" /></a></li> </ul> &l

Python CSV Output Blank Cells -

i trying write exact shell output of python code csv file (including blank fields). python output looks this. have tried head around reason, getting output looks this. contractnn develop nn manag nn order nn parti nn suitabl nn supplier nn work nn csv output desired [[(u'contract', 'nn'), (u'develop', 'nn'), (u'manag', 'nn'), (u'order', 'nn'), (u'parti', 'nn'), (u'suitabl', 'nn'), (u'supplier', 'nn'), (u'work', 'nn')]] [[(u'microsoft', 'nn')]] [[(u'hadoop', 'nn')]] [[]] [[(u'python', 'nn'), (u'python', 'nn')]] [[]] [[]] my python code import csv import nltk nltk import pos_tag nltk.stem.snowball import snowballstemmer nltk import stem import numpy np output_file = open('examp_output.csv', 'w') datawriter = csv.writer(output_file) """bunch of

Compiling Java class targeting 1.7 with classes built with JDK 8 on class path -

i have following scenario: class foo references method in class bar. i'd compile class foo javac targeting java 1.7 providing bar.class binary on class path uses java 8 syntax , compiled jdk 8. in production, jre 1.7 used run application different copy of bar.class on classpath - version of class bar uses java 1.7 syntax , built jdk 7. assuming method signatures bar remain same, there issues compiling , running foo? can compile foo using jdk 7 or must use jdk 8? for straight javac, can use -source/-target let java8 jdk build java7 class files (which means putting different version number in class file). my builds use maven, , while jenkins server building java8, source/target specified 1.7 , run existing java7 jdk. when first dependent project migrated java8, maven pom changed build 1.8 target , forced upgrade.

html - Fixed position overlap absolute position? -

i try create modal i'm stuck in getting overlay layer done. demo http://jsfiddle.net/4z3fss9t/ .modal-wrap{ display: block; opacity: 1; position: absolute; top: 20%; padding: 0 40px; left: 0; border: none; right: 0; z-index: 9999; } .modal-content{ background-color: white; padding: 10px; } .modal-overlay{ position: fixed; background: black; width: 100%; height: 100%; left: 0; top: 0; opacity: 0.5; } <div class="modal-wrap"> <div class="modal-content"> content goes here </div> <div class="modal-overlay"></div> </div> i expect position absolute come in front z-index don't, idea? honestly, whole idea behind z-index in css confuses web designers. it's not rocket science, favor understanding core concepts behind what's happening. odd behaviors fighting with, seem less voodoo. positioned elements first of all, non- positioned el

memory management - Frame Allocation -

i have 2 operating system related questions. first 1 relates frame allocation, more equal allocation specific situation. situation have there 200 free frames in memory , 2 processes trying paged in - p1 has 50 pages, , p2 has 350 pages. question happens p1? give p1 100 frames because having 2 processes , giving them equal number make each 100, or give p1 50 frames , give rest p2? assume later option don't know sure. the answer question highly operating system specific , time specific. in ye olde days of limited physical memory common operating systems swap process in , out of physical memory when there paging. now more common rely on paging. p1 may have 50 pages os may keep 5 of @ time in memory. generally pages loaded when accessed. there has page fault load page. (there exceptions general rule).

c# - How do I go about turning the time into a public int? -

how go turning time public int, kind of need convert timespan difference seconds , save public int. as in 4 hours , 22 min , 34 seconds 15754. using unityengine; using system.collections; using system; public class timeload : monobehaviour { datetime currentdate; datetime olddate; void start() { //store current time when starts currentdate = system.datetime.now; //grab old time player prefs long long temp = convert.toint64(playerprefs.getstring("sysstring")); //convert old time binary datatime variable datetime olddate = datetime.frombinary(temp); print("olddate: " + olddate); //use subtract method , store result timespan variable timespan difference = currentdate.subtract(olddate); print("difference: " + difference); } void onapplicationquit() { //sav

bash - is it possible to scan a file in reverse (bottom up) using ack? -

is possible scan file pattern in reverse (bottom up) using ack (the grep alternative)? right using: tac filename | grep -m1 blablabla but friend mentioned ack might able type of thing without use of tac. went through man file , not find mentioning capability (or maybe dumb , missed it). if not possible above, more efficient way of doing type of search? (find first match of pattern starting @ bottom of file) reading file in such reverse line-oriented fashion going inefficient, due how files stored on disk. file linear stream of bytes, accessible offset beginning file. line not distinct object; rather, it's abstraction defined conventional byte (or pair of bytes) know line ending. first line beginning of file first line ending, second line after first line ending second line ending, , on. in order access lines in reverse, still need scan entire file beginning find last line. the command line have can do. i'm not aware of option ack reverse line-iteration

Jtable not showing what is in the database (MySQL Query browser is used) in Java -

i working on getting data database , transfer jtable in java. problem is, data gathered not showing in jtable. tried debugging printing query in java, prints not show data in jtable. please me, in advance. tt_tt here ui code /* * programmer : inodeo, claire fatima r. * date developed : april 20, 2015 * company : * purpose : gather data database , display * jtable. desktop application requires java installed * in pc run. java installer visit www.oracle.com , download * latest version of java. * */ import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.mouseevent; import java.awt.event.mouselistener; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import javax.swing.*; @suppresswarnings("serial") public

VB.Net InputBox validation negative number -

i'm working on program user input number in inputbox. write codes validate input value numeric, couldn't came procedure validate negative number inputbox. dim userinput string = "" dim userinputasnumber integer dim sumoftotal integer 'to display inputbox userinput = (inputbox("enter positive number", "input needed")) 'to capture userinput not numeric value while (not isnumeric(userinput)) userinput = (inputbox("enter positive number", "input needed")) end while 'if userinput number, convert value numeric variable userinputasnumber = cint(userinput) if (userinputasnumber <= 0) userinput = (inputbox("enter positive number", "input needed")) else sumoftotal = cint(((userinputasnumber * (userinputasnumber + 1)) / 2)) 'calculation end i

date - Days are not added properly with momentJS in JavaScript -

i have code want next 15 days start date var fortnightstart = moment("15 04 2015", "dd mm yyyy"); (var = 1; <= 15; i++) { dates.push(fortnightstart.add(i, "days").format("d mmm")); } console.log(dates); this output ["16 apr", "18 apr", "21 apr", "25 apr", "30 apr", "6 may", "13 may", "21 may", "30 may", "9 jun", "20 jun", "2 jul", "15 jul", "29 jul", "13 aug"] i don't know why missing few days. on every iteration add i days initial date - keeps accumulating (+1, +2, +3 etc). need add not i 1 fortnightstart . var fortnightstart = moment("15 04 2015", "dd mm yyyy"); (var = 1; <= 15; i++) { // 1, not dates.push(fortnightstart.add(1, "days").format("d mmm")); } console.log(dates);

functional programming - How to access a value in type from a list -

this structure of project type a{ t1; t2; } , b = var of , c = b list type d = c list now have function d parameter. need assign t2 unique value every time call function. i guess can't assign value directly t2, instead need return new type new value of t2. think that's how functional language work my problem here don't know how access value using function i still learning syntax, if can give me example, great your question isn't clear @ all. if want a record can change 1 fields, can use keyword mutable . if have type = { t1 : int ; mutable t2 : int } , if x value of type a , can use syntax x.t2 <- 9 instance. if understand correctly, want be: type = { t1 : int ; mutable t2 : int } type b = var of type c = b list type d = c list let func d = list.iter (fun c -> list.iter (function (var a) -> a.t2 <- a.t2 + 1) c) d which can rewritten (by eta-conversions) let func = list.iter (list.iter (function (var a) -> a.t2 <-

Sort an oversized string array in java -

i trying sort oversized string array of emails. when don't fill oversized array beforehand, nullpointerexception. when fill array empty strings, code sorts list of emails alphabetically, puts sorted list of emails behind empty strings. how sort list of emails first lists emails alphabetically in array , lists empty strings? example: if entered example1@domain, example2@domain, star, , apple, following quote output. want of empty strings behind entered data, not before it. [, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , apple, example1@domain, example2@domain, star] code: string[] data = new string[array_size]; public static string[] addemail(string[] data, string email, int index) { int size = data.length; data[index] = email; int i,j; string temp; system.out.println(arrays.tostring(data)); (j = 1;

bash - Parameter as reference? -

i trying make function swap() this swap(){ #swap $1 , $2 here } what want swap array let have array[0]=12 array[1]=45 array[2]=99 swap $array[0] $array[1] so want swap array[0] becomes 45 , array[1] becomes 12 after swap function. thinking of doing swapping referencing $array[0] (such pointer in c) , $array[1] changed. found command eval , upvar seriously, don't understand thing. pretty new shell scripting , of documentation out there confused me lot. bash arrays little tricky. clearest thing can write function take three arguments, array name , 2 indices swap. requires treat array global variable; cannot pass entire array single object in bash . (this require bash 4 or later, introduced -g flag declare .) swap () { local name=$1 local a=$2 local b=$3 local aname=$name[$a] local bname=$name[$b] local tmp=${!aname} # e.g. tmp=${array[$a]} declare -g "${aname}=${!bname}" # e.g. array[$a]=${array[$b]} decla

Future-proofing a Scala/SBT project -

i trying use scala-graph , scala-swing in same program. can use latest graph-core library (1.9.2) alone latest version of scala (2.11.6). can use scala-swing, when that, sbt gives me scala 2.10.4 rather 2.11.6. when tried use both libraries, got errors -- either compilation or runtime errors, depending on how set build.sbt. tried using older version of graph-core (1.8.0), if understand library's release history [1] correctly, designed scala 2.10. doing works, although causes sbt use scala 2.10.4 instead of 2.11.6. i'm worried because seems fragile arrangement. will keep working? build.sbt file (below) not restrict scalaversion or scala-compiler version; says graph , swing libraries use. i'm afraid changes graph library, or swing library, or scala language itself, break code. [the rest of post describes os, installations, , code; might not need read it.] i using ubuntu 14.04. installed scala , sbt using apt-get. swing appears installed on machine. did not insta

(C++) using a vector as a wrapper in a stack -

edit: original question answered. relevant issue though, didn't feel deemed making new post. why unable use push() , pop() function calls of stack? here errors: hctree.cpp:65:16: error: no matching member function call 'push' encoding.push(0); ~~~~~~~~~^~~~ /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../include/c++/v1/stack:197:10: note: candidate function not viable: 'this' argument has type 'const stack<int, std::vector<int> >', method not marked const void push(value_type&& __v) {c.push_back(_vstd::move(__v));} ^ /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../include/c++/v1/stack:194:10: note: candidate function not viable: 'this' argument has type 'const stack<int, std::vector<int> >', method not marked const void push(const value_type& __v) {c.push_back(__v);} ^ hctree.cpp:67:16: error: n

regex - xsd validation failing for regular expression -

i using below simpletype allowing 5 type of words. working fine. problem is, failing, if appended 1 character upper case @ end of string. please me regarding this. <xsd:simpletype name="updatememberphysicalcardtypetype"> <xsd:annotation> <xsd:documentation> type physical data type </xsd:documentation> </xsd:annotation> <xsd:restriction base="xsd:string"> <xsd:pattern value="([permanent|temporary|not carded|retail card|virtual card])*"/> </xsd:restriction> </xsd:simpletype> success case: <typ:physicalcardtype>permanent</typ:physicalcardtype> -> working fine <typ:physicalcardtype>permanentqwer</typ:physicalcardtype> -> getting error. working fine. failure case: <typ:ph

c - Clamd INSTREAM checking -

i'm trying check file using clamd ninstream. struct clam_chunk { unsigned int fsize; char data[1024]; }; .............................................................................. st_data.fsize = __bswap_32(st_data.fsize); //big-endian format { ret = send(fd, "ninstream\n", 11, msg_nosignal); ret = send(fd, &st_data, sizeof(st_data), msg_nosignal); ret = send (fd,"",0,msg_nosignal); } while (ret < 0 && errno == eintr); i have response: "stream: ok", it's wrong, because data contains eicar-test-signature. ping recive pong, simple scan work too.

zend framework 1 Form - Note element lost its value if there is validation error -

i have note element in zend framework 1 form used registration. defined in format: $captcha_reload = new zend_form_element_note('captcha_reload', array('value'=>"<div id='captcha_reload_div'> <a href='javascript:return false;' id='change-image'>change text.</a></div>")); $this->addelement($captcha_reload); this element displays hyperlink , displays during registration page call. the problem during form submission. note element doesn't displays (ie missing hyperlink) if there form validation error. i have checked , tried code below: $this->setdefaults(array('captcha_reload'=>"<div id='captcha_reload_div'> <a href='javascript:return false;'

algorithm - More Stastistical Way to Average N Predictions -

i've run randomforestregressor (scikit ensemble) on n loops, each time changing random seed , therefore changing train test split. way i've n set of predictions (m predictions each loop). i've captured following data: r2_score train dataset on n loops (1 value per loop) r2_score test dataset on n loops (1 value per loop) currently, average out predictions which: r2_score_train > median(r2_score_train) && r2_score_test > median(r2_score_test) i want know better way make out final predictions, using r2_score both train , test dataset. 1 way thinking it, give more weight loop r2_score_train ~ r2_score_test (i.e. difference between them smallest) , lowering weights value high. i using python this. scikit-learn. wanted know if there inbuilt function or 3rd party library?

php - I need a regular express for notepad++ to remove new line and empty spaces -

Image
here sample text: a:7:{ i:0; i:9; } i want new lines , empty spaces removed this: a:7:{i:0;i:9;} so i'm using notepad++ editing , im wondering how above find , replace feature. press ctrl+h open replace window. in search mode select regular expression , check "matches newline" checkbox. in "find what" type - \s leave "replace with" field empty select "wrap around" checkbox , hit "replace all" edit: adding screenshot reference:

android - Returning svg image back to main activity -

i using svgs in android app. created gridview displaying svgs, don't know how return selected svg main activity make visible user. can help? what looking startactivityforresult() . read section named "starting activities , getting results" here: http://developer.android.com/reference/android/app/activity.html so main activity start "select svg" activity, , return result main activity.

javascript - dojo chart height and width issue -

this javascript code dojo chart,whenever creating chart in separate html page working fine, when merging same piece of code in project svg taking width:400px , height:300px ,but have given div width:200px , height:100px thing creating issue in project,i not been able change value, please me, in advance. "dojox/charting/plot2d/columns", "dojox/charting/chart", "dojox/charting/themes/miaminice", "dojox/charting/axis2d/default", "dojox/charting/plot2d/markers", var chart = new chart("chartnode"); chart.addplot("default", {type: columns, enablecache: true,gap:10}); chart.addseries("series a", [50, 20, 30, 40, 10]); chart.settheme(theme); chart.render(); this html code this looks when create chart node place not yet added/displayed in application. reason chart takes default size because can't compute (default size 400/300). solution make sure add chart node displ

javascript - Difference between .queue() and jquery.queue() -

might silly question, confused between .queue() used .dequeue() , $.queue() or jquery.queue() . are same, if why jquery provided them in 2 separate documentations? can, explain ussage differences along appropriate examples ? https://api.jquery.com/queue/ http://api.jquery.com/jquery.queue/ .queue() used method of jquery element. it has 1 parameter "queuename" $("div:first").queue("fx") whereas jquery.queue() standalone function accept dom element it's first parameter , second name of queue. jquery.queue($("div:first")[0], "fx" ); both works same, approach different.

c# - How to bind dropdownlist in partial view in mvc 4 using model? -

hi using partial view in index.cshtml page. , partial view contains 1 dropdownlist bind dynamically database. i don't want use viewbag or viewdata binding dropdownlist. in controller // get: reporting/home public actionresult index() { var view = view(); return view; } public actionresult _reportingmenu() { var dashboardlist = getalldashboards(); return view(dashboardlist); } public ienumerable<dashboarddefinition> getalldashboards() { return _reortdefinitionservice.getalldashboards(); } in index.cshtml @model ienumerable<portal.domain.reportingmodule.reportdefinition.dashboarddefinition> @{ viewbag.title = "reporting"; layout = "~/views/shared/_layout.cshtml"; } <h2>reporting view</h2> @html.actionlink("add new chart", "create", "chart", new { area = "reporting" }, null) @html.partial(&quo

c - How to program these structures? -

i have 3 objects, (at moment) representing structs: a dataset a datasetwindow a movingwindow and variable windowsize there may multiple dataset 's , each should have it's own datasetwindow . ok, fair enough, me sounds make datasetwindow struct , put member of dataset struct there 1 movingwindow , should know dataset 's. ok, far seems pretty simple. create struct movingwindow , has pointer dataset . (an array of datasets). so far, have this: typedef struct { int *buffer; int someothermember; } datasetwindow; typedef struct { int somemember; datasetwindow *window; //pointer datasetwindow obj. } dataset; typedef struct { int offset; int somemember; dataset *datasets; //array of dataset } movingwindow; the part having trouble this: movingwindow should know windowsize , should each datasetwindow . dataset should preferably not need know windowsize is. i don't know how arrange structu

xpages - Adding values to multi-value field and displaying them -

i have 3 multi-value fields , have inserted values in them. of fields text type, edible. i'm trying want add functionality in xpages, can add new values fields. here's got far: the code triggers on save button: var statuss = document1.getitemvalue("statuss"); var stat_vec:java.util.vector = document1.getitemvalue("statuss_update"); stat_vec.add(statuss); document1.replaceitemvalue("statuss_update", stat_vec); var vards = session.geteffectiveusername(); var vards_vec:java.util.vector = document1.getitemvalue("name_update"); vards_vec.add(vards); document1.replaceitemvalue("name_update", vards_vec); var laiks = session.createdatetime("today"); var laiks_vec:java.util.vector = document1.getitemvalue("time_update"); laiks_vec.add(laiks); document1.replaceitemvalue("time_update", laiks_vec); document1.save(); the code have atteched computedfield, values displayed 3 multi value fields + refr

ios8 - ios 8 interactive notifications not showing actions -

this code register interactive notifications ios8 : + (void)registerinteractivenotifications { uimutableusernotificationcategory *corideinvitecategory = [self corideinvitecategory]; uimutableusernotificationcategory *riderinvitecategory = [self riderinvitecategory]; nsset *categories = [nsset setwithobjects:corideinvitecategory, riderinvitecategory, nil]; uiusernotificationtype types = (uiusernotificationtypealert| uiusernotificationtypesound| uiusernotificationtypebadge); uiusernotificationsettings *settings; settings = [uiusernotificationsettings settingsfortypes:types categories:categories]; [[uiapplication sharedapplication] registerusernotificationsettings:settings]; } + (uimutableusernotificationcategory *)riderinvitecategory { uimutableusernotificationaction *accept; accept = [[uimutableusernotificationaction alloc

sql server - GUID PK + INT IDENTITY Clustered Index + Merge Replication + Foreign Keys -

i have database guid pks, , understand performance benefit adding int identity column (e.g. clusterid ) , creating clustered index on it. and joins there performance benefit using clusterid column foreign key. in parent/child situation child table have clustered index on parent clusterid . however in merge replication scenario that's not possible because clusterid column not unique. so i'm wondering how best gain performance benefits in situation. for example: tablea id guid (primary key) clusterid int identity (clustered index)` tableb id guid (primary key) tableaid guid (foreign key tablea) tableaclusterid int (clustered index)` i guess use trigger keep tableaclusterid up-to-date. then query such as select * tableb b b.tableaclusterid = @tableaclusterid would benefit increased performance. is how done? for heavy inserts guid perform better int identity because won't have contention on it. there technics fix it, still ca

php - How do I Paginate my CMS -

i've been following build cms in afternoon tutorial @ http://www.elated.com/articles/cms-in-an-afternoon-php-mysql/ . the cms works great thing it's lacking pagination. article archive displays list of of articles in database, want able separate these pages. i've attempted few times can never seem work. clicking on next page link brings me homepage. i apreciate help code: config.php <?php ini_set( "display_errors", true ); date_default_timezone_set("europe/lisbon" ); define( "db_dsn", "mysql:host=localhost;dbname=cms" ); define( "db_username", "username" ); define( "db_password", "password" ); define( "class_path", "classes" ); define( "template_path", "templates" ); define( "homepage_num_articles", 5 ); define( "admin_username", "admin" ); define( "admin_password", "mypass" );

Performance loss from extensive use of shared_ptr as if C++ being garbage-collected? -

i wondering performance issues of reference counted shared_ptr s, , wrote dumb program computes pow(2, n) in inefficient way millions of memory allocations , deallocations, in order test shared_ptr s while not making compiler optimize away, full optimization. compiled with, g++ t.cpp -std=c++11 -ot -dv_ -pedantic -ofast -s -fwhole-program where -dv_ means use std::vector container. ran as, valgrind ./t 10000 which means compute pow(2, 10000) shows me, total heap usage: 45,174,051 allocs, 45,174,051 frees, 783,160,061 bytes allocated and time ./t 10000 outputs real 0m1.698s user 0m1.693s sys 0m0.004s which surprisingly fast, considering amount of heap allocation done. system laptop i5 cpu , ubuntu linux os. the basic pattern used here defining container classes extending shared_ptr original class. #if defined(v_) #define c_ std::vector #elif defined(l_) #define c_ std::list #elif defined(d_) #define c_ std::deque #else #error

ios - Ignoring warning by #pragma -

how can disable xcode warning format string not string literal in code below? - (void)testremovingoldcode { nsmutabledictionary *oldrequestdict = [[[oldconfigmanager sharedmanager] feedurlforkey:kstatitemfixturedetailurlkey] mutablecopy]; nsstring *urlstring = [nsstring stringwithformat:oldrequestdict[kurlkey], //warning: "format string not string literal" @"param1", @"param2", @"param3"]; } i tired (without success): #pragma gcc diagnostic ignored "-wall" #pragma clang diagnostic ignored "-wall" -wall doesn't include warnings, includes specified set of warnings. might more successful -weverything , however, it's best find exact warning want block. in case -wformat-nonliteral .

c# - Azure application diagnostics log message size limit -

i using trace.error() log error messages azure table storage. observed messages not being logged since big in size. https://msdn.microsoft.com/en-us/library/azure/jj553018.aspx site mentions there maximum 64kb limit per column in azure table storage. see messages bigger around 40kb not being logged. i want know maximum message size limit can truncate error message limit , log successfully. from same link : string a utf-16-encoded value . string values can 64 kb in size. based on this, each character stored in 2 bytes. maximum amount of characters can store in table attribute 32k. on safe side, truncate messages don't exceed 32k limit.

How to refresh directory using java -

i have java code in call shell script extract zip files. after script run, want copy extracted folder other location, when list contents of folder zip file , not extracted one. java code follows: public class test { public static void main(string[] args) throws ioexception, interruptedexception { file file = new file("/home/a/"); file filenew = new file("/home/aaa/"); file filenew1 = new file("/home/aaa/script/"); file[] files = file.listfiles(new filenamefilter() { @override public boolean accept(file dir, string name) { if(dir.exists()){ return true; } else { return false; } } }); for(file file1:files){ system.out.println(file1.getname()); if(file1.getname().equals("app_dir")) { system.out.println("inside app

eclipse - JAVA BEGINNERS Create and roll Dice -

i want create dice rolling simulator. i've gotten far. public class rolldice { private static class rolldice extends jpanel { public void paintcomponent(graphics g) { super.paintcomponent(g); // custom draw code goes here } } public static void main(string[] args) { jlabel message = new jlabel ("\nroll die!\n", jlabel.center); message.setforeground(color.black); message.setbackground(color.white); message.setfont(new font("courier", font.plain, 25)); message.setopaque(true); jbutton roll = new jbutton("roll"); jpanel content = new jpanel(); content.setlayout(new borderlayout()); content.add(message, borderlayout.north); content.add(roll, borderlayout.south); jframe window = new jframe("roll dice"); window.setcontentpane(content); window.setsize(250,300); window.s