Posts

Showing posts from May, 2015

Android Prefererences -

i'm coming think problem preferences not being done correctly why cannot access tem. here preferences: <?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" > <preferencecategory android:title="@string/pref_user_profile" android:textsize="20px" android:layout="@layout/pref_layout"> <switchpreference android:title="@+string/pref_frequency" android:summary="@+string/pref_frequency_summary" android:key="frequency" android:defaultvalue="true" android:layout="@layout/pref_layout"/> <switchpreference android:title="@+string/pref_time" android:summary="@+string/pref_time_summary" android:key=&qu

python - Is there something like DatastoreOutputWriter? -

how write mapreduce results datastore? first thought "datastoreoutputwriter", apparently there no such thing. clarification: question not modifying/saving entities. instead, i'd process them, , store processed results (different kind of entities) in datastore. example: count number of users every , then, , save results new entity containing date , count. the purpose of inputreader split job tasks each entity. write handlers handle each task passed appropriate entity. you don't need datastoreoutputwriter since can write entity in task. mapreduce lib has tools make bit more efficient using async puts. they're recommended code doesn't use them still work. here's simple handler makes small modification , writes entity in mapper phase: def addnewattribute(entity, *args, **kwargs): try: if not entity.get("newattribute"): entity["newattribute"] = false yield op.db.put(entity) # save

ruby on rails 3 - twitter boostrap css displaying differently when pushed -

i trying css recognised '.jumbotron h1' or '.jumbatron .lead' <div class="jumbotron"> <h1>thousands of clinical guidelines!</h1><br> <p class="lead">guidelinesforme free, crowd-sourced database links online clinical treatment guidelines. has <%= guideline.all.count %> guidelines.</p> <%= link_to main_path, class: "btn btn-large btn-success" do%> see guidelines <% end %> </div> but it's inside div class 'jumbotron' <h1> being shown h1, , not 'jumbotron h1' - same problem <p> etc. something overriding i'm not sure how work out what... my_styles.css /* main marketing message , sign button */ .jumbotron { margin: 20px 0; text-align: center; } .jumbotron h1 { font-size: 100px; line-height: 1; } .jumbotron .lead { font-size: 24px

node.js - RESTful Web Service using Node js -

i new node js , trying publish restful web service it. found few tutorials online not explanatory or meant advanced users. i did check rectify framework. seems appropriate advanced node js users. you might benefit taking @ few of frameworks out there make sort of thing easier. take @ express.js or hapi.js , see how build routes, etc. how new restful services in general?

I am trying to populate checkbox true/false values in a windows form application from an xml document -

i may need steered in right direction, have scenario where, on main form have list of 15 different checkboxes. when check of these boxes, want able click 'save' button , have store bool value (1 true, 2 false) in corresponding xml file. my xml file structured follows: <?xml version="1.0" encoding="utf-8" ?> <tests> <engname></engname> <test name="navigatorlaunch" value="0"></test> <test name="navigator_links" value="0"></test> <test name="clr_activeeng" value="0"></test> <test name="open_activeeng" value="0"></test> <test name="clr_archiveeng" value="0"></test> <test name="open_archiveeng" value="0"></test> <test name="replicate_activeeng" value="0"></test> <test name="org" v

mysql - Use PHP to render multiple images to the browser -

the code below renders 1 images browser in conjunction database, want display of image of user, how should amend below code? $coverpic = ""; $sql = "select filename photos user='$u'"; $query = mysqli_query($db_conx, $sql); if(mysqli_num_rows($query) > 0){ $row = mysqli_fetch_row($query); $filename = $row[0]; $coverpic = '<img src="user/'.$u.'/'.$filename.'" alt="pic">'; } you use while loop in fetch results. $coverpic = ''; $sql = "select filename photos user='$u'"; $query = mysqli_query($db_conx, $sql); if(mysqli_num_rows($query) > 0){ while($row = mysqli_fetch_row($query)) { $filename = $row[0]; $coverpic .= '<img src="user/'.$u.'/'.$filename.'" alt="pic">'; //notice .= append string instead of overwrite } } but if want make code little shorter less checks: $coverpic = '

c# - Application cannot locate resource file in Visual Studio 2010 designer -

Image
i made custom user control contains picturebox , renders png image resource folder: private void picturebox1_paint(object sender, painteventargs e) { //overlay shape of image transparentimg = image.fromfile("..\\..\\resources\\reservoir_img.png"); e.graphics.drawimage(transparentimg, new point(0, 0)); } when build , run application user control paint method renders png fine (path must right), when preview form designer in visual studio 2010 doesn't render. shows exception: i can develop , test application, it's kind of annoying design forms when see exception texts. solution use resources.resx file: e.graphics.drawimage(windowsformsapplication1.properties.resources.reservoir_img, new point(0, 0));

What does the pipe character do in a Java method call? -

i've seen pipe character used in method calls in java programs. for example: public class testing1 { public int print(int i1, int i2){ return i1 + i2; } public static void main(string[] args){ testing1 t1 = new testing1(); int t3 = t1.print(4, 3 | 2); system.out.println(t3); } } when run this, 7 . can explain pipe in method call , how use properly? the pipe in 3 | 2 bitwise inclusive or operator, returns 3 in case ( 11 | 10 == 11 in binary).

c++ - setting a later value after constructing an object in object inheritance -

shape *shape[100]; square sqr; void inputdata() { int len,width; cout << "enter length"; cin >> len; cout << "enter width"; cin >> width; sqr = square(len,width,0); //---> have not compute area this, put 0 first shape[0] = &sqr; } void computearea() { int area; area = shape[0]->computearea(); //----> need set area here after getting } shape parent class , square sub-class after creating square objects , insert shape array. not reach setarea() method in square class set area. i have found 2 solution this, feel doesnt suit object inheritance polymorphism. one way implement setarea() in shape class(i have setarea() on square class already) , call setarea method through polymorphism , set square area attributes. another way create object method in shape class getsquare() can reach getarea() method through shape array is 2 method valid? or there better way doing it? class square: public shape{ private: int l

objective c - How can i parse very long JSon string in iOS without memory error? -

i new on ios,i have webservice , tring download 9000+ product info , have long json string,so got error message when products download, malloc: * mmap(size=1978368) failed (error code=12) error: can't allocate region * * set breakpoint in malloc_error_break debug i tried download below 1000 product info , working well. think, memory problem. this code part of project. -(void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname{ if (temp!=nil && ![temp isequal:@""]) { //basliklar arrayine ilgili tek haberin basligini aktariyoruz. //nslog(@"temp=%@",temp); nsdata *data = [nsjsonserialization jsonobjectwithdata:[temp datausingencoding:nsutf8stringencoding] options:0 error:nil]; urunadi=[data valueforkey:@"urunadi"]; urunno=[data valueforkey:@"urunno"]; koleksiyon=[data valueforkey:@"koleksiyon"]

android - How could i change CONTENT-TYPE of WebView#PostUrl()? -

in android webview. i'm trying use webview#posturl() postdata. couldn't find way of changing content-type of request. it's "application/x-www-form-urlencoded". how can change that? stringbuilder sb = new stringbuilder(); sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"); sb.append("<resource>\r\n"); sb.append("<element a=\"a\" b=\"b\"/>\r\n"); sb.append("</resource>"); string postdata = sb.tostring(); mwebview.posturl(url, postdata.getbytes()); thank you! from webview documentation, looks you're stuck default content-type . found this helpful parsing data in api endpoint since couldn't change content-type application/json or easier digest.

c++ - Traversing boost::variant types with Visitor that takes template -

i've got persistence class like: class writer: private boost::noncopyable { template<typename t> struct record { std::vector<t> _queued; // waiting persisted hsize_t _filerows; // on disk dataset _ds; ... }; template<typename t> void write(writer::record<t>& rcrd) { ... } ... that used persist types such as: struct { sockaddr_in udpaddr; ... } struct b { uint8_t id; ... } struct c { ... } ... i can't change apis above , want perform bulk operations on these heterogeneous types. i'm using boost::variant partial success, following their own tutorial : typedef boost::variant< record<a>, record<b>, record<c>, ...> _types; std::vector<_types> _records; struct closerecordvisitor : public boost::static_visitor<> { template <typename t> void operator()(t& operand) const { assert(operand._queued.empty());

osx - Where is PackageMaker? How can i make package installer? -

i'm making development tool needs git, heroku, python, ruby. so need package installer check , install git , heroku toolbelt, if not exist. in guess, can use package installer in xcode. but can not find package installer in /development/utility. recently, xcode development directory moved in xcode package, checked it, still cannot find package maker. 1) package maker? 2) can install heroku , git package maker? packagemaker have been deprecated years ago. as solution can try use downloading apple downloads , but recommend use command line utility: productbuild . or can use 3rd party application: packages

javascript - Get CSS styles of an element -

i have element has following styles: <div id="myelement" style="opacity: 0.9; cursor: auto; visibility: visible;"></div> i want make sure ( setinterval ?) has these styles, no more no less, no changes @ all. wonder if possible retrive styles of element (inline css or external) , compare compare them make sure there not changes? for single element not imagine performance difference between setting , checking first significant. might this: $(document).ready(function(){ var t = setinterval(function(){ $('#myelement').attr('style', 'opacity: 0.9; cursor: auto; visibility: visible;'); }, 1000); } i realise set styles using $('#myelement').css, want ensure no new styles added, setting style attribute should achieve want. unfortunately doesn't account changes stylesheet or style blocks elsewhere on page. have make style attribute bit more comprehensive , include "!important" a

iphone - problems with Apple BLTE-transfer sample app -

my installation of apple's btle-transfer app behaving flaky, on brand new ipads. have googled , not found solution. i installed ios app apple btle-transfer v1.0 unmodified, using xcode 4.6.2, onto four, brand-new ipad mini's gen4 purchased apple store week ago, @ same time: 2 black colored ones ios v6.1.2 , 2 silver colored ones v6.1.3 2 v6.1.2 work best, flaky. 1 of v6.1.3 ones performs btle-transfer app transfers , then. , 2nd v6.1.3 never performs btle-transfer app transfers. no other bluetooth devices running. but btle transfer fails. if 1 ipad peripheral , rest central, none or 1 or 2 others ever receive. ipad #4 never sends or receives. ipad #2 peripheral talks #1 central, , #3 central, never #4 central ipad #1 peri talks #2, never #4, never #3. the problem follows hardware, identical mini's therefore slight timing difference in hardware btle app fails adapt to. i've tried cycling power on ipads , starting app in various sequences. no bluetooth de

arrays - FIFO String Allocation in C# -

i having problem program i'm creating right now. looked answers, it's different want happen because given here strings. we asked create fifo allocation , here expected flow of program console application: enter no. of page frames: 2 enter no. of pages inserted: 4 page inserted: a inserted in frame 1. interrupt generated. page inserted: b inserted in frame 2. interrupt generated. page inserted: a insertion failed. resident page. page inserted: c inserted in frame 1. interrupt generated. according fifo allocation algorithm, remove earliest page inserted in frame if insert new different page. if page in frame page insertion rejected. i made 1 although i'm stuck in trying figure out how find earliest inserted element in array. i hope can me. spent lot of time don't know do. here's code.: class program { static void main(string[] args) { int f, p, interrupt; console.writeline("enter number of frames: ")

flex - Performance issues when creating custom components. Need TIPS -

i in process of converting excel desktop application flex. excel has far better grid functionality looks better trying recreate manually versus using spark advanceddatagrid/datagrid. creating ton of groups , representing each cell bordercontainer label embedded in it. looks great takes while draw drawing each component iterate through arraycollection. the code looks similar this for each(var factor:factor in this._model.assessment.factors) { //draw factor header var factorheaderbackground:bordercontainer = new bordercontainer(); factorheaderbackground.setstyle("backgroundcolor", "0x2d4a6c"); factorheaderbackground.width = 1370; factorheaderbackground.height = 30; var factornamelabel:label = new label(); factornamelabel.percentwidth = 100; factornamelabel.setstyle("verticalalign", "middle");

android - NotificationCompat Ticker Text Not Showing When Updating Notification -

Image
background this app writing familiarize myself of apis, serves no real purpose other demonstrate functionality in android. have service running in foreground ( startforeground ), , has ongoing notification when tapped returns application. service listens broadcasts , logs them db. start service, create notification i create notification using notificationcompat.builder in oncreate of service : @override public void oncreate() { super.oncreate(); log.v(tag, "oncreate"); // notification manager update notifications mnotificationmanager = (notificationmanager) getsystemservice(context.notification_service); intent openappintent = new intent(this, mainactivity.class); openappintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top); pendingintent selectnotifpendingintent = pendingintent.getactivity(this, 0, openappintent, 0); // build notification show mnotificationbuilder = new notificationcompat.b

Batch file fore creating base HTML files & folders -

i'm trying create batch file create basic files & folders website, e.g. css folder, image folder, javascript folder, style.css, index.html. have script setup follows md css md js md img echo ^<!doctype html^>^<html lang="en"^>^<head^>^<meta charset="utf-8"^>^<title^>^document^</title^>^</head^>^<body^>^</body^>^</html^> >> index.html echo >>style.css as can see, want input basic html starter text within html file, does, in straight line. while isn't end of world, nice if format text proper html indents , line breaks. one more thing, possible make batch file put css file in css folder? bit of n00b, gentle :0) thanks! update here code did upon reading response @endoro md css md js md img echo ^<!doctype html^> echo ^<html lang="en"^> echo ^<head^> echo ^ <meta charset="utf-8"^> echo ^<title^> echo ^</title^&

Java/Scala Strange behaviour of readline -

i got strange , urgent problem. hope can me. trying read result of command executing. code never reaches println-statement. "hanging up" program, if end of output reached. no failure , no exception. please me. fall despair. my project mix of scala , java. doesnt matter in language solution is. tried in both. encoding of project cp1252. here code var filescript = runtime.getruntime().exec(pathofscript) var isr:inputstreamreader = new inputstreamreader(filescript.getinputstream()) var in = new bufferedreader(isr) var line:string = "" try { while ({line = in.readline(); line!= null}) { println("line: "+line) } println("outside !!!"); in.close(); } that's strange... java version works fine: inputstreamreader isr = new inputstreamreader(new fileinputstream("c:\\anyfile")); bufferedreader in = new bufferedreader(isr); string line = ""; try { while ((li

javascript - take content from WordPress page and deliver it to HTML via ajax -

i have following problem: html blank page on server 1. wordpress site on server 2. what need call content www.wordpress.site/sample-page/ html page on server 1, not entire page, part can edit wp-admin; without header , footer. also, don't know if there other method, need done via javascript/jquery or ajax. i've used google, hard tutorial this, i've tried lot of tutorials, none need, , don't know javascript make work. so, can me please? big thanks! andrei l.e.: i've found working: http://jsfiddle.net/mdawaffe/hlwdh/ it working written, if try change domain mine, not work. script have implement on server content called (taken)? for more information, asked: i have html + css + js template use phonegap (if don't know it, try it, it's useful) create mobile app android, ios, , blackberry. now, have site: m.trafficvoice.ro (i hope can post links here). in 'live stream' page (it's called services.html), have html5 audio ta

math - What does the O(1) in "ln ln n / ln 2 + O(1)" mean? -

Image
i have difficulty understand o(1) notation in formula, stand constant? why people use big-o notation this? this formula comes paper "balanced allocations" azar et al. , , formulas used in abstract: here, term o(1) means "some term o(1)," meaning term n goes infinity bounded above constant. example, might 137, or sin n, or 1 / n 2 . value described therefore might ln ln n / ln 2 + 137, or ln ln n / ln 2 + sin n, etc. this use of big-o notation common in formal mathematics when discussing low order terms in formula contribute small amount overall total. authors have written entire expression o(ln ln n), less precise ln ln n / ln 2 + o(1) because obscures fact coefficient on ln ln n 1 / ln 2 , low-order growth term bounded above constant. explicitly writing out " + o(1)", authors able give better precision. hope helps!

ruby on rails - RailsTutorial Chap 6, Rake Aborted -

in railstutorial chap.6 when try migrate error: macbook-pro-de-stephane-cedroni:sample_app stephanecedroni$ bundle exec rake db:migrate == addindextousersemail: migrating =========================================== -- add_index(:users, :email, {:unique=>true}) -> 0.0020s == addindextousersemail: migrated (0.0022s) ================================== rake aborted! error has occurred, , later migrations canceled: sqlite3::busyexception: database locked: commit transaction/users/stephanecedroni/.rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.5/lib/sqlite3/database.rb:97:in `close' has had same error? i'm not experimented, need help! thanks i had same problem. i had open console window running "rails console --sandbox", prevented changes database. after closing window make migration. maybe you!

c# - How to refresh component on page after a change on the screen -

i have form contains tab control. 1 tab has 1 user control, has different user control. first tab has bunch of check boxes. based on selection of checkboxes, combobox on other tab populated different data. problem is, user controls both loaded when form loaded, data combo box set. want reload data in combobox when selection on other tab changes. i'm not sure how accomplish because can't directly call method in 1 user control other. coworker suggested event actions. or advice appreciated. you use enter event on tabs , put refresh code in there. solution not perfect because pages won't refresh until "enter" them through tabcontrol. another other option keep reference tabcontrol inside each page , upon data update, refresh pages listening data.

javascript - Show/start video in blogger on image click -

beingwithosho.blogspot.co.il/) blogger page. in every page there's video. before user sees video, i'd them see this image . when user clicks on image, video show/start. this code 1 of pages: <div dir="rtl" style="text-align: right;" trbidi="on"> <div dir="ltr" style="text-align: center;"> <br /><br /> <div dir="rtl"> <span style="color: #8e5353; font-size: x-large;"><b>-9- part</b></span> </div> <div dir="rtl"> <span style="color: #0000ee; font-size: x-large;"><b><u><a href="http://beingwithosho.blogspot.com/2013/05/9-part-broken-family.html">broken family. blessing in disguise</a></u></b></span> </div> <br /><br /><br /> <div> <div dir="rtl"> </div>

Class scope vs module scope attributes in Python -

i declare class computations using several hard-coded constants defined class attributes. of methods similar following: class iapws_1995: @staticmethod def dar_ddelta(delta, tau, delta, theta, psi): _dar_ddelta = \ sum(iapws_1995.n_0 * iapws_1995.d_0 * pow(delta, iapws_1995.d_0-1) * pow(tau, iapws_1995.t_0)) + \ sum(iapws_1995.n_1 * exp(-pow(delta, iapws_1995.c_1)) * (pow(delta, iapws_1995.d_1-1) * pow(tau, iapws_1995.t_1) * (iapws_1995.d_1 - iapws_1995.c_1*pow(delta, iapws_1995.c_1)))) + \ sum(iapws_1995.n_2 * pow(delta, iapws_1995.d_2)*pow(tau, iapws_1995.t_2) * exp(-iapws_1995.alpha_2*(delta-iapws_1995.epsilon_2)**2 - iapws_1995.beta_2*(tau-iapws_1995.gamma_2)**2) * (iapws_1995.d_2/delta - 2*iapws_1995.alpha_2*(delta-iapws_1995.epsilon_2))) + \ sum(iapws_1995.n_3 * (pow(delta, iapws_1995.b_3)*(psi + delta*iapws_1995.dpsi_ddelta(psi, delta)) + iapws_1995.ddeltab_ddelta(delta, delta, theta)*delta*psi)) retur

Deploy web site via Git -

i work on team of web developers. each have personal web site set in our home directories on development server. we want convert them git working repos can branch, rebase, , enjoy benefits of git goodness. in reading online, there's couple of options: 1) create bare repo syncs working repo in www/ via post-receive hook 2) push directly working repo problem option 1 doesn't handle branching well. when push branch other master, post-receive hook still syncs master our changes never appear on development site. problem option 2 git disallows pushing checked-out branch prevent detached head state. in reading around web, "best practice" solution option 2 goes this: 1) on client push dummy branch 2) on server merge dummy master... buzzzz wrong answer. assume end users don't have shell access server. so thought, "no problem, create post receive hook this": #!/bin/bash read oldsha newsha branch git merge $branch now here's weird p

javascript - How does the helper {{templatePath}} work? -

<template name="postitem"> <div class="post"> <div class="post-content"> <h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3> </div> <a href="{{postpagepath this}}" class="discuss btn">discuss</a> </div> </template> this returns absolute url. postpage template defined. automatically gets helper path? don't understand how {{templatepath}} returns. in handlebars.js define helpers in javascript in way: handlebars.registerhelper('helpername', function(argument) { // ... perform actions here return whatever; // return here }); you use helper in way: {{helpername something}} . something there argument or arguments want pass helper. arguments come context working in. 'context' referring json data pass handlebars fill template. your helper takes data , builds it. could,

matlab - Indexing over all values in nested struct -

i have nested struct contains values , defined as: mystruct.level1.a = 1; mystruct.level1.b = 2; mystruct.level2.a = 8; mystruct.level2.b = 9; i want perform operations on elements in level1 , level2. want access values in level1 , level2, put them in vector, without referencing nested field names. e.g. i'd like: level1_vector = [mystruct.level1] which output: level1_vector = [1 2] how can that? use combination of 2 functions below: cell2mat(struct2cell(mystruct.level1))

GNU parallel not working at all -

i have been trying use gnu parallel time, have never been able function @ all! for example, running (in non-empty directory!): ls | parallel echo # outputs single new line ls | parallel echo echo echo # outputs 3 new lines. ls | parallel echo {} # /bin/bash: {}: command not found ls | parallel echo '{}' # /bin/bash: {}: command not found ls | parallel 'echo {}' # outputs: {} ls | parallel -imm 'echo mm' # outputs: mm it seems executing each argument command, makes no sense. i have tried bash, zsh, tcsh, csh, , sh, no avail. as complete writing question, ran parallel --version report version, find: warning: using --tollef. if things acting weird use --gnu. it not clear me why flag set default. needless say, using --gnu worked! thought post save hours of frustration , confusion. edit: fix permanently (in ubuntu @ least), delete --tollef flag in /etc/parallel/config

python - twisted image transfer from client to server gives bad format error -

i trying send image file using tcp server client. tried opening file, reading , transporting using self.transport.write. on client side, when receive data, open file named image in append mode, , write it. client: class echoclient(protocol.protocol): def datareceived(self, data): print 'writing file' f = open('image.png','a') f.write(data) f.close() server (inherits protocol): //somewhere in code image = open(self.newdict[device_str] + attribute_str + '.png') data = image.read() image.close() self.comm_protocol.transport.write(data) opening file on client side gives bad format error. ideas doing wrong ? idea stream image string bad ? if so, there other way can transfer data client ? you have open file in binary mode, 'b' flag, open(..., 'wb' ). the reason file gets corrupted "text mode" 1 of 2 things: on unix, nothing. on windows, rep

javascript - Bootstrap: using typeahead with grid, is this a bug? -

Image
i using bootstrap grid form. form has in grid grid changes after selecting typeahead. bug? http://jsfiddle.net/wcqkp/ (must resize html section wide see grid) $(document).ready(function () { ... $('#inputemail').typeahead({ ... this happens because of this: .controls-row [class*="span"]+[class*="span"] { margin-left: 20px; } this property applied if element class containing word span preceded element containing same word , being inside object controls-row class. ( http://www.w3.org/tr/css21/selector.html#adjacent-selectors ) this works when load page: <div class="controls controls-row"> <input type="text" name="email" id="inputemail" placeholder="email" class="span3"> <input type="password" name="password" id="inputemail" placeholder="password" class="span2"> </div> but trigger typea

c# 4.0 - Conflicting overloaded methods with optional parameters -

i have 2 overloaded methods, 1 optional parameter. void foo(string a) { } void foo(string a, int b = 0) { } now call: foo("abc"); interestingly first overload called. why not second overload optional value set zero? to honest, have expect compiler bring error, @ least warning avoid unintentional execution of wrong method. what's reason behaviour? why did c# team define way? from msdn : if 2 candidates judged equally good, preference goes candidate not have optional parameters arguments omitted in call. consequence of general preference in overload resolution candidates have fewer parameters.

html - PHP NULL vs 'NULL' -

this question came me spending 2 hours of trial , error , finding bug is, , need clarify why working way. the code below prints out dropdown box default string being '--select status--' value of null. print("<label>overall status overwrite:</label> <select name='case_ov_status' class='case_ov_status'> <option selected='selected' value=null>--select status--</option>"); on submit, call function determine whether dropdown box @ default value, if not update sql database. however, i'm confused. if statement below still run despite submitting value of null. found out 2 hours later using if($case_ov_status != 'null') instead of if($case_ov_status != null) solved problem. if($case_ov_status != null){ //still ran despite != null. mysql_query("start transaction", $connection); $sql = "update cases set status=".$case_ov_status."

PHP Header location fails -

i have php file connects mysql database, finds path file , use header location point it. have issue though, instead of path puts /bin:/usr/bin. what cause this? this code: header("location: http://example.com/".$path.".mp3");

caching - How do I ensure consistency of aggregates with high availability? -

my team needs find solution following problem: our application allows users view total sales enterprise, totals product, totals region, totals region x product, totals regions x division, etc. idea. there many values need aggregated many of totals cannot computed on fly - have pre-aggregate them provide decent response times, process takes 5 minutes. the problem, thought common 1 can find no references to, how allow updates various sales without shutting off users. also, users cannot accept eventual consistency - if drill down on total of 12 better see numbers add 12. need consistency + availability. the best solution we've come far direct queries redundant database, "b" (optimized queries) while updates directed primary database, "a". when decide spend 5 minutes update aggregates, update database "c", yet redundant database "b". then, new user sessions directed "c", while existing user sessions continue use "b".

Backbone.js - Models not being passed into view for template use -

i new @ backbone.js(and js in general) , have been experimenting storing model data in .json file. keep getting error: uncaught typeerror: cannot call method 'tojson' of undefined caused by: var questionview = backbone.view.extend({ tagname:"div", classname:"question-container", initialize:function() { _.bindall(this, "render"); console.log(this.model); //logs undefined models being fetched successfully? console.log("questionview created"); this.render(); }, render: function() { var data = this.model.tojson(); //this line throwing error var source = $("#question-template").html(); var template = handlebars.compile(source); $(this.el).html(template(data)); return this; } }); i can see in console models there don't understand i'm doing wrong. in context: $(function() { //question model var question = backbone.model.extend({ initialize: function() { conso

character encoding - Chrome extension: Get charset of current page -

how can tell within background code charset current page defined. more specifically: i'm using context menu , want know whether selected text encoded in utf-8 or not. you can't without content scripts , can minimal permissions using activetab , chrome.tabs.executescript . this: manifest.json "permissions": [ "activetab","contextmenus" ], "background": { "scripts": ["background.js"] } background.js chrome.contextmenus.onclicked.addlistener(function(info, tab) { chrome.tabs.executescript(tab.id, {code:"function getcharset(){return document.charset;}getcharset();"}, function(results){ // results[0] contain charset page in question }); });

c# - Result of RSA encryption/decryption has 3 question marks -

i using rsa encrypt , decrypt small notepad file 1 or 2 words. after processing file result has 3 question marks on begging of result. for example, if encrypt , decrypt notepad file word "hello" in it, result "???hello". did 3 question marks come from? this code: public partial class form1 : form { private rsaparameters publickey; private rsaparameters privatekey; public string result; public form1() { initializecomponent(); var rsa = new rsacryptoserviceprovider(); this.publickey = rsa.exportparameters(false); this.privatekey = rsa.exportparameters(true); } private void button1_click(object sender, eventargs e) { openfiledialog1.showdialog(); } private void openfiledialog1_fileok(object sender, canceleventargs e) { textbox1.text = openfiledialog1.filename; } private void button2_click(object sender, eventargs e) { filestream filestream