Posts

Showing posts from 2014

amazon ec2 - Exception with elasticSearch and AWS plugin -

i'm trying deploy elasticsearch on ec2 instance, got error : [2014-04-04 12:23:30,499][info ][node ] [franklin hall] version[1.0.1], pid[4516], build[5c03844/2014-02-25t15:52:53z] [2014-04-04 12:23:30,500][info ][node ] [franklin hall] initializing ... [2014-04-04 12:23:30,531][info ][plugins ] [franklin hall] loaded [cloud-aws], sites [] {1.0.1}: initialization failed ... - executionerror[java.lang.noclassdeffounderror: org/elasticsearch/elasticsearchillegalargumentexception] noclassdeffounderror[org/elasticsearch/elasticsearchillegalargumentexception] classnotfoundexception[org.elasticsearch.elasticsearchillegalargumentexception] when launch elasticsearch command sudo bin/elasticsearch -xss256k -xmx2048m here installed versions : elastic search 1.0.1 elasticsearch-cloud-aws 1.0.0 do guys have idea of going wrong ? don't know -xss256k -xmx2048m parameters this , thi...

Using Today() and Mid in excel -

excel cell should have below value abc,04-04-2014 the date entered shouldn't hard coded. need using today() or other function. either: ="abc," & text(today(),"dd/mm/yyyy") or ="abc," & text(today(),"mm/dd/yyyy") depending on desired date format.

github - git - Commit and push folder then stop tracking -

i need push dummy file in folder repo sit there unchanged , serve example. file located inside sub-folder so: /main-repo/main-code.py /main-repo/.gitignore /main-repo/sub-folder/dummy-file.dat i can commit , push these files , folders without issues. need after tell git stop tracking sub-folder folder , contents while at same time keeping in repo (i use github ) i tried adding sub-folder/* .gitignore changes still being tracked. tried removing file cache with: git rm --cached sub-folder/dummy-file.dat but removed file repo after pushed. so recap: want first push of sub-folder/dummy-file.dat , after stop tracking changes any file inside subfolder while keeping initial state of subfolder in repo. is possible? i think looking assume-unchanged flag of update-index - allow local changes tracked file ignored git. git update-index --assume-unchanged <file> from git-update-index man page when these flags specified, object names recorded pat...

Regex get text between parentheses and keywords -

i have text pattern this; (((a) or (b) or (c)) , ((d) or (e)) , ((!f) or (!g))) and want this; ((a) or (b) or (c)) ((d) or (e)) ((!f) or (!g)) after want seperate them this; a,b,c d,e !f,!g any awesome :) edit 1: sorry missing parts; using language c# , got; (\([^\(\)]+\))|([^\(\)]+) with got; (a) or (b) or (c) , (d) or (e) , (!f) or (!g) thanks already! taking this previous regex , modifying code little... string msg= "(((a) or (b) or (c)) , ((d) or (e)) , ((!f) or (!g)))"; var charsetoccurences = new regex(@"\(((?:[^()]|(?<o>\()|(?<-o>\)))+(?(o)(?!)))\)"); var charsetmatches = charsetoccurences.matches(msg); foreach (match mainmatch in charsetmatches) { var sets = charsetoccurences.matches(mainmatch.groups[1].value); foreach (match match in sets) { console.writeline(match.groups[0].value); } } the first regex being used contents of outermost paren. the same regex used individual sets wi...

windows - Batch code to temporarily disable mouse input -

i need have batch file starts after program.exe starts temporarily disable mouse input. this i've come far: rem --------------------------------- rem disable mouse set key="hkey_local_machine\system\currentcontrolset\services\mouclass" reg delete %key% reg add %key% /v start /t reg_dword /d 4 rem --------------------------------- suggestions? @echo off echo "please pull mouse cord out of pc..." <do stuff> echo "please plug mouse cord pc." exit /b 0 sorry, couldn't resist. in seriousness though, shouldn't rely on storing registry key in value of batch file. happens if file terminated prematurely? power failure? error in script? if above in example works (i haven't tried it), @ least use reg export export temporary file, , reg import put back. can delete temp file after successful reg import (make sure check %errorlevel% of reg import , not write command on next line, or @ least link...

android - Storing ArrayList in onSavedInstanceState -

i'm running asynctask in fragment class , populating listview result. run asynctask first time fragment instantiated. how store the arraylist of objects created in asynctask in onsavedinstance can retrieve them later? i tried using putparcelablearraylist still nullpointerexception when try retrieve it. thanks help stops: public class stops implements parcelable{ private string station_name; private arraylist<stops> stoptitles; public stops() { } public stops(parcel source) { station_name = source.readstring(); source.readtypedlist(stoptitles, stops.creator); } public string getstation_name() { return station_name; } public void setstation_name(string station_name) { this.station_name = station_name; } public void setstoptitles(arraylist<stops> stoptitles) { this.stoptitles = stoptitles; } public arraylist<stops> getstoptitles() { return stoptitles; } @override public string tostring() { return station_nam...

jquery - paws preloader with the effect of movement and opacity down and up -

Image
i working on pre loader project, pre loader consist on paws there 3 paws on position of bottom, right, , top thinking show them in circle paw 1 : opecity 1; paw 2 : opecity 0.5; paw 2 :opecity 0.5; is possible css3 key frames, if not solution.

IP camera Live video stream to iOS device -

i trying create app receives live video stream ip camera. considering using outside server ivideon , embedding video html webview within app. wondering how complicated feed directly ip cameras default server. new developing ios hoping simple of solution possible. it's possible use vlc re stream rtsp/rtp ip camera hls , play due native support. if want video directly app, easiest way asking camera jpeg images on http.

Explain anonymous Class in Java -

when program run display function gets called. not able understand how? class { class b { void display() { system.out.println("display in b....."); } } } class twenty extends a.b { twenty(a temp) { temp.super(); } public static void main(string args[]) { obj=new a(); twenty abc=new twenty(obj); abc.display(); } } explain program this simple class twenty extending class b . since there method display in b class, twenty inherits method if method declared in it. why able call display method on object of class twenty abc .

MongoDB skip & limit when querying two collections -

let's have 2 collections, , b, , single document in related n documents in b. example, schemas this: collection a: {id: (int), propa1: (int), propa2: (boolean) } collection b: {ida: (int), # id document in collection propb1: (int), propb2: (...), ... propbn: (...) } i want return properties propb2-bn , propa2 api, , return information (for example) propa2 = true , propb6 = 42 , , propb1 = propa1 . this simple - query collection b find documents propb6 = 42 , collect ida values result, query collection values, , filter results collection documents query. however, adding skip , limit parameters seems impossible while keeping behavior users expect. naively applying skip , limit first query means that, since filtering occurs after query, less limit documents returned. worse, in cases no documents returned when there still documents in collection read. example, if limit 10 , first 10 collection b documents returned pointed document in collection propa2 = false , fun...

bash functions arguments in single quotes -

i trying pass 2 arguments following bash function $1 , $2. if echo below statement seems output $1 , $2. need have arguments in single quotes function work correctly. doing wrong? function mysql_diff() { java -jar mysql-diff.jar 'jdbc:mysql://localhost:3306/$1?user=root&password=password' 'jdbc:mysql://localhost:3306/$2?user=root&password=password' } it seems need arguments enclosed in single quotes. achieve that, enclose in double quotes: function mysql_diff() { java -jar mysql-diff.jar "'jdbc:mysql://localhost:3306/$1?user=root&password=password'" "'jdbc:mysql://localhost:3306/$2?user=root&password=password'" } this not prevent variable expansion , result in arguments being enclosed in single quotes.

php - In Codeigniter unable to use order_by random -

unable use order_by random in codeigniter my code is: function fetch_popular_news() { $query=$this->db->order_by('id','rand')->limit(1)->get('main_slider'); $data=$query->result(); return $data; } i tried: function fetch_popular_news() { $query=$this->db->order_by('id','random')->limit(1)->get('main_slider'); $data=$query->result(); return $data; } but it's not working... use instead, work: order_by('rand()')

Totaling scores in C++ -

okay when run code total equal 0 , messes average , grade.i not sure doing wrong total += scores function should be, yet still not adding scores. int validatenumber(int, int, int); in main() function int num, score, total = 0; and validatenumber(num, score, total); and definition int validatenumber(int num, int score, int total) { while (num < 1 || num > 4) { cout << over3 << num << " not between 1 , 4! try again: "; cin >> num; } system("cls"); (int = 1; <= num; i++) { cout << over3 << "enter score " << << ": " << endl; cout << over3 << "enter value 0 100: "; cin >> score; while (score < 0 || score > 100) { cout << over3 << score << " not between 0 , 100! renter score: " << << ": "; cin >> score; } total += score; ...

How to create string of strings in c++ -

i want have sometnig this: first second first second third first second first thirst asdfasd adfads asdfadf sdfsdf sdfasdf afdsdf dffsd it has 4 rows , 4 columns. each row, column pair string. a string of strings different table or matrix of strings. string of strings let string 1 or more sequential characters, such "first" . string may contain string or commonly known substring . string "theater" contains @ least strings "the" , "eat" , , "ate" . matrix of strings matrix of strings contains rows , columns of strings: "first" "second" "apple" "car" "garden" "table" "pear" "tire" "hero" "cat" "orange" "window" "soil" "food" "mango" "engine" a matrix of strings can declared as: std::...

How to customize json output from controller in rails -

i have controller returns list of categories , count of items in each category category.joins(:item).group([:category_id,:name]).count i clean json formatting (which category_id, :name, :count ) {"[10, \"fruit.\"]":2,"[11, \"vegetables.\"]":1,"[2, \"pasty.\"]":1} to this {"categoryitemcount":[ {"id":10,"name":"fruit","count":7}]} so custom root name along named columns thanks in advance! the solution demoed in railscast #219. create model not backed database , represents data want send back. in case categoryitemcount.rb (id, name, count). built array of these on fly using query given above, , output json.

java - Why does Spring MVC respond with a 404 and report "No mapping found for HTTP request with URI [...] in DispatcherServlet"? -

i'm writing spring mvc application, deployed on tomcat. see following minimal, complete, , verifiable example : public class application extends abstractannotationconfigdispatcherservletinitializer { protected class<?>[] getrootconfigclasses() { return new class<?>[] { }; } protected class<?>[] getservletconfigclasses() { return new class<?>[] { springservletconfig.class }; } protected string[] getservletmappings() { return new string[] { "/*" }; } } where springservletconfig @configuration @componentscan("com.example.controllers") @enablewebmvc public class springservletconfig { @bean public internalresourceviewresolver resolver() { internalresourceviewresolver vr = new internalresourceviewresolver(); vr.setprefix("/web-inf/jsps/"); vr.setsuffix(".jsp"); return vr; } } finally, have @controller in package com.exam...

sms - list scroll lags for getting data from conversation in android -

i'm trying show sms conversation in android, purpose i've used following code , works fine. uri sms_inbox = uri.parse("content://sms/conversations/"); cursor c = getcontentresolver().query(sms_inbox, null, null, null, "date desc"); for each item in list i've use: string thread_id = cursor.getstring(cursor.getcolumnindexorthrow(staticfinalvalue.thread_id)) .tostring(); conversationdetailscursor data = getconversation.showingthreadid(thread_id , context); showingthreadid() is: conversationdetailscursor details = new conversationdetailscursor(); uri uri = uri.parse("content://sms/inbox"); string = "thread_id=" + thread_id; cursor mycursor = getcursor(uri, , context); // phone , name inbox uri if (mycursor.movetofirst()) getnameandnumber(mycursor , details , context); else { // phone , name sent uri uri = uri.parse("content://sms/sent"); = "thread_id=" + ...

How do you escape round brackets in passwords for bitbucket-api in node.js -

i trying access particular repository on bitbucket using bitbucket-api in node.js , password contains funny characters (round brackets , spaces). doesn't throw useful errors or let me data. i happen password don't want change it. know removing round brackets , spaces password fixes issue. what can do? after plenty of searching , stepping implementation curl-transport.js, have found way work around issue. relies on understanding of curl-transport passes require('child_process').exec . essentially mechanism works starting new process curl , passing in command line arguments. having round brackets, confuses curl , having spaces confuses command line argument parsing. work around it, simply add double quote first character of username , ending double quote last character of password ; when 2 strings concatenated (ie: username+":"+password) final string "username:password" get's passed 1 argument process. my node code looks this:...

xampp - Apache: Prevent PDF-File with non-pdf-extension from opening -

i'm quite new setting server, have xamp / apache 2 related question: when rename extension of pdf-file .txt browsers open pdf plain text (which understand , good). but: when rename pdf-extension .jpggggg, still opens pdf! why?? because i'm afraid uploads valid pdf hidden exe in , tricks me doubleclciking (which installs virus/backdoor/anything else on server or ruis it) . so how can in manage filter such "pdfs .exe/.app in it" out? infos you: --> apache version 2.4 --> default mime-type set plain text! --> deactivated mime_magic module loading (by starting line # (#loadmodule mime_magic_module modules/mod_mime_magic.so)) --> , deactivated other line mimemagic in (# mimemagicfile "conf/magic"). (i unfortunately had no other idea deactivationg mimemagic-module!) what else can do! so questions are: 1. why browsers (chrome, ie 8, firefox) handle file pdf although extion set ".jpggggg" , how can preve...

Using MySQL Case for comparing dates -

i need tabulate data 3 tables report. please see query select date( sale.sale_time ) dat, location.location_name location, sale.sale_id total_orders, sum( case sale.is_cancelled when 0 sale.sale_amount else 0 end ) sales, sum( case sale.is_cancelled when 0 sale.sale_discount else 0 end ) discounts, sum( case sale.is_cancelled when 0 sale.sale_tax else 0 end ) taxes, count( distinct sale.customer_id ) total_customers, sum( case when date( person.added_on ) = date( sale.sale_time ) 1 else 0 end ) new_customers, sum( case sale.is_cancelled when 1 1 else 0 end ) cancelled_orders sales sale inner join locations location on location.location_id = sale.location_id inner join people person on person.person_id = sale.customer_id group dat,location the results new_customers showing wrong, more total_customers . wrong, , how correct this? the results this: dat location total_orders sales discounts t...

hash - How does checking hashes work if no 2 hashes are ever the same? -

i may wrong here, understand, no 2 hashes ever same. certainly, when md5 word "password" twice, 2 different hashes. if user's password "password123", hash "482c811da5d5b4bc6d497ffa98491e38" if user enters password when logging in @ later date, hash of password123 is: "286755fad04869ca523320acce0dc6a4" how can compare 2 hashes if they're different exact same word? hash of same value same algorithm same - why ok compare hashes verify if values different (if hashes same may still mean values different, using sufficiently long hash sha256 may safe enough assume values same password verification). most have bug in getting original values represented same way (i.e. non-trimmed spaces, different encoding,...) , causes hashes different. note md5 not acceptable hashing passwords due known weakness.

javascript - Angular JS Root Scope -

i working angular js @ view layer. need use global variable used , modified controllers method in application: var app = angular.module('mywebservice', ['ngcookies']).run( function($rootscope) { $rootscope.authtoken = null; }); app.controller('usercontroller', function($cookiestore, $scope, $location, $routeparams, $http, $timeout, $rootscope) { $scope.login= function() { $http.defaults.headers.post = {'accept' : 'application/json', 'content-type' : 'application/json'}; $http.post('/myservise/api/user/login-user', { emailid : $scope.username, password : $scope.password }).success(function(data, status) { if (status == 200) { $rootscope.authtoken = data.object.authtoken; }).error(function(data, status) { console.debug(...

google cloud storage - Can't create bucket -

i created google cloud storage account. i logged in - , 'new bucket' button 'greyed' out (that lighter red) - , can't click it. what going on? want create bucket. i waited & refreshed page , works. it taking time provision or recognise i'd added billing data (would have been nice if told me this).

c# - “error: 19 - Physical connection is not usable” with OWIN access in Azure database -

Image
i have tried other postings on dreaded "error 19" , found few answers not apply or not help, hence new post. serious potential problem azure+ef users. first occurrence: i using latest version of in vs2013 ef6.1 razor project (packages listed @ end). database hosted on sql azure. after running webapp few time (in dev environment) error: a transport-level error has occurred when receiving results server. (provider: session provider, error: 19 - physical connection not usable) the line dies on this: i gather error relates connection pooling (and running out of connections), cannot spot leak anywhere. as access owin membership , other database features throughout app have databasecontoller other controllers inherit. creates relevant components , disposes of them. databasecontroller.cs [authorize] public class databasecontroller : controller { #region properties /// <summary> /// user manager - attached application db context /// </sum...

vb.net - Button needs to have functionality of <a href= and Target=_parent -

i have button uses response.redirect, opens page want in new window instead of opening in current window(refreshing new page?) as <a href= target=_self ? i'm not using need button rest of buttons. vb.net please use j query script reference , use window.open("foo.aspx");

javascript - $locationChangeSuccess not firing on browser back action in IE10 and IE11 -

on project i'm working on, number of checkboxes in view used apply , remove set of filters search result set. values of these checkboxes written query string facilitate ability pre-load filter state via navigation. simplify, i'll pretend there 1 checkbox , ignore fact there's supposed filtering. to ensure state in query string correct, when check-box checked, function called writes checkbox's value query string. checkbox's value bound scope property called "checkboxvalue". <input ng-model="checkboxvalue" ng-change="writevaluetoquerystring()" type="checkbox"/> in addition this, when there update query string, call function gets current value query string , writes $scope.checkboxvalue. ensures value in controller , value in query string in sync 1 another, regardless of change in value originates. altogether simplified version of looks this: app = angular.module 'myapp', [] app.controller...

javascript - How do I update/add to a JSON file using angularJS? -

i've created local json file , able data file using app.controller('appctrl', function($scope, $http){ $http.get('employees.json').success(function(data){ $scope.employees=angular.fromjson(data.employees); console.log($scope.employees); }); //this data json file taken , stored $scope.employees. works fine } i've been trying write equivalent http post call doing $scope.employees.push , (understandably) updating value of local variable. how update or add values original employees.json file? i don't think it's possible directly angular. there other sources integrate app, can have angular leverage. exploring filesystem api (html5) - verify browsers support this. another options jquery.twfile . you store localstorage , access other object. method i'd lean towards more (depending on size). otherwise i've had have server-side it.

sql - I am working in access 2013 and I keep getting a syntax error for the FROM clause -

select customerid, customerfirstname, customerlastname, salesrepid tblcustomer "[cade]", "[cane]" order customerlastname; put like condition in where clause select customerid, customerfirstname, customerlastname, salesrepid tblcustomer [columnname] "cade" or [columnname] "cane" order customerlastname; http://office.microsoft.com/en-001/access-help/use-like-criterion-to-locate-data-ha102809506.aspx

Trigger python code from Google spreadsheets? -

in excel can create user defined functions python using pyxll . have been moving google spreadsheets , using google app script, libraries bigger , better in python, wish there way build user defined functions using python google spreadsheets. there ways interact python google sheets gspread . there way run python on google app engine sheet trigger code? other ways there trigger python code google spreadsheets? one way have code reads spreadsheet time, runs other code when condition met. without gae, use following code: #http://code.google.com/p/gdata-python-client/downloads/list import gdata.spreadsheet.service s spreadsheet_key = 'spreadsheetkey'# https://docs.google.com/spreadsheet/ccc?key=<spreadsheet key>&usp=sharing#gid=0 worksheet_key = 'od6' #first tab gd_client = s.spreadsheetsservice(spreadsheet_key, worksheet_key) gd_client.email = 'user@gmail.com' gd_client.password = 'password' gd_client.programmaticlogin() list_f...

r - `rms::ols()`: how to fit a model without intercept -

i'd use ols() (ordinary least squares) function rms package multivariate linear regression, not calculate intercept. using lm() syntax like: model <- lm(formula = z ~ 0 + x + y, data = mydata) where 0 stops calculating intercept, , 2 coefficients returned, on x , other y . how do when using ols() ? trying model <- ols(formula = z ~ 0 + x + y, data = mydata) did not work, still returns intercept , coefficient each x , y . here link csv file it has 5 columns. example, can use first 3 columns: model <- ols(formula = corren ~ inten_anti_ncp + inten_par_ncp, data = ccd) thanks! rms::ols uses rms:::design instead of model.frame.default . design called default of intercept = 1 , there no (obvious) way specify there no intercept. assume there reason this, can try changing ols using trace .

Difference between Linux Loadable and built-in modules -

what's difference between loadable modules , built-in (statically linked) modules? i got question while finding out answer difference between system calls subsys_initcall() , module_init() linux kernel supports inserting of modules (aka device drivers) in 2 ways: built-in kernel modules - when kernel booted up, kernel automatically inserts driver in kernel (it's more part of kernel code). loadable kernel module (lkm) - driver not automatically loaded kernel, user can insert module @ run-time insmod driver.ko or modprobe driver.ko the advantage loadable modules have on built-in modules can load unload them on run-time. if working on module , need test it. every time test , need make changes it, can unload ( rmmod driver.ko or modprobe -r driver.ko ) , after making changes, can insert back. built-in modules if need make changes in module need compile whole kernel , reboot system new image of kernel. configuration: can configure module either of 2 ed...

c# - EF Metadata Class not working -

i seem having trouble creating metadata class generated model classes. have created below code, resharper telling me partial class partial class single part. actual membership generated class in project in same solution. problem? [metadatatype(typeof(membershipviewmodel))] public partial class membership { } public class membershipviewmodel { [required, stringlength(3, minimumlength = 3, errormessage = "format: (045/135)")] [displayattribute(name = "report cycle")] public string reportcycle { get; set; } }

java - Efficient algorithm for three-dimensional linear search -

i have issue in task in java program. task find voltage dip pulse width , delay of voltage drop. parameters considered voltage, pulse width , pulse delay. the program implemented 3 dimensional in linear search. total compile time takes 21 hrs complete 1 round. me in proposing efficient algorithm 3 dimensional search better compile time? here part of code: //...snip if (exu.isdryrun()) { return; } // singlerun(); // exu.pause(50); // if( wasthereanerror() == true) { pulsewidthloop(); (v = 6.4; v <= 9.0; v += .1) { fixed_constant(); } (v = 6.3; v >= 6.0; v -= .1) { fixed_constant(); } } private void fixed_constant() { (d = 604; d <= 1000; d += 4) { pulsewidthloop(); } (d = 600; d >= 4; d -= 4) { boolean res = pulsewidthloop(); } } private boolean pulsewidthloop() { final boolean result[] = new boolean[1]; result[0] = true; exu.exec(new ataskts() { @runcontextdirect ...

rest - What's the easiest way to invoke a Spring.NET service exposed over remoting using Python -

i have .net 3.5 service exposed using spring.net 1.2 on .net remoting. invoke service methods python, looking quickest , easiest way achieve this. options exploring are: expose service via rest (is possible spring.net 1.2, or can done separately without affecting existing remoting interface?) invoke .net remoting calls python (the marshalling issues make me think approach non-starter) something else? any suggestions? update : service interface trivial -- not use advanced features such callbacks. depending on services you're exposing, exporting plain old clr object asmx web service can trivial in 1.2 , configuration change. .net remoting has functionality can't exposed asmx , rest services (e.g. callback objects, lifetime specification etc) , if application relying on that, might bit more difficult or impossible. you need post more information on service interface give more detailed answer.

Batch: goto was unexpected at this time error -

so im making project school , want goto menu if user input not valid code this: :menu echo. echo. echo know first? echo. echo. echo 1) salary echo 2) do? echo 3) schools near me offer game design programs echo 4) requirements echo 5) credits echo. echo. set /p choice="enter number: " if %choice% == 1 goto salary if %choice% == 2 goto if %choice% == 3 goto schools if %choice% == 4 goto req if %choice% == 5 goto credits goto menu when enter input, there line flashes goto unexpected @ time exits doing wrong? should add input not valid option. (1,2,3,4,5) if %choice% == 1 goto salary imagine, do, when %choice% empty. line read as: if == 1 goto salary obviously syntax error. "goto unexpected". to avoid this, use if "%choice%" == "1" goto salary this read as: if "" == "1" goto salary syntax ok now.

json - Angularjs $resource and $http synchronous call? -

i want write 2 services 1 $http.get method , 1 $resource this service should receive json object , looks this, @ moment code direct in controller , not in service: var csvpromise= $http.get(base_url + 'datasource/1').success(function(data) { $scope.data4=json.stringify(data); }); the problem is, want save received data in $scope.data4 , want use data after $http.get call value empty. direct after call there , object needs value: new myobject($scope.data4) so myobject must wait long until data has arrived. or can make synchronous call $http or $resource ? how can ? have found many examples promise , .then nothing has worked me. edit: have written service didn`t work: var test=angular.module('myapp.getcsv', ['ngresource']); test.factory('getcsv',function($log, $http,$q, $resource){ return { getdata: function (id) { var csvpromise= $http.get(base_url +'datasource/'+id) ...

Zurb Foundation: Want horizontal scrollbar -

i have following code: <div class="row"> <div class="large-12 columns"> <div class="item">items go here</div> <div class="item">items go here</div> ... many .item here ... </div> </div> each .item have fixed width, 150px . want div large-12 scrollable if there more .item can fit within current screen. how can that? currently, if add many .item , go next line! thanks you'll need add overflow-x:scroll; , white-space:nowrap; parent container. , display:inline-block; .item s. here's working demo .

c# - Filtering a list of classes with LINQ -

i have list of class. need filter list using text. class person { string name; int age; } i have list of person class list<person> personlist; i have 100 values in personlist; need filter using text. wrote this.personlist.where(item => item.name.contains(txtfilter.text)).tolist(); but not return expected result..can 1 me? you need preserve result return linq statement in variable this var filteredlist = this.personlist.where(item => item.name.contains(txtfilter.text)).tolist();

ruby - undefined local variable or method error when trying to use `instance_variable_set` in rspec -

i have class this require 'net/http' class foo def initialize @error_count = 0 end def run result = net::http.start("google.com") @error_count = 0 if result rescue @error_count += 1 end end and spec file it. require_relative 'foo' describe foo let(:foo){ foo.new} describe "#run" context "when fails 30 times" foo.instance_variable_set(:@error_count, 30) end end end and run rspec foo_spec.rb , fails error. foo_spec.rb:7:in `block (3 levels) in <top (required)>': undefined local variable or method `foo' #<class:0x007fc37410c400> (nameerror) how should call instance_variable_set method in rspec? edit i want call send_error method if 30 times fails. require 'net/http' class foo def initialize @error_count = 0 end def run result = net::http.start("google.com") @error_count = 0 if result rescue @error_count += 1 ...

if statement - Warning message when using If(...) function in R -

i'm having problems if function in r. first tried this: test<-matrix(10,3,3) if(test[2,2]==10) {test[2,2]<-5} ok, it's doing want. so, try this: if(hylo.measures[i,3]=="clc0006x") {hylo.measures[i,3]<-"clc0005x"} ops! got following message: warning message: in `[<-.factor`(`*tmp*`, iseq, value = "clc0005x") : invalid factor level, na generated i couldn't figure out going on here! what obvious step missing? that third column factor variable; might want check code make sure want. anyway, can add level manually if you're sure it's want do. here's example of adding level on iris r>iris$species[5] <- "hahah" warning message: in `[<-.factor`(`*tmp*`, 5, value = c(1l, 1l, 1l, 1l, na, 1l, 1l, : invalid factor level, na generated r>levels(iris$species) <- c(levels(iris$species), "hahah") r>iris$species[5] <- "hahah" r>iris[5,] sepal.length ...

jquery - How can i make search icon clickable? -

<div data-role=page"> <form method="post"> <input name="search" id="search" value="" placeholder="buscar" type="search" onfocus="this.placeholder = ''" onblur="this.placeholder = 'buscar'"> </form> </div> i using jquery mobiles 1.4.2 how can make search icon clickable(like enter)when click on it should act enter button. , how can change border color of it? i set here border please @ this. <div data-role=page"> <form method="post"> <input style='border:1px solid red;' name="search" id="search" value="" placeholder="buscar" type="search" onfocus="this.placeholder = ''" onblur="this.placeholder = 'buscar'"> </form> </div> look @ thread http://forum.jquery.com/topic/anyone-have-a-way-to...

In C# dynamic key word performance? -

if use dynamic key word & assign type on it, compiler perform boxing/un-boxing operation? example; dynamic myinstance=null; object key="bankproject.payment"; type mytype=servicecashe.gettype(key);//get desire type cache... myinstance=activator.createinstance(mytype); //instanciate mytype unless it's value type, there'll no boxing going on - in code sample you've used, there's no real use of dynamic typing anyway. code thus far equivalent to: object key = "bankproject.payment"; type mytype = servicecashe.gettype(key); object myinstance = activator.createinstance(mytype); it's when perform dynamic member access - e.g. myinstance.somemethod() dynamic typing come effect. way avoid make types you're fetching dynamically implement interface: object key = "bankproject.payment"; type mytype = servicecashe.gettype(key); ipayment myinstance = (ipayment) activator.createinstance(mytype); myinstance.somemethodininterf...

c++ - fread fails with VS2008 64-bits -

i'm porting software 32 64-bits using visual studio 2008 , i'm encountering issue regarding fread causes segfault when called: here code sample reproducing issue: void somefunction(std::string filepath) { file* myfile = fopen(filepath.c_str(),"rb"); // returns valid handle if (myfile) { char* buffer = new char[buffer_size+1]; memset(buffer,0,buffer_size+1); fread(buffer,1,buffer_size,myfile); // segfault happens here fclose(f); } } geterror , ferror not report error , file can read when compiling 32-bits. triggers segfault when entering fread on 64-bits though. i've tried several other file reading methods (with ifstream , qt's qfile ) , work. unfortunately, fread used in many other places in code , know if there peculiar implementation vs2008 64-bit before changing every bit of code uses it. thanks in advance. ok guys think figured out. seems issue related msvcrt linking on debug...

Exhaustively feature selection in scikit-learn? -

is there built in way of doing brute-force feature selection in scikit-learn ? i.e. exhaustively evaluate possible combinations of input features, , find best subset. familiar "recursive feature elimination" class interesting in evaluate possible combinations of input features 1 after other. no, best subset selection not implemented. easiest way write yourself. should started: from itertools import chain, combinations sklearn.cross_validation import cross_val_score def best_subset_cv(estimator, x, y, cv=3): n_features = x.shape[1] subsets = chain.from_iterable(combinations(xrange(k), k + 1) k in xrange(n_features)) best_score = -np.inf best_subset = none subset in subsets: score = cross_val_score(estimator, x[:, subset], y, cv=cv).mean() if score > best_score: best_score, best_subset = score, subset return best_subset, best_score this performs k -fold cross-validati...

c++ - Enabling mprotect does not return to normal state? -

i trying create program track memory of process.. have @ point trying protect memory using protect function: static void protect(void* ptr, size_t size) { memorymgr& mgr = memorymgr::instance(); assert(!(size%s_pagealign)); assert(ptr == (void*)((unsigned long long)(ptr)&0xfffffffffffff000)); printf("protecting: 0x%x - 0x%x\n" ,(unsigned long long)(ptr), (unsigned long long)(ptr) + size); assert(mgr.m_protected.insert(memorymgr::protected_t::value_type(ptr, size)).second); int r = mprotect(ptr, size, prot_read); if (r) { perror("mprotect"); cout << "error: " << r << endl; cout.flush(); exit(1); } s_alloccnt += size / s_pagealign + ((size%s_pagealign)? 1 : 0); } and have regisered interuupt handler does: static void handler(int sig, siginfo_t *si, void *unused) { memorymgr::onsegfault(si ->si_addr, sig); } int memorymgr::onsegfault(void* addr, int serious) { memorymgr& mgr = instance(); ...

How to write i18n String for Rails 4.1 Enums? -

for exmaple, edit config/locales/en.yml en: activerecord: models: user: user attributes: user: name: name you can get user.model_name.human # => user user.human_attribute_name('name') # => name but how write rails 4.1 enums i18n values ? try enum_help gem. description: help activerecord::enum feature work fine i18n , simple_form.

How to use GETDATE() in Oracle to find number of days between Current Date and some specified date? -

suppose have table called projects , has columns projectid, startdate , enddate . startdate of each project specified , enddate specified projects finished. ongoing projects, enddate null . have perform task : find project id , duration of each project. if project has not finished, report execution time of now. [hint: getdate() gives current date] for wrote code, select projectid, case when enddate null getdate() - startdate else enddate - startdate end "duration" projects; but giving me ora-00904: "getdate": invalid identifier 00904. 00000 - "%s: invalid identifier" *cause: *action: error @ line: 113 column: 27 the line 113, column 27 position of getdate(). so way use getdate() here? getdate() function tsql. want use instead current_date . also, improved query bit using coalesce . select projectid, coalesce(enddate,current_date) - startdate "duration" projects; you may want refine result using ...

javascript - Switching CSS Background Image With jQuery On Scroll -

i'm trying header made gets smaller on scroll. currently, code looks jquery involved in header size: $(function() { $('#header').data('size','big'); }); $(window).scroll(function() { if ($(document).scrolltop() > 0) { if ($('#header').data('size') == 'big') { $('#header').data('size', 'small'); $('#header').stop().animate({ height: '60px' }, 600); } } else { if ($('#header').data('size') == 'small') { $('#header').data('size', 'big'); $('#header').stop().animate({ height: '100px' }, 600); } } }); it working great, , have header size portion down. how can replicate in order change size of logo 80 x 80 40 x 40 (and include transition)? here's css logo: #logo { ...