Posts

Showing posts from June, 2014

List Facebook Page events on website for a Venue using FQL or Graph API -

i helping out friend site venue lists events on fb location, ticket uri, time, etc. i have found lots of info on how data, unclear on how public events without being logged in fb. what type of tokens need have website pull events data , display visitors? basically, attempting show set number of upcoming events , assume visitors site not logged in fb. on page, https://developers.facebook.com/docs/reference/fql/event , says this: permissions to read event table need: a generic access_token public events (those privacy set open) user access_token user_events permission user can see event non-public events app access_token user_events permission (for non-public events, must app created event) page access_token user_events permission (for non-public events, must page created event) i not looking code really, having trouble figuring out how access/auth process works. it appears fql may best option can queries based on date ranges, alas, stuck on access/auth/token par...

iphone - Drawing a DOT within a cells UIImageView's UIImage -

currently, attempting draw simple dot inside of cell's uiimageview 's uiimage . attempting accomplish same thing calendar application iphone has when event represented calendar. [[event calendar] cgcolor] is ekevent object logs uidevicergbcolorspace 0.509804 0.584314 0.686275 1 i attempt create small dot color [[event calendar] cgcolor] . heres trying do: cgcontextref contextref = uigraphicsgetcurrentcontext(); cgcontextsetfillcolorwithcolor(contextref, [[event calendar] cgcolor]); cgcontextaddellipseinrect(contextref,(cgrectmake (12.f, 5.f, 4.f, 5.f))); cgcontextdrawpath(contextref, kcgpathfill); cgcontextstrokepath(contextref); cell.imageviewpic.image = uigraphicsgetimagefromcurrentimagecontext(); but here errors i'm getting: myscheduler[21445] <error>: cgcontextsetfillcolorwithcolor: invalid context 0x0 myscheduler[21445] <error>: cgcontextaddellipseinrect: invalid context 0x0 myscheduler[21445] <error>: cgcontextdrawpath: invalid ...

html - stop asking for download an embedded file on unavailability of plugin to display -

i'd embedded pdf file on page. on browsers shows pdf file on browser instead of showing file ask me download file. 1 of possible reason unavailability of plugin in browser display file. want if unable show not ask file download. url reference you can use https://docs.google.com/viewer accomplish this. all enter link , wil generate link use iframe link embedded

android - Database not visible in DDMS folder when real device used instead of emulator -

i creating sample application create database, inserts data , displays in spinner. for testing using android phone instead of emulator (as fedup slow response). my problem application running succesfully spinner not displaying result unable view folder structure under ddms->data. i confused whether database created or not, please suggest me how view database if use real device instead of emulatpor you must start emulator, browse emulator files in ddms view select file explorer go data > data > com.your.package > databases > your_database_name , new tab appear data! won't work on real device. you can pull/export database , analyse more sqlite browser enjoy !

php - MAGENTO PRODUCT: Product Page got errror in magento -

Image
i m newi magento , in website menu working proper , category show product in list.phtml proper when click on product detail of product time page redirect localhost/magento/index.php/categoryname/productname.html but got error report show in below image.. plz give suggestion or solve issue a:5:{i:0;s:203:"sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 1";i:1;s:4055:" #0 d:\wamp\www\magento\lib\varien\db\statement\pdo\mysql.php(110): zend_db_statement_pdo->_execute(array) #1 d:\wamp\www\magento\lib\zend\db\statement.php(300): varien_db_statement_pdo_mysql->_execute(array) #2 d:\wamp\www\magento\lib\zend\db\adapter\abstract.php(479): zend_db_statement->execute(array) #3 d:\wamp\www\magento\lib\zend\db\adapter\pdo\abstract.php(238): zend_db_adapter_abstract->query('select `catalog...', array) #4 d:\wamp\www\magento\lib\varie...

Compiling C code for ODE Model into .so file for R package -

i organizing r code have written package. code contains mcmc algorithms inference on parameters in ordinary differential equation models, solving ode thousands of times. necessary pass model ode function of desolve package using compiled code instead of r function. normally, use commands system('r cmd shlib mymodel.c') dyn.load(mymodel) to use compiled versions. instead, r automatically generate .so files when install package. cannot find way because these c functions not use r function. need path valid dll pass ode function. doesn't seem make sense make wrapper ode model since can't use function inside of r, maybe confused. cannot find package on cran uses c code in manner, maybe not possible.

javascript - Facebook throws error without code -

facebook throws me unknown error: "error acquired. please try again later." there no error in firefox console. my javascript source is: (function () { function requestcallback(response) { var message = document.getelementbyid("success_message"); if (message) { if (typeof response.error_code != 'undefined') { message.innerhtml = 'wrong'; } else { message.innerhtml = 'success'; } } } var vkinvite = function () { if (typeof fb == 'undefined') { settimeout(vkinvite, 100); } else { console.log("try use facebook... fb.init"); fb._initialized = false; fb.init({ appid: 'xxxxxxxxxxxxxx', frictionlessrequests: true }); (function sendrequestviamultifriendselector() { console....

regex - PHP preg_match returning the wrong indexes -

i'm trying extract indexes of specific word string using php's preg_match . take example word hello : $r = "/\b(hello)\b/u"; let's want in string: $s = 'hello. how you, hello there. helloorona!'; if run preg_match preg_offset_capture parameter , passing in array called $matches, preg_match($r, $s, $matches, preg_offset_capture); i expect returned (i.e. ignoring last "hellooroona" phrase): ["hello", 0], ["hello", 20] but in fact, when return echo value of $matches either through json_encode or looping on matches, value returned always: ["hello", 0], ["hello", 0] if run on similar string, let's $s = 'how you, hello there.'; the answer ["hello", 13] which correct. run on hello hello hello , 3 indexes, 0. summary so seems index counter returning first index. expected behavior? how actual indexes? the second ["hello", 0] not secon...

do we need 3*N instances on amazon ec2 to host N mongodb shards? -

the question might seem ridiculous seems me "yes" little crazy. mongodb suggests have replication sets of 3 machines. if database can stand on 1 computer, need 3 machines, , if tomorrow need shard , need 2 machines need 6, right ? or there smarter can done , comes free mongodb ? (with coding theory hamming, ... number of bits need not linear in size of total number of bits) please don't hesitate ask me reformulate if not clear in advance answers, thomas so there documentation recommended cluster setup in terms of phisycal instance separation. there should considered 2 things (at least) separately. 1 replication , 1 see documentation : http://docs.mongodb.org/manual/core/replica-set-members/ which means have have @ least 2 data nodes (due ha) in replicaset , can have 1 arbiter not holding data participate in election described in docs linked above. need odd number of setmembers due primary has elected majority inside replicaset. the other aspect sha...

Use page <title/> in surrounding template in Lift -

i know in /page.html can do: ... <body class="lift:content_id=main"> <div id="main" class="lift:surround?with=default;at=content"> <title class="lift:head">title_goes_here</title> ... ... more transparent designers able put <title/> in <head/> of /page.html . would possible <title/> snippet used in /templates-hidden/default.html somehow read regular head <title/> in used /page.html ? thanks! i think answer rather "no", because lift reads data inside id="???" in page.html . architecture choice afaik. you should ask on mailing list, think, if propose changes lift architecture. btw, know title overridden (inserted) if use sitemap ?: https://www.assembla.com/wiki/show/liftweb/sitemap

php - Missing argument 1 for function error -

warning: missing argument 1 function abc() function ort_view_menu() { $items['thick_box_view'] = array( 'title' => 'viewed details', 'description' => 'g report', 'page callback' => 'abc', 'type' => menu_callback, 'access callback' => true, ); return $items; } function abc($nid) { $rows = array(); $node = node_load($nid); is error caused due $nid used in function ? yes, call function abc not supply required argument $nid needed in function.

java - org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject -

i'm trying parse below json file: {"units":[{"id":42, "title":"hello world", "position":1, "v_id":9, "sites":[[{"id":316, "article":42, "clip":133904 }], {"length":5}] }, ..]} this have tried: object obj = null; jsonparser parser = new jsonparser(); object unitsobj = parser.parse(new filereader("file.json"); jsonobject unitsjson = (jsonobject) unitsobj; jsonarray units = (jsonarray) unitsjson.get("units"); iterator<string> unitsiterator = units.iterator(); while(unitsiterator.hasnext()){ object ujson = unitsiterator.next(); jsonobject uj = (jsonobject) ujson; obj = parser.parse(uj.get("sites").tostring()); jsonarray jsonsites = (jsonarray) obj; for(int i=0;i<jsonsites.size();i++){ jsonobject site = (jsonobject)jsonsit...

cakephp - Combining two arrays in to one in cake php -

this array have. array ( [0] => array ( [fooditem] => array ( [id] => b102 [food_item_title] => prown cocktail [active] => 1 ) [menufooditem] => array ( [menu_id] => 2 ) ) ) i want combine fooditem , menufooditem array 1 following using native php or cake php array ( [0] => array ( [fooditem] => array ( [id] => b102 [food_item_title] => prown cocktail [active] => 1 [menu_id] => 2 ) ) ) you can using blow code. $i = 0; foreach($datas $data) { $result[$i]['fooditem'] = $data['fooditem']; $result[$i]['fooditem']['menu_id'] = $data['menufooditem']['menu_id']; $i++; }

git add - Unable to commit in Git -

when enter in console: $ git add . i get: nothing added nothing specified. may wanted 'git add.'? try this: $ git commit -am "your commit message"

matlab - Sum of product each row by a matrix -

i have matrix a , three-dims matrix b . want sum (by i ) a(i,:)*b(i,:,:) , but without loops i . i'll start creating random matrices similar described: n = 4; m =3; = rand(n,m); b = rand(n,m,5); 1) loop version: c = zeros(1,size(b,3)); i=1:n c = c + a(i,:)*squeeze(b(i,:,:)); end basically performs matrix multiplication of each row of a corresponding slice of b , , accumulates sum. this slighty improved permuting matrix b once outside loop, avoiding multiple calls squeeze ... 2) vectorized version: c = sum(sum(bsxfun(@times, permute(a,[2 3 1]), permute(b, [2 3 1])),1),3); i don't make claims should faster. in fact suspect looped version both faster , less memory intensive. i'll leave compare 2 using actual dimensions working with.

c# 4.0 - How to upload images to facebook which is selected by using photoChooserTask in windows phone 8? -

i developing windows phone app in have post photo facebook. , particular photo choosen using photochoosertask or camerachoosertask. normally, can post particular photo successfully, facing problem post selected photo. saw link link so please if know issue please me out. thanx in advance. edit private void postclicked(object sender, routedeventargs e) { //client parameters var parameters = new dictionary<string, object>(); //var parameters1 = new dictionary<>(); parameters["client_id"] = fbapi; parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html"; parameters["response_type"] = "token"; parameters["display"] = "touch"; parameters["contenttype"] = "image/png"; //the scope give access users data, in case //we want publish on wall parameters["scope"...

diacritics - Accented characters using jquery -

i have script included in body of html file: <script> function read() { $.get("prevision.txt", function(data) { $('#prev').html(data); }); } $(document).ready(read); </script> when there accent included in .txt file, #prev shows: � instead of accent. i have files encoded utf-8. how can solve this? thanks use html codes instead of true characters. for ex. '<' == '&lt;' // true complete reference accented chars here

android - Getting all records but if some of them are connected then getting only last one -

example table id | parentid | desc | date 1 | null | .... | 1 2 | null | .... | 2 3 | 1 | .... | 3 4 | 1 | .... | 4 5 | 2 | .... | 5 6 | null | .... | 6 7 | null | .... | 7 okay, want records if of them connected via id <-> parentid, want 1 latest date. result of query table above shold be id | parentid | desc | date 4 | 1 | .... | 4 5 | 2 | .... | 5 6 | null | .... | 6 7 | null | .... | 7 how can in sqllite? if have api level 16 (jelly bean) or later, following work: select id, parentid, "desc", max(date) date mytable group coalesce(parentid, id) in older android versions, must use correlated subquery filter out records earlier date: select * mytable not exists (select 1 mytable t2 coalesce(t2.parentid, t2.id ) = coalesce(mytable.parentid, mytable.id) , t...

C# + NUnit: Unit testing methods with byte array arguments -

i write unit tests classes methods having byte array arguments. there 100 methods in total, , array size ranges 5-10 few 100 bytes. how should generate , store test arrays? should generate them manually or generator code (which should unit tested, too)? should generate them in memory during test, or should generate them in advance , store them somewhere? in latter case, should store them in files (even if unit tests shouldn't touch file system), or should store them inside test code (for example, in strings in hexadecimal format, this: "47 08 00 14 etc.")? i started create them manually , store them in test code in hex strings. worked lot such binary strings, can read them relatively ("i don't see code. see blonde, brunette, redhead.") problem is, approach slow, , think using automatic generator result in more maintainable tests. how should test output of generator correct? sounds catch-22... i suggest few approaches, not sure 1 suita...

phpexcel - Excel sheet corrupted after conditional formatting -

i generating excel sheet phpexcel, when using conditional formatting condition being (search text or part of it), validation error when trying open generated sheet. works numbers, less texts. here code : //conditional formatting $objconditional1 = new phpexcel_style_conditional(); $objconditional1->setconditiontype(phpexcel_style_conditional::condition_containstext) ->setoperatortype(phpexcel_style_conditional::operator_containstext) ->addcondition('x'); $objconditional1->getstyle()->getfont()->getcolor()->setargb(phpexcel_style_color::color_yellow); $objconditional3 = new phpexcel_style_conditional(); $objconditional3->setconditiontype(phpexcel_style_conditional::condition_cellis) ->setoperatortype(phpexcel_style_conditional::operator_greaterthanorequal) ->addcondition('0'); $objconditional3->getstyle()->getfont()->getcolor()->setargb(phpexcel_style_color::col...

sql server - mssql isnull don't work in outer apply -

outer apply ( isnull( (select top 1 sea.daily, sea.seasonid season sea sea.propertyid = prop.propertyid , fromdate < @fromdate , todate > @todate ), (select top 1 sea.daily, sea.seasonid season sea sea.propertyid = prop.propertyid) ) ) pri write error incorrect syntax near ')'. incorrect syntax near keyword 'as'. missing "select"?? outer apply ( select isnull( (select top 1 sea.daily, sea.seasonid season sea sea.propertyid = prop.propertyid , fromdate < @fromdate , todate > @todate ), (select top 1 sea.daily, sea.seasonid season sea sea.propertyid = prop.propertyid) ) ) pri raj

iphone - Add fixed UILabel in UIPickerView -

Image
i saw this question , answer , tried few options non worked. i create uipickerview 1 below, (fixed labels inches , feet) wouldn't appear: create uiimagepicker this: - (void)viewdidload { _picker = [[uipickerview alloc] init]; cgrect pickerframe = cgrectmake(0, 0, 200, 216); pickerview.frame = pickerframe; pickerview.userinteractionenabled = yes; pickerview.datasource = self; pickerview.hidden = yes; pickerview.delegate = self; pickerview.showsselectionindicator = yes; [self.view addsubview:pickerview]; [textfield setinputview:pickerview]; textfield.delegate = self; [pickerview removefromsuperview]; _picker.hidden = yes; } - (bool) textfieldshouldbeginediting:(uitextview *)textview { if (textview.tag==1){ //field uipickerview _picker.hidden = no; [self addpickerlabel:@"feet" rightx:114 top:342 height:21]; [self addpickerlabel:@"inches" rightx:241 top:342 height:21]; } ...

javascript - Implementing Column resize using jQuery -

i trying implement column resizing using jquery below(please see http://jsbin.com/udunubo/1/edit ) here js code function resizeevents(selector) { function xy(e, ele) { var parentoffset = ele.parent().offset(); return e.pagex - parentoffset.left; } var checkpos; $(selector).on('mousedown', function () { $(this).attr('init', true); return false; }); $(selector).on('mouseup', function () { $(this).attr('init', false); }); $(selector).closest('div').on('mousemove', function (e) { var inits = $(this).find('.resize').filter(function(){ return $(this).attr('init') == true; }); if (inits.length > 0) { var pos = xy(e, inits.first()); if (!checkpos) { checkpos = pos; retu...

powershell - Configure printer from a remote pc using vbs and psexec -

i have vbs file configuring network printer. stored in remote pc..i need run vbs file pc. have used psexec remotely execute file. ran psexec using admin account that's common both machines. printer not getting configured though there no errors. same script works when directly executed in remote pc. tried wmi & power shell coding.. both r behaving i.e. configuring printer when running script locally.. vbs file makes use of "addwindowsprinterconnection" configure printer. reason printer not getting configured? if want run script remote share on remote computer, need run psexec explicit credentials: psexec \\hostb -u username -p \\hosta\share\script.vbs see this thread in sysinternals forum. in powershell should able around issue via credssp .

c# - jqGrid passing extra parameters when calling delGridRow -

i reading documentation here regarding how delete row api works, didn't find way cleanly pass down parameter/s. possible in edit , when fetching data, not delete. basically explain why need it, have session based editable grid, session needs unique guid generated when rows written session, render them hidden inputs(outside of grid) specific id each grid knows input his. know griddelrow has "url" option , concatenate url query string, break current behavior controller action method looks public virtual actionresult editrow(rowgridviewmodel rowgridviewmodel, string guid) { return handlegriditemedit(rowgridviewmodel, guid); } and jqgrid api call $(gridobject).jqgrid("delgridrow", id, { "top": "", "left": "", "width": "150px", "zindex": 99999, "modal": true, "drag": false, "closeonescape": true, }); so if edit url opt...

xslt - how to fetch current date time with utput file name using saxon9 command prompt -

i have requirement in every time output file name should unique using saxon command file .i thought using -now command getting error .i getting error non numeric year component.please suggest me solution .my command java -jar saxon9pe.jar -now:yyyy-mm-ddthh:mm:ss+hh:mm input.xml input.xsl >output.xml can add timestamp @ end of output file.this command run window scheduler. i think either need set now option concrete value 2013-08-26t12:00:00 or can use current-datetime() in stylesheet access current date/time.

java - Print transaction status on TextArea -

i developing project following : 1.truncate temporary table t1. 2.insert thousand rows temporary table t1. 3.execute procedure has commit statements in it. 4.insert rows table t1 other identical table(with respect structure) t2 5.execute 2 more procedures. now have made swing ui contains textarea on want print transaction status. this reading excel file.. validating excel file.. inserting entries table t1.. , on i have made following method update status @ each step. public void updatestatus(string message){ string temp = this.statustext.gettext(); this.statustext.settext(temp + message + "\n"); } calling method along statements do log.debug(message) job me ! complicates code design. every dao component depends on method. can suggest me better design option. thanks in advance ! log.debug(message) job me ! complicates code design. every dao component depends on method. can suggest me better design option. you h...

Replace Exact Occurrence of Word in PHP? -

i need repeatedly remove stop words articles. using function str_replace achieve this. first argument use stop list array variable remove occurrence of stop words. works fine except removes matches occur in middle of word (i.e, if stop words "th" remove "th" "the", "then" etc). now if have supplied argument using plain text add space on either side of word remedy situation. since using variable array won't work. tried using concatenate operator, doesn't seem legal connector inside function. current code looks this: $i = str_replace(" " . $swarray . " ", $string ); you need instead use preg_replace word boundaries. example below we're replacing word the while avoiding replacing them or then etc $string = preg_replace('/\bthe\b/', '', $string);

sql server 2008 - how to get next Identity not the last inserted identity of Identity column -

i have 2 table purchase , purchaseproduct purchase has primary key auto increment identity column possilbe next identity of identity column , lock nothing can wrong insert in purchaseproduct table you don't need "lock" identity value. table uses value of identity , it's used forever, if rollback. sql fiddle example: http://sqlfiddle.com/#!3/5fdb9/1/0 . note id s make table, 1 , 5. if doesn't address problem, please revise question.

actionscript 3 - as3 error #2032 with local xml files -

this appears common problem. still, i've tried every solution has been proposed , still error #2032 when try load xml file. var loader:urlloader = new urlloader(new urlrequest("/../assets/levels/level_0-1.xml")); //error loader.addeventlistener(ioerrorevent.io_error, onioerror, false, 0, true); loader.addeventlistener(event.complete, loadlevelcomplete, false, 0, true); the entire folder of project has been marked trusted, i've added -use-network=false compiler arguments, , i'm launching swf in browser. i've been checking path past 2 days, made multiple dummy files different paths. still, #2032. there else should do? it still local security restriction preventing flash opening file. chrome has strict local testing restrictions. you can test putting online on test server, or on local server using localhost.

c++11 - How to access functionality of both GPU & SoundCard Chip directly from C++? -

this question has answer here: c++ const usage explanation 12 answers i student,learning c++ concurrency programming.i want know how access functionality both graphic card chip , sound card chip through c++ program.is there way connect respective drivers , application without using external libraries such opengl,openal etc.can briefly describe solution example. thank you. const int * const function_name(const int * point) const; //(1) (2) (3) (4) the first prevents returned pointer being used modify whatever data being accessed function. (unless want modify it), since prevents unexpected modification of shared data. the second prevents caller modifying returned pointer. has no effect when returning built-in type (like pointer), , can bad when returning class type since inhibits move semantics. the third prevents fun...

Fetching tags from a feature file using cucumber -

is there command line option list tags in cucumber test suite? for example, want like: cucumber --show-tags foo.feature that give me like: @ci @development @regression @wip the syntax have tried "cucumber -f tag_cloud foo.feature" , giving me "cannot load tag_cloud(load_error)" i wanted know how exactly. do need install api's additionally?? or how is? kindly me i believe --show-tags option deprecated. instead, have use custom formatter. nat ritmeyer had custom formatter task - https://gist.github.com/natritmeyer/2995205 . 1) copy following "list_tags.rb" file in "features/support" directory: =begin copyright (c) 2012, nathaniel ritmeyer rights reserved. redistribution , use in source , binary forms, or without modification, permitted provided following conditions met: 1. redistributions of source code must retain above copyright notice, list of conditions , following disclaimer. 2. redistributions in bin...

r - How to read the data from web -

i import data http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/regression/mg r. dataset contains 1,385 data points featuring 6 independent variables , 1 dependent variable. how can import data file r? i suppose looking read.table : read.table("http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/regression/mg") if want remove column numbers , colons numeric values, can use gsub : dat <- read.table("http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/regression/mg", stringsasfactors = false) dat[-1] <- lapply(dat[-1], function(x) as.numeric(gsub(".:", "", x)))

javascript - how to popup window for editing row with ng-grid and angular js -

i've started read angular-js. seems cool learn. i've looked through http://angular-ui.github.io/ng-grid/ . ng-grid seems nice , easy use, not sure how popup modal window when edit button clicked on given row? , when "save" button clicked, content updated/refreshed on grid row highlighted. something http://www.jtable.org/ . don't want fix jtable , angular js together. anyone please help? thanks & regards tin you can adding column template here working fiddle i have hide , show div, giving id can give pop of jquery $scope.gridoptions = { data: 'mydata', enablepaging: true, columndefs: [{field: 'id', displayname: 'id', enablecelledit: false, colfiltertext: ''}, {field:'name', displayname:'name', enablecelledit: true, colfiltertext: '' }, {field:'edit', displayname:'edit', enablecelledit: true, celltemplate: editcontactc...

matlab - Undefined function 'eq' for input arguments of type 'cell' -

i tried make function generates number of strings. function [p] = getpattern (v) load('code128b.mat') a=1:length(code128b) if v == code128b(a,1) p=code128b{a,3}; end end code128b.mat contains data, first column numbers while third column strings. want input numbers , produce string. why function produce error: undefined function 'eq' input arguments of type 'cell'.? don't it. thanks help. for cell arrays, curly braces ( {} ) used extract contents of cells, while parentheses ( () ) used extract subset of cells (that is, result cell array). use code128b{a,1} instead of code128b(a,1) number instead of cell containing number. however, if v cell have use isequal compare contents.

angularjs - Cell template with filter in ng-grid -

i created cell template depends on filter, filter not processed. the cell defined {field:'status', displayname:'status', celltemplate: 'cell/statuscelltemplate.html'}] template is <button class="btn btn-primary" ng-click="changestatus(row.getproperty('id'),'{{row.getproperty(col.field) || switchstatus}}')">{{row.getproperty(col.field)}}</button> edit myapp.filter('switchstatus', function() { return function(input) { return (input == 'stopped') ? 'started' : 'stopped'; }; }); the rendered cell <button class="btn btn-primary ng-scope ng-binding" ng-click="changestatus(row.getproperty('id'),'stopped')">stopped</button> . expect started second parameter. plunker : when clicking on stopped, current status should started where data come from? think meant check if input 'stopped' or 'sta...

c# - Using a pre-existing PHP script to upload images to a server -

i'm creating winform application need upload image files central image server. before this, there pre-existing php script has been written allow images uploaded server via web portal. i've been told can make program access php script , use functionality. how possible? so far i've tried following lines of code: iphostentry iphostinfo = system.net.dns.gethostentry("http://scriptlocation.html"); ipaddress ipaddress = iphostinfo.addresslist[0]; using (tcpclient client = new tcpclient()) { client.connect(ipaddress, 21); client.sendtimeout = 3000; var status = client.connected; lblstatus.text = status.tostring(); console.writeline(status); } but when run following error; no such host known i'm new network programming this, please point me in right direction? if understand correctly trying send file http. consider using webclient: using(var wc = new webclient()) { wc.uploaddata("http://scriptlocation.html...

In programming, what is an expression? -

i've googled question, , searched on so, can't seem straight answer. is question basic no-one has thought ask yet? can please explain "expression" in programming. also program in javascript, if definition varies in js please highlight difference? in javascript: "an expression valid unit of code resolves value. conceptually, there 2 types of expressions: assign value variable , have value. expression x = 7 example of first type. expression uses = operator assign value 7 variable x. expression evaluates seven. code 3 + 4 example of second expression type. expression uses + operator add 3 , 4 without assigning result, seven, variable. javascript has following expression categories: arithmetic: evaluates number, example 3.14159. (generally uses arithmetic operators.) string: evaluates character string, example, "fred" or "234". (generally uses string operators.) logical: evaluates true or false. (often involves logical o...

ruby - Rails 4 + Postgresql array type: Weird behavior when saving record, can't cast array -

so, i'm having following setup in rails 4 postgresql # migration create_table :custom_category_groups |t| t.string :name t.string :content_types, array: true, default: [] end # controller class customcategorycontroller < applicationcontroller # ... def update @custom_category_group = customcategorygroup.new(custom_category_group_params) if @custom_category_group.update(custom_category_group_params) # ... end end private def custom_category_group_params params.require(:custom_category_group).permit(:name, content_types: []) end end # view = form_for @custom_category_group |f| = f.collection_check_boxes :content_types, %w(interviews testimonials blogs).map { |ct| [ ct.titleize, ct ] }, :last, :first when i'm saving custom category group following error: typeerror - can't cast array when take in log see following db statement being issued: update "custom_category_groups" set "content_types" = $1, ...

How to set image metadata with python API 0.11.0 in openstack grizzly? -

i work devstack -grizzly installation. add image metadata [see code] using openstack python api . i use glance.images.create , provide metadata properties argument. unfortunately, created image has no metadata (properties). image.get prints none . import keystoneclient.v2_0.client ksclient import glanceclient keystone = ksclient.client(auth_url=credentials['auth-url'], username=credentials['username'], password=credentials['password'], tenant_name=credentials['tenant']) glance_endpoint = keystone.service_catalog.url_for(service_type='image', endpoint_type='publicurl') glance = glanceclient.client('1',glance_endpoint, token=keystone.auth_token) image_name="test-cirros" image_file="cirros.img" open( image_file ) fimage: image = glance.images.create(name=image_name, is_public=true, disk_format="qcow2", c...

php - Alexa Rank to Traffic Estimation Formula -

anybody have idea how can convert alexa rank estimate daily visitors of website. previous can alexa site reach percentage alexa reach no more available. previous using forumula $visitors = (200000000*$reach)/100 how can estimate alexa rank? this article contains more precise formula , online converter "alexa rank -> monthly traffic" - http://netberry.co.uk/alexa-rank-explained.htm monthly visitors = 104,943,144,672 x alexarank ^ -1.008

javascript - Manual SVG text rendering using svg.js + glyphs pulled from SVG font -

i working on project have create design assets dynamically in browser. past few months have been using canvas this, being asked if can create vector based assets directly client. after investigating html5 svg, seems might able this, , after playing around raphael.js , svg.js, decided svg.js better. more lightweight, , < ie9 support not issue me. my main concern using svg have render text svg's, , have text vector based , available in final asset. not this, need able measure text's bounding area (to nearest pixel). in see 2 problems: just using standard draw.text() call create <text> element no means must bundle font asset, not possible due licensing reasons. calling text.bbox() bounding area of text element inaccurate when comes height. believe returns height tallest/lowest characters in font rather characters being used, getclientrect() standard html elements. i see solution solve these problems, , looking advice: i believe manually render glyphs ...

c++ - How to create a variable size char array in VC++ -

const int sizea = 600; char sz[sizea]; above code works fine. below code segment cause errors. i'm working on visual studio 2005 - mfc application cstring strfinal; .......//strfinal value dynamically changing . . const int size = strfinal.getlength(); char sz[size]; error 2 error c2057: expected constant expression error 5 error c2070: 'char []': illegal sizeof operand error 4 error c2133: 'sz' : unknown size error 3 error c2466: cannot allocate array of constant size 0 in current version of c++, arrays must have fixed size, specified compile-time constant. if need use run-time value, options are: most portably, use dynamic array class such std::string or std::vector<char> ; use compiler supports c99 variable-length arrays non-standard extension; wait year dynamic arrays (hopefully) introduced in c++14 (and perhaps wait bit longer compiler vendor catch up).

PHP: a way to check user login other than sessions -

i building website , using sessions check user login. wondering if there better , safer way check user login. because sessions stored in clients computer think not safe , easy hack. correct?how big websites facebook , twitter check if user logged in or not. new php dont question basic. sessions way go here. no matter use authentication, if client computer compromised, client's method of authentication can abused. in regard, other way can safe sessions are. all big sites use sessions, in conjunction cookies.

javascript - How to query for objects stored in an array in a mongoDB -

i have following nested object stored in mongodb: var appointment = new schema ({ students: [{user1:string,user2:string, _id: false}], }); i want query appointments studentname stored in array students either in user1 or user2. have no idea how achieve that? if array use: appointment.find({ students: {$in: [studentname]} }, function(err, appointmentsdb) { // }); you can use $or operator , dot notation this: appointment.find({ $or: [ { 'students.user1': studentname }, { 'students.user2': studentname } ]}, callback);

mysql use the selected variable in the same query -

i have table 'booking_summary' stores type of method (method = air or sea). have join table 1 of 2 other tables depending on method column. if method air,then table join booking_air,if sea booking_sea. not want run multiple queries on particular page. this latest attempt,that has failed.the table_name alias table want in same query. $sql = "select case when a.shipping_method = 'sea' 'booking_sea' else 'booking_air' end 'table_name', case when a.user_id ='$active_id' 'y' else 'no' end 'generate_access', case when c.mbl null 'pending' else c.mbl end 'mbl_status', case when c.hbl null 'pending' else c.hbl end 'hbl_status', a.*,b.user_name booking_summary left join registered_users b on a.user_id = b.user_id left join table_name c ...

javascript - Redirecting Based on user-agent -

i redirect unwanted request pages url i example.com/garbage-value request on server in bulk 2000+ every day request have no user agent in , shows in analytics so want stop them,i thought possible way redirect them. the site made in asp can implement in asp or javascript or there other way so. i thinking of did not worked //for iphone/ipod site: if ((navigator.useragent.indexof('iphone') != -1) || (navigator.useragent.indexof('ipod') != -1)) { document.location = "http://url.com/iphone/"; } ---------------------------------------- //for ipad site: if ( (navigator.useragent.indexof('ipad') != -1)) { document.location = "http://url.com/ipad/"; }

TFS 2012 error TF400422 when exporting to Excel -

i have installed microsoft visual studio professional 2012 (v11.0.060610.01 update 3) , have office professional plus 2010 installed in windows 7 enterprise (with sp1) 64-bit operating system. since weeks ago everytime try export in result of work items' query (through "open query in microsoft excel" option) get: microsoft visual studio team foundation error tf400422: failed open in microsoft excel: error loading type library/dll. (exception hresult: 0x80029c4a (type_e_cantloadlibrary)) anyone knows how solve problem? i tried repair , reinstall "visual studio 2010 tools office". solution proposed in export excel in tfs 2012, error code: tf400422 not work me. any appreciated! thanks i believe because tfs 2012/2013 don't work 64-bit version of office

xslt processing on select attribute on apply-templates -

i have xslt below , apply xslt input xml[pasted below], working fine except 1 thing need clarify. this input xml <test> <experiment id='1'> <dish1> <conditions pressure='x' temp='y'/> <measurement timestamp='8am' reading='y'/> </dish1> <dish2> <conditions pressure='x' temp='y'/> <measurement timestamp='8am' reading='y'/> </dish2> <dish1> <conditions pressure='x' temp='y'/> <measurement timestamp='2pm' reading='y'/> </dish1> <dish2> <conditions pressure='x' temp='y'/> <measurement timestamp='2pm' reading='y'/> </dish2> </experiment> <experiment id='2'> <dish1> <conditions pressure='x' temp='y'/...

linux - echo the type of terminal being ran -

i'm trying echo type of current terminal being ran. instance if running konsole echo konsole. i've tried running echo $term but prints out xterm every time. there better , more accurate way of doing this? pstree can help. $ pstree -s $$ init───gnome-terminal───bash───pstree the -s option shows parents of specified process. in bash (and bourne-shell variants), $$ denotes pid of current shell. another invocation (while running xterm returns): $ pstree -s $$ init───xterm───bash───pstree specifying -a option makes pstree use ascii characters can parse output easily: $ pstree -a -s $$ init---gnome-terminal---bash---pstree

ruby on rails - Polymorphic and non-polymorphic associations on the same model -

i have log model polymorphic association , association user model: class log < activerecord::base belongs_to :loggable, polymorphic: true belongs_to :user end in user model, have has_many association log model: class user < activerecord::base has_many :logs end i want have association in user model follows: class user < activerecord::base has_many :logs has_many :logs, as: :loggable end but imagine 2 associations conflict each other (i don't know, didn't try)... so right approach problem? or there better way of doing it? how renaming 1 of associations this: class user < activerecord::base has_many :user_logs, class_name: 'log' has_many :logs, as: :loggable end to fetch logs associated given user, set scope on log model this: class log < activerecord::base belongs_to :loggable, polymorphic: true belongs_to :user scope :for_user, lambda { |user| where('user_id = :user_id or (loggable_type = ...

doctrine - Symfony 2 form manipulate db query -

i'm having troubles implementing relational database schema symfony 2.3.2 , doctrine. thats's structure: details table has 1 many relation seasons table details table has 1 many relation episodes table episodes table has many 1 relation seasons table when symfony renders episode form, it's including choice field seasons table, doesn't take care details seasons relationship defines seasons matching detail. see http://fpaste.org/34835/ 4 sources what cleanest way fix that?

Change sender's address in mutt via console -

i want dynamically set sender's address when using mutt via console (not composing). checked described, tried this question nothing works. there no change @ all, no matter do. set set from="sender@help.me" set edit_headers=yes in both /etc/muttrc , ~/.muttrc, also, tried sort of -e commands, like -e "set from=email@example.com" -e 'my_hdr from:sender@help.me' -e "send-hook . 'my_hdr from: other name <otheremail\@example.com>'" having export email=sender@help.me in front but receive mails username@compname.de a typical call looks this export email="sender@help.me" && echo | mutt -s "versandtest" -c "mycc@help.me" -e 'my_hdr from:sender@help.me' -a /opt/data/yolodat.txt /opt/data/trolodat.txt -- "myaddress@help.me" < /tmp/mailbody any more ideas appreciated this works me: export email="name <from@address.com>"; echo "tes...

excel - Find text from another column and replace them with adjacent values -

for example: column column b column f column g 50 61 50 1.9 63 69 61 0 72 74 63 1.8 69 1.96 72 2.1 74 2.5 column g has values of column f. i want find text in columns , b using text in column f , replace using text in column g result: column column b column f column g 1.9 0 50 1.9 1.8 1.96 61 0 2.1 2.5 63 1.8 69 1.96 72 2.1 74 2.5 assuming cells numbers (as shown in example), convert them 'text' 'number' format. then: type on c1: =vlookup(a1,$f$1:$g$6,2,0) type...

css - How Do I Get iFrames Side-by-Side? -

i need pull web page our vbulletin site webpage inform our community our servers status. basically, need use iframes. have them in there cant them side side. i've hunted on internet , comments have read not it. here code have work with: <center> <iframe src="http://cache.www.gametracker.com/components/html0/?host=63.251.20.99:6820&bgcolor=16100d&fontcolor=b9946d&titlebgcolor=150c08&titlecolor=b9946d&bordercolor=000000&linkcolor=ffff99&borderlinkcolor=ffffff&showmap=0&currentplayersheight=350&showcurrplayers=1&showtopplayers=0&showblogs=0&width=180" frameborder="0" scrolling="no" width="100%" height="512"> </iframe> <iframe src="http://cache.www.gametracker.com/components/html0/?host=74.91.116.62:27015&bgcolor=16100d&fontcolor=b9946d&titlebgcolor=150c08&titlecolor=b9946d&bordercolor=000000&linkcolor=ffff99&borderlinkcolor...

entity framework - Mapping one DTO to multiple entities -

i have db model following. here describe entities have in ef model: public class person { public int id { get; set; } public int addressid { get; set; } public int roleid { get; set; } public string name { get; set; } public string email { get; set; } } public class address { public int id { get; set; } public int countryid { get;set; } public string city { get; set; } } public class role { public int id { get; set; } public string name { get; set; } } public class country { public int id { get; set; } public string name { get; set; } } on front end have management interface allowing edit user info. so, in each of grid lines show following dto object: public class systemuser { public string username { get; set; } public string email { get; set; } public string city { get; set; } public string country { get; set; } public string rol...

php - Filter Google Maps map with a dropdown menu -

i have google maps map generated database table. filter marker of 2 selections: regione , provincia, made in ajax. my page: <head> <script type="text/javascript" src="jquery-1.3.2.js"></script> <script type="text/javascript"> jquery(document).ready(function() { jquery('#sel_regione').change(function(){ var cont = jquery('#sel_regione').attr('value'); jquery.post("selection.php", {regione_id:cont}, function(data){ jquery("#sel_provincia").empty(); jquery("div#result").empty(); jquery("#sel_provincia").prepend(data); }); }); jquery('#sel_provincia').change(function(){ var id_naz = jquery('#sel_provincia').attr('value'); jquery.post("result.php", {provincia_id:id_naz}, function(data){ jquery("div#r...