Posts

Showing posts from March, 2012

ios - Setting self.view.frame after going back does not work -

i setting uitableviewcontroller 's frame in viewdidappear follows: self.view.frame = cgrectmake(0.0, 0.0, 320.0, 468.0); the original frame height 516.0 . this works fine , frame change. however, when go view controller (it in uinavigationcontroller ), frame not change (says @ 516.0 though line indeed called when going back. what causing frame not change second time controller shown , how rectify this? viewdidappear not called when dismiss modal view. think of modal view view on top on view. when push or pop view controller on/off navigaction controller's stack, usual viewwillappear / viewdidappear methods aren't called. if want ensure they're called, add uinavigationcontrollerdelegate protocol root view controller:

c# - Can you use jQuery in WPF Applications? -

i have been creating wpf application on past few months , wanted add abit of animation application.i have been told before jquery javascript library use animation. the problem after looking around abit there not many things on internet lets me know if possible. i'm new jquery wont know much. if jquery isnt possible in wpf, is? so technically can use jquery in wpf. not in way might like. web browser control load html, css, , javascript local or remote sources. please note* did not make example scratch. comes this site in xaml add control <webbrowser x:name="wbmain" margin="30"></webbrowser> and in code wbmain.navigate(new uri("c:/myfilethatusesjqueryandhasjqueryasaref.htm")); additionally communication between 2 possible require bit of work. have create com visible class full trust security [permissionset(securityaction.demand, name = "fulltrust")] [comvisible(true)] public class objectforscripti

python - Multiple apps in Django admin -

Image
i have no clue why users staff status don't see apps. superuser can see 3 apps installed: backend backoffice polls as user staffstatus have backoffice available. each app did in admin.py : from django.contrib import admin <appname>.models import <class1, class2, ...> ... ... admin.site.register(class1) admin.site.register(class2) ... admin.site.register(classn) here screenshot of permissions area: where polls? backend? missing? you need change permissions able view app. django doesn't have separate “view” permission.

php - sqlsrv_query missing first result in while loop -

hi have following code function dropdownmenumobile($parentid,$siteid,$root=false) { $menu = ""; $sql = "exec spgeneratedropdownmenumobile ".$parentid.",".$siteid; $stmt = sqlsrv_query($globals['conn'],$sql); sqlsrv_fetch($stmt); if($stmt && sqlsrv_has_rows($stmt) === true) { $menu .= "<ul>"; while($rs = sqlsrv_fetch_array($stmt, sqlsrv_fetch_numeric)) { $urllink = str_replace("<br />"," ",$rs[2]); $urllink = replaceillegalchars($urllink); $actuallink = (strlen($rs[7]) > 2) ? $rs[7] : $rs[0]."/".makeseurl($urllink); $liclass = ($rs["5"] > 0)?"expand":""; $menu .= "<li class=\"".$liclass."\">"; $menu .= "<a href=\"/".$actuallink."\"&g

Neo4j http API NullPointerException -

i using http api query neo4j server. exact same queries different values not work consistently. infact entire system breaks because of nullpointer exception being thrown. cannot figure out root of problem { "query":"start n=node( { current_user_node } ), n1 = node( { contact_node } ) create unique n-[:has_contact {device: {device_id}, name: {name} }]->(n1)", "params":{"current_user_node":2,"contact_node":5941,"device_id":"f1485935-48f8-4624-af5d-67529ae91227","name":"samir coll "} } the above query returns { "exception": "nullpointerexception", "fullname": "java.lang.nullpointerexception", "stacktrace": [] } i tried above query in neo4j-shell command line , query returned null. while { "query":"start n=node( { current_user_node } ), n1 = node( { contact_node } ) create unique n-[:has_co

windows - Find UNC path of a network drive? -

i need able determine path of network q drive @ work webmethods project. code have before in configuration file. placed single character leters inside of directories security reasons. not sure semi-colon for, think double slashes drive name comes play. question: there easy way on windows 7 machine find out full path of unc specific drive location? code: allowedwritepaths=q:/a/b/c/d/e/ allowedreadpaths=c:/a/b;//itpr99999/c$/a/filename.txt alloweddeletepaths= in windows, if have mapped network drives , don't know unc path them, can start command prompt (start | run | cmd.exe) , use net use command list mapped drives , unc paths: c:\>net use new connections remembered. status local remote network ------------------------------------------------------------------------------- ok q: \\server1\foo microsoft windows network ok x: \\server2\bar microsoft windows network command

django - Diango 1.6 How about this way of create an object for a model which has two ForeignKey fields? -

there 3 models: user, question , answer. my way can works--override answer modelform's save method, pass 2 objects(question , user it. i not sure whether official way or best way. or there tutorial situation, thanks. this code: #settings.py #root urls.py urlpatterns = patterns('', url(r'^$', 'myauth.views.home', name='home'), url(r'^questions/', include('questions.urls',namespace='questions')), ) #urls.py urlpatterns = patterns('questions.views', url(r'^(?p<question_pk>\d+)/detail/$', 'detail', {'template_name': 'questions/detail.html'}, name='detail'), ) #models.py class user(abstractbaseuser): username = models.charfield() class question(models.model): user = models.foreignkey(user) title = models.charfield() content = models.textfield() class answer(models.model): #use

c# - Using .sqlite3 file to create a database on Windows Phone 8 -

i've been trying out sqlite on windows phone using tutorial base http://code.msdn.microsoft.com/wpapps/using-sqlite-with-wp8-52c3c671 , in it, database created in app.xaml this string dbpath = path.combine( windows.storage.applicationdata.current.localfolder.path, "db.sqlite"); if (!fileexists("db.sqlite").result) { using (var db = new sqliteconnection(dbpath)) { db.createtable<person>(); } } private async task<bool> fileexists(string filename) { var result = false; try { var store = await windows .storage.applicationdata.current.localfolder .getfileasync(filename); result =true; } catch { } return result; } i have database.sqlite3 file database created, , added project on assets folder. how can use file create database on windows phone app ? add database.sqlite3 in solution. , make sure database.sqlite3 build action property

arrays - Connecting points in matlab -

Image
i working in matlab , have 2 arrays following points qazx = 5 5 6 47 7 38 8 29 9 10 10 31 qazy = 15 16 16 57 17 28 18 49 19 30 20 25 i want connect 2 arrays. example want line between (5,5) , (15,16), , separate line (6,47) (16,57) , on. i have tried following code none seem work. appreciated. plot(qazx,qazy) plot(qazx(:,1),qazx(:,2),qazy(:,1),qazy(:,2)) plot([qazx(:,1),qazy(:,1)],[qazx(:,2),qazy(:,2)]) you close: plot([qazx(:,1),qazy(:,1)]',[qazx(:,2),qazy(:,2)]')

meteor - How can I access form elements from server function? -

i use mesosphere , want make custom rule validate equalsfield: mesosphere.registerrule("equalsfield", function(fieldvalue, rulevalue){ //var rulevalue = $('#'+rulevalue).val(); //var rulevalue = document.getelementbyid(rulevalue).value; return fieldvalue === rulevalue; }); but can't use jquery $ or document because not accesible on server side (these works on client side) so looks want to check 1 field equal field. in actuality when rule validated in mesosphere, rule passed 5 parameters: fieldvalue, rulevalue, fieldname, formfieldsobject, , fields. since formfieldsobject object containing raw unvalidated data form, name of each input key , current value key value, means can create new rule follows.. mesosphere.registerrule("equalsfield", function(fieldvalue, rulevalue, fieldname, formfieldsobject, fields){ return fieldvalue === formfieldsobject[rulevalue]; }); then when set rules, pass name of field current field should equ

panel - Automatically close a Google Apps Script UiApp after five seconds -

i want automatically close uiapp after number of seconds: function showconfirmationdialogue() { var app = uiapp.createapplication().setheight('80').setwidth('400'); app.settitle('test'); var panel = app.createverticalpanel(); app.add(panel); var doc = spreadsheetapp.getactive(); doc.show(app); // part doesn't seem work utilities.sleep(5000); app.close(); return app; } thanks! the ui create shown when call doc.show(app) , way can update or close use handler function ends return app . so not possible want same function creates ui since "returned" 1 time. i know 1 trick can achieve want using handler trigger source call closing handler function automatically using "special" property of checkbox widget . here code, uses checkbox can of course make invisible in final code. function showconfirmationdialogue() { var app = uiapp.createapplication().setheight('80').setwidth('400');

vba - Delete Row from Array -

i trying go through array find duplicate entries in single column of array , delete entire row. i getting figuring out rangestart, rangeend, , lastrow above , part working fine. data = range(rangestart, rangeend) = lastrow - 1 2 step -1 if data(i - 1, x) = data(i, x) 'delete data(i) end if next any awesome! sub removedups() const compare_col long = 1 dim a, anew(), nr long, nc long dim r long, c long, rnew long dim v string, tmp = selection.value nr = ubound(a, 1) nc = ubound(a, 2) redim anew(1 nr, 1 nc) rnew = 0 v = chr(0) r = 1 nr tmp = a(r, compare_col) if tmp <> v rnew = rnew + 1 c = 1 nc anew(rnew, c) = a(r, c) next c v = tmp end if next r selection.value = anew end sub

Java, How do i use add a string and an integer to an array -

this array code have far: arraylist<data> arrl = new arraylist<data>(); arrl.add("tim", 23); need know how integer , string array. for example: names: , ages: tim 23 max 56 clare 43 i know how add integers or strings array-lists can't figure how incorporate both in same array. your list taking objects of type data . so, create data class contains string name , int age. create data object each entry want , add arrl list. public class data { private string name; private int age; /** * constructor */ public data(string name, int age) { this.name = name; this.age = age; } // getters , setters go here. } in example used constructor allow easy construction of data object name , age. list<data> arrl = new arraylist<data>(); arrl.add(new data("tim", 23));

c# - keep the call center / admin functionality seperate from the purchase tunnel but not duplicate the code -

i've got asp.net mvc 4 application basic purchase tunnel application the project structure looks myproject.domainmodel myproject.repository myproject.service myproject.ui.purchasetunnel i need add call centre functionality, allow call centre users log in , place orders people on phone , admin tasks. for security reasons don't want deploy call centre functionality on our public facing web servers, want purchase tunnel. how keep call centre functionality separate purchase tunnel not duplicate purchase tunnel code project? i've played around areas "callcenter" area deployed application, making stake holders nervous. any ideas? i've never had flawless experience areas. work in principal create new section of site separate configuration, it's pain serve css/js/img assets. you have few options. largely depends on how code you'll share public facing , call-center sides use same site different roles. if call-center site same

actionscript 3 - Actionscript3, dynamic text, loop, xml -

i have 6 dynamic text fields & want add text in them xml file. this code works: titletxt1.text = xmllistmain.children()[0].title; but in loop there problem: for (var i:number = 0; < xmllistmain.children().length(); i++) { titletxt[i].text = xmllistmain.children()[i].title } titletxt[i].text part error. how can fix this? if first textfield named titletxt0.text (ie numbering starts 0 ): for (var i:number = 0; < xmllistmain.children().length(); i++) { this['titletxt' + i].text = xmllistmain.children()[i].title; } if first textfield named titletxt1.text (ie numbering starts 1 ): for (var i:number = 0; < xmllistmain.children().length(); i++) { this['titletxt' + (i + 1)].text = xmllistmain.children()[i].title; } better start numbering 0 things can omit step of adding 1 loop's index.

perl - Why isn't this concatenating as expected? -

i'm trying lean perl , doing few simple exercises myself used it. one of exercises manipulating strings , i've written below. #!/usr/bin/perl use strict; print "please enter text..\n"; $string =<stdin>; $string_reverse = reverse $string; print "reversed: $string_reverse\n"; $string_length = length $string; print "length: $string_length\n"; $string_upper = uc $string; print "uppercase: $string_upper\n"; $string_lower = lc $string; print "lowercase: $string_lower\n"; print "enter second bit of text\n"; $second_string = <stdin>; print $string . $second_string; this produces following output. please enter text.. test reversed: tset length: 5 uppercase: test lowercase: test enter second bit of text 123 test 123 i expected concatenated text shown as: test123 why showing instead on new line every time? my $string =<stdin>; reads in string, including newline. try us

api - Query Track by ISRC -

is possible info track using isrc instead of id? instead of http://api.deezer.com/track/123455 something like http://api.deezer.com/track/?isrc=8764237 it's not documented yet yes, can search track based on it's isrc number, following api call : https://api.deezer.com/2.0/track/isrc:uswb11200587 note in cases, isrc code may contain dash between letters/numbers.

compilation - Sass was working fine for 6 months but not compiling anymore -

i have been using sass 6 months. working sass not compile. the version of sass is: 3.2.14 the version of compass is: 0.12.2 the version of ruby is: 2.2.0 os is: windows 8 problem : sass not compiling. accessing the path in ruby, no problem. ruby reads: "sass watching changes. press crtl-c stop." i'm using _partials , have imported them correctly input.scss file. example import @import '_footer', '_columns', '_content', '_h1-h6', '_mobile', '_home' ; i using adobe dreamweaver 5.5 text editor. what have tried in effort troubleshoot: one one, have eliminated each partial @import see if there coding problem. did not work! restarted dreamweaver restarted pc uninstalled ruby , re-installed ruby i message in command line: [sass] nomethoderror: undefined method `perform' nil:nilclass i'm not sure else can do, please help. sass partials not require underscore whe

javascript - node mssql update query, get rowcount -

i'm using nodejs package mssql ( https://npmjs.org/package/mssql#cfg-node-tds ) connect ms sql database , perform update queries. i understand if update query ends not affecting rows, still return success event. handle success event differently if 0 rows affected since not intended outcome of query. after doing research, found when performing sql queries, can use @@rowcount number of affected rows, i've yet figure out how use mssql node package. has used node package , and handled update queries way trying to? thanks! okay, right link provided, node package can call stored procedures. either create logic on js side or tsql side. since dba/developer trade, lets create sp perform update return number of rows effected. i using adventure works sample database. -- use sample db use adventureworks2012; go -- sample select select * [person].[person] lastname = 'walters'; go -- stored procedure create procedure usp_update_first_name (@id int, @

linkage - C++'s extern-"C" functionality to languages other than C -

as known, declaring extern "c" c++ function makes name have c linkage, enabling c code link. my question - there other programming languages can make c++ function names have linkage to, extern "lisp" or extern "fortran" ? if not, why? internal structure behind "c" , makes limitations? what alternatives? the c++ standard, 7.5.2 dcl.link, says: linkage between c++ , non-c++ code fragments can achieved using linkage-specification: linkage-specification: extern string-literal { declaration-seqopt} extern string-literal declaration the string-literal indicates required language linkage. international standard specifies semantics string-literals "c" , "c++". use of string-literal other "c" or "c++" conditionally supported, implementation-defined semantics. [ note: therefore, linkage-specification string literal unknown implementation requires diagnostic. —end

Installing rmagick gem on windows 7 rails 4 ruby 1.9.3 -

i trying install rmagick gem https://github.com/rmagick/rmagick use carrierwave gem https://github.com/carrierwaveuploader/carrierwave image uploads. i following railscast http://railscasts.com/episodes/253-carrierwave-file-uploads , can't images display through index page in app. i need install rmagick image resizing following error when running bundle command following declared in gem file: gem 'rmagick', '2.13.2'. has got suggestions resolving error? in advance guys: fetching gem metadata https://rubygems.org/....... fetching gem metadata https://rubygems.org/.. resolving dependencies... using rake (10.1.0) using i18n (0.6.5) using minitest (4.7.5) using multi_json (1.8.2) using atomic (1.1.14) using thread_safe (0.1.3) using tzinfo (0.3.38) using activesupport (4.0.0) using builder (3.1.4) using erubis (2.7.0) using rack (1.5.2) using rack-test (0.6.2) using actionpack (4.0.0) using mime-types (1.25) using polyglot (0.3.3) using treetop (1.4.15) usi

c++ the use of understanding pointers -

i reading on c++ pointers. http://www.cplusplus.com/doc/tutorial/pointers/ #include <iostream> using namespace std; int main () { int firstvalue = 5, secondvalue = 15; int * p1, * p2; p1 = &firstvalue; // store address of firstvalue = 5 p2 = &secondvalue; // store adrees of secondvalue = 15 *p1 = 10; // p1 = 10 *p2 = *p1; // p2 = 10 p1 = p2; // p1 = 10 *p1 = 20; // p1 = 20 cout << "firstvalue " << firstvalue << '\n'; cout << "secondvalue " << secondvalue << '\n'; return 0; } from understanding output should be firstvalue 20 secondvalue 10 but when @ answers other way round firstvalue 10 secondvalue 20 i don't understand quite pointers. please help p1 = p2; // p1 points p2 pointing @ *p1 = 20; // *p2 = secondvalue = 20

.net - ASP.NET Web Administration tool; asp.net connection string -

i have asp.net webapplication on local machine , sql server database on server. ran aspnet_regsql.exe on server. after created admin role asp.net administration tool. created 1 user admin privileges. under security section in sql server, provided user db_owner access. when m trying run application, m getting below error, server error in '/ubcat' application. login failed user 'admin'. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.data.sqlclient.sqlexception: login failed user 'admin'. source error: line 36: line 37: context.logins.addobject(login); line 38: context.savechanges(); line 39: } line 40: //connection string: <customerrors mode="off"></customerrors> <authentication mode="forms"> <forms name="ubcatsqlauthcookie&

html - Unordered List height 100% not fitting to height of parent div -

i have unordered list inside of div (using bootstrap panel). div set 100% height, , without unordered list inside of it, fill rest of browser window desired. when add unordered list, instead of unordered list filling in parent div , using "overflow-y: scroll" correctly, flows off page of content. i want unordered list snap height of parent div of content stays on browser window user has scroll inside of unordered list's parent div. how make unordered list's height snap parent div completely? <div class="panel panel-default classroompanel"> <div class="panel-heading">choose classroom</div> <div class="panel-body"> <ul class="classroomlist"> <li>sample element</li> <li>sample element</li> <li>sample element</li> <li>sample element</li> <li>sample element</li>

ide - How to search a directory that's excluded from my project in PyCharm? -

i have "cachegen" folder lot of files program generates kept. usually, when searching code, want omit directory since it's derivative of actual code - i've excluded project. in case, though, there seems problem cached result, , want search through cachegen directory find it. however, if select cachegen directory, pycharm says "directory [cachegen] not found" - though path exists.

activerecord - Rails 4.0.2 select & uniq -

i'm using activerecord query campaigntype.includes(:campaign_description) .select('distinct campaign_description_id, campaign_description.name') .where(:campaign_id => campaign_id) which used work on rails 3. gives lot of depecation warnings , example: currently, active record recognizes table in string, , knows join comments table query, rather loading comments in separate query. however, doing without writing full-blown sql parser inherently flawed. since don't want write sql parser, removing functionality. on, must explicitly tell active record when referencing table string: post.includes(:comments).where("comments.title = 'foo'").references(:comments) i've tried different ways i'm not getting there. appreciated. i cannot explain why got error mentioned in comments, have done same on end , works properly. however, there issue may have effect of solving problem anyways. unfortunately, while technically

java - List.Remove(obj) is removing the incorrect value -

i'm doing code remove 1 line <p:datatable> using commandlink in same line. xhtml <p:datatable value="#{demandacontroller.equipefornecedor}" var="equipe" id="dtequipe" style="width:70%; margin-top:5%"> ... <p:column headertext="excluir" width="20%"> <p:commandlink value="excluir" actionlistener="#{demandacontroller.removerfuncequipe(equipe)}" update="dtequipe" ></p:commandlink> </p:column> </p:datatable> bean private list<equipe> equipefornecedor = new arraylist<equipe>(); public void removerfuncequipe(equipe funcionario) { equipefornecedor.remove(funcionario); } the method removerfuncequipe(equipe) called correct item value (inspected) but...when try remove equipefornecedor.remove(item), removes incorrect value of list. doing wrong?? edit : public abstract class defaultentity implements ser

Java executes arithmetic Expression wrong? -

i don`t understand how java progressing arithmetic expression int x = 1; int y = 1; x += y += x += y; system.out.println("x=" + x + " y=" + y); with java x = 4 , y = 3. in c, perl, php x=5 , y = 3 on paper x = 5 , y = 3 this nasty part, obviously: x += y += x += y; this executed as: int originalx = x; // used later x = x + y; // right-most x += y y = y + x; // result of "x += y" value stored in x x = originalx + y; // result of "y += x" value stored in y so: x y (start) 1 1 x = x + y 2 1 y = y + x 2 3 x = originalx + y 4 3 the important part use of originalx here. compound assignment treated as: x = x + y and first operand of + evaluated before second operand... why takes original value of x , not "latest" one. from jls section 15.16.2 : if left-hand operand expression not array access expression, then:

Simplify repeated scope attributes in angularjs -

i found myself repeating following structure , i'd simplify it: <container> <clock property="data"></clock> <calendar property="data"></calendar> <alert property="data"></alert> </container> with relative directive app.directive('clock', function(){ return { restrict: 'e', scope: { 'property': '=' } } }); how remove property="data" each item , move @ container level? you can set property="data" in parent directive , make available through controller your container directive <container property="data"> app.directive('container', function(){ return { restrict: 'e', scope: { 'property': '=' }, controller: function($scope){ this.getdata = function(){ return $scope.property; } } } }); and child directive

python - looping through dynamic table -

how loop through dynamic database table? i have situation need loop through table n rows while looping adds rows in same table , should loop until old , newly added rows not iterated end. for example have created prototype import sqlite3 lite import sys con = none try: con = lite.connect('dynamiciteration.db') cur = con.cursor() cur.execute("drop table if exists tbl") cur.execute("create table tbl (id integer primary key, roll text)") cur.execute("insert tbl (roll) values ('1')") con.commit() except lite.error, e: print "error %s:" % e.args[0] sys.exit(1) cur.execute("select roll tbl") rows = cur.fetchall() print len(rows) j = 0 row in rows: #print 'iteration '+str(j) j = j + 1 try: cur.execute("insert tbl (roll) values ('"+str(j)+"')") con.commit() if(j < 100): cur.execute("select r

javascript - Is it possible to listen to all events triggered on an element -

is possible listen events triggered on dom element no matter name of event? , if possible there reason 1 should no that? unfortunately not able find in either stackoverflow or google :( i planning write script needs respond 2 dozens different custom events , wondering if, instead of binding each event element listen of them , based on event name, dynamically call function.. you can't in way you've suggested simple alternative: const events = 'click mouseover mouseout'; events.split(' ').foreach(e => window.addeventlistener(e, dostuff)); function dostuff(){...}

c# - String replace with pattern matching -

i have following variable string pulled database , changes each time: for example first time string is: you can use [xyz] framework develop [123], web, , [abc] apps second time string is: you can use [aaa] framework develop [bbb], web, , [ccc] apps i replace [xyz] or [aaa] .net , [123] or [bbb] desktop , and [abc] or [ccc] mobile . the text in braces change since variable string want replace the text in first brace .net , text in second brace desktop , text in third brace mobile . the transformed string should - you can use .net framework develop desktop, web, , mobile apps: what easiest way using string replace in c#? you can want regular expressions: // error checking needed..... string input = "you can use [xyz] framework develop [123], web, , [abc] apps"; regex re = new regex(@"(\[[^\]]+\])"); matchcollection matches = re.matches(input); input = input.replace(matches[0].value, ".net").replace(matc

gorm - inheritance in Grails domain model -

my grails app's domain model has following requirements: a user belong 0 or 1 organisations an organisation either charity or company charities , companies have some common fields , (non-nullable) fields unique each organisation type i put common organisation fields abstract organisation class charity , company both extend. can't store hierarchy in single table because there non-nullable fields specific each organisation type. relevant parts of domain model shown below: class user { string name static belongsto = [organization: organization] static constraints = { organization nullable: true } } abstract class organization { string name static hasmany = [users: user] static mapping = { tableperhierarchy false } } class charity extends organization { // charity-specific fields go here } class company extends organization { // company-specific fields go here } when @ mysql schema generated model, inheritance r

C# Read Excel data that is linked to Oracle DB -

how read data excel.xslx linked oracle? can read entire sheet fine using c# , print console window, data being pulled (and refreshed every often) cannot read named range or table. have tested reading data named ranges/tables in other workbooks (not being pulled oracle) fine. prefer not read entire sheet. question how refer linked data named range or table in sql query using c#, or if there other way read linked data excel? code posted below followed output error (which has no build warnings/errors), 'persontable' named range gave data being pulled oracle11g. using system; using system.collections.generic; using system.linq; using system.text; using system.data.oledb; namespace readexcelnamedrage { class program { static void main(string[] args) { string connectionstring = "provider=microsoft.ace.oledb.12.0; data source=c:\\documents , settings\\jhamandi\\desktop\\hroracletest.xlsx;extended properties=excel 8.0"; /

html - targeting different div styles with target method -

hello using target method manipulate different div styles, first "link_one" working, while have 1 link, question how make work "link_two" ? link_two second part of css ? more important here each link maniluplating 2 different classes in link 1 , 2 1 of class same. <a href="#sections">link_one</a> <div id="sections"> <div id="link_one">info</div> <div id="link_two">info</div> </div> /* link 1 code */ #sections:target #link_one{ height:90px; background:#333; transition:all 1s ease; } #sections:target .rslides { height:0px; transition:all 1s ease; } /* link 2 code */ #sections:target #link_two{ height:90px; background:#333; transition:all 1s ease; } #sections:target .rslides { height:0px; transition:all 1s ease; } one way apply target selector be: for

Relocating shards in elasticsearch -

step 1) creating node named "node1" step 2) creating new index in node1 named "application" , in index type "testing" step 3)index created 5 shards. no replicas step 4)now insert 5 doc in index. splitted among 5 shards step 5)now initiate new node called "node2" in node1's cluster. step 6) per understanding shared shards between nodes. 2 shards moved new node question 1)now request document @ node1 present in relocated shards(shards moved node1 node2) question 2) search return requested document or not question 3) how 2 nodes communicate each other question 4) can read , write in node2 ? if yes can search same data written node2 node1.. thanks in advance..! all answers yes :) the nodes communicate each other through transport port, default 9300 port (or first 1 free in (9300-9400] range. use custom binary protocol communicate, based on serialization of objects (not standard java serialization in of cases th

Regex for selecting files in 6 hour intervals -

i have list of files timestamp in file name, named in form: file_year-month-date-hour-minute.something.gz. for instance there files named file_2013-06-17-00-05.something.gz file_2013-06-17-00-10.something.gz i need select files in 6 hour intervals regex. selecting "file_year-month-date*" gives me daily files, not sure how filter down 6 hour chunks. you can regex if must: file_\d{4}-\d{2}-\d{2}-(?:00|06|12|18|24)-(?:[0-5][0-9])\..+?\.gz

java - Looping through the keys of a hashMap -

i have hashmap called africanpeople private hashmap<integer, object> africanpeople = new hashmap<integer, object>(); the key age , value person object. i want loop through hashmaps keys , people between age of 30 , 45. is possible? it possible, using for (integer key : map.keyset()) but hashmap not appropriate structure this. should use treemap instead, can directly return submap containing keys between 30 , 45:

How to make this BATch file have a timer (time left to shutdown or reset)? -

how make batch file have timer? see how time left. windows says "windows shut down in less minute". @echo off color 0a title restart\/shutdown :start echo welcome, %username% echo do? echo. echo 1. shut down echo 2. restart echo. echo 0. quit echo. set /p choice="enter choice: " if "%choice%"=="1" goto shutdown if "%choice%"=="2" goto restart if "%choice%"=="0" exit echo invalid choice: %choice% echo. pause cls goto start :shutdown shutdown.exe -s -t 10 :restart shutdown.exe -r -t 10 you use command "timeout /t 10" or like: @echo off /l %%# in (10,-1,1) (set/p "=%%# seconds left... "<nul: ping -n 2 127.0.0.1 >nul cls:)

css - Can you make the border transparent? -

in css there way make border transparent, box (inside) border same? please see link: http://jsfiddle.net/xiijamiie/lfwbn/14/ #white_box { position:absolute; min-width:90%; max-width:90%; margin:0 auto; height:92%; top:0%; left:5%; right:5%; background:white; z-index:1; width:80%; border:5px #0f0 solid; } i know if can make green border 0.6 opacity , keep white inside normal. is possible or have make 2 divs on top each other? thanks in advance! you use: border: 5px rgba(0, 255, 0, 0.6) solid; updated example #white_box { position: absolute; min-width: 90%; max-width: 90%; margin: 0 auto; height: 92%; top: 0%; left: 5%; right: 5%; background: white; z-index: 1; width: 80%; border: 5px rgba(0, 255, 0, 0.6) solid; } alternatively, use outline too; both have different results. outline: 10px solid rgba(0, 255, 0, 0.6); example here

javascript - How to clean part of layer with KineticJS? -

i'm working on drawing tool kineticjs. there problem. can't clean part of layer. algorithm of drawing: draw line, use rubber cleaning , continue drawing. , clean parts of layer disappearing. full, before using rubber. demo code: erase code: draw layer.clear(x,y,width,height) clear canvas using context.clearrect(x,y,width,height). but remember kinetic objects retained objects on canvas automatically redrawn. that's why canvas fills again after layer.clear.

compare - comparing nil to integer in Objective-C -

in following case string nsstring if (string.length < 1) { return; } and string turns out nil if statement still evaluate correctly because in case nil evaluates 0 . however, recommended practice (by clang or apple) , there arguments against , doing closer to: if (!string || string.length < 1) { return; } it's common like: if (string.length) { // string not nil , string has non-zero length } else { // either string nil or length 0 } there no need, in such case, check see if string nil or not. when string nil , end doing [nil length] . calling method on nil pointer results in value of "zero". how "zero" interpreted depends on method's return type. primitive types appear 0. bool appears no . pointers appear nil .

Excel VBA - How to sort by first two letters of cell? -

Image
i have 2 columns want sort. want below column first sorted first 2 letters, column b. column - column b ab - info 3339876 ab - data 3339877 ab - data 3339878 ac - info 3339123 ac - data 3339124 ac - info 3339125 ad - info 3339456 ad - info 3339457 ad - data 3339458 the first 2 letters of column important , must sorted them first. information after first 2 letters of column irrelevant , not matter. more important column b # data sorted in ascending order second (after first 2 letters of column a) sorry confusion. clears things up. sort highlighting column , hit alt + a + sa update: 'excel sorts alphanumeric text left right, character character' , may not order numbers if combined single cell. should create column 2 letter code want use sorting using =left(a2,2) , copying way down. multilayered sort clicking sort button, sorting first on 2 digit code alphabetically ,

SQL: get maximum value and it's corresponding field(s) -

i need max lesson_score following table, along respective date particular user: -------------------------------- |uid |lesson_score |date | -------------------------------- |1 |2 |1391023460 | |1 |8 |1391023518 | |1 |4 |1391023596 | -------------------------------- i need result of: --------------------------- |lesson_score |date | --------------------------- |8 |1391023596 | --------------------------- my sql looks this: select date, max(lesson_score) lesson_score cdu_user_session_progress uid = 1 group date"; but gives me 3 rows: --------------------------- |lesson_score |date | --------------------------- |2 |1391023460 | |4 |1391023596 | |8 |1391023518 | --------------------------- what doing wrong? thanks! try using select lesson_score, date cdu_user_session_progress order lesson_score desc limit 1; the order by - part responsible, max. le

c# - CRM 2011 Custom Workflow accessing data from a created record trigger -

Image
i creating custom workflow - triggered on create of record (custom activity). i need able access data custom activity above within custom workflow have hard time finding reference on how information newly created record. any advice? in advanced. edit: public sealed class feeinvoicegenerator : codeactivity { [input("myfee")] [referencetarget("fee")] [requiredargument] public inargument<entityreference> somefee { get; set; } protected override void execute(codeactivitycontext executioncontext) { itracingservice tracingservice = executioncontext.getextension<itracingservice>(); try { tracingservice.trace("creating invoice fee"); workflowhelper workflowhelper = new workflowhelper(); workflowhelper.debugmessageson = true; //creates connection info invoicefeehelper invoicefeehelper = new invoicefeehelper(); invoicefe

ios7 - Is there a better way to define NSManagedObjectContext definitions for MagicalRecord? -

in every method in every class of ios app, exception of appdelegate, have following line of code: nsmanagedobjectcontext *localcontext = [nsmanagedobjectcontext mr_contextforcurrentthread]; in appdelegate.h file have this: nsmanagedobjectcontext *localcontext; and in appdelegate.m file have this: localcontext = [nsmanagedobjectcontext mr_contextforcurrentthread]; i read in should have 1 such line of code in appdelegate, , have multiple references of other classes/methods. if leave line of code out of of classes exception of appdelegate, accomplishing that, best way it? update code added appdelegate.h file: @property (strong, nonatomic) nsmanagedobjectcontext *managedobjectcontext; @property (strong, nonatomic) nsmanagedobjectcontext *localcontext; this code added appdelegate.m file: // set default magicalrecord context in view controllers uitabbarcontroller *tbc = (uitabbarcontroller *)self.window.rootviewcontroller; uinavigationcontroller *nc = tbc.vi

javascript - Add class to active page does not work for pages in sub folders -

i have following script add class .active current page: //main menu .active classes handler $("#mainmenu a").filter(function () { var href = location.href.replace(/#*/, ""); if (location.pathname === "/") {href += "index";} return href === this.href; }).addclass("active"); everything works fine pages in main directory not work pages in sub folders, example: it works <a href="index.php">home</a> won't work for: <a href="sub/test.php">home</a> why that? need add "last of index"? full hmtl: <li><a href="index">home</a></li> <li><a href="about">about</a></li> <li class="submenu"><a href="gallery">gallery</a> <ul> <li><a href="sub/test">page in sub folder</a></li> </ul> &

c# - merge items into one that are repeated in the same list -

i have query in database returns me list of objects( in case notifications), list brings lot of repeated items(a notification can contain multiples attachments, query join attachment table, bringing lot of notificationid repeated, notification lot of attachment). want acomplish merge attachments 1 specific notification id 1 item (let notification class has list of attachments) did this: dim dupes = list.groupby(function(x) x.notification.notifiedid) .select(function(s) s.tolist()) .tolist() but don't know how merge grouped ones, here? try in c# list.groupby(x=> x.notification.notifiedid).selectmany(o=> o); i don't know vb can try this dim dupes = list.groupby(function(x) x.notification.notifiedid) .selectmany(function(s) s) .tolist()

jquery - Apply overlay gradient to images just like myspace -

Image
i want apply gradient overlay lot of images myspace did in new design . images have title black gradient background . i searched of tutorials shown using background image on div . want apply property <img> tags appearing on page. here's closest tutorial found in terms of want achieve . explained using background image. if @ background of title. black background ensures text clear enough . can please me out in writing general css achieveing on images ? you should put more effort trying out first.. found interesting got started.. http://jsfiddle.net/mpmnc/1/ .overlay { content: 'test'; width: 100%; height: 100%; background-color: rgba(100,255,50,0.5); position: absolute; top: 0; } .overlay-wrap { display: inline-block; position: relative; } unfortunately doesnt seem css alone suffice does :before not work on img elements? for gradient: http://www.colorzilla.com/gradient-editor/

iphone - iOS: At a specific coordinate, adding a UIView as subview of another UIView -

i have ten (x,y) coordinates values in nsinteger array. //yet implement i want add series (10 array) of uiview on bigger uiview . [self.mybiggerview addsubview:mysmallview]; i not getting how add mysmallview @ specific (my coordinate array) coordinate. please help either after or before [self.mybiggerview addsubview:mysmallview]; set frame of small view this: mysmallview.frame = cgrectmake(coord1,coord2,width,height);

random forest - How can I subsample a SpatialPointsDataFrame in R -

Image
i working on running randomforest. i've imported point data representing used , unused sites , created raster stack raster gis layers. i've created spatialpointdataframe of used , unused points underlying raster values attached. require(sp) require(rgdal) require(raster) #my raster stack xvariables <- stack(rlist) #rlist = list of raster layers # reading in spatial used , unused points. ldata <- readogr(dsn=paste(path, "data", sep="/"), layer=used_avail) str(ldata@data) #attach raster values point data. v <- as.data.frame(extract(xvariables, ldata)) ldata@data = data.frame(ldata@data, v[match(rownames(ldata@data), rownames(v)),]) next plan run random forest using data. problem is, have large data set (over 40,000 data points). need sub sample data having hard time figuring out how this. i've tried using sample() function think because have spatialpointsdatafram wont work? i'm new r , appreciate ideas. thanks!

Magento url_rewrite exists in core_url_rewrite but it always redirects me to homepage -

if click on product redirects me homepage instead product page. looked up, request path exists in database , assigned correct target path. if call target path (catalog/product/view/id/420243) directly, works! i have absolut no idea why url rewrite path isn't working. weird thing isn't working products. ideas? the core_url_rewrite table has on 6.5 millionen rows...but couldn't cause problems, or? thank help, best, stefan p.s. it's magento 1.6.0.0 yes, problem seo plugin, makes many rewrites. change core_url_rewrite table url_rewrite_id bigint(64). warning table first... know, in case. the problem should fix itself.

c# - MSDN Entity Framework Code First Tutorial: SQL Error -

i going through this tutorial on msdn . code in first part of tutorial. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.data.entity; namespace codefirstnewdatabasesample { class program { static void main(string[] args) { using (var db = new bloggingcontext()) { // create , save new blog console.write("enter name new blog: "); var name = console.readline(); var blog = new blog { name = name }; db.blogs.add(blog); db.savechanges(); // display blogs database var query = b in db.blogs orderby b.name select b; console.writeline("all blogs in database:"); foreach (var item in query) { console.writeline(item.name); } console.writeline("

c# - Method InterceptAsync in type Google.Apis.Auth.OAuth2.ServiceAccountCredential does not have an implementation -

i placed error message in title because scored web , cannot find single instance of else having issue. i'm attempting use google .net api access analytics data shown here: http://www.toplinestrategies.com/dotneters/net/accessing-and-querying-google-analytics-via-service-account-c/?lang=en i've followed everything, having created credential, pointed key file , password, , used email address client id. but weird thing is, when execute page, fails error in title. the offending line of code appears one: var credential = new serviceaccountcredential( new serviceaccountcredential.initializer(clientid) { scopes = new[] { scope } }.fromcertificate(certificate)); if remove line page doesn't cause exception, if add it, fails immediately. but skips breakpoints on page entirely, can't step see or error is, if executing before page loads. i suspected bad credentials if run fiddler see there no traffic passing google or anywhere

where to load grails message when throwing exception in a service -

where should separation of ui message elements if grails service throws exception? should message loaded service , passed controller via exception, or should controller load message based on type of exception thrown? assumes message have parameter values need filled in. here exception: class customexception extends runtimeexception { string message } loading message source controller after catching exception: class myservice { void dosomething() { ... if (somethingbad) { string value = 'mary smith' throw new customexception(value) } ... } } class mycontroller { def myservice void processrequest() { try { myservice.dosomething() } catch (customexception e) { flash.error = g.message(code:'user.input.error', args:'[${e.value}]') render view:'some_gsp' } ... } } loading error message s

Cant chain Jquery text effect plugin -

trying each texteffect run in sequence. this jquery code run text effect on each class, 1 after other. <script type="text/javascript"> $(document).ready(function() { $(".sci-fi1").texteffect(function() { $("sci-fi2").texteffect(function () { $(".sci-fi3").texteffect() }); }); }); </script> this div contains text want run effect on in sequence <div id ="text"> <br /> <h2>john </h2> <p class="sci-fi1"> software developer </p> <p class="sci-fi2"> web designer </p> <p class="sci-fi3"> computer technician </p> </div> for reason first text effect runs, have missed something? can not chain plugins way i'm attempting? there event.texteffecte