Posts

Showing posts from February, 2015

php - Accept username that is ecrypted by hash in the database -

php - Accept username that is ecrypted by hash in the database - when i'm creating user, username , password saves in hash. want username , password when log in, can read system. using laravel below code user controller public function postsignin() { if (auth::attempt(array('username'=>input::get('username'), 'password'=>input::get('password')))) { homecoming redirect::to('admin/dashboard')->with('message', 'you logged in!'); } else { homecoming redirect::to('users/login') ->with('message', 'your username/password combination incorrect') ->withinput(); } } case sensitivity not require hashing. utilize non _ci encoding in database table. ci stands case insensitive. assuming still want hash username, need hash user input (username), in same manner stored in database, before passin...

node.js - query using column from junction table -

node.js - query using column from junction table - i have node entity many many relationship through edge var node = db.define('nodes', { 'name': sequelize.string }); var border = db.define('edges', { 'weight': sequelize.string }); node.hasmany(node, { as: 'parents', foreignkey: 'parent_id', through: edge}); node.hasmany(node, { as: 'children', foreignkey: 'child_id', through: edge}); i want nodes children created after specific time using query following node.getchildren({ include: [edge], where: ['createdat > ?', 1413000965754] }).complete(function(err, children){ // ... }); but cant work. node.js sequelize.js

java - Maven : NoClassDefFoundError Xms256m while running Maven Command -

java - Maven : NoClassDefFoundError Xms256m while running Maven Command - i below exception while running maven command mvn --version mvn --version exception in thread "main" java.lang.noclassdeffounderror: xms256m caused by: java.lang.classnotfoundexception: xms256m @ java.net.urlclassloader$1.run(urlclassloader.java:202) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:190) @ java.lang.classloader.loadclass(classloader.java:306) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:301) @ java.lang.classloader.loadclass(classloader.java:247) not find main class: xms256m. programme exit. 'cmd' not recognized internal or external command, operable programme or batch file. what can reason. have set below maven environment variables m2_home m2 maven_opts java maven maven-2 maven-3

SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005 -

SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005 - i getting error below in 1 of ssis task ssis error code dts_e_oledberror. ole db error has occurred. error code: 0x80004005. ole db record available. source: "microsoft ole db provider sql server" hresult: 0x80004005 description: "syntax error or access violation". its oledb source task in dataflow task , having query below: select patientser changetable(changes dbo.patient,?) ct ct.sys_change_operation = 'i' when execute same query on server replacing ? "0" works fine. any thought wrong query missing in ssis? ssis syntax-error oledb oledbexception

html - Clicking on anchor links moves whole page to top -

html - Clicking on anchor links moves whole page to top - so have webpage whole html's overflow hidden html { overflow: hidden; } and have nav bar has anchor links , div has content has overflow auto, it's scrollable. nav: <ul> <li><a href="#events">events</a></li> <li><a href="#jazz">jazz</a></li> <li><a href="#weddings">weddings</a></li> </ul> content div: <div class="content"> <div id="events">events</div> // content <div id="jazz">jazz</div> // content <div id="weddings">weddings</div> // content </div> now, problem when click on link on nav, illustration jazz, whole page goes top, everything: nav, div content , obviously, div shows jazz section . there way stays in place , div content box scrolls section? thanks! given i...

Changing Delphi XE5 workspace to Delphi 7 -

Changing Delphi XE5 workspace to Delphi 7 - is possible alter xe5's workspace delphi 7 like? designing forms within window pain , move components palette , design form outside of canvas. you can switch classic undocked desktop in desktop drop down. it's not identical delphi 7, perchance close you'll out of box. the other thing can seek enable floating designer, disabled default. more details here: http://francois-piette.blogspot.co.uk/2013/04/enabling-floating-form-designer-in.html you'll need adapt registry key version. article has key xe4. xe5 is: hkey_current_user\software\embarcadero\bds\12.0\form design set embedded designer value false . restart ide , you've got familiar floating design surface. delphi delphi-xe5

spring - @Autowired with JUnit tests -

spring - @Autowired with JUnit tests - i´ve using junit tests have issues, these tests have @autowired annotation within spring beans , when reference them beans @autowired null. here illustration code: public class test { protected applicationcontext ac; @before public void setup() { ac = new filesystemxmlapplicationcontext("classpath:config/applicationcontext.xml" "classpath:config/test-datasources.xml"); } @test public void testrun() throws exception { imanager manager = (imanager)this.ac.getbean("manager"); manager.dosomething(); } } @service public class manager implements imanager { public boolean dosomething() throws exception { parametersjcscache parametersjcscache = new parameter...

How to use Android restricted API methods ¿reflection? -

How to use Android restricted API methods ¿reflection? - i'm developing app has scheme privileges , want utilize intallpackage() , deletepackage() methods, aren't visible in regular api. have no thought how utilize reflection create these methods available. knows how can access methods code? steps create them available on android sdk? tutorials it? as suggested, can done reflection. avoid changes in sdk causing problems it's thought validate methods first before calling them, ensure exists , have right method signature. if grab android source code should able find of hidden methods, marked @hide annotation. edit: here (incomplete) example, enabling access point programatically should give clues: wifimanager wifimanager = (wifimanager) getsystemservice(context.wifi_service); method method = wifimanager.getclass().getmethod("setwifiapenabled", wificonfiguration.class, boolean.class); method.invoke(wifimanager, config, true); essentia...

How to remove elements from a queue in Java with a loop -

How to remove elements from a queue in Java with a loop - i have info construction this: blockingqueue mailbox = new linkedblockingqueue(); i'm trying this: for(mail mail: mailbox) { if(badnews(mail)) { mailbox.remove(mail); } } obviously contents of loop interfere bounds , error triggered, this: for(int = 0; < mailbox.size(); i++) { if(badnews(mailbox.get(i))) { mailbox.remove(i); i--; } } but sadly blockingqueue's don't have function or remove element index, i'm stuck. ideas? edit - few clarifications: 1 of goals maintain same ordering popping head , putting tail no good. also, although no other threads remove mail service mailbox, add together it, don't want in middle of removal algorithm, have send me mail, , have exception occur. thanks in advance! you may p̶o̶p̶ poll , p̶u̶s̶h̶ offer elements in queue until create finish loop on queue. here's example: mail...

php - Switch case inside of 'value' for CDataColumn -

php - Switch case inside of 'value' for CDataColumn - does know how display switch/case value in cgridview column field? i've got entry in db types 'picture', 'video', 'audio', 'drawing', in cgridview display text instead of 1, 2, 3, 4. i've found online, apply 2 values, need 4, array( 'name'=>'column_name', 'type'=>'html', 'value'=>'($data->gender=="1")?"male":"female"', ), any ideas great! array( 'name'=>'column_name', 'type'=>'html', 'value'=>function($data){ $result = 'unknown'; //($data->gender=="1")?"male":"female" switch($data->gender) { case 'male': $result = 'this male'; break; } homecoming $result; }, ), php yii

javascript - SharePoint JSOM: get SPFolder custom field value -

javascript - SharePoint JSOM: get SPFolder custom field value - we have a sharepoint 2013 document library a custom content type added library, based on standard "folder" content type; new "displayname" text field added content type a few folders of custom content type created in document library i seek create javascript command visualize folder construction library. can't custom "displayname" field value this.clientcontext = sp.clientcontext.get_current(); var web = this.clientcontext.get_web(); this.clientcontext.load(web); this.clientcontext.executequeryasync(function(sender, args) { (var = 0; < this.toplevelfoldersurl.length; i++) { var contextparams = {}; contextparams.folderurl = web.get_serverrelativeurl() + "/" + this.toplevelfoldersurl[i]; // folder contextparams.toplevelfolder = web.getfolderbyserverrelativeurl(contextparams.folderurl); this.clientcontext.load(c...

Ignore service files when run perforce reconcile command -

Ignore service files when run perforce reconcile command - i utilize "reconcile" command adding new files changelist. issue service files (files suffix ,v) added changelist. does know how prevent adding them changlist? save remove them? thanks. to remove them set of opened files, utilize 'p4 revert'. you can delete files changelist while editing changelist prior submit, files remain open add together , you'll still need revert them. to prevent them beingness added changelist in first place, have @ p4ignore feature: http://www.perforce.com/blog/120214/new-20121-p4ignore perforce

plsql - How to write a delete trigger in Oracle PL/SQL - stuck on identifying "matching rows" -

plsql - How to write a delete trigger in Oracle PL/SQL - stuck on identifying "matching rows" - i have trigger i'm writing whereby , 1 time delete row, want delete corresponding row in table (which common_cis.security_function ). and source table party.security_function here columns in common_cis.security_function : url scrty_func_name scrty_func_desc idn create_tmstmp cncrcy_user_idn here columns in party.security_function : update_user_src_sys_cd update_user_id update_ts scrt_func_nm scrt_func_desc creat_user_src_sys_cd creat_user_id creat_ts what have far : delete common_cis.security_function ccsf ccsf.scrty_func_name = :new.scrt_func_nm; is right idea? or utilize kind of row-id ? thanks i think should utilize integrity constraints that, namely foreign key constraint "on delete cascade" condition. here example, check first there tables in schema names used: -- create ...

timeout issues in spring integration gateway for soap request and reply -

timeout issues in spring integration gateway for soap request and reply - i facing chellenge while setting timeout soap request esb interface interface(using spring integration). while sending request esb interface, setting request timeout = 5000ms , reply timeout = 5000ms in case services downwards on esb interface, request not timeout in desired timeout time of 5000ms(5 sec) , timeout in 40sec or more. tried utilize default request timeout , default reply timeout options int:gateway configuration same issue. please see below configuration done: <int:gateway id="soapesbgateway" service-interface="test.soap.service.servicesoap"> <int:method name="serviceresponse" request-channel="requestchannel" reply-channel="replychannel" request-timeout="5000" reply-timeout="5000" /> </int:gateway> <int:chain input-channel=...

Local Service User Logged into Windows -

Local Service User Logged into Windows - i created windows service tracks app server user connected through load balancer. it retrieves user logged windows on machine, cross references active directory (ad) business relationship homecoming first name, lastly name , e-mail (for notification through website created project) there 1 scheme on network users remote system, vista system, reason returning values "local service" logged machine, it's weird , security guys impossible "local service" business relationship logged windows. here how user logged windows managementscope ms = new managementscope("\\\\.\\root\\cimv2"); objectquery query = new objectquery("select * win32_computersystem"); managementobjectsearcher searcher = new managementobjectsearcher(ms, query); foreach (managementobject mo in searcher.get()) { _username = mo["username"].tostring(); } // remove domain part username string[] usernameparts = _...

HTML form set as POST but method GET performed -

HTML form set as POST but method GET performed - on webshop i've build i'm having problem posting html form. in every case (99,9%) working expected, in specific cases goes wrong. , have no clue. that's why i'm posting question here. my html form looks like: <form id="gegevens" class="form-horizontal margin-bot-15" method="post" action="<?=host?>/winkelmand/gegevens-controleren/" role="form" autocomplete="off"> // input forms , lot of html <input type="submit" class="btn btn-shopping-cart" value="order"> </form> now page /winkelmand/gegevens-controleren/ should accessed post , not get . in 99,9% of cases post expected. in other cases, it's get , no info posted page. i can see in access logs because url /winkelmand/gegevens-controleren/ accessed via get . i've had issue twice @ same day (and 7 days before no issue). ammount of...

windows - how to save data/records from html form to DB2 database -

windows - how to save data/records from html form to DB2 database - this html form <form class="form-horizontal" id="mycredantials" > <div class="form-group"> <label class="col-sm-2 control-label">username : </label> <div class="col-sm-10 col-md-2"> <input type="text" class="form-control" id="tbusername" placeholder="username"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">email : </label> <div class="col-sm-10 col-md-2"> <input type="text" class="form-control" id="tbemail" placeholder="email"> </div> </div> <div class="form-group"> <label class="col-sm...

Grails with commons-dbcp2 connection pool datasource -

Grails with commons-dbcp2 connection pool datasource - background: have 2 projects a: spring based java project b: grails project gui i have 2 questions related: how can utilize org.apache.commons.dbcp2.basicdatasource in grails project instead of default apache tomcat datasource? there limitation org.apache.tomcat.jdbc.pool.datasource , allows 1 initsql string. want run 2 init sql statements ["set schema", "set role"], possible dbcp2 because takes connectioninitsqls list. tried combine 2 sql statements semicolon tomcat datasource gave validation error. is possible extend datasource parent bean? want extend grails datasource abstract bean defined in java project, thought reuse mutual datasource properties. i haven't seen performance comparing between particular pool , tomcat pool, guess you'll trading in ferrari plays 1 radio station jalopy plays two. look @ comparisons of tomcat vs others - it's faster. if don't much traff...

java - Explicitly defining the end of the input in a regular expression using $ -

java - Explicitly defining the end of the input in a regular expression using $ - i have code using regular look separate input string 2 words, sec word optional (i know might utilize string.split() in particular case, actual regular look bit more complex): package com.example; import java.util.regex.matcher; import java.util.regex.pattern; public class dollar { public static void main(string[] args) { pattern pattern = pattern.compile("(.*?)\\s*(?: (.*))?$"); // works //pattern pattern = pattern.compile("(.*?)\\s*(?: (.*))?"); // not work matcher matcher = pattern.matcher("first second"); matcher.find(); system.out.println("first : " + matcher.group(1)); system.out.println("second: " + matcher.group(2)); } } with code, expected output first : first second: sec and works if sec word not there. however, if utilize other regexp (without dollar sign...

copying table with data from different database in Microsoft SQL Server -

copying table with data from different database in Microsoft SQL Server - i writing store procedure info migration. in there, need re-create table , whole info other database current database's temp table. but, database name come parameter. , need process copied data. but, not know how create dynamic database name. create procedure [dbo].[mgrt] @dbname varchar(50) begin set nocount on; if object_id('tempdb..#tmpch') not null drop table #tmpch; select * #tmpch mddx.dbo.ch order mdate,mtime declare @count int = 0 declare @currow int = 0 select @count = count(*) #tmpch while @currow <= @count begin declare @lastdate nvarchar(10) = '-' set @lastdate = (select top 1 to_date ch order syskey desc) if @lastdate = '' or @lastdate null begin set...

How to remove Android ViewPager tabs divider? -

How to remove Android ViewPager tabs divider? - how remove dividers viewpager? here code: <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.bus.tralisto.mainactivity" /> i cannot set android:divider or used to. have thought how remove them? i think can "hack" making divider transparent : <style name="yourtheme" parent="@android:style/theme.holo.light"> <item name="android:actionbartabbarstyle">@style/divider</item> </style> <style name="divider" parent="@android:style/widget.holo.actionbar.tabbar"> <item name="android:divider">@android:color/transparent</item> //or util...

struct - C++: unimplemented: non-static data member initializers -

struct - C++: unimplemented: non-static data member initializers - i have next code: #include <fstream> #include <iostream> #include <algorithm> #include <vector> using namespace std; struct node{ vector<int> vic; bool visitato = false; }; int main (){ vector<node> grafo; ifstream in("input.txt"); int n, m, s, from, to; in >> n >> m >> s; grafo.resize(n); (int = 0; < m; i++){ in >> >> to; grafo[from].vic.push_back(to); } (int = 0; < grafo.size(); i++) for(int j = 0; j < grafo[i].vic.size(); j++) cout << "from node " << << " node " << grafo[i].vic[j] << endl; } and (on ubuntu) type next command: /usr/bin/g++ -deval -static -o2 -o visita visita.cpp -std=c++0x and next error: visita.cpp:10:21: sorry, unimplemented: non-static info fellow member ...

mysql - (ruby) How can I retrieve a list of hashes cascaded by parent_id? -

mysql - (ruby) How can I retrieve a list of hashes cascaded by parent_id? - i have in database table similar one: +----+--------+-----------------+ | id | parent | name | +----+--------+-----------------+ | 1 | 0 | father 1 | | 2 | 0 | father 2 | | 3 | 1 | kid 1 - 3 | | 4 | 0 | father 4 | | 5 | 2 | kid 2 - 5 | | 6 | 2 | kid 2 - 6 | | 7 | 1 | kid 1 - 7 | +----+--------+-----------------+ the list purposedly sorted primary key (id). logic simple, if parent 0, it's father category, otherwise kid or child-child (and on). using ruby (sinatra , datamapper), want accomplish cascaded list: [ { "id":1, "parent":0, "name":"father 1", "childs":[ { "id":3, "parent":1, "name":"child 1 - 3", "childs":[ ] ...

JSF(Java Server Faces) and RichFaces tutorial needed -

JSF(Java Server Faces) and RichFaces tutorial needed - i read jsf tutorial point course, there's no rich faces in course, searched didn't find tutorial, please tell me tutorial (video, pdf or site tutorial point (preferred) ), in advance. i think best tools can utilize understand , teach richfaces live demo site ( 1 version 4.x) : http://showcase.richfaces.org/ , components reference site (this 1 version 4.5) : http://docs.jboss.org/richfaces/latest_4_5_x/component_reference/en-us/html/ hope help you. java jsf richfaces

c# - How to create a text File in solution Explorer? -

c# - How to create a text File in solution Explorer? - it's bit hard explain i'll seek best. i'm not asking how create text file or read text file , display. it's more basic that. my question is: i've written paragraph of text file don't know how set under solution explorer, programme can reference instead of writing many times. here 1 of coding sample string , have couple of them using same text different tasks. here manually(?) wrote text(string) want save text file can refer to. string st = "i apples. reddish apples. reddish apples greenish apples"; string result = st.orderbydescending(s => s.split(' ').count()).first(); this.lblmostwordsinsen.text = result; actually, code above has error under split, says char doesn't contain definition split. how prepare it? i've found coding below "text_file_name.txt" or (@"d:\test.txt") want file should not stored in d driv...

html - How to improve the positioning code? -

html - How to improve the positioning code? - the next code positioning text on image. requirements are: image should adapt screen automatically. on smart phone, image should displayed completely. showing part of image not allowed. text should accurately positioned anywhere wish. class="snippet-code-css lang-css prettyprint-override"> .txtimg{ position: relative; overflow: auto; color: #fff; border-radius: 5px; } .txtimg img{ max-width: 100%; height: auto; } .bl, .tl, .br, .tr{ margin: 0.5em; position: absolute; } .bl{ bottom: 0px; left: 0px; } .tl{ top: 0px; left: 0px; } .br{ bottom: 0px; right: 0px; } .tr{ top: 0px; right: 0px; } class="snippet-code-html lang-html prettyprint-override"> <div class="txtimg"> <img src="http://vpnhotlist.com/wp-content/uploads/2014/03/image.jpg"> <p class="bl">(text appear @ bot...

mono - CefGlue Running Examples on Linux -

mono - CefGlue Running Examples on Linux - i've downloaded latest version of cefglue corresponding cef binaries. can demo examples run fine in windows, linux gtksharp demo not run. compiles fine under monodevelop on linux box throws dllnotfoundexception: libcef i've set libcef.so in executable directory running ldconfig in cef release directory. i'm new linux, there's simple , obvious i'm missing. the answers on this bitbucket issue explain how library path resolution can fixed. unfortunately, this bitcuket issue goes on explain linux back upwards broken , maintainer dmitry says doesn't have resources back upwards linux. linux mono monodevelop chromium-embedded cefglue

java - Create a Camel Route in a different Class -

java - Create a Camel Route in a different Class - i write application load camel routes. i have spring - camel instance. load "modules" order routes, , have posibility de- / active set of route module. so write xml file , unmarschal java-classes. every module java-class. , want define camel routes within java-classes. when extends java-classes routebuilder, jaxb don't marschal than. have 1 of thought how can define routes "from().to()" in method class not extends routebuilder? thank ideas!!! oh, write question, 5 minutes ago found solution: public class xyz { public static routebuilder routen() { routebuilder builder = new routebuilder() { public void configure() { errorhandler(deadletterchannel("mock:error")); from("file:documentin").id("defaultroute") .to("file:documentout"); } }; homecoming buil...

iOS Facebook permissions listed twice on PFFacebookUtils logInWithPermissions -

iOS Facebook permissions listed twice on PFFacebookUtils logInWithPermissions - i using parse , trying log users in pffacebookutils loginwithpermissions:block: method. asking user_friends permission , once, here i'm getting: the login process works fine though. here code: [pffacebookutils loginwithpermissions:@[@"user_friends"] block:^(pfuser *user, nserror *error) { if(user){ ... } }]; is framework bug or missing obvious? on ios 8.1 , have latest parsefacebookutils/parse pods. ios facebook parse.com parsefacebookutils

javascript - Prevent calling onchange event when checkbox value changes -

javascript - Prevent calling onchange event when checkbox value changes - i prevent triggering onchange event of selectbooleancheckbox when value toggled in togglebillablechkbox method. <p:selectbooleancheckbox value="#{mybean.billableboolean}" widgetvar="billableeditvar" id="billableedit" onchange="showbillableforedit(this)"> </p:selectbooleancheckbox> function showbillableforedit(obj){ if(obj.checked){ confirmbillableyesedit.show(); } else{ confirmbillablenoedit.show(); } } <p:confirmdialog id="confirmbyeseditid" header="please confirm" severity="alert" visible="false" widgetvar="confirmbillableyesedit" message="edit sure want invoice service ?" > <p:commandbutton value="yes" oncomplete="confirmbillableyesedit.hide();" global="false" > </p:commandbutton> ...

php - How to get and filter all referenced FAL files with extbase -

php - How to get and filter all referenced FAL files with extbase - i'm working on extension, displays files referenced in sys_file_reference. there possibility categorize , filter every file based on new custom property in sys_file_metadata. what's best way , filter referenced files typo3\cms\core\resource\file model? with help of typo3\cms\core\resource\filerepository able file models including metadata. repository expects uid retrieve file . fetch referenced files repository , pass them findfilereferencebyuid() method. class documentrepository extends \typo3\cms\extbase\persistence\repository { /** * disables pid constraint * * @return void */ public function initializeobject() { $querysettings = $this->objectmanager->create('typo3\\cms\\extbase\\persistence\\generic\\typo3querysettings'); $querysettings->setrespectstoragepage(false); $this->setdefaultquerysettings($querysettings); ...

silverlight - Is it possible to convert Windows Phone App project into Windows Phone Class Library? -

silverlight - Is it possible to convert Windows Phone App project into Windows Phone Class Library? - i accidentally created windows phone app project instead of windows phone class library project , worked on few days, till realized when i'm running "end-point" application installs "library" app well. so possible convert windows phone app project windows phone class library? luckily solution easy. instead of creating new windows phone class library project , manually moving files it, i modified project.csproj : 1) close visual studio 2) alter silverlightapplication tag false 3) remove tags: supportedcultures xapoutputs generatesilverlightmanifest xapfilename silverlightmanifesttemplate silverlightappentry 4) open vs , clean project that's it! p.s.: tested on wp7.1 & vs2012 silverlight windows-phone-7 visual-studio-2012 windows-phone-8

java - Change JButton ImageIcon on Click -

java - Change JButton ImageIcon on Click - i attempting create jframe application in java similar minesweeper different rules/goals. i have created grid of jbuttons, 12x12 , have jbutton 2d array. i'm trying alter image of button when clicked (make x or image of gold nugget). know how if had individual name each button, seems not logical create 144 individual buttons , name each of them. so need on click event of button, change/set image of button, in action listener can figure out if know specific array coordinates of button. my question how alter image of specific button? or how values of button[?][?] can alter image of button? thanks! public class goldpanel extends jpanel{ imageicon ximage = new imageicon("x.png"); imageicon goldimage = new imageicon(""); losingbuttonlistener losebutton = new losingbuttonlistener(); winningbuttonlistener winbutton = new winningbuttonlistener(); jbutton[][] button = new jbutton[12][12]; //creates layo...

c# - Convert Expression<Func> to Expression<Func> and vice versa -

c# - Convert Expression<Func<T, TProperty>> to Expression<Func<object, object>> and vice versa - is there way convert property selector expression<func<t, tproperty>> expression<func<object, object>> , vice versa? know how convert expression<func<t, object>> using... expression<func<t, tproperty>> oldexp; expression.lambda<func<t, object>>(expression.convert(oldexp.body, typeof(object)), oldexp.parameters); ... need cast both, argument , result of function, not e.g replace them expressionvisitor because need casted later. you right need utilize expressionvisitor , expressionconvert. here 2 methods asked (as back upwards methods): public expression<func<object, object>> converttoobject<tparm, treturn>(expression<func<tparm, treturn>> input) { var parm = expression.parameter(typeof(object)); var castparm = expression.convert(parm, typeof...

excel - How to add a picture from a file to the header of a Word document -

excel - How to add a picture from a file to the header of a Word document - i have been trying add together header image word document create vba running in excel. i set word document , utilize statement: set applword = new word.application applword.visible = true set docword = applword.documents.add docword.sections(1).headers(wbheaderfooterprimary).range.inlineshapes.addpicture filename:= _ "c:\users\folder\picture.png" but maintain getting runtime error 5941 . i have tried , not find fix. looking kind of help on solution problem! excel vba excel-vba

JavaScript/html time -

JavaScript/html time - i'm trying convert normal 24 hr scheme 20 hr scheme in javascript or html there seems problems , don't know how prepare them, programme code whole works ok it's not accurate in area of displaying proper time can help me. 24hrs per day 20hrs 60 minutes per hr 40 minutes per hr 60 seconds per min 80 seconds per min 1000 milliseconds per sec 1350 milliseconds per second i have been working code supposed milliseconds 1/1/1970 create things simple said programme isn't working quite right, have table lets me know normal time @ each changed hr that's info have check fiddle: http://jsfiddle.net/z4s7j9vl/1/ my approach timestamp difference between current time , midnight of same day: millis = ts - clone.gettime(); this way how many milliseconds have passed day , can conversion there. limited converting time only, if months , years followed same principles convert same way current timestamp. time

android - Difference in height of root Layout calculated from two methods -

android - Difference in height of root Layout calculated from two methods - i calculating height of root layout ( relativelayout) height , width 'fill_parent' using method , returns 690 final relativelayout rootlayout=(relativelayout)findviewbyid(r.id.root_layout); viewtreeobserver vto = rootlayout.getviewtreeobserver(); vto.addongloballayoutlistener(new viewtreeobserver.ongloballayoutlistener() { @override public void ongloballayout() { rootlayout.getviewtreeobserver().removeglobalonlayoutlistener(this); mrootlayoutheight=rootlayout.getheight(); toast.maketext(myactivity.this,""+mrootlayoutheight,toast.length_long).show(); } }); this layout has listview calculate calculate 'bottom' of individual rows using this for(int = 0; <= month_listview.getlastvisibleposition() - month_listview.getfirstvisibleposition(); i++){ ...

r - How to apply predict function to number of data frames in a list? -

r - How to apply predict function to number of data frames in a list? - i have model object , apply predict values number (e.g. 5) of new info stored list. info of same length , contain same 3 predictor variables. in end, have predicted values stored matrix or list has many columns (or elements) have datasets used in prediction (e.g. 5). being total newbie in r programming, haven’t figured out working solution problem. this simple illustration question: firstly, let's generate info , create model object, in example, linear model: training <- data.frame(y=rnorm(10), x1=rnorm(10), x2=rnorm(10)) model <- lm(y~., data=training) then, let's generating info in list predictions: testing <- list() (i in 1:5){ testing[[i]] <- data.frame(x1=rnorm(10), x2=rnorm(10)) } finally, apply prediction function lapply every new info in list , unlist predictions' list matrix: predictions <- lapply(testing, function(x){predict(model,...

javascript - Chaining function that returns promise doesn't resolve after flushing timeout -

javascript - Chaining function that returns promise doesn't resolve after flushing timeout - the chain within testcode not resolve... resolve level 1 , level2. it('three level promise', inject(function ($q, $timeout, $rootscope) { var plusone = function(value) { var deferred = $q.defer(); $timeout(function() { deferred.resolve(value+1); }, 10); homecoming deferred.promise; } var promisecall = function() { homecoming plusone(1).then(function (data){ console.error('call1 resolved', data); homecoming plusone(data).then(function (data2){ console.error('call2 resolved', data2); homecoming plusone(data2).then(function (data3){ console.error('call3 resolved', data3); homecoming data3; }); ...

matlab - Add 2 histograms fit line and change colour -

matlab - Add 2 histograms fit line and change colour - i have next code: % histograms histfit(s,40,'normal') hold on; hist(r,40,'normal') g=findobj(gca,'type','patch'); set(g(1),'facecolor',[0 .5 .5],'edgecolor','w') set(g(2),'facecolor',[0 1 1],'edgecolor','w') set(gca,'fontsize',18,'fontname','euclid') xlabel('r & s') hold off; i can add together 1 fist histogram fit line. want alter colour of fit line of first histogram , add together , alter fit line colour of sec histogram. regards well missing phone call histfit sec histogram, line not appear @ all. here sample code works fine. notice how utilize findobj fetch actual lines , alter colors: rng default; % reproducibility %// generate dummy info s = normrnd(10,1,100,1); r = 3*normrnd(10,1,100,1); % histograms histfit(s,40,'normal') hold on; histfit(r,40,'normal') ...

html - Dropdown not working on navigation menu -

html - Dropdown not working on navigation menu - when hover on top level navigation menu, don't kid level menus. the html construction of nested navigation menu retrieved browser view source looks below. <div id="topmenu-position"> <nav class="sort-pages modify-pages" id="navigation" role="navigation"> <ul aria-label="site pages" role="menubar"> <li aria-selected='true' class="selected firstli " id="layout_1" role="presentation"> <a aria-labelledby="layout_1" aria-haspopup='true' href="http&#x3a;&#x2f;&#x2f;localhost&#x3a;8080&#x2f;web&#x2f;guest&#x2f;home" role="menuitem"> <span> home</span> </a> <ul class="child-menu" role="menu"> ...

php - Advanced search query using multiple, and varied queries -

php - Advanced search query using multiple, and varied queries - currently, user can add together criteria searched amongst our database find matching results. working perfectly, however, there need 'enhance' search. help create things clearer, there working illustration below: scenario a user wants buy property: within location which has 4 bedrooms is detached within cost range of $300k - $500k. this added database, , function below finds matching properties (shortened): $locations = location::wherehas('coordinate', function ($q) utilize ($bedrooms, $property_type) { $q->where('bedrooms', '=', $bedrooms) ->where('type', '=', $property_type); })->lists('id'); so can see, query pretty 'set' on querying one number of bedrooms , one property type' - it's 1 variable on same row! now, proble...

ms access 2010 - Sub Query - Part Numbers and Quantity -

ms access 2010 - Sub Query - Part Numbers and Quantity - looking find part numbers (d046d) @ to the lowest degree 1 record having vaule greater zero. d046d e024a abc123 0 abc123 0 abc123 0 123abc 0 123abc 1 123abc 0 1a2b3c 0 1a2b3c 0 all want returned 123abc select d008g, d046d, e024a 20121 (20121.[d046d])=(select sc.d046d 20121 sc e024a >0) this error becuase find multiple d046d in subquery. if want parts quantity greater zero, clause should say where e024a > 0 now want part numbers @ to the lowest degree 1 record > 0, can conclude want see each qualifying part number 1 time - best achieved using distinct: select distinct d008g, d046d, e024a 20121 e024a > 0 ms-access-2010

javascript - Result of `document.getElementsByClassName` doesn't have array methods like `map` defined, even though it is an array -

javascript - Result of `document.getElementsByClassName` doesn't have array methods like `map` defined, even though it is an array - i have next bit of code select divs , add together click handler on them var tiles = document.getelementsbyclassname("tile"); tiles.map(function(tile, i){ tile.addeventlistener("click", function(e){ console.log("click!"); }); }); this throws error because map not defined, though tiles array. if create array this, map works fine: var = [1, 2, 3, 4]; a.map(/*whatever*/); a workaround attach map tiles this: tiles.map = array.prototype.map; this works fine. question why doesn't tiles have map defined on it? not array? right, it's not array. it's "array-like". don't attach map tiles . do array.prototype.map.call(tiles, function...) some might suggest array.prototype.slice.call(tiles).map(function... which sort of boils downwards same...

postgresql - How to get Rails 4 if a record has two conditions return true else false? -

postgresql - How to get Rails 4 if a record has two conditions return true else false? - i'm setting vote system, , trying have helper model can check if user has voted card. i'm new rails , can't seem figure 1 out. how have model check votes record has user_id of current_user , card_id ? i'm trying limit calling helper many times each iteration of _cards.html.erb setting voted variable. not sure how this, trying set variable printing true every card, ones have no votes. setting variable not working , neither helper, true. cards_controller.rb: def if_voted(card_id) if vote.where(:user_id => current_user.id, :card_id => card_id) true else false end end helper_method :if_voted _cards.html.erb: <td> <%= @voted = if_voted(card.id) %> <% if @voted == true %> <span class="green"><center> <% elsif @voted == false %> <span class="red"><center> <% ...

c - How to print values from an input data file from an array? -

c - How to print values from an input data file from an array? - i'm finish beginner programmer bear me. so have input text file utilize input programme in command window using program.exe < data.txt. text file has 5 lines, each line has 3 double values, 30.0 70.0 0.05 etc. i want utilize array of structures print these input values, printf("the first value %f", array[i][0]). here wrong code far: #include <stdio.h> #include <stdlib.h> #define maxsources 100 typedef struct { double x; double y; } coordinates_t; typedef struct { coordinates_t point; double w; } soundsource_t; coordinates_t a; soundsource_t b; int main(int argc, char *argv[]) { int i; while(scanf("%lf %lf %lf", &a.x, &a.y, &b.w) == 3) { soundsource_t soundsource[maxsources][2]; (i = 0; <= maxsources; i++) { printf("%d", soundsource[i][0]); printf("%d", soundsour...

c# - Save custom property in Outlook MailItem permanently -

c# - Save custom property in Outlook MailItem permanently - i’m coding simple c# programme tries store custom properties in outlook mailitem metadata… created simple method in order write single property: public static void addcustompropertytoemail(outlook.mailitem mail, string propkey, object propvalue){ if (propvalue system.int32) { // int mail.userproperties.add(propkey, outlook.oluserpropertytype.olinteger,true, outlook.olformatinteger.olformatintegerplain); } else if (propvalue system.double){ // double mail.userproperties.add(propkey,outlook.oluserpropertytype.olcurrency,true,outlook.olformatcurrency.olformatcurrencydecimal); } mail.userproperties[propkey].value = propvalue; mail.save(); } and in order read single property: public static string getcustompropertyfromemail(outlook.mailitem mail, string propkey){ homecoming (mail.userproperties[propkey] != null) ? mail.userproperties[propkey].value.tostring() : null; } when print @ console each pro...

android - How to make the Toolbar title clickable exactly like on ActionBar, without setting it as ActionBar? -

android - How to make the Toolbar title clickable exactly like on ActionBar, without setting it as ActionBar? - background i wish show actionbar on preferenceactivity, it's not available pre-honeycomb devices (even in back upwards library). because such class isn't available on back upwards library, can't phone call "setsupportactionbar" . don't wish utilize library (like this one) since of libraries i've found still utilize holo style, didn't updated far, in mind. to this, i'm trying mimic look&feel of title of actionbar new toolbar class, presented on back upwards library v7 . the problem i've succeeded putting title , "up" button, can't find out how create them clickable normal action bar, including effect of touching. the code here's code: settingsactivity.java public class settingsactivity extends preferenceactivity { @override protected void oncreate(final bundle savedinstancestat...