Posts

Showing posts from March, 2015

angularjs - GET request throws error after app implemented SSL: Mixed Content: This request has been blocked; the content must be served over HTTPS" -

mixed content: page @ ' https://www.example.com/dashboard ' loaded on https, requested insecure xmlhttprequest endpoint ' http://api.example.com/inventory/10/ '. request has been blocked; content must served on https. we have angular web app runs flask on back-end. working fine until implemented ssl. afterwards, keep getting strange error everywhere. now, $http.get request in dashboard.js calling " https://api.example.com/inventory/10 " in code below , yet error claiming trying request "http" instead. $http.get($rootscope.baseurl+'/inventory/' + item.id) where rootscope.baseurl " https://api.example.com ". it's weird because requests going through our web application our back-end, requests throwing weird error. here's header gets error in our network tab of console in chrome. request url: https://api.example.com/inventory/10 request headers provisional headers shown accept:application/json, ...

Android API below 21 material theme action bar - activity can`t extend ActionBarActivity -

what understood android api guide backward comparability, if 1 need action bar material theme (means primary color , primary dark "upper strip" etc.) need add library appcompatv7 , extend actionbaractivity , manipulate in way style files. https://developer.android.com/training/material/theme.html my activity extends other class (it`s java etc...). can do? consider above - can give complete example of need put in each style file in order support , feel of material theme action bar in app min api 16? because standart example extend actionbaractivity , copy paste regular code android api guide link

c++ - Is there a type trait to count the total number of constructors? -

is possible deduce number of constructors type has during compile time? #include <iostream> #include <type_traits> struct a{ int m_i; float m_f //constructor 1 a(int i): m_i(i) {} //constructor 2 a(float f): m_f(f) {} }; int main() { //prints 2 std::cout << number_of_constructors<a>::value << '\n'; } i hoping avoid macro involvement constructors, perhaps way. is possible deduce number of constructors type has during compile time? in c++11/14? no , far can tell. why? because c++ don't have support reflections , there study group sg7: reflection work on proposal add reflection c++.

excel - Count lines of text in a cell -

Image
i have excel spreadsheet of data work need split in vba. couple of columns have multiple lines of text , others not. i've figured out how split multiple lines of text, problem taking column single line of text , copying down. example: company_name drug_1 phase_2 usa drug_2 discontinued drug_3 phase_1 europe drug_4 discontinued below code using split columns b & c , can handle d manually, need column copy down rows 2-4. there's on 600 rows otherwise manually. (note: i'm putting column b below, , column c c) sub splitter() dim iptr1 integer dim iptr2 integer dim ibreak integer dim myvar integer dim strtemp string dim irow integer 'column loop irow = 0 iptr1 = 1 cells(rows.count, 1).end(xlup).row strtemp = cells(iptr1, 1) ibreak = instr(strtemp, vblf) range("c1").value = ibreak until ib...

How to hash a row in Python? -

i trying implement following algorithm in python [1] : the problem : (row compression) let a n x m array of bounded degree d (i.e., each element of a integer, a , such 0<a<d .), , let k number of distinct rows of a . find k x m array, a' , such each row of a appears in a' . the method : (hashing) hash rows of a table, skipping duplicates , adding rest a' . i not understand how hash row in python? well, understand mean "hash rows of table". understand following. suppose have matrix this: a = [[1, 2, 3, 4], [1, 2, 3, 4], [6, 7, 5, 4]] so, hash rows (somehow) , get: b = [x1, x2, x3] where xi hash of row i . here have x1=x2 since row 1 , row 2 equal. since x1=x2 , keep 1 , have: a' = [[1, 2, 3, 4], [6, 7, 5, 4]] am right? if so, how can implement such algorithm in python? thanks. [1] d. comer, "removing duplicate rows of bounded degree array using tries", purdue university, 1977...

c# - asp.net generic handler calling another handler -

is possible call handler within handler? have custom handler fires off whenever file type requested , im going through authentication process , need call handler. my problem have no idea how go calling other handler within handler. many thanks an http handler class. can instantiate other class , calls processrequest method. a better design, though, avoid handler-to-handler call, , instead move common code utility class , call both handlers. i'm assuming here want handler calls share httpcontext , request/response streams. if want first handler call second handler, read response,and return response of own, you're going want use glenn's answer instead.

regex - tokenizing with regular expression python -

i have following code want tokenize text located in directory regular expression def tokenize(): infile = codecs.open('test_test.txt', 'r', encoding='utf-8') text = infile.read() infile.close() words = [] io.open('test_test.txt', 'r', encoding='utf-8') csvfile: text = unicode_csv_reader(csvfile, delimiter=',', quotechar='"') item in text: word in item: words.append(word) tregex = re.compile(ur'[?&/\'\r\n]', re.ignorecase) newtext1 = tregex.sub(' ', text) newtext = re.sub(' +', ' ', newtext1) words = re.split(r' ', newtext) print words but error traceback (most recent call last): file "d:\kksc\kksc.py", line 150, in oncheckspell tokenize() file "d:\kksc\kksc.py", line 32, in tokenize newtext1 = t...

node.js - Best practice to store a operation hours in mongo -

Image
i need design schema in mongoose store operation hour shop, ui in admincp this: as can see first column working day, owner of shop can turn on/off if want. second opening hour , last 1 closing hour. the schema need have default value "off" or "false" sat , sun every shops close on these days. i not sure how design schema in mongoose. this come up: working: { mon: { enable: { type: boolean, default: true }, start: { type: number }, end: { type: number } }, tue: /* , on */ } it looks bad, there must better way it.

html - HTMLEditFormat and take care of line breaks -

i have text database , want insert html page. i'm using htmleditformat take care of special characters '<' etc... problem: when displayed in browser line breaks gone. there special formatting function in cf automatically replace line breaks correct html tag? htmleditformat() escape html markup, line breaks separate issue. definition, line breaks in html don't affect rendering. same multiple spaces , tabs. if text in question collected in textarea, 1 option output in disabled textarea, render line breaks , spaces typed. my usual approach to replace new lines tag , tabs 5  's. paragraphformat() function handle new lines. http://help.adobe.com/en_us/coldfusion/9.0/cfmlref/wsc3ff6d0ea77859461172e0811cbec22c24-6e24.html or function cflib handle tabs you: http://www.cflib.org/udf/paragraphformat2

document.write - Javascript using document write -

so i'm trying print text, , defined variables using document.write function in notepad++ , javascript. can't show in web browser when open .html file. i'm new javascript. here's code. <html> <body> <script> var x == 23 ; var y == 55 ; var z == var x + var y ;</script> <script> document.write("the sum of x + y" + z +<br>);</script> <script> document.write("the sum of x + y = " + z + <br>);</script> <script> document.write("the sum of x + y = " + ( x + y) + <br>);</script> <script> var x = "bob dylan" , var y = "is enrolled in cop 2500" , var z = "with professor whiting, best!"</script> <script> document.write( x + y + z);</script> </body> </html> <html> <body> <script> var x = 23 ; var y = 55 ; var z = x + y ; document.write("...

php - make one array the key and another array the value -

this question has answer here: how combine 2 arrays together? 3 answers say have 2 arrays, first array is: array ( [3] => 1 [4] => 2 ) the seccond array: array ( [0] => first [1] => second ) i looking way grab values each array, , make array so: array ( [one] => first [two] => second ) so value first array becomes key , value second array value in new array. if makes sense @ all. you need array_combine function of php array_combine($array1,$array2); here $array1 keys , $array2 values

asp.net - Required Field validator in edit item template is not working -

this code.i using gridview in asp.net.i trying add requiredfieldvalidator textbox_id in gridview edit mode nothing happens if dont put in textbox , click update. <columns> <asp:boundfield datafield="studentid" headertext="student_id" /> <asp:templatefield headertext="id"> <edititemtemplate> <asp:textbox id="textbox_id" runat="server" wrap="false" causesvalidation="true" validationgroup="a"></asp:textbox> <asp:requiredfieldvalidator id="requiredfieldvalidator1" validationgroup="a" runat="server" controltovalidate="textbox_id" errormessage="requiredfield" forecolor="red"></asp:requiredfieldvalidator> </edititemtemplate> <%--<itemtemplate> ...

java - Finding the highest value of a varying number -

how find value of 'high score' of brackets? private static boolean basicsweep(string input) { int noofclosingparentheses = 0; int noofopeningparentheses = 0; int highscore = 0; (int = 0; < input.length(); i++) { character currentcharacter = input.charat(i); if (currentcharacter == '(') { noofopeningparentheses++; highscore++; } else if (currentcharacter == ')') { noofclosingparentheses++; } } return false; } let's have string "((p)) & (q v (r & s))". 'high score', or maximum in case 2, tied between ((p)) , (...(r&s)). how go doing this? suspect store value in placeholder variable, i'm not sure variable go. current 'highscore' variable equal total number of opening parentheses, that's no good. any appreciated. apologies vagueness - quite difficult explain! note: method work in progress - no need comme...

browser - Modifying the User Agent String in Chromium source code -

where in chromium source code can modify browser's user agent string? i working mac os. also, not want append user agent. essentially, want change ua enough website still thinks chrome (as standard chromium ua), while not chrome. i have had issues appending unique identifier in causes many websites block access.

git - libgit2sharp unable to do a repository push - Unable to evaluate expression because the code is optimized -

when debugging using repository network object quick watch of instance tells me threads need running, causes message in title. not sure why case when doing push message. this real issue here why push below not work versus removing , re-adding remote. code below - parameter values valid. commits local repo working. signature works using remote after removal , re-add of remote. branch correct in case below.: private repository getgitrepo() { string path = settings.getsetting(constants.gitrepositorypath); repository repo = new repository(path); return repo; } using (var repo = getgitrepo()) { if(commit != null) { var options = new pushoptions(); options.credentialsprovider = new credentialshandler( (_url, _user, _cred) => new usernamepasswordcredentials() { username = settings.getsetting(constants.gitusername), password = settings.getsetting(constant...

Algorithm to find a group seating arrangement for an open book test -

you planning group seating arrangement open book test given list of students, v different schools participate. assuming fact students known each other directly or indirectly cheat more compared unknown people sitting together. suppose given lookup table t t[u] u ? v list of students u knows. if u knows v, v knows u. required arrange seating such student @ table doesn't knows other student sitting @ same table either directly or through other student sitting @ same table. example, if x knows y, , y knows z, x, y, z can sit @ same table. describe efficient algorithm that, given v , t, returns minimum number of tables needed achieve requirement. analyze running time of algorithm. follow student relations out 2 edges, graph: a - e - j \ q b - d \ t r - w - x - y - z all students in same subgraph have separated, minimum number of tables 1 each students in largest group - in example largest subgraph r-w-x-y-z , 5 tables. untested python pseudocode: # given...

javascript - Math.Random() To pick random array -

im working on simple russian roulette javascript game. doing printing live or die screen want random, have array set live , die printout want generate random number between 0-5 isnt human entered. here current have running. <script> var randomnumber = math.random(); var = ['die', 'die', "die", 'live', 'die', 'die']; document.write('you ' + a[randomnumber]); </script> can have math.random(); in var? , can plug in document.write(); ? math.random() generates number between 0 , 1. 1 between 0 , 5 follows: var randomnumber = math.floor(math.random() * 6)

hadoop - move data from HDFS to RDS directly -

background: working on web project expose analytical data stored on local mssql database. database updated regularly. emr cluster responsible use custom hive scripts process raw data s3 , save analytical results s3. every time update database, emr launched , analytical files downloaded s3 local drive, , imported sql server tables. current data flow is: s3 -> hdfs/hive-> s3 -> local drive -> db tables so going move db server aws , make process automated , faster. want new data flow be: s3 -> hdfs/hive -> rds. the hive script complex , have use it. hive cannot use rds storage location external tables. looked @ data pipeline needs use s3 intermediate storage , needs lots of setup. read creating custom map/reduce job connects rds via jdbc , import. willing study custom mapper/reducer if solution. my question solution easy config (we need update different tables according dates), having smaller learning curve(c#/sql shop , new emr, time-constraint) , efficien...

java - How to add a jbutton to a jpanel -

i've trying (unsuccessfully) add loop generated jbuttons jpanel. thing jpanel on jscrollpane. here code: string categoria = this.cmbcategoria.getselecteditem().tostring(); string[] partidos = myestadio.buscarpartidos(categoria).split("/"); jbutton b; for(string p : partidos){ b = new jbutton(p); this.panelscroll.add(b, borderlayout.center); system.out.println(p); system.out.println(b.getlocationonscreen()); as can see, i'm printing label , button's location sure exists. it exists , label doesn't show up. jpanel has borderlayout layout , i'm using netbeans 8.0.2 in fact putting newly created button instances same place. 1 on another. use other layout constraints (such north, south, ...), different layoutmanager or better, nested layoutmanager s such flowlayout within borderlayout . moreover, should add jpanel .

How to prepend a consecutive sequence number to every paragraph using jQuery? -

in ui, have button , paragraphs. requirement prepend consecutive sequence numbers every paragraph on clicking of button. i tried way. did not work. var count=0; $("#buttongparano").click(function(){ jquery.each($("#col2 p").not(".append").prepend(++count)); }); }); on 1st click, prepending '1' every paragraph, on 2nd click, prepending '2' , on. want when click once, 1st para should have sequence no. 1, 2nd paragraph should have sequence no. 2 , on. the paragraphs written this: <div id="col2"> <p class="firstparagraph"> lorem ipsum sit amet, consecte elit, sed diam nonummy nibh euismod <em>tincidunt</em> ut laoreet dolore magna aliquam erat </p> <p class="secondparagraph"> duis autem vel eum iriure dolor in hendrerit in vulputate velit esse <strong>molestie</strong> consequat, vel illum eu feugiat nulla facilisis @ vero eros et accumsan et iusto odio...

gorm - Grails domain custom validator check uniqueness -

can check combination uniqueness of field inside custom validator in grails domain class? long points string field1 string field2 level level level validator {val,obj-> if(obj.points<1000){ //make sure level unique field 1 level unique: ['field1'] } else{ //make sure level unique field 2 level unique: ['field2'] } } you can't. unique constraint ddl constraint. means grails/hibernate create unique index in database schema when app starts, constraint remains immutable. validator constraint closure , executed @ runtime every time domain class validated. you have validate uniqueness checking entity in database using finder or criteria, rejecting error if unique condition exists. in finders, don't forget exclude record validating.

javascript - Why getCurrentPosition() fails after unlocking gps acces in googleChromeAndroid -

i'm implementing welcome messages site show @ beginning if user hasn't enabled gps. the thing after enabling gps via chrome ui js still can't access gps postion (keep getting unables alerts on web page). if page reloaded can. is there way update state of blocking/nonblocking option without refreshing whole web page ? <script> var button = document.getelementbyid("button"); button.onclick = function() { var geosuccess = function (position) { var startpos = position; alert("longlat" + startpos.coords.longitude); }; var geoerror = function (error) { alert("unable"); }; navigator.geolocation.getcurrentposition(geosuccess, geoerror); }; </script> please check out link :- gps not know whether asked can tell .it might please forgive me if irrelevant. code here : <span id="demo" /> <script...

google chrome - How to add a tooltip to a <option> in a <select> box in HTML? -

in firefox stable (v38) , earlier versions of chrome, have used "title" html attribute on nodes user can hover on given option , view tooltip or "hover text". here's example of referring to: <select> <option title="hover text!">thing 1</option> <option title="hover text!">thing 5</option> <option title="hover text!">thing 3</option> <option title="hover text!">thing 2</option> <option title="hover text!">thing 42</option> </select> here jsfiddle of above code: http://jsfiddle.net/lsabota/bt3x780j/20/ this seems work firefox stable (v38), doesn't work latest stable version of chrome , doesn't seem work firefox aurora. expect user able hover on of options , see title text (which works in older version of chrome , latest version of firefox). had thought title html attribute proper way - there way accompl...

powershell - Simple InputBox function -

i'm aware of simple pop-up function powershell, e.g.: function popup($text,$title) { $a = new-object -comobject wscript.shell $b = $a.popup($text,0,$title,0) } popup "enter demographics" "demographics" but unable find equivalent getting pop-up ask input. sure, there read-line , prompts console. and there complex function, seems overkill script ask input once or twice: function getvalues($formtitle, $texttitle){ [void] [system.reflection.assembly]::loadwithpartialname("system.drawing") [void] [system.reflection.assembly]::loadwithpartialname("system.windows.forms") $objform = new-object system.windows.forms.form $objform.text = $formtitle $objform.size = new-object system.drawing.size(300,200) $objform.startposition = "centerscreen" $objform.keypreview = $true $objform.add_keydown({if ($_.keycode -eq "enter") {$x=$objtextbox.text;$objform.close()}}) $objform.a...

PyCharm: msvcrt.kbhit() and msvcrt.getch() not working? -

i've tried read 1 char console in pycharm (without pressing enter), no avail. functions msvcrt.getch() stops code, not react key presses (even enter), , msvcrt.kbhit() returns 0. example code prints nothing: import msvcrt while 1: if msvcrt.kbhit(): print 'reading' print 'done' i using windows 7, pycharm 3.4 (the same heppens in idle). what wrong? there other way read input without enter?

html - How to align a div element using the center of the page as a reference? -

Image
so i'm trying element align percentage center of page. so i've tried replacing i'd put percentage either left or right "center" .aboutcredit { z-index:-100000; center:25%; top:75%; transform:translatey(-50%) translatex(-50%); position:fixed; text-align:center; vertical-align:middle; } but no luck. kind of i'm trying here: i don't know if have noticed, center:25%; nothing. want left:50% . seeing want moved 25%, make left:75%; , should you're looking for. so: .aboutcredit { width: 50px; height: 50px; background-color: black; z-index: 1; position: absolute; left: 75%; top: 50%; transform: translate(-50%); text-align: center; vertical-align: middle; } <div class="aboutcredit"></div>

phonegap build + phonegap-cli + ionic icons -

Image
i pretty sure trying accomplish kind of extreme.. no wait, isn't! i need ionic resources+phonegap-cli+phonegap build combo right. now, here's problem. no matter how hard try (because trying hard , wrong ^^ ) can't ios build show icon files submitting phonegap build. beginning consider fault not entirely on pg:build side. i have root folder, /app application , /resources folder. latter generated ionic resources . now when build phonegap remote have structure in /pgbuild folder create ad hoc: /resources /www the config.xml (which in main project root folder) contains following entries: here's ipa package contents: which more or less specificated in phonegap build docs. in docs there no way found understand path these src relative. root of zip? root of www? i've tried move /resources /www, no avail. i've tried pretty every combination of folders , src, missing because info.plist contains only: cfbundleiconfiles = ( "icon.png",...

hadoop - sqoop data from oracle to hive ERROR -

i'm trying sqoop data oracle hdfs. i'm using sqoop purpose. downloaded ojdbc6.jar , put in /usr/hdp/2.2.0.0-2041/sqoop/lib path , executed following command check whether i'm able connect oracle database. sqoop list-databases --connect jdbc:oracle:thin:@hostname:port/service --username xxxx --password xxxx --verbose; i'm getting following error. warning: /usr/hdp/2.2.0.0-2041/accumulo not exist! accumulo imports fail. please set $accumulo_home root of accumulo installation. 15/05/29 15:24:42 info sqoop.sqoop: running sqoop version: 1.4.5.2.2.0.0-2041 15/05/29 15:24:42 debug tool.basesqooptool: enabled debug logging. 15/05/29 15:24:42 warn tool.basesqooptool: setting password on command-line insecure. consider using -p instead. 15/05/29 15:24:43 debug sqoop.connfactory: loaded manager factory: org.apache.sqoop.manager.oracle.oraoopmanagerfactory 15/05/29 15:24:43 debug sqoop.connfactory: loaded manager factory: com.cloudera.sqoop.manager.defaultmanagerfac...

c# - Efficently insert rows + data -

i have excel has tens of thousands of rows. need insert data randomly within excel. below have function using main concern shifting , inserting data. need better idea or method can same mine faster. a answer show method , comment explain how works. can reused if else needs it. here mine: private void shiftrows(int from, int numberof) { from++; range r = oxl.get_range("a" + from.tostring(), "a" + from.tostring()).entirerow; (int = 0; < numberof; i++) r.insert(microsoft.office.interop.excel.xlinsertshiftdirection.xlshiftdown); } public void inputrowdata(string[] data, int rds) { int bestrow = getrowbyrds_a(rds); string[] formateddata = formatoutput(bestrow, data); string val = getvalueofcell(bestrow, 6); if (val != null) { shiftrows(bestrow, data.length); bestrow++; } else shiftrows(bestrow, data.length - 1)...

java - JAK generated KML not work with Google My Maps -

i write manually kml file trying import polygons in mymaps. way works fine: <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://earth.google.com/kml/2.0"> <document> <placemark> <style> <polystyle> <color>#a00000ff</color> <outline>0</outline> </polystyle> </style> <polygon> <outerboundaryis> <linearring> <coordinates>9.184254,45.443636 9.183379,45.434288 9.224836,45.431499 9.184254,45.443636</coordinates> </linearring> </outerboundaryis> </polygon> </placemark> </document> </kml> i try write java program using jak generate possibile equal file, doesn't wo...

python - Ignoring escape sequences -

i'm using python 2.6 , have variable contains string (i have sent thorugh sockets , want it). problem following error: typeerror: file() argument 1 must encoded string without null bytes, not str after looked found out problem string i'm sending contains '\0' isn't literal string can edit double backslash or adding 'r' before hand, there way tell python ignore escape sequences , treat whole thing string? (for example - don't want python treat sequence \0 null char, rather want treated backslash char followed 0 char) considering comments looks incorrectly used pil/pillow api, namely image.open function requires file name instead of file data.

hash - Merge ruby hashes adding keys -

i have 2 hashes same keys {1=>2, 2=>450, 3=>3} and {1=>'1232', 2=>'ffsa', 3=>'vdsvds'} i want merge them this { 1=> {:number => 2, :string => '1232'}, 2=>{:number => 450, :string => 'ffsa'}, 3=>{:number => 3, :string => 'vdsvds'} } getting values subkey 'number' first hash , values subkey 'string' second hash. best way achieve this? here way : h1 = {1=>2, 2=>450, 3=>3} h2 = {1=>'1232', 2=>'ffsa', 3=>'vdsvds'} h1.merge(h2) { |_, o, n| { number: o, string: n } } # => { # 1=>{:number=>2, :string=>"1232"}, # 2=>{:number=>450, :string=>"ffsa"}, # 3=>{:number=>3, :string=>"vdsvds"} # }

php - CodeIgniter session available in one controller but not in other -

codeigniter session available in 1 controller not in other... session setting user controller class user extends ci_controller { // session worked here public function __construct() { parent::__construct(); session_start(); } function setsess (){ // database model call, value comes database $_session['user'] = array ( 'isloggedin' => true, 'id' => $userdata[0]['id'], 'username' => 'abc', 'email_address' => $userdata[0]['email_address'], 'country' => $userdata[0]['country'], 'lastloggedin' => $lastlogintime ); // redirect profile } } unable receive in class profile extends ci_controller { public function __construct() { parent::__construct(); session_start(); } public function inde...

swift - Unit-testing a functional core of value objects: how to verify contracts without mocking? -

i wanted give functional core/imperative shell approach shot, since swift's struct s easy create. now drive me nuts in unit tests. how unit test net of value objects? maybe i'm stupid search right terms, in end, more unit tests write, more think should delete old ones. in other words tests seem bubble call chain long don't provide mock objects. impossible ( struct ) value objects, because there's no way replace them fake double unless introduce protocol, doesn't work in production code when methods return self or have associated types. here's simple example: struct foo { func obtainbar() -> bar? { // ... } } struct foomanager { let foos: [foo] func obtainfirstbar() -> bar { // try `bar` every `foo` in `foos`; pass first // 1 isn't nil down } } this works concrete foo class or struct. how supposed test obtainfirstbar() does? -- plug in 1 , 2 , 0 foo instances , see happens. but i...

JavaScript OOP and asynchronous methods from Chrome extension api -

i making chrome extension , uses little blocks of text. made class , each block instance of class. such that: function block(bid){ var block = object.create(block.prototype); block.title = "default" block.content = ""; block.bid = bid; return block; }; block.prototype.settitle = function (){ chrome.tabs.query({currentwindow: true, active: true}, function(tabs){ this.title = tabs[0].title; }); }; my problem when call settitle() on block object title property isn't being changed method; stays @ "default". know has synchronous , async methods lost on going fixing this. any appreciated! to avoid further discussion, assumption it's scoping issue. try wit following code: function block(bid){ var block = object.create(block.prototype); block.title = "default" block.content = ""; block.bid = bid; return block; }; block.prototype.settitle = function (){ v...

c# - Google Charts json data not loading -

i'm using asp.net mvc , google charts try , generate simple line graph 2 data records. i'm pulling data database, data isn't appearing on chart. data consists of 2 records 2 fields: weekofentry (datetime) , weight (decimal). chart appears, data points aren't there. i'm guessing data formatted improperly? here's javascript: <script type="text/javascript"> //load visualization api library , linechart library. google.load('visualization', '1.0', { 'packages': ['corechart'] }); //set callback run when google visualization api loaded. google.setonloadcallback(drawloseatonlinechart); //callback creates , populates data table, instantiates line chart, //passes in data, , draws it. function drawloseatonlinechart() { var url = "@url.action("getchartstatistics")"; var jsondata = $.ajax({ method: 'get', url: url, ...

How to parse JSON from a URL with PHP -

i have url: http://server.com/api.php?results {"name":"pit, loka","current":{"item":"16","test":"test","test":"84","test":"ok"}} i guess php example is: <?php $file = file_get_contents("http://server.com/api.php?results=item"); $data = json_decode($file); print_r($data); ?> but can't results. how can solve problem? <?php $file = file_get_contents("http://server.com/api.php?results=item"); $data = json_decode($file); $name = $data->name; // "name":"pit, loka" $current = $data->current->item; //"current":{"item":"16","test":"test","test":"84","test":"ok"} foreach ($current $currentx) { echo $currentx->item; } ?> it should work... please test.

c# - Session.Abandon Not Firing or Throwing error message -

i have following piece of code throwing error message need enable session on web.config, none of things have found far, can tell me how suppose working?. i have tried place code within decline on page_load server seems avoid session's instructions: public partial class decline : datapage { protected decline() { session.removeall(); session.clear(); session.abandon(); response.cookies.remove("accessed"); } protected void page_load(object sender, eventargs e) { response.redirect("~/account/login.aspx"); } } this full message: session state can used when enablesessionstate set true, either in configuration file or in page directive. please make sure system.web.sessionstatemodule or custom session state module included in <configuration>\<system.web>\<httpmodules> section in application configuration this running .net 4 ...

java - Toolbar hidden by noification pannel -

Image
so i've generated apk, when start app, toolbar hidder noification pannel: android.support.v7.widget.toolbar toolbar.xml: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/main_toolbar" android:layout_width="match_parent" android:layout_height="50px" android:background="#263355" local:theme="@style/themeoverlay.appcompat.dark.actionbar" local:popuptheme="@style/themeoverlay.appcompat.light" xmlns:android="http://schemas.android.com/apk/res/android"> <linearlayout android:id="@+id/main_toolbar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical"> ...

c - Using realloc to resize a dynamic array -

i tried extend ful list of players. when use reallo c function, save player except last. mean if had 4 players in array , tried extend array 7 got new array in size 7 , 3 players. this part of function: void initializelistfortree(player** players, int listsize) { int formulasize = bla bla bla..... players = (player **)realloc(players, sizeof(player *)*formulasize); if (!players) { printf("memory allocation failed\n"); } } more like: void initializelistfortree(player*** players, int listsize) { int formulasize = bla bla bla..... void *p = realloc(*players, sizeof(player *)*formulasize); if (!p) { printf("memory allocation failed\n"); } else { *players = p; } } and @ call site player **playerslist = null; initializelistfortree(&playerslist, 1); ... initializelistfortree(&playerslist, 2); etc.. this, of course, if type pointer list of pointers.

c# - Goertzel Filter returned Magnitude in relation to average energy of the buffer -

i pass slices of buffer goertzel filter. buffer contains freqs of 18khz , silence. duration of each 75ms. sampling rate = 44.1. works fsk. i'm trying detect threshold of goertzel filter of 18khz. thought of measuring average energy of buffer next formula: energy = (1/n) * sum(abs(x[n])) //where n total number of samples in x slice now, problem how energy related returned value of goertel filter. have noticed freq measure lower goertel's magnitude smaller. example: if goertel tuned detect 13k 50 100; for, 18k smaller numbers: 0.00001 0.005. array pass float[] , numbers in range of +-1. there solution that?

java - Connecting iSeries JDBC to Microsoft Azure SQL Server -

i have used scott klement's example code create connection our iseries (level v5r2m0) using jtds-1.3.1.jar our azure sql server. scott's example rpg ile program mssqltest gets far connection value test fails null. java software loads , shows no errors. following code in question: prop = jdbc_properties(); jdbc_setprop(prop: 'username' : 'dbadmin@mssqlserver'); jdbc_setprop(prop: 'password' : 'password'); jdbc_setprop(prop: 'databasename' : 'sqldatabase'); jdbc_setprop(prop: 'encrypt' : 'true'); jdbc_setprop(prop: 'hostnameincertificate' : '*.database.windows.net'); jdbc_setprop(prop: 'logintimeout' : '30'); conn = jdbc_connprop('net.sourceforge.jtds.jdbc.driver' :'jdbc:jtds:sqlserver://mssqlserver.database.windows.net:1433' : prop ); jdbc_freeprop(prop); if (conn = *null); return; endif; the connection parameters provided microsoft as: jdbc:...

java - Struts Jquery Select tag sometimes not get data. (<sj:select />) -

i use <sj:select /> some times data. not, need refresh page populate select box. please me... for populating category <s:url var="categoryurl" action="returntrainings"/> <sj:select href="%{categoryurl}" id="category" cssclass="employeeinput" onchangetopics="reloadsecondlist" onalwaystopics="reloadsecondlist" name="categorynamefortraining" list="distinctcategory" headerkey="0" headervalue="select category"/> for populating training <sj:select href="%{categoryurl}" id="selectwithreloadtopic" cssclass="employeeinput" formids="trainlist" reloadtopics="reloadsecondlist" name="traininglist.hcmotraininglistid" list="selectedtrainingnames" listkey="hcmotraininglistid" listvalue="trainingnam...

Java SFTP specify absolute path -

i have used code sftp java upload package com.as400samplecode; import java.io.file; import java.io.fileinputstream; import java.util.properties; import org.apache.commons.vfs2.fileobject; import org.apache.commons.vfs2.filesystemoptions; import org.apache.commons.vfs2.selectors; import org.apache.commons.vfs2.impl.standardfilesystemmanager; import org.apache.commons.vfs2.provider.sftp.sftpfilesystemconfigbuilder; public class sendmyfiles { static properties props; public static void main(string[] args) { sendmyfiles sendmyfiles = new sendmyfiles(); if (args.length < 1) { system.err.println("usage: java " + sendmyfiles.getclass().getname()+ " properties_file file_to_ftp "); system.exit(1); } string propertiesfile = args[0].trim(); string filetoftp = args[1].trim(); sendmyfiles.startftp(propertiesfile, filetoftp); } public boolean startftp(string propertiesfilename, string filetoftp){ props = new properties(); standa...

not matching empty string for regex -

i trying use regex matching date(from 2000-2099). following regex okay. ((((^20[02468][048])|(^20[13579][26]))-(((0[13578]|1[02])-(0[1-9]|[12]\d|3[0-1]$))|((0[469]|11)-(0[1-9]|[12]\d|30$))|(02-(0[1-9]|1\d|2[0-9]$)))|((^20\d{2})-(((0[13578]|1[02])-(0[1-9]|[12]\d|3[01]$))|((0[469]|11)-(0[1-9]|[12]\d|30$))|(02-(0[1-9]|1\d|2[0-8]$)))))|0000-00-00){1} note: match leap year(#days in month: 31, 30, 29 ) or normal year(#days in month: 31, 30, 28 ) or default (0000-00-00) however matches empty string too. tried search solution this one mine way more complex , tried add {1,} suggestion stated in link. but doesn't work. and don't understand why matches empty string well, please tell me too? add required attribute input: <input pattern="(((^20[02468][048])|(^20[13579][26]))-(((0[13578]|1[02])-(0[1-9]|[12]\d|3[0-1]$))|((0[469]|11)-(0[1-9]|[12]\d|30$))|(02-(0[1-9]|1\d|2[0-9]$)))|((^20\d{2})-(((0[13578]|1[02])-(0[1-9]|[12]\d|3[01]$))|((0[469]|11)-(0[1-9]|[12...

java - Example of parser using Mime4j 0.7.2 version -

i've lot of .eml files , need parse them. i'm using mime4j version 0.6.1 , wanna update version 0.7.2, cannot find sample. read post apache mime4j maven dependency 0.7.2 , helped me right maven dependency. it's still lot of problems new methods. example in version 6 class multipart got method getbodyparts , return list<bodypart> , , returs list<entity> . have example how parse smtp (eml) email mime4j 0.7.2?

tfs2015 - Upgrading TFS 2013 Build Service to TFS 2015 RC -

i've upgraded our dev environment tfs 2015 rc tfs 2013 update 4. went well. now, want address build environment. what's process upgrading existing build controller/agents tfs 2015 rc? ideally i'd existing machines handle both xaml , build.vnext builds. edit: according docs, seems existing build infrastructure not upgraded. that's fine, i'd able manage agent service through admin console. can on app tier. tfs 2015 not have build controller concept , supports vnext builds have understood.so need configure tfs 2013 build controller , tfs 2013 build agents keep using xaml build environment.this address xaml build issue. , can follow following msdn article install , configure new vnext builds in environment: install , configure new build agent , pool: http://nkdagility.com/configure-a-build-vnext-agent-on-vso/ create build definition: http://nkdagility.com/create-a-build-vnext-build-definition-on-vso/ https://msdn.microsoft.com/en-us/library/vs/a...

android - two functions accessing database at the same time -

i have function , function b . function runs in loop. updates data base every 6 seconds. function b updates database when user changes . during long run 2 functions trying access database @ same causing in sqlite crash. please suggest way avoid this. below function b while(1) { tvaudiomgrinstance->updatedatabase(); if(errno != eintr) { // in android sleep() function takes argument seconds rc = sleep(periodic_update_database_time); } if((rc != 0)||(errno == eintr))//even checking errno alone enough..as errno global thread alone { tvaudiomgrinstance->updatedatabase(); #if tvaudiomanager_log_enable alogd("exit audmgr pthread"); #endif break; } } if use 1 helper instance shared between these functions, of db access code serial. check this: http://touchlabblog.tumblr.com/post/24474750219/single-sqlite-connection ...

ios - Why am I not getting didEnterRegion or didExitRegion calls when using CLLocationManager's startMonitoringForRegion -

i trying set client's app trigger database update when ios device arrives at/leaves office. (it's app client's salespeople use in field, customer sites not have network connectivity, client wants database updated salespeople leaves office/return office.) i never getting didenterregion or didexitregion calls. i have singleton regionsmanager manages instance of location manager. using cllocationmanager , startmonitoringforregion method. on launch, invoke regionsmanager creates location manager , set delegate of location manager. in app delegate's didfinishlaunchingwithoptions method check uiapplicationlaunchoptionslocationkey , in case i'm being relaunched region entered/exited, never happens. i have nslocationalwaysusagedescription key/value pair in info.plist. i call cllocationmanager.authorizationstatus make sure app authorized, , if not call requestalwaysauthorization . once verify app authorized, check ismonitoringavailableforclass(c...

Zabbix user-defined parameters -

i have need of monitroing special serivce state via zabbix. when run on server supp@db3 ~ $ /etc/init.d/kannelgate zabbix it prints number in console - 1 or 0 (service up/down) what should write in zabbix agent output agent , send zabbix server? you can define user parameter writing following line zabbix_agentd.conf: userparameter=kannelgate.state,/etc/init.d/kannelgate zabbix please see zabbix documentation more information on defining user parameters.

java - JDBC in groovy script mysql access denied even though permissions are set up correctly -

i have written following groovy script connect mysql database: this.class.classloader.rootloader.addurl(new file("/root/mysql-connector-java-5.1.35.jar").tourl()) import groovy.sql.* def username = 'root' def password = 'password' def database = 'database' def server = 'localhost' def db = sql.newinstance("jdbc:mysql://$server/$database", "$username", "$password", 'com.mysql.jdbc.driver') when run this: groovy sqlcon.groovy i following error: caught: java.sql.sqlexception: access denied user 'root'@'localhost' (using password: yes) @ query.run(query.groovy:10) but can log in mysql database locally using same credentials , output from select host, user mysql.user; looks this: +-----------+------------------+ | host | user | +-----------+------------------+ | 127.0.0.1 | root | | localhost | root | +-----------+---...

excel - Use an array formula to check if a similar contract ended in the last 12 months -

Image
i'm troubleshooting report spreadsheet i've written. logic had written isn't working, thought i'd see if ask here. essentially, have list of contracts, list of products, list of end , start dates, , various other pieces of information. need know if product of renewal using information. example data: product company number start of contract end of contract contract id include in month's report fax 1234 10.09.2013 10.09.2014 1 no fax 1234 10.09.2014 10.09.2015 2 no box 5678 11.01.2014 30.04.2015 3 no box 5678 01.05.2015 11.01.2016 4 yes fax 5678 01.05.2015 01.05.2016 5 yes cup 9876 03...