Posts

Showing posts from April, 2014

jquery - Can't achive a part of json encoded data -

i have response: {"status":"succes","message":"some message!"} all data.status or data.message undefinied... success : function (data, status) { console.log(data); if(data.status=='error'){ console.log(data.message); //$('p.file_error').html(data.message); }else { console.log(data.message); } } my controller has this: $data['status']='error'; $data['message']='some message!'; echo json_encode($data); you should have this, think you're missing datatype value should type "json" works properly. $.ajax({ url : base_url() + '/controller/method', data : {param1: 'val1', "param2" : val2}, type: "post", datatype: "json", success: function(response) { console.log(respo

javascript - Change in child accordion indicator icon twitter bootstrap -

i have 2 level twitter bootstrap accordion drop down indicator icons. problem when close sub-group indicator changes in parent too. (sorry bad english) $('.accordion-body').on('show', function() { $(this).siblings('.accordion-heading').children('.ui-icon').removeclass('ui-icon-triangle-1-e').addclass('ui-icon-triangle-1-s'); }); $('.accordion-body').on('hide', function() { $(this).siblings('.accordion-heading').children('.ui-icon').removeclass('ui-icon-triangle-1-s').addclass('ui-icon-triangle-1-e'); }); jsfiddle uhm, pretty obscure, here's cause: "show" , "hide" events bubble default, hide/show event firing in sub-collapsible getting catched parent collapsibles. the solution tweak listeners way: $('.accordion-body').on('show', function(e) { e.stoppropagation(); … } here working version of fiddle: http://jsfiddle.n

wolfram mathematica - How to combine two lists to plot coordinate pairs? -

i have read x-data (from text files) list1, , y-data list2: list1 = { 0.0, 0.172, 0.266, ..} list2 = {-5.605, -5.970, -6.505, ..} how combine 2 lists in order plot points {0.0, -5.605}, {0.172, -5.970}, {0.266, -6.505},.... if don't pinguin dirk's suggestion try transpose[{list1,list2}]

mysql - Bulk INSERTs from multiple hosts preformace optimization -

i have 15 amazon aws ec2 t1.micro inctances simultaneusly populate amazon rds mysql d2.m2.xlarge database data using large inserts (40000 rows in query). the queries send continuously. table innodb, 2 int columns, there index both columns. cpu utilization of rds instance 30% during data receiving. when have 1 ec2 instance, speed in orders faster run 15 instances simultaneusly. , 15-instances group work slower , slower until speed becomes totally unsatisfactory. how can optimize performance of process? upd: show create table results following: create table `userdata` ( `uid` int(11) not null, `data` int(11) not null, primary key (`uid`,`data`), key `uid` (`uid`), key `data` (`data`) ) engine=innodb default charset=latin1 i need 2 indexes cause nessecary me fetch data uid , data value. i insert data insert userdata (uid, data) values (1,2),(1,3),(1,10),... 40000 (uid,data) pairs. 15 parallel instances insert ~121 000 000 rows in 2 hours, sure can more fast

sqlite3 - How to convert an existing sqllite database into a Rails one? -

i have sqlite3 database 3 tables has id column primary key, has no created_at or update_at columns. i want use in rails3 applications. how can convert 'rails database'? it sounds want single rails app access 2 different databases? need 2 things: you need have app connect 2 different databases. "real" database , sqlite3 db after can connect both dbs, may need setup models , override of default rails naming conventions. for first item, can follow this: connecting rails 3.1 multiple databases for second item, if tables don't follow railsy way of naming them, can create model looks this: # app/models/foo.rb class foo < activerecord::base establish_connection "your_sqlite_connection_name_#{rails.env}" self.table_name = "name_of_table_in_sqlite_db" end

php - MAX numeric value from mixed array -

i have array contains both strings , numeric values, while using code keep getting highest string value, how numeric max values array? $maxprice = max($textpieces); i have tried returns number of keys in array $maxprice = max(array_search($textpieces)); thanks help! have looked max function here not give information http://php.net/manual/en/function.max.php i have looked @ solution find highest max() of mixed array possible without building custom function? $maxprice = max(array_filter($textpieces, 'is_numeric')); it @ first filters entries contains digits (integers) , extracts max() it the following solution: $max = array_reduce($textpieces, function($max, $i) { if (is_numeric($i) && $i > $max) { return $i; } return $max; }); var_dump($max); could bit more performance (from both cpu , memory perspectives) more complicated well.

objective c - view controllers: presentation, dismissal -

Image
just purpose of learning particular aspects of xcode, creating simple app has 2 functional view controllers. each contains button can pressed switch other. not using segues. using pointers retrieved app delegate. visual illustration (click higher resolution): when app loads, root view controller presents view 1. when click "switch view 2," following code causes view 2 appear: - (ibaction)buttonpressed:(id)sender { appdelegate *appdelegate = (appdelegate*)[[uiapplication sharedapplication] delegate]; [self presentviewcontroller:appdelegate.view2 animated:yes completion:nil]; } so far, good. but when click "switch view 1" on second view, same code (replacing "view2" "view1") gives following error: application tried present modally active controller. so summarize (where --> = presents), have root --> view1 --> view2 -x-> view1 i don't care retaining history of presents whom. want buttons bring top (make vi

c# - linq sum how to display as currency -

i have following in razor view: <td>@payments.sum(p => p.amount)</td> i want display currency have '$' , 2 decimals on end. i think go {0:c}. i don't know how incorporate i've got sum not have overload format. do need css class? you this: <td>@string.format("{0:c}", payments.sum(p => p.amount))</td>

How to make javascript created image a link -

hey there not fluent javascript , jquery. want replace div image when clicked on 1 div , make image clickable i.e. want add link image. to using javascript function replacecontentincontainer(id,content) { var container = document.getelementbyid(id); container.innerhtml = content; } i calling javascript index.ctp file <div id="vedio-image"> </div> <div class="title"> <a href="javascript:replacecontentincontainer('vedio-image', '<img width=\'480px\' height=\'220px\' src=\'<?php echo $this->webroot.'img/'.$count['news']['videoimage']; ?> \'/ >')"> <?php echo $count['news']['title'];?> </a>

ms word - VBA script convert folder of .rtf files to .docx files - two minor problems -

i use vba script (see below) in word 2013 convert folder of .rtf files .docx files. works, has 2 minor problems. i have acknowledge each original file .rtf file. when word opens each .rtf file there's dialog requires me confirm each file .rtf file. when view converted .docx files in word there's "compatibility mode" header, suggests haven't converted. are there fixes these problems? first 1 kind of undermines whole point of scripting , i'm afraid second 1 cause unforeseen problems. sub convertrtftodocx() set oword = createobject("word.application") application.filedialog(msofiledialogfolderpicker) .title = "select folder..." .show myfolder = .selecteditems.item(1) end mywildcard = inputbox(prompt:="enter wild card...") mydocs = dir(myfolder & "\" & mywildcard) while mydocs <> "" debug.print mydocs set odoc = oword.do

jquery - FancyBox with Vimeo not working -

i have followed instructions here: fancybox 2.0.4 , vimeo try , videos open lightbox still can't fancy box work. ideas? page videos here: http://kodiakgroup.com/clients.php html: <div class="lightbox-client" style="margin-right: 20px;"> <a href="http://player.vimeo.com/video/65867546?title=0&amp;byline=0&amp;portrait=0" class="lightbox"><img src="/images/thumb-video-carlton.jpg" /><br /><br />carlton-bates</a> </div> <div class="lightbox-client"> <a href="http://player.vimeo.com/video/65867545?title=0&amp;byline=0&amp;portrait=0" class="lightbox"><img src="/images/thumb-video-arris.jpg" /><br /><br />arris</a> </div> javascript near bottom: <!--script

jquery - Unable to Load player when using JWplayer -

i'm using jwplayer 6 in django website. want display different videos on same page. due fact i'm iterating on objects, can't assign different class id's jwplayer tag. when load it, 1 video display while other pop out error: loading player i've been looking way fix yet no success! django template {% block content %} {% flip in flips %} <p> {{flip.title}} </p> <center> <div id="myelement">loading player...</div> <script type="text/javascript"> jwplayer("myelement").setup({ image: "{{media_url}}/{{flip.vid_image}}", source[ {file: "{{media_url}}/{{flip.vid_watch}}" }, {file: "{{media_url}}/{{flip.vid_mp}}" ], title:"{{flip.title}}", width:692, height:389 });

security - Does my web login system work? -

i'm building web login system website without ssl, here implement: have table in server has 2 fields, raw username , pass_hashed (hased sha1(password)). when ever user login system, do: generate key. password_hashed = sha1(key + sha1(password)) submit 3 value: username, key, password_hashed in server side: check if key stored in database, if yes, make login invalid else save key database. query user info base on username, , compare sha1(key + pass_hased) , password_hashed. my question method ok? if yes, can use key timestamp? although solution better nothing flawed. because @ point during user's registration process need send portion of information. if information captured on wire @ point login can repeated later. you need ssl.

sql - Creating a check constraint for multiple specific inputs -

i assumed fine execute sql ommand this installation' or 'software repair' this didn't work tried this didn't go great either, got missing expression data recovery this gave me cannot validate sys.ch_servicetype -check constraint violated does mean constraint in place? if not how can enforce check constraint table require specific values? thanks use in keyword. servicetype in ('training', 'data_recovery', 'consultation', 'software installation', 'software repair')

Set or update dictionary entries code pattern in Python -

given dict following format: dict_list = {key0: [list0,list1], key1: [list0,list1], ...} i updating dict_list in following manner: for key in list_of_possibly_new_keys: if key not in dict_list.keys(): dict_list[key] = [list0, list1] else: dict_list[key][0].extend(list0) dict_list[key][1].extend(list1) is there way make code shorter using native constructs (i.e. no additional methods)? increasingly encountering data "set or update" pattern in code, , wondering whether there more concise way this. update/clarification: sample actual contents of dict_list: dict_list = {'john solver': [['05/10/2013','05/14/2013','05/22/2013'],[20.33,40.12,10.13]]} where floats represent john solver's daily expenses in dollars. if possible, we'd keep using 2 long lists instead of many date-expense pairs, we'd conveniently perform sum of expenses operation using sum(dict_list['john solver'][1]).

javascript - In PHP and jQuery, make one drop-down depend on another drop-down list? -

this question has answer here: use jquery change second select list based on first select list option 6 answers how set values select box or drop down list box previous list box value set [duplicate] 2 answers i have 2 drop down lists 1 depended on other if 1 value selected other 1 load same values database. example if select 1 country other load same cities country. <select name="a" class="input_text" id="a"> <?php include 'config/config.php'; $sql="select * department order dept asc"; $result=mysql_query($sql);$options=""; while ($row=mysql_fetch_array($result)){ $did=$row["deptcode"]; $depts=$row["dept"]; $options.="<option value='$did'>".$depts;}?> <

php - What does this => Operator mean? -

this question has answer here: what “=>” mean in php? 6 answers i tried searching on google, can't seem find out operator mean in php? => any please? => separator associative arrays. in context of foreach loop, assigns key of array value. what "=>" mean in php?

c++ - Enable compiler optimisation only for individual functions/files -

i working on c++ code in visual studio 2012 environment. code base not huge (contained in around 10-12 source files). execution time of functions in project huge (say 10 sec in rel mode, 50 sec in debug mode) now while debugging, require @ functions executing towards end of application lifetime. there way disable compiler optimisation specific functions and/or files in project. enable me have optimised execution of computationally extensive functions note: had erroneously mentioned "debug symbols" instead of "compiler optimisation" previously. asking questions w.r.t. compiler optimisation because of can become difficult inspect variable values while debugging break points. you can turn optimization on or off specific files in properties->c/c++->optimization dialog. same dialog use whole project, per file settings override project settings. you can surround particular functions or areas of code #pragma optimize( "", off ) , #pragm

java - Double to Number -

how convert double number in java, in code below? public number parse(string text, parseposition status) { // find best number (defined 1 longest parse) int start = status.index; int furthest = start; double bestnumber = double.nan; double tempnumber = 0.0; (int = 0; < choiceformats.length; ++i) { string tempstring = choiceformats[i]; if (misc.regionmatches(start, tempstring, 0, tempstring.length(), text)) { status.index = start + tempstring.length(); tempnumber = choicelimits[i]; if (status.index > furthest) { furthest = status.index; bestnumber = tempnumber; if (furthest == text.length()) break; } } } status.index = furthest; if (status.index == start) { status.errorindex = furthest; } int c= 0; return new double(bestnumber); } but in eclipse shows type mismatch: cannot convert double number

asp.net - Gridview finding control in gridview -

how find control of gridview in user defined function ... throws dataset ds = objselectall.paging(pagesize, pagenumber, userid, roleid); if (session["username"].tostring() == "admin") { foreach (gridviewrow row in userrolegridview.rows) { imagebutton imgeditbtn = (imagebutton)row.findcontrol("editbutton"); imagebutton imgdelbtn = (imagebutton)row.findcontrol("deletebutton"); dataset dsusr = objselectall.userbasedpaging(pagesize, pagenumber, userid, roleid); userrolegridview.datasource = dsusr.tables[1]; userrolegridview.databind(); ... you need check current row data row or header row. for checking row type need write if(row.rowtype == datacontrolrowtype.datarow) { // ever want } now code like foreach(gridviewrow row in gridview1.rows) { if(row.rowtype == datacontrolrowtype.datarow) { // ever want } } i hope fix problem.

Add Search button in place of enter button Windows phone 8 -

i working on windows phone 8 app,want add button text search(in place of enter button) while click on search textbox jsut in store search shows white button in place of enter button on keyboard. to follow standards should set inputscope search. not "search" text, windows phone standard search keyboard. <textbox inputscope="search" />

html - Center a div both horizontal and vertical having a width in % -

i have login page , want center both horizontally , vertically. have written code it's not working. html: <div class='loginmaindiv'> <div class="logintable"> </div> </div> css: .loginmaindiv { height:550px; width:100%; text-align:center; } .logintable { display: block; margin-left: auto; margin-right: auto; } this example of can do: http://jsfiddle.net/jun83/ play around margin of .logintable until fits requirements. used css: .loginmaindiv { height: 550px; text-align:center; background: #ffdddd; /* clarity */ } .logintable { width: 75%; margin: 50% auto; background: #ddddff; /* clarity */ } both background: #... statements can deleted without consequences.

cakePHP, processing a huge table in a loop -

i have table (3,000,000 records) need process. i've created loop, using sql count result upper boundary. need iterate through each row, manipulate data , save db. manipulation , updates simple, ask is: how query every pass, next row table? i know can use resource , iterate it. using basic php it's possible use db cursor, how can using cakephp? anyone?

ruby - My Sinatra App displaying 'Internal Server Error' after deployed to Heroku -

my app working locally, after deploying heroku i'm getting 'internal server error' on page the error log follows. http://pastie.org/private/b5lgfmij1by3krieyp9sq i cannot see problem is thanks help! the problem related database (or lack of): 2013-05-13t06:58:57.488018+00:00 app[web.1]: pg::error - not connect server: connection refused did add 1 $ heroku addons:add heroku-postgresql:[dev|basic|crane|etc] -a app_name ? checkout dev center article info on setting rack based web apps (including sinatra) , setting database access: deploying rack-based apps

python - nested loop code not working please -

with open(sys.argv[2]) f: processlist = f.readlines() in range(0,1): process = processlist[a] print process b in range(0,3): process1 = process.split() print process1[b] sys.argy[2 ] files has 2 sentences sunday monday local owner public i trying read once sentence @ time , in each sentence trying access 1 word @ time.... able things need individually loop doesn’t not iterate... stops after first iteration.... with open(sys.argv[2]) f: line in f: #iterate on each line #print("-"*10) demo word in line.rstrip().split(): #remove \n split space print(word) over file produce ---------- sunday monday ---------- local owner public

algorithm - What's the difference between big O and big Omega? -

Image
big omega supposed opposite of big o, can have same value, because definition big o means: g(x) cg(x) bigger or equal f(x) and big omega means g(x) cg(x) smaller or equal f(x) the thing changes value of c, if value of c arbitrary value (a value choose meet inequality), big omega , big o same. what's point of two? purpose serve? big o bounded above (up constant factor) asymptotically while big omega bounded below (up constant factor) asymptotically. mathematically speaking, f(x) = o(g(x)) (big-oh) means growth rate of f(x) asymptotically less or equal to growth rate of g(x). f(x) = Ω(g(x)) (big-omega) means growth rate of f(x) asymptotically greater or equal growth rate of g(x) see wiki reference below: big o notation

code to destroy zend session gets executed although its not allowed by if else and switch case conditions -

$getid = $this->getrequest()->getparam('id'); // 1 coming url $id_from_cart = 1; if($getid != $id_from_cart) { echo "unset session"; zend_session::namespaceunset('cart'); } else { echo "dont unset"; } when use $getid = 1 static value, working fine if use $this->getrequest()->getparam('id') value 1 although goes in else condition in both cases unsets session (code written in if condition). how possible, code destroy session has been written in if condition. have tried many things couldn't reach anywhere. suggestion great help. have tried switch case, in_array , if else. try $getid = (int) $this->getrequest()->getparam('id');

javascript - PHP validate integer is not functioning -

i'm trying make error box pop when theres letters inside of textbox, not working , i'm not sure need do. here code section <tr> <td align="right">&nbsp;&nbsp;weight:</td> <td><input type="text" name="weight" value="<?php echo $weight?>" onblur="validateinteger(diamonds.weight,'weight')" <?php if($formmode==1) echo 'disabled';?> size="15" /></td> </tr> i'm new website i'm not sure how post codes here therefore uploaded pastebin. for complete code please click. http://pastebin.com/zfue6gwq thanks in advance suppose should modify validateinger function. first, take @ parseint specification. should remember return number if parameter not number. instance: parseint("12px") return 12 . because of that, should better test value isnan (which return true in case if value "12px"): f

Google Places API autocomplete specific city -

i have questions google places api android. this request being called: https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&key=api_key&components=country:hr&language=hr&input=lad the issue want addresses within specific city. possible? here quote google places api autocomplete suggests should work. blockquote (regions) type collection instructs place service return result matching following types: locality sublocality postal_code country administrative_area1 administrative_area2 blockquote (cities) type collection instructs place service return results match either locality or administrative_area3. so specify citry or postal code in order filter addreses city. --edit-- this approach doesn't work either. maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&key=api_key&types=geocode&location=45.811093,15.974121&radius=12000&components=country:hr&language=hr&

c++ - Best way to instantiate different object types according to value? -

i'll simplify problem of hundreds of classes count of 2 , try explain mean: class base { }; class a: public base { }; class b: public base{ }; static base* foo (int bar){ switch (bar) { case 0: return new a(); break; case 1: return new b(); break; default: return new base(); } } i want instantiate objects according value of bar. feel switch-case isn't best way in c++ way more inheritors of base . edit: going std::map approach came this: struct dictionary { typedef base* (dictionary::*functionpointer)(void); std::map <int, functionpointer> fmap; dictionary() { fmap.insert(std::make_pair(0, new a())); fmap.insert(std::make_pair(1, new b())); } base* call (const int i){ functionpointer fp = null; fp = fmap[i]; if (fp){ return (this->*fp)(); } else { return new

html5 - Animated Text with CSS -

i'm trying create animated text html5. here how goes. example have word telephone. each alphabet appear specific colour animation. after visiting tutorials cant seems find of them. found text-shadow, instance, http://www.w3.org/style/examples/007/text-shadow.en.html it nice if has tutorial on such animation. here example using css3 @keyframes .lettera{ animation:lettera 0.5s infinite; -webkit-animation:lettera 0.5s infinite; /* safari , chrome */ } @keyframes lettera{ {color:red;} {color:blue;} } @-webkit-keyframes lettera /* safari , chrome */{ {color:red;} {color:blue;} } working demo read on css animations more browser compatibility versions i still agree there may have been lack of research here, here links google out link 1 link 2 link 3

python - Accessing items in a list -

i collect hashtags coming twitter. reading documentation need entities https://dev.twitter.com/docs/platform-objects/tweets "entities": { "hashtags":[], "urls":[], "user_mentions":[] } i'm able access entities dict , hashtags list for line in iter(my_tweet_file) tweetionary = json.loads(line) print tweetionary["entities"] print tweetionary["entities"]["hashtags"] but i'm not able parse correctly items inside hashtags list, i'm interested in text values (lin , scot in following example) [{u'indices': [41, 45], u'text': u'lin'}, {u'indices': [55, 60], u'text': u'scot'}] i want populate dictionary of text extracted hashtags list. thanks, denny you can nicely using built-in counter() : from collections import counter extracted = [{u'indices': [41, 45], u'text': u'lin'}, {u

c# - What's the better way to write this linq query? -

sql : select node.categoryid, node.categoryname, node.description, node.lft, node.rgt, node.showonmenu, (count(parent.categoryname) - 1) level, (case when node.lft = node.rgt - 1 'true' else 'false' end) leaf article_category node, article_category parent node.lft between parent.lft , parent.rgt group node.categoryid,node.categoryname,node.description,node.lft,node.rgt,node.showonmenu order node.lft my linq expression : var list = (from node in dbcontext.categories parent in dbcontext.categories node.lft >= parent.lft && node.lft <= parent.rgt select new { node.categoryid, node.categoryname, node.description, node.lft, node.rgt, node.showonmenu, parentname = parent.cate

Display highchart tooltip using Jquery ui dialog -

i want display values of multiple text areas tooltip various points in highchart graph.on button click dialog box open containing text areas.on clicking ok button these inputs displayed tooltip of various points of highchart line graph..i able take input text areas when trying put them inside custom dialog box jquery ui custom dialog box not getting displayed along highcharts graph.. i have used code tooltip.. dialog box code.. $(document).ready(function () { $("#dialog").dialog({ autoopen: false, width: 350, height: 500, modal : true, resizable: false, show:"slow" }); $('#button').click(function() { $( "#dialog" ).dialog( "open" ); $("#mydialogtext").text("data"); }); }); here js fiddle.. http://jsfiddle.net/rbenu/13/ i have used input selector take values text area.do need add specific selectors custom dialog box or existin

Encryption algorithm of Android Device Admin API -

does know algorithm use when protecting encrypted storage? haven't found information having read documentation. i have done online research, , think found part of android documentation describes encryption implementation of os. the actual encryption used filesystem first release 128 aes cbc , essiv:sha256. master key encrypted 128 bit aes via calls openssl library. source: http://source.android.com/devices/tech/encryption/android_crypto_implementation.html

apache2 - Does an apache restart reliably clear pagespeed cache? -

i'm developing website that's getting frequent javascript updates , have started using mod_pagespeed in effort ensure customers have latest code. the docs tell me doing clear pagespeed cache , force clients new javascript/css: sudo touch /var/cache/pagespeed/cache.flush i did test changing javascript code, hitting refresh on browser verify still seeing old code (my cache expiration set 1 day), restarting apache, , can indeed see new changes. can trust restart sufficient, , cache.flush not needed, or need run flush command well? i'm reading restart of apache required clear memory cache, not how file cache and/or cache.flush fits in that. update: i pulled pagespeed code, , if i'm understanding correctly, cache.flush process updates timestamp. it looks that's happening in rewriteoptions::updatecacheinvalidationtimestampms here: http://modpagespeed.googlecode.com/svn/trunk/src/net/instaweb/rewriter/rewrite_options.cc if figure out timestamp upda

Taking screenshots on Firefox and Safari (using their APIs or Canvas code) -

i've been dealing taking screenshots firefox , safari browsers can't figure out how it! google chrome api can way (it's pretty simple): chrome.tabs.capturevisibletab(null, null, function (image)).....etc but can't find simple way on firefox , safari!! answer got here using 'html2canvas' ( http://html2canvas.hertzen.com/examples.html ) not 100% solution in order take exact screenshots of specific webpage!! doesn't work me in case!!! can me issue in order find simple solution firefox , safari? i have used html2canvas , found quite efficient taking partial or full page screenshots. require knowledge of javascript , client side scripting. if looking more easier approach , there numerous extensions on google chrome webstore. popular 1 awesome screenshot allows take screenshot of entire webpage (till scroll bar ends).

ember.js - Ember, show spinner after changing route -

i show spinner (loading, please wait..) when user has wait data loaded. let's assume loading data takes considerable time (1+ seconds). want show visual feedback happening, instance when user navigates pressing "next item" from http://localhost:9000/#/somedata/1 to http://localhost:9000/#/somedata/2 i found few articles problem, however, none of them seem work. article here describes displaying spinner instance https://gist.github.com/tomdale/3981133 . however, article outdated. able access isloaded state of array changing {{#if isloaded}} {{#if content.isloaded}}. however, content.isloaded 'true' while new data fetched using ember-data. another promissing article found template loading delay ember.js . however, here while transitioning url, layout displayed, once data loaded. i using ember-data revision: 12 , ember 1.0.0-rc.3. i implemented solution using combination of jquery's ajaxstart , ajaxstop functions , spin.js . i run i

Opening file php -

supposing have file called "utils.php" open file writing or reading: $myfile="myfile.txt"; $fileout=fopen($myfile,'w') or die("not opened"); now if have script under directory , "mydir/myscript.php" , include "utils.php" in "myscript.php", where file (try to) opened from ? path of "utils.php" or path of "myscript.php". , if "myscript.php"'s directory, means each script includes "utils.php" search file called "myfile.txt" in directory, doesn't it? paths assumed relative directory of script running command, unless absolute path specified (by prefixing path '/'), if script being called somewhere else. if specified include in say, "/var/www/localhost/htdocs/foo.php", include statement in same folder, within included file fopen statements within whichever folder php file in (unless otherwise specified).

Access 2010: Can't access query after splitting DB -

i split db , when try change information on few queries, can't access them. have front end , end , understand should make changes queries/forms via front end, grayed out , inaccessible. at point, tried unsplitting db (which believe did), still can't edit queries or forms. i can click on query/form , see result of it, can't design view edit it. i'm taking shot in dark , saying in process of splitting database, either created front-end in accdr or accde format (a runtime application). purpose of shouldn't able open queries or forms or tables in design view on front end. can open database , save again accdb file , continue normal. if you're having other problems linked tables, suggest open linked table manager , refresh links (if moved backend file, necessary). i recommend trying proceed normal using shift bypass sure. ( hold shift key when start database. attempt modify in design view). if these fail, attempt copy queries , /or forms if

cuda - nvcc fatal: A single input file is required for a non-link phase when an outputfile is specified -

i'm getting problem nsight eclipse. installed cuda toolkit 5.0 have project uses several c files , 1 cuda file. i read problem arises when use c files along cuda files in nsight changed files .cu , .cuh extensions in project. likewise said problem comes having path files black spaces made sure it's not case. the error arises when tries compiling first file calcular.cu this compilation output make building file: ../calcular.cu invoking: nvcc compiler nvcc -i/usr/include/imagemagick -g -g -o0 -gencode arch=compute_11,code=sm_11 -gencode arch=compute_12,code=sm_12 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_20,code=sm_21 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -odir "" -m -o "calcular.d" "../calcular.cu" nvcc –xcompiler –fopenmp --compile -g -i/usr/include/imagemagick -o0 -g -gencode arch=compute_11,code=compute_11 -gencode arch=compute_11,code=sm_11 -gencod

Flatten nodes that have repeated child node using XSLT -

i have document of following structure (this example me verbalize problem), i'm trying flatten. flattening mean copying <report_entry> nodes several <event> s each <report_entry> node contained single <event> what have: <?xml version="1.0"?> <report_data> <report_entry> <id>1</id> <event> <start_date>2011-09-06</start_date> <end_date>2011-09-10</end_date> </event> <event> <start_date>2011-09-10</start_date> <end_date>2011-09-15</end_date> </event> <event> <start_date>2011-09-15</start_date> <end_date>2011-09-20</end_date> </event> </report_entry> <report_entry> <id>2</id> <event> <start_date>2011-09-20</start_date> <end_date>2011-09-25</end_date> </event&

dependencies - prolog predicate dependency tree -

let's have scenario: ascendent(x,y) :- parent(x,y). ascendent(x,y) :- parent(x,z), ascendent(z,y). brother(x,y):-parent(z,x),parent(z,y), x \= y . uncle(x,y):-brother(x,z),parent(z,y),x \= y. how can know predicates used ascendent , predicates uses ascendent? there built-in function or meta-predicate useful task?

r - Why are = and <- not equivalent in within()? -

> within( list(a="a",b="b"), c="c" ) error in eval(expr, envir, enclos) : argument missing, no default > within( list(a="a",b="b"), c<-"c" ) $a [1] "a" $b [1] "b" $c [1] "c" i'm not sure why these 2 shouldn't equivalent. seems the = version getting interpreted argument named c within because of ... . there way disable behavior? tried, within( list(a="a",b="b"), `c`="c" ) but fails too. you correct c="c" (or clause of form) getting interpreted supplied argument. , no, there's no way disable -- it's presumably handled down @ level of r parser. this difference between = , <- documented ?"<-" the operators ‘<-’ , ‘=’ assign environment in evaluated. operator ‘<-’ can used anywhere, whereas operator ‘=’ allowed @ top level (e.g., in complete expression typed @

canvas - Android drawing a path ON TOP of another path -

Image
so facing weird problem in drawing app. i drew these lines 1 8 top bottom , left right. while i'm drawing line, shows it's drawing behind other lines. whenever let go off screen, sometimes pops front, seems random. what overlooking draw on top of else @ times? my drawview.java: public class drawview extends view implements ontouchlistener { private path path = new path(); private paint paint = new paint(); private map<path, paint> pathmap = new hashmap<path, paint>(); private boolean isscreencleared = false; public drawview(context context) { super(context); this.setontouchlistener(this); paint.setcolor(color.black); paint.setantialias(true); paint.setstrokewidth(5); paint.setstyle(paint.style.stroke); paint.setstrokejoin(paint.join.round); paint.setstrokecap(paint.cap.round); } @override public void ondraw(canvas canvas) { if (isscreenclea

javascript - Cannot see controls on a MediaElement Player in Flexbox Modal in Android 4.0.4 -

i have problem mediaelement player created within fancybox modal. specific android device running 4.0.4. on ios devices, new android os, chrome, firefox, , ie down 7, when create new mediaelement player within flexbox modal, able view , interact controls. but when create on 4.0.4, controls hidden, though can tap on them if correctly guess are. cannot click on video itself, makes playing difficult. , hidden controls problem. mediaelementjs_settings = { loop : mej_loop, pluginpath : options.plugin_path, ipadusenativecontrols: options.mobile_native_controls, iphoneusenativecontrols: options.mobile_native_controls, androidusenativecontrols: false, alwaysshowcontrols: false, error : function (mediaelement, domobject) { $('<p class="' + options.component_type + '_error_message">

inheritance - Making variable volatile in subclass, in Java -

i've come across following situation: public class foo { private boolean valid; ... } public class concurrentfoo extends foo { ... } since concurrentfoo subclass used in multithreaded environment, opposed foo, not thread-safe , i'd boolean valid be, instead, volatile boolean valid , only in subclass . the goal using volatile avoid locks , synchronization, since seem unnecessary. there ever 2 updates variable in lifetime of object, , lots of (concurrent) reads. of course, use synchronization solve problem in subclass, or implement other way, such there clearer distinction when using foo , concurrentfoo . instance: public class concurrentfoo extends foo { // considered shadowing, when adding volatile? private volatile boolean valid; // or fresh name. private volatile boolean concurrentvalid; } anyway, i curious know if possible modify non-access modifiers , such volatile (well, except final ), in subclass . if isn't

python - remove arguments passed to chrome by selenium / chromedriver -

i'm using selenium python , chromium / chromedriver. want remove switches passed chrome (e.g. --full-memory-crash-report), far find out how add further switches. my current setup: from selenium import webdriver driver = webdriver.chrome(executable_path="/path/to/chromedriver") driver.get(someurl) as far understand can used add arguments: from selenium.webdriver.chrome.options import options chrome_options = options() chrome_options.add_argument("--some-switch") driver = webdriver.chrome(chrome_options=chrome_options) so, how rid of default arguments or wipe default arguments clean , pass custom list? use excludeswitches chrome option. see: https://sites.google.com/a/chromium.org/chromedriver/capabilities

android - how to set value to rating bar with string -

i number database string. want set number (for example 3 or 4) rating bar. says rating bar accepts float variables. what should do? you need parse string float.you can this-> float rating = float.parsefloat(string); ratingbar.setrating(rating);

java - Google Map variable is null -

i'm trying , set googlemap variable using the following code: private googlemap mmap; mmap = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.mymapview)).getmap(); //mapfragment fm = (mapfragment) getfragmentmanager().findfragmentbyid(r.id.mymapview); //mmap = fm.getmap(); log.e("ridetracking", "google map value:"+mmap); if (mmap != null) { proxy.setprojection(mmap.getprojection()); } here xml part of app: <fragment android:id="@+id/mymapview" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.mapfragment"/> for reason value of mmap null , i'm not sure why returning null since have line of code: mmap = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.mymapview)).getmap(); here logcat output: 05-13 14:09:08.553: e/ridetracking(6415): google map value:n

sql - How to calculate the individual sums of multiple columns in a single query -

using oracle 11gr2 on windows 7 client. have following sample table: yr mnth region city handled_package expected_missing_package actual_missing_package 2012 november western san fransisco 200 10 5 2012 november western los angeles 400 20 15 2012 november eastern new york 300 15 20 2012 november western seattle 100 5 7 2012 november eastern philadelphia 200 10 12 2012 november midwest chicago 300 15 15 2012 december midwest detroit 50 3 2 2012 december western los angeles 300 15 19 2012 december eastern new y

java - Spring MVC - Eclipse Warning - Validation Message -

i tried looking answer, kept getting false positives since it's "validation message" warning. have jsp line <a href="login">member home</a> which maps @requestmapping(value = "/login", method = requestmethod.get) public string login(modelmap model){ return "home"; } this setup works intended spring security intercepting request, warning eclipse webcontent/login not found. the warning makes sense, since don't have file called login, missing step prevents warning. i realize it's warning, , can suck up, avoid that, if leads bigger problems later. using: spring 3.1.0 , spring security 3.1.2 on jboss 7.1 edit: more complete warning: description resource path location type webcontent/login not found. index.jsp /rms/webcontent line 11 validation message line 11 being html link code posted above. by type "validation message" eclipse tells warni

JavaScript deadlock -

here saw javascript deadlocks , code: var loop = true, block = settimeout(function(){loop = false}, 1); while(loop); it's infinite loop , causes browser freezing. it's said deadlock created when 1 operation wait 1 executed , vice-versa . question is, except that, kind of situations deadlock occurs , ways avoid them? that's not deadlock, infinite loop, can't have deadlock in javascript can't have more 1 thread accessing data. what happens here loop never ends , js engine being mono-thread (regarding script), scheduler never calls callback give settimeout . in fact have had same behavior without second line.

python - Sphinx: Linking a Lexer with a style sheet using pygments -

good evening, lets using built java lexer in pygments highlight syntax of code block in sphinx document. how change style sheet java lexer associated with. (i.e. want change color of words being highlighted). thanks in advance! just point pygments_style setting custom pygments style class. see how to write custom pygments style class. should work in theory - haven't tried myself though. hope helps.