Posts

Showing posts from September, 2015

android - Automated my builds -

i have multiple app , android project want automated in build , release sequence. have ant script build , create apk of app. want have 1 script or ant file start build sequence app. maybe don't konw search, can't find easy documentation on ant. the point of use jenkins ant (or maven, i'm not sure of difference between them now) automated build sequence when people commit on project. any int appreciated maven dependencies (over ant) don't need pass around jars. recommend maven on ant day. syntax , overall process easier understand, @ end of both build tools. if able to, more recommend upgrading gradle. easy create different build types , create them ./gradlew assemble here project jake wharton can see power of gradle. there release , debug build, can make lot more if like. https://github.com/jakewharton/u2020 here android docs gradle http://tools.android.com/tech-docs/new-build-system/user-guide . if can't find looking here, check out main grad...

laravel - Parse error: syntax error, unexpected T_STRING in /var/sites/s/example.co.uk/artisan on line 46 -

i'm trying create (laravel) migration on shell of production shared hosting server. in shell, run following: /usr/bin/php artisan migrate:make mydatabase and receive following error: warning: unexpected character in input: '\' (ascii=92) state=1 in /var/sites/s/example.co.uk/artisan on line 46 parse error: syntax error, unexpected t_string in /var/sites/s/example.co.uk/artisan on line 46 the error references line 46 $artisan = illuminate\console\application::start($app); it doesn't seem backslashes, part of original config? don't understand. furthermore, no matter try artisan /usr/bin/php artisan --version warning: unexpected character in input: '\' (ascii=92) state=1 in /var/sites/s/example.co.uk/artisan on line 46 parse error: syntax error, unexpected t_string in /var/sites/s/example.co.uk/artisan on line 46 what missing? check php version php -v , if it's less 5.3 should update because namespaces introduced in php 5...

html - JSTL c:if statement not working -

i want able send alert if query string exists, dont need know value returns, exists. i tried this, doesnt work: <% request.setattribute("appinfo", request.getparameter("appinfo")); %> <c:if test="${appinfo}"> <script> alert("${appinfo}"); </script> </c:if> i tried (with url being ?appinfo=88) , worked. <% request.setattribute("appinfo", request.getparameter("appinfo")); %> <c:if test="${appinfo == 88}"> <script> alert("${appinfo}"); </script> </c:if> i dont understand why solution 2 works 1 doesnt, ideas? c:if doesn't work javascript if, non-null values regarded "truthy". c:if need result true or false. can do <c:if test="${appinfo != null}"> to check if value there.

import com.google.android.gms.drive.model.File undefined Android -

i want use "webcontentlink" read data of publicly shared file other's google drive. since part of file package imported package in app. eclipse not recognizing import , giving error. added "google-api-java-client" library in eclipse. other package working fine except one(com.google.android.gms.drive.model.file). please me how fix sorry poor english.

jquery - Open lightbox link outside of iframe window -

i have iframe in photo links. i'm trying enable lightbox go parent display photos @ moment confined within iframe itself. i tried using <base target="_parent" works navigating links doesn't seem work lightbox. the lightbox using jquery based. nyromodal v2 :: jquery plugin . i have searched google , found 1 apparent solution on windows-addict.com doesn't work. switched the exact same lightbox using in example in case mistake on end. i'm pretty sure there simple explaination knows lightbox , iframes i've exhausted of ideas @ point! does know solution? edit code: this call in <head> : <!-- lightbox --> <link rel="stylesheet" href="http://static.tumblr.com/wlao44f/cdln5ocfk/nyromodal.css" type="text/css" media="screen" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <scri...

reporting services - Native SSRS user security -

in order allow users run ssrs reports in native mode, must add them users? right now, seems need have access report in ssrs report manager , access ssrs report server (being added user on server). have ad group can run reports, giving adding of them user on server seems overkill, if none of them ever log in. am missing something, or normal? generally, when deploy reports ssrs instance use "reportadmin" user secure password. set projects configurations deploy multiple servers. in setup ssrs servers have 2 window user accounts, "reportadmin" , "reportuser". 2 user added ssrs instances roles, 1 has admin rights , other view rights. clients report consumption use "reportuser" role.

ruby - Trying to reach rails app on shared server via subdomain, how? -

i trying run rails app (rails 4.0.0 , ruby 2.1.2p95) on shared server. app in "~/myapp" folder. had overcome problems runtime js. managed , able start app, without problems. rails s -p 12001 => booting webrick => rails 4.0.0 application starting in development on http://0.0.0.0:12001 => run `rails server -h` more startup options => ctrl-c shutdown server [2014-05-16 09:35:33] info webrick 1.3.1 [2014-05-16 09:35:33] info ruby 2.1.2 (2014-05-08) [x86_64-linux] [2014-05-16 09:35:33] info webrick::httpserver#start: pid=27965 port=12001 i able reach app , see working, if add in ~/public_html/.htaccess file rewriteengine on rewritecond %{http_host} ^mydomain.com$ [or] rewritecond %{http_host} ^www.mydomain.com$ rewriterule ^(.*)$ "http://0.0.0.0:12001%{request_uri}" [p,qsa,l] however redirects whole domain rails app. how subdomain? eg. mysubdomain.mydomain.com thanks :)

windows - what is keyboard shortcut to "select text between the cursor and the beginning of the document" -

for general knowledge: does know following keyboard shortcuts windows machine? learned them long long time @ beginning of learning , has forgotten now. how "select text between cursor , beginning of document" ? and, how "select text between cursor , end of document" ? helps highly appreciated. the keyboard shortcut above 2 be shift + ctrl + home and shift + ctrl + end reference these , many other shortcuts: http://www.w3schools.com/tags/ref_keyboardshortcuts.asp

git - Importing project from Github doesn't work in Aptana -

i try import project github in aptana via import project --> git repository new project . login using github credentials , lists repositories. choose repository import. but hangs on resolving deltas: (6/6), 100% done. i tried download git windows , point aptana git executable, doesn't change anything. edit: i found out similar happens when connect existing project github repo. when pushing or pulling, aptana hangs on launching delegate... . one workaround try first clone repo in command line (with git windows ) , import project in aptana. if clone doesn't work, need investigate (partially cloned), in blog post : check git fsck returns, instance, blog post suggests using git merge , adds in comments: since pack files have been downloaded correctly need interrupt process ctrl+c, git fetch fetch branch information remote repository , checkout master (or other) branch again git checkout master see if there proxy issue (like switching ntlm...

joomla2.5 - How to get full url of a article by it's ID in joomla? -

i have article id, how can valid full url of article? article associated menu might not know, there easy way in php url ? using joomla 3.2 tried following already. $article = controllerlegacy::getinstance('content')->getmodel('article')->getitem($article‌​id); jroute::_(contenthelperroute::getarticleroute($articleid,$article->catid)) you can use $article = jcontrollerlegacy::getinstance('content') ->getmodel('article')->getitem($articleid); $url = jroute::_(contenthelperroute::getarticleroute($articleid, $article->catid, $article->language))

angularjs - Filter in ng-options not working -

i have object maps ids objects. display list of these object , use filter, cannot work. specifically, i'm trying prevent object id 2 appearing in options here's i've got: http://jsfiddle.net/9d2za/ <div ng-app ng-controller="ctrl"> unfiltered: <select ng-model="selectedbidtype" ng-options="bidtype.id bidtype.label (bidtypeid, bidtype) in bidtypes"> </select> <br> filtered: <select ng-model="selectedbidtype" ng-options="bidtype.id bidtype.label (bidtypeid, bidtype) in bidtypes | filter:{id: '!2'}"> </select> </div> please note: cannot change structure of bidtypes object in whatever fix come with. here's angularjs: function ctrl($scope) { $scope.selectedbidtype = 1; // bid type objects indexed id fast lookup (this cannot changed in solution) $scope.bidtypes = { 1: {id: 1, label: "buy"...

python - Reading mixed type binary data with Numpy (characters, floats and integers) -

i trying read binary files mixed types (of varying data structures) numpy arrays. the data organized in *.dat file , *.dict (plain text contains data dictionary). example of data dictionary have following: "name" "s" "50" "project id" "i" "4" "amount" "f" "8" my idea have class i'd instantiate , load data calling f = data_bin() f.load("profit.bin") this code working flawlessly whenever have mix of integers , floats, throw string field in middle, throws me error . "typeerror: float argument required, not numpy.string_" the class wrote bellow. side note, can need data in numpy (for performance , compatibility existing code reasons), can live going python lists , there numpy. i appreciate this! class data_bin: def __init__(self): self.datafile="no file loaded yet" self.dictfile="no file loade...

javascript - D3.js and Drupal - SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data -

this strange ... use drupal , drupal view outputs json file. if access file directly embedded javascript error: syntaxerror: json.parse: unexpected character @ line 1 column 1 of json data however, if copy file output drupal view passes json validation , if paste file produced javascript there no error , script executes correctly. here generated json data: {"nodes":[{"node":{"body":"this short story","category":"heatwave","latitude":43.6689985,"longitude":-79.3155716,"link":"http://crewtoronto.ca/entityform/1"}},{"node":{"body":"this short description of effect of ice storm on our household","category":"ice storm","latitude":43.6689985,"longitude":-79.3155716,"link":"http://crewtoronto.ca/entityform/2"}},{"node":{"body":"the ice storm affected large tree in our backyar...

c# - Unable to update label text in ASCX from event handler -

i've 2 custom asp.net web form controls below: main.ascx account_selection.ascx main contains account_selection. main acx contains event handler drop down lives on account_selection ascx. i show error message on main ascx if there issues on contract selection. message never gets displayed. spent couple of hours never works. event handler definately gets called. i'm wondering if it's update panel or event hanlder. please help, below code snippets: account_selection.acx has below: <asp:updatepanel id="upcontracts" runat="server"> <contenttemplate> <asp:dropdownlist id="dropdown" runat="server" autopostback="true" onselectedindexchanged="ondropoptionselected"> <asp:listitem text="select account" value="0"></asp:listitem> </asp:dropdownlist> </contenttemplate> </asp:updatepanel>...

ios - How to get UISwitch with its tag? -

i have function call each time open controller draw me uiswitch. int y = 0; (int = 0 ; < daysarray.count ; i++) { uiswitch * daysswitch = [[uiswitch alloc]initwithframe:cgrectmake(255, y, 20, 20)]; [daysswitch settag:i]; [daysswitch seton:yes]; [daysswitch addtarget:self action:@selector(switchpressed:) forcontrolevents:uicontroleventvaluechanged]; [self.availabletimesscrollview addsubview:daysswitch]; y = y+ 130; } i trying set of uiswitch on or off according tag. uiswitch * switch = (uiswitch *) [self.view viewwithtag:0] [switch seton:no]; but doesn't change or seem affect it. so if not right answer tag of uiswitch set on or off , how can it? the default tag view 0. you're adding these uiswitch instances self.availabletimesscrollview calling viewwithtag: on self.view . method return nearest ancestor given tag, it's returning self.availabletimesscrollview . assuming vi...

javascript - Is there a way for a form to identify only one required field -

for instance in example; <form> <input type="email" name="email" id="useremail" placeholder="email address" required> <br> <input type="tel" name="phone" id="userphone" placeholder="phone number" maxlength="10" required> <br> <input type="submit" id="sidebarformsubmit" value="submit"> </form> is possible somehow/somewhere able identify user has inputed in either email or phone number field. on submit doesn't show "this required". reword: can @ least 1 of form inputs mandatory, both allowed 1 or other not none. in above example, user needs have @ least 1 form of communication whether phone number or email. can have both however, not none. if so, how go this? is possible somehow/somewhere able identify user has inputed in either email or phone number field. on submit doesn't sho...

html - typeahead not working with lower version of ui bootstrap -

here plunker link if changed version of <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.4.0.js"></script> ui-bootstrap-tpls-0.6.0.js , works fine need make typeahead in v0.4.0. possible? hello have edited plunkr , here working plunkr the change have made changed version of angular js using. <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js"></script> if want use ui-bootstrap-0.4.0 have use older version of angular because newer version of angular seems not compatible properly. hope you. thanks.

knockout.js - knockout-kendo.js data binding issue -

i using knockout-kendo.js knockout.js binding kendo grid. if bind object's first level property works fine. here sample - http://jsfiddle.net/rniemeyer/jztg5/ in above example items property defined in viewmodel (i.e. viewmodel.items) however if use object's second level property bind kendo grid, doesn't work. here sample binding doesn't work - http://jsfiddle.net/thakkar/qhf2w/3/ in example, items property not directly defined in viewmodel. instead property of object used in viewmodel. (i.e. viewmodel.obj.items) var item = function(id, name, type) { this.id = id; this.name = ko.observable(name); this.type = type; }; var vm2 = function() { this.items = ko.observablearray([ new item(1, "one", "a"), new item(2, "two", "b"), new item(3, "three", "a") ]); var viewmodel = function() { this.obj = ko.observable(new vm2()) }; ko.applybindings(new viewmodel...

How to calculate the date of next Monday in PHP? -

i'm trying date comes next monday @ night 00:01 am. i'm using following lines: date('y-m-d h:i:s', strtotime(**'next monday, 01:01am'**, strtotime(date("y-m-d h:i:s")))) this gives me proper output: 2014-05-19 01:01:00 but if try write: date('y-m-d h:i:s', strtotime(**'next monday, 00:01am'**, strtotime(date("y-m-d h:i:s")))) i'm getting: 1970-01-01 05:30:00 please tell me wrong here. 00:01 am not correct use 12:01 am try this: date('y-m-d h:i:s', strtotime('next monday, 12:01am', strtotime(date("y-m-d h:i:s")))); it give 2014-05-19 12:01:00 demo

javascript - Can you keep changes made to HTML/CSS with jQuery? -

i keep track of comic book collection online using mass amount of tables. color table cells based on ones have vs. don't have. i'm trying make life easier adding jquery site allow me "click" on cell change color. what don't know how make change permanent. works fine dandy (and i'm going add more functionality cycle through more colors), when refresh page changes made page lost. is there way make changes permanent?? adding "save" button perhaps? not sure how achieve this. simple example of i'm doing: <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script> $(document).ready(function() { $('td').click(function() { $(this).css('background-color', '#5f0'); }); }); </script> <table> <tr> <td>#1</td> <td>comic title</td> <td>collected edition</td> <td>omnibus</td> </tr> </table...

opengl 4 - GLSL coherent imageBuffer access in single-stage (fragment shader), single-pass scenario -

i have single fragment shader performs processing on imagebuffer using image load/store operations. exclusively concerned following scenario: i have single fragment shader (no multistage (eg. vertex fragment shaders) considerations, , no multipass rendering) imagebuffer variables declared coherent. exclusively interested in coherent imagebuffers. to make things clear, scenario following: // source code of sole , unique fragment shader: coherent layout(1x32) uniform uimagebuffer data; void main() { ... various calls imageload(data, ..., ...); ... various calls imagestore(data, ..., ...); ... } i have largely looked @ spec arb_shader_image_load_store especially paragraph: "using variables declared "coherent" guarantees results of stores visible shader invocations using similarly-declared variables; calling memorybarrier required ensure stores visible other operations." note: "coherent uniform imagebuffer data;" dec...

javascript - Difference in these two ways of declaring AngularJS controller? -

are these 2 equal? is latter "shorthand way" write controller? angular.module("root", []) .controller("index", ["$scope", function ($scope) { // .. }]); vs angular.module("root", []) .controller("index", function ($scope) { // .. }); thanks! the duplication of names strings (they call property annotation ) protection against mangling. javascript minifiers mangle variable names, prevents angular being able dependencies name inject them. mangling has no effect on strings, if they're annotated, injector can still them up. you can drop property annotation if you're absolutely, positively sure code won't mangled. if you're working in collaboration someone, or if you're writing library, use it.

mysql - Insert data to openfire database using java -

i using external mysql database openfire server , im trying insert data "openfire" named database , table name "ofuser" , fields columns "username" , "plainpassword","encryptedpassword","name","email","creationdate","modificationdate" this code: try{ class.forname("com.mysql.jdbc.driver"); //step 3: open connection system.out.println("connecting selected database..."); conn = drivermanager.getconnection(db_url, user, pass); system.out.println("connected database successfully..."); //step 4: execute query system.out.println("inserting records table..."); stmt = conn.createstatement(); string sql = "insert ofuser " + "values (100, 'zara', 'ali...

linux - Redirecting Terminal Output of Running Process -

i connecting server using ssh , running minecraft server there with java -jar server.jar now, want able close ssh session without closing minecraft server and, if need type commands server or read server output, want able re-connect ssh , output , input terminal window. is possible? i've read redirecting output file, won't solve problem :/ i use screen detach , reattach window. https://www.digitalocean.com/community/articles/how-to-set-up-a-minecraft-server-on-linux

css - Adding an Image in d3js -

i've checked lot of replies can't of them work. i'm using d3js interactive map , i'd fill each state different image. using g.selectall("#countries") .append('image') .attr('xlink:href', 'image-uri') .attr('width', '500') .attr('height', '500') this seems work, won't paint image in 1 of countries (setting x , y not enough because country has not fixed width or height , image overflow) with g.selectall("#us") .append('image') .attr('xlink:href', 'image-uri') .attr('width', '500') .attr('height', '500') nothing happens and, way, have same problem of case above. since fill style property works, thought fill country using image, following code g.selectall("#us").style('fill', 'url(urlimage-uri)'); this makes country disappear, if there no image paint (the image uri il v...

f# - How to specify a self return type -

i've got abstract class called "recorda" slicing logic want subclass couple of classes. want "record" define abstract slice method must implemented return it's own type, e. g. type "recordb" when sliced returns recordb type. is possible in fsharp? if not, why not? the way interface have method returns different type depending on concrete class make parametric: type record<'concrete> = abstract member slice : unit -> 'concrete type recordb() = interface record<recordb> member this.slice() = new recordb()

sql - Mysql select unique value + first occurrence + last occurence -

i'm having trouble creating query returns following table containing transactions. table looks this: id address_from address_to timestamp so want create list contains: all unique addresses , first transaction , last. i have no problem selecting unique addresses this: select address_from address transactions union select address_to address transactions but how can add first timestamp address appeared in either address_from or address_to , last? hints in right direction highly appreciated. is want? select address, min(timestamp), max(timestamp) ((select address_from address, timestamp transactions ) union (select address_to address, timestamp transactions ) ) group address; this has timestamps addresses, not id s. unclear looking for.

function - jQuery not executing -

so have code in script tags: $(function(){ $("#news-link-1").click(runaccordion(1)); $("#news-link-2").click(runaccordion(2)); $("#news-link-3").click(runaccordion(3)); $("#news-link-4").click(runaccordion(4)); $("#news-link-5").click(runaccordion(5)); $("#news-link-6").click(runaccordion(6)); $("#news-link-7").click(runaccordion(7)); $("#news-link-8").click(runaccordion(8)); $("#news-link-9").click(runaccordion(9)); $("#news-link-10").click(runaccordion(10)); $("#news-link-11").click(runaccordion(11)); $("#news-link-12").click(runaccordion(12)); }) but odd reason, can execute function when there's 1 row (condition) inside. how can execute function rows inside? or perhaps need if() statement? edit: if use if() statement in function, each next statement override previous one: $(function(){ if ($("#news-link-1...

xcode - iOS simulator issue in an empty application -

i have issue first attempt @ xcode 5.1.1. after created new empty application on startup menu clicked file/new/file/storyboard , created new storyboard chose main storyboard in deployment info, added view controller , text field , compiled through run button on top left , ios simulator still contains nothing.

java - List Intersection -

given 2 lists of integers no duplicates. intersection of 2 lists list of integers in both lists, when run program ouput wrong, can 1 me figure out did messed up public class list_intersection { public int [] intersection (int [] tab1, int []tab2) { int [] result = new int [7]; int k = 0; (int i=0; i< tab1.length; i++) { (int j=0; j<tab2.length; j++) if(tab1[i]==tab2[j]) result[k++]=tab1[i]; } return result; } public static void main(string[] args){ intersection_union a= new intersection_union (); int [] tab1= { 4, 7, 12, 6, 17, 5 , 13}; int [] tab2= { 7, 19, 4, 11, 13, 2, 15}; int [] res = new int [7]; res=a.intersection(tab1, tab2); system.out.println(" l'intersection est : " + res); } } i think problem can't system.out.println array. you can use loop print out content of array. system.out....

jquery - php function call with ajax -

i trying call php function when html button clicked.i have done searching , found impossible directly , should use ajax. attempt far not working.this test.php , function in page. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.nextpage').on('click', function() { $.ajax({ url: 'test.php', data: {x: 1}, type: 'post', datatype: 'json', success: function(response) { alert(response); } }); }); }); </script> </head> <body> <button type="button" class="nextpage">go nextpage</button> ...

method in JavaScript object didnt work -

i write sourse, dont understand why if put this.isexist() function inside chat() function (the main function), didnt work. but if put this.isexsist() function outside this.chat function, works well. someone can explain me why this? here source didnt work: <a href="javascript: chat(1,111);"> new chat 1</a><br /> <a href="javascript: chat(2,222);"> new chat 2</a><br /> <a href="javascript: chat(3,333);"> new chat 3</a><br /> <a href="javascript: chat(4,444);"> new chat 4</a><br /> <a href="javascript: chat(5,555);"> new chat 5</a><br /> <div id='chatbar.1' style='float:left; position:fixed; bottom:0px; left:10px;'></div> <script> function chat(id, nic) { this.max = 3; if (typeof(this.arrchat) == "undefined") { this.arrchat = new array(); this.arrchat['i'...

c# - Decorating named components in windsor -

my assembly contains multiple implementations of ifoo. 1 of implementations decorator foodecorator. additionally have foofactory resolve foos decorated foodecorator. assumed best way resolve components name. current registration looks this: component.for<ifoofactory>() .implementedby<windsorfoofactory>() .lifestylesingleton(), component.for<ifoo>() .implementedby<foodecorator>(), alltypes.fromthisassembly() .basedon<ifoo>() .configure(c => c .named(c.implementation.name)))); and implementation of factory looks this: public class windsorfoofactory : ifoofactory { private readonly ikernel _container; public windsorfoofactory(ikernel container) { _container = container; } public ifoo newfoo(type footype) { return _container.resolve<ifoo>(footype.name); } public void returnfoo(ifoo foo) { _container.releasecomponent(foo); } } so if assembly conta...

c# - How to use the SqlParameter.Offset property and ADO.NET to store a binary file in SQL Server 2012 -

i learning how store files without using filestream attribute on varchar(max) in sql server, because dont need store large binary files. despite want store binary data small chunks of it. found sqlparameter.offset property. here info msdn: "the offset property used client-side chunking of binary , string data. example, in order insert 10mb of text column on server, user might execute 10 parameterized inserts of 1mb chunks, shifting value of offset on each iteration 1mb." it sounds need, confused how use it. created simple table called binaryfilestable (id, filedata).the id primary key , filedata varbinary(max). here code far. public static void main(string[] args) { var filebytes = file.readallbytes("../../image.jpg"); const string connectionstring = @"server=.; database=testdb; integrated security=true"; sqlconnection connection = new sqlconnection(connectionstring); connection.open(); using (connect...

php - Yii Update CGridView based on dropdown select -

found solution check end of post i'm been working on 4 weeks , haven't made headway. have found tons of similar examples online , yet tried couldn't work. had burden community of questions. i have model/table called tbl_symptoms/symptoms has 7 columns/attributes: id, symptomcode, title, shorttitle, inclusions, exclusions, symptomcategory. i use dropdown select (which gets populated table on server has symptom categories in 1 column). while can gridview populate symptoms, can't populate same category symptoms dropdown. this last solution tried out (right it's not rendering gridview, when did had other problems, i'm posting code guys have point of reference potential solutions): symptoms.php search function: public function search() { $criteria=new cdbcriteria; $criteria->compare('symptomcategory',$this->symptomcategory,true); return new cactivedataprovider($this, array( 'criteria'=>$criteria, ...

elasticsearch - Automatically decide document type -

i have large database 2 different types of documents , want them indexed in es different document types in es terms well. don't want prefilter database. is possible configure es set type of documents according structure during indexing? to give more information: i'm indexing tweets twitter api. not have tweets in json format json documents delete tweet in database. want index these 2 documents unique. tweets ensure setting tweet id document id mapping. can't same on delete docs because overwrite tweets. separating 2 setting them different docs both use same id ensure that, i'm open other suggestions. the delete docs this: {"delete": {"status": {"id":417427762463649792, "user_id":608116073, "id_str": "417427762463649792", "user_id_str":"608116073"} } } and tweets this(excerpt): {"created_at": "sun dec 29 22:59:59 +00...

java - Need to use Scanner to read a file but don't know how to compare -

i trying write method reads text file using scanner compare them see if characters ('a' - 'z') binary operators can't used (compilation error). ideas how work around it? i need convert uppercase letters lowercase, , have counter keep track of how many times each letter appeared in text file. i need ignore symbols , numbers in text file. after reading comments, changed code into: import java.util.scanner; public class letterinventory { int counter = 0; private int[] inventory; char[] alphabet = "abcdefghijklmnopqrstuvwxyz".tochararray(); public letterinventory () { inventory = new int[26]; } public void countoccurrences(scanner file) { while (file.hasnextline()) { // read line line , make lowercase string line = file.nextline().tolowercase(); // character of line (char c :line.tochararray()) { if (c >= 'a' && c...

javascript - How to use Leaflet GeoJson Options -

i'm trying implement choropleth of nyc leaflet. i'm following along on it's tutorial doing so, , going fine until reached "adding interaction" section. when try add mouseover function, or other, can't e defined, , chrome console throws uncaught typeerror: cannot read property 'setstyle' of undefined error. this way i've been adding highlightfeature option oneachfeature l.geojson(geojsonzipcode, {style: style, oneachfeature: highlightfeature}).addto(map); these 2 functions being called, style works fine, highlightfeature not: function style(feature) { return { fillcolor: getcolor(feature.properties.density), weight: 1, opacity: 1, color: 'white', dasharray: '3', fillopacity: 0.7 }; } function highlightfeature(e) { var layer = e.target; layer.setstyle({ weight: 5, color: '#666', dasharray: '', fillopacity: 0.7 }); if (!l.browser.ie && !l....

javascript - Cannot read error angularjs factory -

i try read particular data in distant js (available ajax calling), call factory in controller : app.controller('paramsctrl', ['$scope', '$http', 'distantfactory', function($scope, $http, distantfactory) { $scope.datad = distantfactory.getdistant(); }]); my factory : app.factory('distantfactory', function($http, $q) { var factory = { distant : false, getdistant : function() { var deferred = $q.defer(); $http({method: 'get', url: urldatadistant, cache: false, timeout: 1500}). success(function(data, status) { /* define data */ factory.distant = paramsfield.params[0].data.date; deferred.resolve(factory.distant); }).error(function(data, statuts) { deferred.reject('error'); }); return deferred.promise; } } // return ...

Swapping two bytes in perl -

i trying swap 2 bytes @ time in file. thinking read in 2 bytes @ time , use reverse switch bytes around. not sure how read 2 bytes @ time in perl. can make suggestion reading 2 bytes @ time hugely inefficient. should continue read larger blocks @ time , process bytes in buffer. $buf =~ s/(.)(.)/$2$1/sg; or $buf = pack 's<*, unpack 's>*', $buf;

java - Issue with android sql-query..."no such column"? -

i want use sql database store records game. don't have clue sql. have class "records" should manage in , output of records. additionally have class sqldatabasehelper provides sql-database. my problem following line: crsrecord = sqlitedatabase.rawquery(query_get_record + category, null); i got error "no such column: sys103" "sys103" name of category. don't know why can read. have idea? sql table creation: create table records ( id integer primary key autoincrement, category varchar(30) not null, displaytime varchar(12) not null, recordtime varchar(10) not null); i guess writing works reading doesn't work. public class records { private sqliteopenhelper sqliteopenhelper; private sqlitedatabase sqlitedatabase; private static final string insert_new_record = "insert records(category, displayrecord, timerecord) values("; priva...

php - Custommize get column from findAll function Yii -

i have problem that, using criteria customize number column query $criteria=new cdbcriteria(); $criteria->select =array('companyname', 'companycountcoupon','companydes', 'companylogo'); $models = company::model()->findall($criteria); after put array , echo result $rows = array(); foreach($models $i=>$model1) { $rows[$i] = $model1->attributes; } echo cjson::encode($rows) my problem results contains attributes of table, , attributes not in criteria->select set = null {"companyname":"abc","companycountcoupon":"0","companydes":"hello","companylogo":"\/upload\/company\/abc.jpg",**"companyid":null,"companywebsite":null,"companyadrress1":null,"companyadrress2":null,"companyphone1":null,"companyphone2":null**} please me. all ...

How to create a special order_number that is based off the table id column in PostgreSQL and Rails -

i have orders table in sql database (postgresql if matters, , rails 4.04) , want column "number" in orders table kind of shadow id column. in other words want automatic sequential field want in form: order::product_nu_prefix + ((order::starting_product_no + order.id).to_s) so if set product_nu_prefix = 'pe' , starting_product_no = '11681' then first order create have product number: kb11682 , kb11683 should purely in postgresql or there way in rails? keep in mind i'll need know latest order.id when order comes in because when save new record want field saved correctly. you're looking @ uuid 's (universally unique identifiers) these allow assign special id record, giving instant reference throughout app. such use cases include likes of order numbers , api keys , message id's we implement you're asking quite regularly: #app/models/order.rb class order < activerecord::base before_create :set_num ...

couchdb - How To Get Parent Details In Couch Db? -

please me i have created databse named product and have created 2 product documents id 'p101','p102' { "_id": "p101", "_rev": "5-8d1c4b5b7f6e65a5997d4ec5b4346e5f", "type": "product", "name": "shirt", "hersteller": "oska", "price": 11.15 } { "_id": "p102", "_rev": "3-8ad956f0c524b1a2396ebdda1ed0afbe", "type": "product", "name": "pullover", "hersteller": "acme", "price": 7.58 } now added 1 order document 'p101' parent { "_id": "ord-101", "_rev": "7-dbd8cca3b6dc9f4cb3b8bb7e4aec6630", "type": "order", "orderdate": "01.01.2012", "parentprodct": "p101" } now have added report document...

inheritance - Derived classes with ActiveRecord in Yii -

i working following database design, , wanted understand how can best address in yii. +---------------+----------------+---------------------+ | table | column name | column type | +---------------+----------------+---------------------+ | question | id | int | | | description | text | | | type | enum('mcq', 'text') | | | | | | | | | | mcq_question | id | int | | | question_id | int | | | option1 | text | | | option2 | text | | | option3 | text | | | option4 | text | | | correct_answer | option1 | | | | ...

php - Doctrine/Symfony - I have some errors. Something wrong with my relations -

i exception entities. tried play them. checked on google relation appropriate entities... couldn't find best configuration. i'm making website can create albums. a user can have multiple albums.so have entity album , have inside user property : /** * album * * @orm\table(name="album") * @orm\entity(repositoryclass="moodress\bundle\albumbundle\entity\albumrepository") */ class album { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** ** @orm\manytoone(targetentity="moodress\bundle\userbundle\entity\user") ** @orm\joincolumn(nullable=false) */ private $user; /** * @var string * * @orm\column(name="name", type="string", length=255) */ private $name; /** * @var \datetime * * @orm\column(name="creationdate", type="datetime") */ private $creationdate; /** * @var \datetime...

python - Removing part of a string that has been obtained by a regular expression using strip functions -

i having problem. have regular expression looking through rss feed weather url = 'http://rss.weatherzone.com.au/?u=12994-1285&lt=aploc&lc=9388&obs=1&fc=1&warn=1' weather_brisbane = urlopen(url) html_code = weather_brisbane.read() weather_brisbane.close() i have regex: weather_contents = findall('<b>(.+)</b> (.*)', html_code) if weather_contents != []: print 'contents' section_heading in weather_contents: print section_heading print i result: contents ('temperature:', '20.1&#176;c\r') ('feels like:', '20.1&#176;c<br />\r') ('dew point:', '13.6&#176;c\r') ('relative humidity:', '66%<br />\r') ('wind:', 'e @ 2 km/h, gusting 4 km/h\r') ('rain:', '0.0mm since 9am<br />\r') ('pressure:', '1024.9 hpa\r')​ so question is, there way result: contents temperature:...

MYSQL update if not exists else do nothing -

my question how update value in table if not exists on table.i checked insert ... on duplicate key update describes inserting updates , not insert. my situation like, have 2 tables (t1,t2). want update column in t1 value if not present in t2. otherwise increment value , try update again. want like update t1 set column = 'value' if not exists in t2 can suggest solution here way using join. create table tab1 (id int , val int); insert tab1 values (1,1),(2,3),(3,5); create table tab2 (id int , val int); insert tab2 values (4,1),(2,3),(3,5); in above tab1 (id = 1) not available in tab2 , using following command can update such values update tab1 t1 left join tab2 t2 on t1.id = t2.id set t1.val = case when t2.id null 8 else t1.val end the output after update command like mysql> select * tab1 ; +------+------+ | id | val | +------+------+ | 1 | 8 | | 2 | 3 | | 3 | 5 | +------+------+ also can use exist prett...

sql - Split values from one column into multiple columns -

i have got following query select mobile_no, customer_no, processing_date, listagg(maak, '-') within group (order maak) which outputs example mobile no |user | date | maak 04343243 |1000978 | 31-jan-14 | cross net(mins)-4.271-66.1-landline(mins)-2.029-200.467 how can split values in column maak based on '-' in different columns called tariff, amount , usage. desired output in case be mobile no | user | date | tariff | amount | usage | tariff | amount | usage 04343243 | 1000978 | 31-jan-14 | cross net(mins) | 4.271 | 66.1 | landline(mins) | 2.029 | 200.467 also, looking standard code independent of number of '-' in row work number of '-'.

R caret train Error in evalSummaryFunction: cannnot compute class probabilities for regression -

> cv.ctrl <- traincontrol(method = "repeatedcv", repeats = 3, + summaryfunction = twoclasssummary, + classprobs = true) > > set.seed(35) > glm.tune.1 <- train(y ~ bool_3, + data = train.batch, + method = "glm", + metric = "roc", + trcontrol = cv.ctrl) error in evalsummaryfunction(y, trcontrol, classlevels, metric, method) : train()'s use of roc codes requires class probabilities. see classprobs option of traincontrol() in addition: warning message: in train.default(x, y, weights = w, ...) : cannnot compute class probabilities regression > str(train.batch) 'data.frame': 128046 obs. of 42 variables: $ offer : int 1194044 1194044 1194044 1194044 1194044 1194044 1194044 1194044 1194044 1194044 ... $ avgprice : num 2.68 2.68 2.68 2.68 2.68 ... ... $ bool_3 ...