Posts

Showing posts from June, 2011

c# - Return different model on partial view -

i'm having trouble returning viewbag list of model partialview, different type of model parentview, wish render result, inside partial view rendered on parent view. perhaps looking @ code, give better understanding. here controller: public actionresult search() { //viewbag.usuarios = db.user.tolist(); return view(); } [httpget] public actionresult pesquisar(userfilter userfilter) { list<usermodel> retorno = new list<usermodel>(); viewbag.mensagem = "não foi encontrado registro com os filtros informados"; if (userfilter.name != null) { retorno = db.user.where(x => x.name.contains(userfilter.name)).tolist(); if (retorno != null) { viewbag.usuarios = retorno; return partialview("search", viewbag.usuarios); } return view("search", viewbag.mensagem); } if (userfilter.userid != ...

Relative path in Xlwings Pythonpath -

is possible reference python code in parent folder of current folder this: pythonpath = "../../python_code" it won't work on computer. objective avoid hard coded paths. indeed, can set so: pythonpath = thisworkbook.path & "/.." you might need @ least v0.7.0 though.

python - Reordering numpy array -

i have following numpy array: arr = np.array([0.3, 3.5, 12.0, 2.9, 11.0, 23.0]) i want reorder array starts @ 4th position, followed items after start position in order, followed items before start position. i.e. [2.9, 11.0, 23.0, 0.3, 3.5, 12.0] how can without loop? try np.roll(arr, -3) negative since want "move" elements left

c++ - Interrupt arduino routine to run a slow delay based process -

i have arduino data collection , sends esp8266 on serial. serial communication esp not quick may know , depends on lot of waiting. have button , want stop data collection or sending , have open door. door opening takes 30 seconds. what's best way this? not full code, goes below. of course doesn't work because can't use while or delay in isr, don't know how restructure it. attachinterrupt(4 , openadoor, falling); void loop(){ gathersomedata(); senddatatoesp(); if(wait_for_esp_response(2000,"ok")) lightgreenled(); else lightredled(); } byte wait_for_esp_response(int timeout, const char* term) { unsigned long t = millis(); bool found = false; int = 0; int len = strlen(term); while (millis() < t + timeout) { if (serial2.available()) { buffer[i++] = serial2.read(); if (i >= len) { if (strncmp(buffer + - len, term, len) == 0) { found = true; break; } } } } buffe...

How to access elements of a pair set in C++ -

i have set. of form set<pair<string,int> > stockset want find if above set has entry given string first element. find value of 2nd part of pair, int given first element of pair string . i know how map , single element set. unable figure out how this, need syntax. you can't figure out because can't this. the elements in set "complete" elements. because see std::pair in there, , think set contains 2 elements, doesn't mean is. set contains std::pair , single, complete, element. if have std::pair , somewhere, can search set see if there's equivalent pair in there. if have half of object set contains, can't it. the options see here are: iterate on set manually, until or not find you're looking for. if there's minimum int value expect in there, can use lower_bound() , passing std::pair minimum value int portion, , string you're search for, , see lower_bound() digs up. perhaps reconsider decision use std::s...

c++ - Overloaded Operator not working properly? -

i getting error when compile program , unsure how fix appropriate function solve problem. post main, header, , cpp file below desired outcome following. help/tips appreciated, thank you! error get: error c2679 binary '+=': no operator found takes right-hand operand of type 'double' updated: have fixed code update "=" operator overload , working except 1 line of output. this output: a: no name: $0.00 b: saving: $10000.99 c: checking: $100.99 a: no name: $10101.98 b: saving: $10000.99 c: checking: $100.99 a: joint: $0.00 b: saving: $10000.99 c: checking: $100.99 a: saving: $10101.98 b: saving: $10101.98 c: checking: $100.99 a: saving: $10302.98 b: saving: $10302.98 c: checking: $201.00 for reason "joint" balance comes 0 , unsure why. should show $10101.98 the main: #include <iostream> #include "account.h" using namespace std; void displayabc(const account& a, const ac...

maven - Jenkins SSH Plugin - Execute different shell script commands depending on task (build/release) - environment variable -

using same jenkins job, there way configure jenkins ssh plugin execute different commands depending on: the task type: maven build/release an environment variable mvn clean install -denvironment=dev i worked out first option (the execution of different commands depending on build type - build vs release) we need following plugins : readonly parameter plugin : pass read parameter (environment=pro) when launching release. environment injector plugin : pass hidden parameter (environment=dev) when building. release plugin job configuration : execution environment -> configure release build override build parameters checked string parameter release_version string parameter development_version readonly string parameter environment - pro inject environment variables build process checked properties content environment=dev post steps: can access declared variable (environment) in shell script. for instance: if [ "$environment" = "dev...

java - IllegalArgumentException: Invalid conditional statement inside expectation block -

i have problem expectations block have written in test case: new expectations() { { mfindhandlermock.findall((model) any, (set<id>) any, false); if (!pwithrealdata) { result = collections.emptyset(); } else { result = palldata; } times = 1; deencapsulation.invoke(mdb, "readsqlquery", withany(string.class)); result = "select * realdata"; times = 1; } }; the test case crashes with: java.lang.illegalargumentexception: invalid conditional statement inside expectation block exactly here: if (!pwithrealdata) { it's simple boolean false in case. i have absolutly no clue why exception happens. searched google found nothing helpful. could me? from jmockit release notes version 1.14: enhancement: conditionals , loops trigger exception when found inside expectation recording block, prevent api misuse , encourage simpler tests. see...

Namespace indentation in Visual Studio with C# -

visual studio indents code within namespace. can avoided when disabling indentation globally, not want. in other cases, indentation fine, don't fact code 1 level - makes ugly me. namespace x { public class {} } i prefer this: namespace x { public class { } } in c++, there's nice workaround explained here : namespace x {; // ; after opening brace makes visual studio not indent class below. class {}; } but in c#, namespace cannot directly contain fields doesn't work. how can visual studio stop indenting namespaces without disabling indentation globally? update visual studio 2013 behavior c++ has changed tools->options->c/c++->formatting->indentation: [ ] indent namespace contents enables preferred formatting, while {; trick doesn't work anymore. no change c# find. text editor → c# → tabs → indenting — set "block" text editor → c# → formatting → general — turn off every checkbox saying "automaticall...

how to open multiple activity in android -

i showing images in view pager button. trying open different activity each image when click on it. package com.union.pr26; import android.app.activity; import android.content.intent; import android.os.bundle; import android.support.v4.view.viewpager; import android.view.view; import java.util.arraylist; public class mainactivity extends activity { viewpager viewpager; customeswipeadapter adapter; arraylist<class>list=new arraylist<class>(); list.add(class(main2activity.class)) @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); viewpager=(viewpager)findviewbyid(r.id.viewpager); adapter=new customeswipeadapter(this); viewpager.setadapter(adapter); } public void activity(view v){ class activityclass=list.get(1); intent intent =new intent(this,activityclass); ...

c# - Creating a very simply Shipping Calculator -

so have create simple sales calculator, have got gui made far , here code far. private void button1_click(object sender, eventargs e) { //to hold data double weight; double zone; double weightcost; //validate data if (double.tryparse(textbox_weight.text, out weight) && double.tryparse(textbox_zone.text, out zone)) { } so far @ moment want assume shipping price $5.25. zones, need program recognize whether or not zone x, y, or z entered, if 1 of not entered need sort of error message display. zone x, $14.75 zone cost, y $16.15 , zone z $50.95. want display information in 3 labels, being label_weightcost label_zonecost , label_totalcost, though don't quite know how display information labels after doing calculations. calculations quite easy, being weightcost = weight * 5.25 zonecost = zone ( need know how have program recognize whether or not zone x, y or z , equal $14.75 $16.15...

c++ - Is delete[] equal to delete? -

ip_adapter_info *ptr=new ip_adapter_info[100]; if free using delete ptr; will lead memory leak, if not why ? this disassembly code generated vs2005 ; delete ptr; 0041351d mov eax,dword ptr [ptr] 00413520 mov dword ptr [ebp-0ech],eax 00413526 mov ecx,dword ptr [ebp-0ech] 0041352c push ecx 0041352d call operator delete (4111dbh) 00413532 add esp,4 ; delete []ptr; 00413535 mov eax,dword ptr [ptr] 00413538 mov dword ptr [ebp-0e0h],eax 0041353e mov ecx,dword ptr [ebp-0e0h] 00413544 push ecx 00413545 call operator delete[] (4111e5h) 0041354a add esp,4 whether leads memory leak, wipes hard disk, gets pregnant, makes nasty nasal demons chasing around apartment, or lets work fine no apparent problems, undefined. might way 1 compiler, , change another, change new compiler version, each new compilation, moon phases, mood, or depending on number of neutrinos...

reactjs - Is the call to super(props) in an ES6 class important? -

suppose i've following class: class tabs extends react.component { displayname: tabs; static proptypes = { selected: react.proptypes.number, children: react.proptypes.oneoftype([ react.proptypes.array, react.proptypes.element ]).isrequired }; constructor() { super(); this.state = { selected: 0, maxselected: 0 }; render() { return( <div> {this.props.selected} {this.props.children} </div> ); } }; i want know if passing following constructor important: constructor(props) { super(props); } my current code works fine wanted know if practice. according ben alpert react team it's necessary pass props constructor if intend on using this.props inside constructor. after constructor invoked, react attaches props component outside.

java - Can't add more than one record, ID not autoincrimenting -

i'm trying add site details database , after insert row, output result textview. record being inserted database because it's being shown in textview, can insert 1 record , i'm not sure why. i'm been using tutorial here , modifying meet needs. here dbadapter: public class dbadapter { // /////////////////////////////////////////////////////////////////// // constants & data // /////////////////////////////////////////////////////////////////// // logging: private static final string tag = "dbadapter"; // db fields public static final string key_rowid = "_id"; public static final int col_rowid = 0; /* * change 1: */ // todo: setup fields here: public static final string key_name = "name"; public static final string key_address = "address"; public static final string key_username = "username"; public static final string key_password = "pass...

How do I overload two different I/O operator in C++ -

i have class this: myclass { public: int a; unsigned char b,c,d; size_t e,f; double g, h; friend ostream& operator<< (ostream& os, const myclass& mc) { os<<mc.a<<mc.b<<mc.c<<mc.d<<mc.e<<mc.f<<mc.g<<mc.h; return os; } }; i have overloaded << operator, want << case, how can overloaded 2 different << operator? i thought this: myclass { public: int a; unsigned char b,c,d; size_t e,f; double g, h; friend ostream& operator<< (ostream& os, const myclass& mc, int type) { if(type==1){ os<<mc.a<<mc.b<<mc.c<<mc.d<<mc.e<<mc.f<<mc.g<<mc.h; return os; } else if(type==2){ os<<mc.a<<mc.c<<mc.d<<mc.e<<mc.g; return os; } }; but didn't work, too many arguments operator function . ...

if statement - Is it possible to use a List in Google Sheets via the OR() function during a comparison (test)? -

specifically in regards conditional formatting, applicable in broader scope of if() tests within google sheets... can compare using =if(a1=or("yes","y","yes")) , achieve same result =if(or(a1="yes"),(a1="y"),(a1="yes")) ? know both expressions simplified removing leading if() , since i'm desiring use information in context of conditional formatting. i know above 2 statements not evaluate identically. there different (and simpler) syntax verbose or(<full-expression>,<full-expression>,etc...) , or stuck that? well, little more searching under different question yielded answer one: regexmatch() . =regexmatch(a1,"yes|y|yes") evaluates same =if(or(a1="yes"),(a1="y"),(a1="yes")) . note: per above-linked page, google products use re2 regular expressions.

c# - xsd.exe converts unsignedShort to byte -

i'm using xsd.exe generate class schema. schema defines 1 attribute xs:unsignedshort. <xs:attribute name="number" type="xs:unsignedshort" use="required"/> in generated class gets defined 1 single byte. private byte numberfield; i need parse number string , assign field value. how can achieve this?

android - Telephone with OpenTok -

we developing voip app , want switch tokbox library. ours telephone app viber specific audience. need app behave telephone app. user makes call, receiver hears phone ringing, picks call , hangs when done talking. find lot of resources on tokbox online (for android , ios) couldn't find info on telephone library. can point me right direction or explain things little bit. thanks in advance. to implement mobile telephony app (like viber) user calls user b need couple of pieces in addition tokbox platform. first need make use of standard apple&google push notifications initiate call b. example can use google's service [1]. typically send http request server initiate call b , server use google api send push notification b. at same time server should generate tokbox sessionid call , send sessionid , token user a. user can use them connect tokbox session , start publishing while waiting b join it. when b receives notification can alert user (ringing ton...

c# - How Do I Open Paint Maximized with a File -

i'm trying open mspaint maximized , open file @ same time. know how open file paint , view image, can't manage open paint image , having paint maximized. here code: static void butten1(object sender, eventargs e) { processstartinfo info = new processstartinfo() { filename = "mspaint.exe", windowstyle = processwindowstyle.maximized }; process.start(info); } pass in file name parameter. var filepath = @"c:\icon.png"; processstartinfo info = new processstartinfo() { filename = "mspaint.exe", windowstyle = processwindowstyle.maximized, arguments = filepath }; process.start(info); note works because paint interprets first parameter file open. means solution work paint , other apps try open what's passed in first parameter.

java - Realm access from incorrect thread Exception while a copy was sent using copyFromRealm -

when streaming copy of realm objects instead of realm reference , observing on schedulers.io thread, there crash famous exception message "realm access incorrect thread. realm objects can accessed in thread created." shouldn't copy thread free? can produce 1 thread , process on different thread? this how creating observable. public observable<brand> getallbrands() { return realm.where(brand.class) .findall() .asobservable() .flatmap(observable::from) .map(brand -> realm.copyfromrealm(brand)); } following how observe getallbrands(). observable<brand> brandobservable = datamanager.getallbrands(); brandobservable.observeon(androidschedulers.mainthread()) .subscribeon(schedulers.io()) .subscribe(new observer<brand>() { @override public void oncompleted() { log.d("reactive", "completed"); ...

How to generate a pie chart from 2 string values in asp.net c# -

Image
i have 2 columns id , severity , both of datatype string in database table severity column having high, medium , low values. added chart control , specified data using sql data source i'm unable output y coordinate values should of integer type. need generate chart below every severity level having percentage value: code: private void getchartdata() { string cs = configurationmanager.connectionstrings["constr"].connectionstring; datatable dt = new datatable(); using (sqlconnection con = new sqlconnection(cs)) { con.open(); sqlcommand cmd = new sqlcommand("select id, severity amd", con); sqldataadapter da = new sqldataadapter(cmd); da.fill(dt); con.close(); } chart1.series[0].xvaluemember = "severity"; chart1.series[0].yvaluemembers = "id"; chart1...

How to get timezone name in different language C# on Azure -

i getting timezone using string timezonename = "indian standard time"; var tz = timezoneinfo.findsystemtimezonebyid(timezonename); it returning desired value in english if change current culture , testing code on azure (web app service). please me find way in can code return value in different language arabic, french, etc. this because not dealing name, id. timezoneinfo.findsystemtimezonebyid read method name. not "by name" "by id". id meant same across languages. what can go across timezones , compared names (display name) likely, take 1 want. names localized: https://msdn.microsoft.com/en-us/library/system.timezoneinfo.displayname(v=vs.110).aspx the display name localized based on culture installed windows operating system. but id not never ever change. on purpose.

laravel - Store SMS template in database and render it later -

i need store sms template in database. hello, {{ $username }} . apparently it'd solution use blade templates here. how can retrieve sms template database , compile variables? same way views when rendering blade templates instead render database? one simple way create temp view file everytime want send sms template $templatefromdatabase = 'hi, {{$username}}'; $tempfilepath = time().'.blade.php'; file::put($tempfilepath, $templatefromdatabase); //render view $html = view::make($tempfilepath,['username'=>'my name']);

c# - Internet explorer url issue with special characters -

i'm trying fix bug on website , issue ie (all versions). bug following: i have page display document according code. but when code contains special charachters "ü" internet explorer want download rather display it. in case it's picture can pdf or browser can display itself. the url working others browsers... https://example.com/getdocument?codedocument=testüblabla thank reading :) i same issue, can try that: url = httputility.urlencode(url, encoding.utf8);

python - Django - Getting POST data from list within a list in a form -

trying figure out elegant way accurately post data form in django input fields dynamically created user. i haven't quite coded i'll try describe sufficient detail: the form follows below models. class address(models.model): title = models.charfield(max_length=200) instructions = models.textfield() date_time_added = models.datetimefield(auto_now=true, null=true, blank=true) class contact(models.model): address = models.manytomanyfield(stop, through='address_contact') first_name = models.charfield(max_length=100) last_name = models.charfield(max_length=100) phone_num = models.charfield(max_length=20, default='') email = models.charfield(max_length=50, default='') company = models.charfield(max_length=30, default='') date_time_added = models.datetimefield(auto_now=true, null=true, blank=true) class address_contact(models.model): address = models.foreignkey(address, on_delete=models.cascade) contact = models.foreignkey(contact, on_delete=...

c++11 - Why constexpr data members are not implicitly static? -

if this: constexpr int len = 100; len variable defined const without need of typing const keyword. have static storage, without need type static keyword. from other hand, if same in class : struct a{ constexpr static int size = 100; }; size still defined const without need of typing const keyword, however size not static data member. need type static explicitly. if don't there compilation error. question is: reason of need explicitly type static ? constexpr should not imply static , because having constexpr without static makes sense. consider: #include <iostream> struct dim { constexpr dim(int a,int b) : a(a), b(b) {} constexpr int prod() const { return a*b; } int a,b; }; int main() { constexpr dim sz(3,4); int arr[ sz.prod() ]; std::cout << sizeof(arr) << std::endl; } it should not imply static outside of class definition since static there means 'local translation unit' , cons...

android - ShareLinkContent has small image -

Image
i'm getting problem sharelinkcontent. . shared pic below through app. have problem size of image main image i shared pic through app, shared post display but want display post based on what? can result him. why such small image result in sharing? sharelinkcontent linkcontent = new sharelinkcontent.builder() .setimageurl(uri.parse(post_image_url)) .setcontenttitle(party.gettitle() + " - " + utility.convertdbdateforpartydisplayformat(party.getdate_time_start())) .setcontentdescription(post.getmessage() + " - " + post.getnick_name() + " \n@ " + party.getstore_name()) .setcontenturl(uri.parse(urlmanager.facebook_app_link + "?type=past_party&id=" + party_id)) .build(); sharedialog.show(linkcontent); read image sizes best practices faceb...

debugging - Print Line Number in Matlab -

i have matlab function runs few thousands of lines of code. under condition, breaking. can well, debug code , run step-by-step. so, have try, catch block in matlab handle error. in addition this, possible capture, line number of code well. for example : try error here <----- catch err disp(['error occured on line no ' num2str(lineno]) end any idea, how can implemented ? try this. print out line numbers along full stack. try %some code; catch exc getreport(exc, 'extended') end

rust - Access to self from the parameters of a macro that creates a struct -

i'm trying write macro generates struct. implementation struct generated macro, blocks of code provided macro arguments. here minimal example of such macro: macro_rules! make_struct { ($name:ident $block:block) => { struct $name { foo: i32, } impl $name { fn new() -> self { $name { foo: 42 } } fn act (&self) { $block } } }; } and here example of how macro can used: fn main() { // works make_struct!(test { println! ("bar: {:?}", 24); }); let test = test::new(); test.act(); } i give access self inside supplied code. like: fn main() { // not work make_struct!(test { println! ("foo: {:?}", self.foo); }); let test = test::new(); test.act(); } i understand not work because of macro hygiene rules. specifically, self.foo expression evaluated in syntax context of main function, se...

javascript - Strange behavior of jquery.hotkeys -

although subject of keyboard shortcuts has been treated here often, cannot account following. 1) put jquery dialog function statements () { /* initialization */ $.ajax ({ url: '/comeandgo/movements/statements.php', type: "get", datatype: 'html', async: false, success: function (data) { $('#maincontainer').html(data); }, error: function () { alert("error"); } }); $("#dlg_statements").dialog( { title:"statements", height: 560, width: 600, modal: true, position: {my: "top", at: "top+60"}, buttons: [ { id: "bcancel", text: "dismiss", click: function () { $(this).dialog("close"); location.href = gpath + "homepage.php"; } ...

php - sitelink searchbox for opencart 2.0.3.1 -

hey using opencart 2.0.3.1 , want put schema.org markup in header of opencart site, pasted inside header.php (which can find in catalog/controller/common/header.php ) added schema.org markup below $data['scripts'] = $this->document->getscripts(); and added <?php if($sitelinks_search_box) echo $sitelinks_search_box; ?> below <base href="<?php echo $base; ?>" which in header.tpl catalog/view/theme/default/template/common/header.tpl but still not able schema.org source when view source! please help.

ElasticSearch: Labelling documents with matching search term -

i'm using elasticsearch 1.7 , in need of way label documents part of query_string query match. i've been experimenting highlighting, found gets bit messy cases. i'd love have document tagged matching search terms. here query i'm using: ( note ruby hash later gets encoded json ) { query: { query_string: { fields: ["title^10", "keywords^4", "content"], query: query_string, use_dis_max: false } }, size: 20, from: 0, sort: [ { pub_date: { order: :desc }}, { _score: { order: :desc }} ] } the query_string variable based off user followed topics , might this: "(the , walking , dead) or (iphone) or (video , games)" is there option can use documents returned have property matching search term the walking dead or (the , walking , dead) if you're ready switch using bool/should queries, can split match on each field , use named queries , in results you'll name o...

.net - Transfer data from remote server database into local database daily -

i have access (to-be-developed) web service can return data remote database. the consumer data windows/.net application needs insert data local database (not sql server). this syncing one-way -> server local database. local database can have more data (inserted locally through .net application) server database. how can achieve kind of data transfer? specific questions have now: what type of data should web service return ? how ask data web service not found in local database ? you should use windows services perform above task . can schedule windows service run once in day import data remote database server local server. you have write own logic determine data present @ local database , import data not present in local data store. have write logic in wndows service only.

c# - MonoMac Could Not Load Assembly or Dependency -

i have simple application built using monodevelop 3.0/xcode 4.0/.net 4.0 on os x 10.7 (lion). basically, have windows gui , mac gui application, , both share class library. class library simple (deliberately), , passes moma tests flying colors. os x gui runs on development os x machine, when create .pkg file , install on test os x machine, won't run @ all. have mono runtime installed on test machine -- runtime only, not sdk or monodevelop. application open, make call shared library, fails system.io.filenotfoundexception: not load file or assembly 'xxx' or 1 of dependencies. my shared library has following dependencies: system system.configuration system.core system.xml.linq system.data.datasetextensions microsoft.csharp system.data system.xml surely basic mono framework supports of these assemblies, right? missing? can't believe releasing simple application (via .pkg file, not appstore) difficult! please point me in right direction? thanks. ...

Azure Storage Blob Put SSL handshake error -

i have correctly formed url blob put operation, using shared access signature: http://xyz.blob.core.windows.net:80/container/blob_name?sv=2015-04-05&sr=b&sig=xtpl3m2wrwilarpojlnjlacpiws41%2bosfwittapgwie%3d&se=2016-03-07t06%3a00%3a59z&sp=w using fiddler's composer, able upload data (with "x-ms-blob-type: blockblob" header). however, when change url "https" -- put fails status code 502, , following message: [fiddler] connection 'xyz.blob.core.windows.net' failed. system.security.securityexception failed negotiate https connection server.fiddler.network.https> https handshake xyz.blob.core.windows.net (for #21) failed. system.io.ioexception handshake failed due unexpected packet format. it surely seems problem on azure's end. how resolved? p.s. in chrome, problem manifests "net::err_ssl_protocol_error". in edge, "xmlhttprequest: network error 0x80070005, access denied." doh! expli...

mysql - Eliminate duplicate records in rail where condition -

i trying fetch record has unique value .below output getting after using vouchernumber.where(:goodie=> 2917) [#<vouchernumber id: 559, vendor_id: 5, voucher_number: "1", trip_id: nil, expiry_date: "2016-03-23 18:30:00", goodie_id: 2917, status: "un", amount: #<bigdecimal:8f9b7f0,'0.122e3',9(36)>, created_at: "2016-03-04 11:37:22", updated_at: "2016-03-04 11:37:22">, #<vouchernumber id: 565, vendor_id: 5, voucher_number: "4", trip_id: nil, expiry_date: "2016-03-23 18:30:00", goodie_id: 2917, status: "un", amount: #<bigdecimal:8faf750,'0.122e3',9(36)>, created_at: "2016-03-04 11:37:22", updated_at: "2016-03-04 11:37:22">, #<vouchernumber id: 567, vendor_id: 11, voucher_number: "sss", trip_id: nil, expiry_date: "2016-03-22 18:30:00", goodie_id: 2917, status: "un", amount: #<bigdecimal:8fad7c0,'0.112e3...

trouble with contingency table in R -

i looked everywhere did not find answer question. having trouble makig contingency table. have data many columns, let 1, 2 , 3. in first column there let 100 different values, in second 20 , third column has 2 possible values: 0 , 1. first take data value 1 in column 3 (data<-data[column3==1,]). have around 20 different values in 1. column , 5 in 2. column. when contingency table size 100x20, not 20x5, , contains lot of zeros (they correspond combination of column1 , column2 has value 0 in column3). greatful every kind of help, thanks. just use table() function data after doing data<-data[column3==1,]) it might helpfull

android - Google maps does not play for some devices and the app crash -

i use code in order instantiate google map : map = ((mapfragment) getchildfragmentmanager().findfragmentbyid(r.id.map)); mmap = map.getmap(); mmap.setmylocationenabled(true); this use work fine many devices such nexus 5 , samsung galaxy s6 have tablet (sony xperia z3) , when try navigate fragment app crash logcat: fatal exception: main process: com.example.veriah.loneworker, pid: 20646 java.lang.nullpointerexception: attempt invoke virtual method 'void com.google.android.gms.maps.googlemap.setmylocationenabled(boolean)' on null object reference also have activated locations tablet. know why happening? thank in advance try solution : map.getmapasync(new onmapreadycallback() { @override public void onmapready(googlemap googlemap) { ...

count number of characters in image in php -

i have image contains text lines. want count number of characters or number of lines in image using php or jquery or javascript. please give me link or solution this. thanks phpocr phpocr simple optical character recognizer. works numbers default character support available custom templates. has features such as: - image upload - remote image url - html output type - plaintext output type - xml output type - easy create templates different fonts - jpg, png , gif support (with php/gd , gif2png libraries) works automated setups. found 2 helpful links - http://phpocr.sourceforge.net/ https://github.com/thiagoalessio/tesseract-ocr-for-php

windows - NLTK v3.2: Unable to nltk.pos_tag() -

hi text mining champions, i'm using anaconda nltk v3.2 on windows 10.(client's environment) when try pos tag, keep getting urllib2 error: urlerror: <urlopen error unknown url type: c> it seems urllib2 unable recognize windows paths? how can work around this? the command simple as: nltk.pos_tag(nltk.word_tokenize("hello world")) edit: there duplicate question, think answers obtained here manan , alvas better fix. edited this issue has been resolved nltk v3.2.1. upgrading nltk version resolve issue, e.g. pip install -u nltk . i faced same issue , error encountered follows; traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\site-packages\nltk-3.2-py2.7.egg\nltk\tag\__init__.py", line 110, in pos_tag tagger = perceptrontagger() file "c:\python27\lib\site-packages\nltk-3.2-py2.7.egg\nltk\tag\perceptron.py", line 141, in __init__ self.load(ap_mo...