Posts

Showing posts from July, 2015

How do I search with php sessions using the native_session library in codeigniter -

i found can't use phpsessions straight away in codeigniter i've downloaded native_sessions lib codeigniter. i have searchquery searching postal codes in database using online postalcode database api. store postalcodes api in session , search postal codes in factory table have row postcode every factory. so factory table looks this: factories --------- factoryid factoryname adress postcode country ... ... ... my searchquery postcode looks this: if (!isset($_cookie['cookie'])) { $query = "select * (`bedrijfcategorieen`) join `bedrijven` on `bedrijfcategorieen`.`idbedrijven` = `bedrijven`.`idbedrijven` join `categorieen` on `bedrijfcategorieen`.`idcategorieen` = `categorieen`.`idcategorieen` (`bedrijfsnaam` '%".$this->input->post('search')."%' or `plaats` '%".$this->input->post('search')."%' or `telefoonnummer` '%".$this->

How to use a newly started WCF service ASAP -

in application have manually start executable. executable acts server , starts wcf service whole initialization process takes time. in client (that has created new process) have use wcf service asap . so check every 100ms service has started calling ping() method of service. first call throws endpointnotfoundexception handle. second call throws communicationobjectfaultedexception. i've checked , after handle endpointnotfoundexception state of communicationobject use create client proxy opened. approach wrong , how should check whether service started? update1: how start wcf service: servicehost servicehost = new servicehost(typeof(testservice)); const string address = "net.pipe://localhost/testservice"; binding binding = new netnamedpipebinding(); binding.receivetimeout = timespan.maxvalue; servicehost.addserviceendpoint(typeof(itestservice), binding, address); servicehost.open(); while (true) { thread.sleep(100); } update2: how create proxy: channelfac

php - Redirect Prestashop 1.5 from subfolder to the root -

i have prestashop 1.5.x installed in subfolder, not in root. want accesible root directory, edited .htaccess file set rewritecond , rewriterule change main domain , subfolder. works, instantly redirects main domain store. # copy , paste following code .htaccess file # in public_html folder of hosting account # make changes file according instructions. # not change line - rewriteengine on rewriteengine on # change yourdomain.com main domain. rewritecond %{http_host} ^(www.)?mysite.com$ # change 'subfolder' folder use main domain. rewritecond %{request_uri} !^/prestashop/ # don't change line. rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # change 'subfolder' folder use main domain. rewriterule ^(.*)$ /prestashop/$1 # change yourdomain.com main domain again. # change 'subfolder' folder use main domain # followed / main file site, index.php, index.html, etc. rewritecond %{http_host} ^(www.)?mysite.com$ rewriterule ^(/)?$ pre

jsf 2 - PrimeFaces tags not recognised -

i new jsf , primefaces , have created project jsf2.0, glassfish v3.0 , jdk 6.0.now want use primefaces tags instead of jsf tags. have downloaded primefaces-3.5.jar , added web-inf/lib folder , recognized *.xhtml pages. but when try run application not recognizes primefaces tags. example: if insert: <p:inputtext id="username" validator="#{regbean.username}" required="true" requiredmessage="please enter username"/> instead of: <h:inputtext id="username" value="#{regbean.username}" required="true" requiredmessage="please enter username!"/> it not show input box in web application. need include configuration details in web.xml file? please suggest!! try like <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <ht

android - Query with layout -

Image
i have been working on layout lately. there 2 image shown. first 1 shows need , second 1 shows get. can suggest me how achieve linearlayout . , when linearlayout means no layout_weight or relativelayout need used. know using these 2 simplify work, want why through code not achieved. below code xml. <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" > <button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/mytext" /> <imagebutton android:id="@+id/ib" android:layout_width="wrap_content" android:layout_height="match_parent&q

.net - Different Web.Config Files For each User on TFS -

i'am able configure different web.config files (debug & release) on tfs. is possible configure web.config files each user separately? objective include personal connection strings connect local databases on tfs. thanks in advance. sure, can same .config files so: have web.debug.config , web.release.config out of box... so in order make unique, based on configuration type, create web..config, , put in specific credentials. then create configuration going configuration manager.

android - Get BroadcastRecevier Object from ResloveInfo -

i stuck now; issue 1 of activity has register 1 private broadcastreceiver , need unregister , usual cannot change file. my approach broadcast receiver information () intent package manager.querybraodcastreceiver method. now want broadcast receiver object it. is there other approach work out problem? is there other approach work out problem? fix activity unregister receiver. cannot anywhere else in app.

Silverlight 5, ria services with entity framework 6.0 alpha 3 -

i trying create silverlight 5.0 application using ria services, entityframework 6.0 alpha 3. greenfield project never used other version of entityframework. seems compile fine, except silverlight data project connects web project generate proxies. following error: error 2 method not found: 'system.data.objects.objectcontext system.data.entity.infrastructure.iobjectcontextadapter.get_objectcontext()' is there incompatibility or doing wrong? ria services is opensource name "open ria services" (see on codeplex ). colin blair, project leader, has announced first version ef6 support : http://www.openriaservices.net/blog/post/the-open-ria-services-blog/1016/4-3-alpha-nuget-packages-released/ you can install nuget package : ria services entity framework 6+ . if want install nuget package ria services entity framework 6+ , sure select "include prerelease" item in top combo box.

JSF UTF 8 characters not seen ONLY in first form post, jsf, tomcat? -

Image
i have simple jsf form submit username , password , persist database. only in first form submit, having problems utf-8 characters. when submit ğğüüçç in first post, wrong characters. in second try, alright. here web.xml , index.xhtml: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>/faces/*</url-pattern> <

c# - How can I display two asp:Panel controls side by side? -

i have 2 panels. want show them abreast, don't. .aspx: <asp:panel id="treeviewmenu" width="20%" height="500" runat="server" scrollbars="both" horizontalalign="left"> <asp:treeview id="treeview" runat="server" showlines="true" imageset="xpfileexplorer" onselectednodechanged="treeview_selectednodechanged"> </asp:treeview> </asp:panel> <asp:panel id="qvobjektmenu" width="75%" height="500" runat="server" horizontalalign="right"> <asp:table runat="server" horizontalalign="right"> <asp:tablerow> <asp:tablecell> <asp:label runat="server"> qvobjekt id: </asp:label> </asp:tablecell> <asp:tablecell> <

preprocessor - Conditional Compilation inside Literate Haskell -

i have literate haskell file , want use conditional compilation. use bird style of literate programming. following code not work. > #if min_version_base(4,6,0) > import control.exception > #endif i need solution cabal 1.14.0 edit: cpphs has option --unlit unlits literate sourcecode, don't know how pass option cpphs in cabal. as @kosmikus points out, can put c preprocessor directives outside > or \begin{code} , work expected – if not interfere processing of non-code parts of literal code. you cannot use c preprocessor directives bird-style literate programming, unlitting step replaces > space, have no chance # first column. can verify passing -keep-tmp-files ghc , checkout generated .lpp file. you can resort \begin{code} ... \end{code} blocks both, if mix them them > -style lines of code, keep space in mind , add lines wrapped in \begin{code} ... \end{code} : > {-# language cpp #-} literal comment \begin{code} #if min_version

c# - Programmatically Changing the Default Collection for WCF Proxy Class -

i have application users connect 1 or more wcf services running on machines in network. because address of these connections not known @ time of installation, application must programmatically connect these services (i.e. cannot use add service reference). have connection working using following code: string url = "...the url..."; basichttpbinding binding = new basichttpbinding(); endpointaddress address = new endpointaddress(url); ilicenseservice service = channelfactory<ilicenseservice>.createchannel(binding, address); however, of members of service class return observablecollection of elements. know how change collection type in service reference dialog box, using advanced settings. however, cannot figure out way set value programatically client knows read return type observablecollection instead of list. clues? it should deserialize type defined interface of service class, or type of property of serialized object. try changing collecti

salesforce - Dynamically assign rowClasses attribute on <apex:dataTable> component -

i have visualforce page renders pdf file following component declaration: <apex:datatable value="{!somesobjectlist}" var="sobj" rowclasses="{!if( mod( pos, 2 ) == 0, "grey_box,white_box", "white_box,grey_box" )}"> . . [column declarations] . </apex:datatable> however, cannot compile. attempting save prompts following error message: save error: element type "apex:datatable" must terminated matching end-tag "</apex:datatable>". how can accomplish (i.e. zebra patterning context-dependant first colour)? thank in advance! apparently, problem using double quotations define classes. awkward, once single class definitions work fine. anyway, swaping double quotes inside if clausule single quotes seems fix problem, indicated @doug-b in sf stackexchange page.

Grails assert - verify that assertion failed in unit test -

grails newbie question: when have assert [condition] in grails controller, how verify assertion fails unit test? i'm thinking shouldfail(exception) { .. } i'm not sure exception catch. thanks you can use assertionerror . shouldfail(assertionerror) { assert 'one' == 'two' }

c# - Oracle saving arabic numbers as "??" -

working on winform based app connecting oracle via oledbdatareader, when save data having arabic number, instance: اب۸۴۴ saves اب??? i using varchar type. weird save non numeric data entering digits in arabic keyboard messes entire string. i using oracle 10g xe

capistrano - How do I configure monit to allow the change in pid? -

i deploying rails app sidekiq. on each deploy capistrano stops previous running version of sidekiq (a ruby process) , starts new one. monitoring sidekiq pid file monit. problem: each time deploy pid file changes monit detects has changed , restarts process. on period of few days , multiple releases end multiple sidekiq instances when want one. here monit config sidekiq: check process sidekiq_main pidfile /srv/apps/orders/current/tmp/pids/sidekiq.pid every 3 cycles start program = "/bin/bash -c -l 'cd /srv/apps/orders/current ; nohup bundle exec sidekiq -e production -c /srv/apps/orders/current/config/sidekiq.yml -i 0 -p /srv/apps/orders/current/tmp/pids/sidekiq.pid >> /srv/apps/orders/current/log/sidekiq.log 2>&1 &'" stop program = "/bin/bash -c -l 'cd /srv/apps/orders/current ; bundle exec sidekiqctl stop /srv/apps/orders/current/tmp/pids/sidekiq.pid 10'" group sidekiq is there way configure monit allow pid file

javascript - How to callback function from another file in nodejs? -

im starting work async programming, im making nodejs application, i´ve slice code in files: index.js, ctluser.js, dao.js etc... .. index.js main file requires ctluser , ctluser require dao.js... dao connect database , execute queries... abstracting, structure this... index.js var ctluser = require('./ctluser.js'); var username = ctluser.getusername('1'); console.log("return ctluser" + username); ctluser.js var dao = require('./dao.js'); var getusername = function(id){ var username = dao.executequery("select username tbusers id = " + id ); console.log(return dao = username); return username; } dao.js here fine... var mysql = require('mysql'); var executequery = function(query) { var connection = mysql.createconnection({ host : server, user : user, password : password, database : database }); connection.co

php - Google Cloud Messaging for Chrome Error 500 -

so i'm trying send message chrome extension through gcm, using php. $data = json_encode(array( 'channelid' => 'channel id here', 'subchannelid' => '0', 'payload'=>'test' )); $ch = curl_init(); $curlconfig = array( curlopt_url => "https://www.googleapis.com/gcm_for_chrome/v1/messages", curlopt_post => true, curlopt_returntransfer => true, curlopt_postfields => $data, curlopt_ssl_verifypeer => false, curlopt_httpheader => array( 'authorization: bearer ' . $access_token, 'content-type: application/json' ) ); curl_setopt_array($ch, $curlconfig); $result = curl_exec($ch); each request returns { "error": { "code": 500, "message": null } }. thanks. 500 http error code internal error. se

.net - Oracle.DataAccess.Client Error -

background: website use oracle , spring.net. version of oracle.dataaccess: 4.112.2.0 version of spring: 1.3.2.40943 webconfig file <db:provider id="sddbprovider" provider="oracle.dataaccess.client" connectionstring="user id=****; password = *****; data source = (description=(address=(protocol=tcp)(host=****)(port=****))(connect_data=(server=dedicated)(service_name=*****)))" /> this working fine in debug mode. , publish website on local iis (7.5) & working fine. when copy published folder remote server (also runs iis 7.5) gives folowing errror. note: checked bin in published folder , has necessary dll oracle oci ociw32 oracle.dataaccess orannzsbb11 oraocci11 oraociei11 oraops11w error thrown dependency of object 'oracle.dataaccess.client' defined in 'assembly [spring.data, version=1.3.2.40943, culture=neutral, publickeytoken=65e474d141e25e07], resource [spring.data.common.dbproviders.xml] line 400

c# - How to update multiple MongoDB servers simultaneously - direct mode or replica set? -

interested in using mongodb cache servers. relatively new mongo bear me ... 1 of tasks should perform following: retrieve records database , update 2 mongodb servers. task writes mongo servers , doesn't perform "read" actions. task should run every 250 ms , amount of documents updated between 0 - 180 records (relatively small records - each record document). know how can perform task using one update in code ? (i not want loop on servers , perform update each of them) one point mention: data in mongo servers should read locally @ each machine in order gain small latency possible. should create replica set? if so, replica set reflect up-to-date data in each server given frequency of 250 ms? or should connect them directly mongodb://server1,server2/?connect=direct , perform 1 update in code translated 2 updates - 1 each server? replies inline.. i know how can perform task using 1 update in code? (i not want want loop on servers , perform update

php - Check if email exists in sql database and output thereafter (regarding running if inside if) -

so have form running on page i'm experimenting with. atm have 1 input , email. want register , if person tries add same email again return error msg , otherwise add it. so code i've been posting with: <?php $username="user"; $password="pass"; $database="test"; $email = mysql_real_escape_string( $_post['email'] ); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "unable select database"); $query = "select * enroll email='$email' "; $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) ) { print 'user in table'; } else { $query = "insert enroll values ('','$email')"; $result = mysql_query($query) or die(mysql_error()); print 'user added'; } ?> that works fine! if add email exists says "user in table"

C programming - array size based on command line argument -

i'm trying make grid board game, know maximum size board can can smaller based on user inputs in command line. have made following program, compiles when write dimensions command line says 'segmentation fault (core dumped)'. can tell me i've done wrong? #include <stdio.h> #include <stdlib.h> #include <string.h> #define board_width 80 #define board_height 52 int i; int j; int width; int height; int generations; int grid[board_width][board_height]; int main(int argc, char *argv[]) { if (argc < 2) { printf("not enough arguments entered\n"); exit(1); } else { width = atoi(argv[2]); height = atoi(argv[3]); generations = atoi(argv[4]); } for(i=0;i<width;i++) for(j=0;j<height;j++) printf("%2d", grid[i][j]); } many things you've set fixed board_width , board_height when declare variable, if pass in higher values on command line it's not going work. but trying print? have not initialised grid

iphone - Gesture Recognizer memory usage -

i adding several different swipe gestures app , i'm wondering if better add 1 , query how many fingers, direction, etc. by adding several distinct gesture recognizers front (each different swipe direction , number of required touches) can route each own handler method , deal them independently. do these uigesturerecognizer objects take lot of memory?

python - Saving dictionary keys as strings -

i have following dictionary: ordereddict([(u'b1', ordereddict([(u'ip', u'199.0.0.1'), (u'port', u'1122')])), (u'b2', ordereddict([(u'ip', u'199.0.0.1'), (u'port', u'1123')]))]) i want create string take keys dictionary , join them put : in between, result be (b1:b2) there can lot of keys in dictionary. can me out that? use str.join >>> collections import ordereddict >>> dic = ordereddict([(u'b1', ordereddict([(u'ip', u'199.0.0.1'), (u'port', u'1122')])), (u'b2', ordereddict([(u'ip', u'199.0.0.1'), (u'port', u'1123')]))]) >>> ":".join(dic) u'b1:b2'

c# - Detecting all concrete implementions of interfaces at run time -

i'm trying create code detects concrete implementations of interface within c#. dont believe problem facing confined c# , general oop question. i want detection @ runtime have ability expand implementations of interface @ future date. what options/approaches available me in order achieve this? for example public interface ianimal{ void makenoise(); } public class dog : ianimal{ public void makenoise() { console.writeline("woof"); } } public class cat : ianimal{ public void makenoise() { console.writeline("meow"); } } public class animalinstancecontroller{ /*im trying populate classes implement ianimal */ public ienumerable<ianimal> {get;set;} } thanks nicholas you can relatively using reflection, eg: var assemblies = appdomain.currentdomain.getassemblies(); var alltypes = assemblies.selectmany(x => x.gettypes()); var impltypes = alltypes.where(t => !t.isinterface &&

c# - Strange VS2010 behavior with datagrid and designer -

i working on winforms app datagridview control on it, , experiencing frustrating things. first off, want turn off autocolumngeneration, it's not listed in properties. no problem, can line of code...and gets weird: in code, datagridview inaccessible. doesnt exist on form. looking this, because designer declaring part of initializecomponent() method instead of initializes other controls. because in designer, change make there gets reversed can't fix this. is there way stop visual studio doing this? found hack around using 1 of datagrid columns (which accessible) create reference datagridview associated , access way. works, ugly , not intuitive @ all. i think found it: in designer, click on datagridview control, , change property of generatemember true. i'm guessing set false. that property used that: hide control code windows. it's useful labels or toolstripseparators don't need deal in code.

Powershell get-content text file and loot to run msinfo32.exe -

$computers = get-content -path c:\output\output.txt $output = '\\pcname\c$\output\' $output1 = '.txt' ($output2 =$output+$computers+$output1) msinfo32.exe /report $output2 /computer $computer what getting msinfo32.exe /report $output2 /computer $computer reading first pcname , name , writing file name each pcname space between each of them. sorry seem simple question started using ps. thanks you've got 2 issues here. to concatenate strings path, need use join-path you're getting first computer name because aren't looping through list of computers. quick & dirty revision (assumes each computer name on own line in output.txt ) $computers = get-content -path c:\output\output.txt; $output = '\\pcname\c$\output\'; $output1 = '.txt'; $computers | foreach-object { $output2 = (join-path -path $output -childpath $_) + ".txt"; msinfo32.exe /report $output2 /computer $_; }

c# - Sending Datagridview to email -

i made code can send email gmail.com c# , working well. want put datagridview1 in email body , send it. somone can show me how can that? searched lot found useless information , asp.net codes. here atual code of sending email . datagridview name : datagridview1 private void btnsend_click_1(object sender, eventargs e) { // create message datagridview contents in body , set recipients. var client = new smtpclient("smtp.gmail.com", 587); client.enablessl = true; client.credentials = new networkcredential("jpbritopoker@gmail.com", "*****"); var mail = new mailmessage(); mail.from = new mailaddress("youraccount@yahoo.com"); mail.to.add("jpbritopoker@gmail.com"); mail.subject = "this subject of mail"; mail.body = "here want datagridview1"; client.send(mail); } datagridview special tool of dot net , email (whic

php - Replacing string with variables stored in an array -

ok i'm unsure syntax on one, think logic self explanatory i'm unsure if preg_replace work or whether loop needed end result. $string = $randomizer->fecthrandomphrase($cfg['seo']['meta']['descriptions']['single'], 3, $_server['request_uri']); returns string lorem ipsum dolor sit amet,[address1], [address2], [postcode]. consectetur adipiscing elit. mauris id dui sem, eget laoreet tellus. vivamus lacinia vestibulum odio lobortis - [region] i search string parts want change; $find = array('[address1]','[address2]','[postcode]','[region]'); i pull information stored in these variables , place them in array; $replace = array($address1,$address2,$postcode,$region); the before returning phrase apply preg_replace swap on info have stored $phrase = preg_replace($find,$replace,$string); do need loop through array $replace allow reading of each variable , replace work or using wrong fun

c# - Call base method instead of override -

in c#, class a contains public method foo() processing , returns value. protected method bar() , in class a performs same logic foo() , followed additional processing, , returns value. in order avoid duplicating code, bar() calls foo() , uses return intermediate value. class { public virtual string foo() { string computedvalue; // compute value. return computedvalue; } protected string bar() { string computedvalue; string intermediatevalue = foo(); /// more processing create computedvalue intermediatevalue. return computedvalue; } } class b inherits a , overrides foo() . override calls base class implementation of bar() . class b : { public override string foo() { base.bar(); } } this (of course) goes infinite loop until computer runs out of memory , yields stack overflow exception. the obvious solution rewrite private foointernals method contains guts of foo. foo , bar modified use results of met

java - What is the use of recursive type bound in this case -

i have following piece of code public static <t extends comparable<t>> t max(list<t> list){ iterator<t> iter = list.iterator(); ... // code finding max element in list ... } my question is, need recursive type bound in case? far understanding, t extends comparable < t > means that, t can compared t itself. comes fact that, class 't' implements comparable<t> , so, class myclass implements comparable<myclass>{ } if wrong here, feel free correct me. so coming actual doubt, why need specify < t extends comparable < t > > ? ways argument list<t> list going contain elements of same type. i.e., suppose pass parameter of type list < myclass2 > , elements going of same type, i.e. myclass2 .. so implication of recursive type bound? in advance. why need specify <t extends comparable<t>> ? because comparable not require implementing class comparable itself. in theo

java - Facebook Realtime API and Access Token persistance -

i have webapp has facebook log in , once user logs in store user's access token in db. have subscribed user feed using realtime api. when ever user adds status or comments callback fb. tell me there change(i don't id of comment or status). have query graph api stored access token feed , see things updated. if see there new comment after last query had made, process it. is there way id of comment or status made user? and access token expires in hour. can't query data when there user update callback after hour. can't ask user go app again , re authorize, since won't use app after log in(i need him log in webapp can access token). is there way access token without user having go through authorization phase again(this because user won't come app again after logs in, poll fb activities)? thanks

java - How perform task on javaFX TextField at onfocus and outfocus? -

i working on javafx project. need perform task on javafx textfield . for example on "on focus" event textfield want print system.out.println("textfield on focus"); and on "out focus" event should print system.out.println("textfield out focus"); i thought might helpful see example specifies changelistener anonymous inner class scottb mentioned. textfield yourtextfield = new textfield(); yourtextfield.focusedproperty().addlistener(new changelistener<boolean>() { @override public void changed(observablevalue<? extends boolean> arg0, boolean oldpropertyvalue, boolean newpropertyvalue) { if (newpropertyvalue) { system.out.println("textfield on focus"); } else { system.out.println("textfield out focus"); } } }); i hope answer helpful!

Magento Mobile HTML5 theme -

i downloaded , followed instructions magento plugin html5 mobile templates ( http://www.magentocommerce.com/magento-connect/magento-community-mobile-html5-theme-6529.html ) , installed expected latest version of stable magento (installed tonight) below picture of default config design themes section: http://s3.postimg.org/8nku3rc1v/screen_shot_2013_05_14_at_01_45_05.png below picture of connect install screen: http://s3.postimg.org/guctvc24j/screen_shot_2013_05_14_at_01_45_37.png yet when looking @ site mobile - see normal desktop site. have no overrides in place far can tell. whats wrong!? i found out problem , got fixed myself. basically install had put theme not under default package enterprise. this means added new exception design -> package looked : iphone|android value enterprise , under theme , template , css etc matched expression iphone|android , value of mobile. that makes work :)

shutil - Python Cannot create a file error [Error : 183] -

i using following code copy contents of 1 directory directory (python) shutil.copytree(sourcedirectory,destinationdirectory,symlinks=false,ignore=ignore_patterns(updatedlist)) where updatedlist = , .config, .ico,*.log i generating updatedlist on fly (based on user inputs) keep getting following error whenever try perform copy operation stated above. [error 183] cannot create file when file exists note : there files present in source directory matching extensions mentioned in updatedlist. i thinking mentioning extension of files present in ignore list should suffice, apparently not. i using python 2.7 my imports import logging import os win32api import getfileversioninfo, loword, hiword import zipfile import shutil import sys os.path import isfile distutils import dir_util import configdto import datetime import updatesettings import time import win32api import socket shutil import copytree, ignore_patterns import os please . thanks i .. s

javascript - KendoSparklines inside table rows, where rows are added dynamically -

Image
i have table rows added dynamically. 1 of cells in each row includes kendosparkline chart. every time new row added, charts in previous rows disappear , must redrawn. each row has knockout click binding sets context of configuration panel in right (see attached image) current viewmodel representing row. after inserting row can click on each row missing chart , click calculate , chart appear. anyone can explain me behavior? how can make sure when adding new row, charts in existing rows still there? traversing viewmodels in $.each() loop , calling refresh() on each chart, elegant solution? i ended adding $.each() loop mentioned in question, function takes care of adding new rows in main viewmodel . loop through observablearry() of row viewmodels , call calculate function (except 1 added). works fine, , knew that. wanted avoid looping through array every time 1 adds new row table. here code: var rowvm = function () { var self = this; // dat

c# - .NET async, can a single thread time-slice between tasks? -

i'm trying grasp on asynchronous programming in c#/.net. read article ( link ) on brown university's website cs168 course defines asynchronous programming interleaving tasks within same thread. says, "now can introduce asynchronous model... in model, tasks interleaved 1 another, in single thread of control", , shows interleaving in figure. can't seem 2 tasks interleave within same thread in .net. there way that? i wrote simple apps try test theory, i'm not sure if i'm doing correctly. main program outputs screen every often, using thread.sleep() simulate work. asynchronous task same. if multiple threads used, output interleaved. i'm trying test on single thread. i have wpf app runs on ui thread, task , main program output sequentially. create , start task this: var taskfactory = new taskfactory(taskscheduler.fromcurrentsynchronizationcontext()); var task = taskfactory.startnew(workdelegate); i have console app starts task delegate us

Name of shortcut created by wix installer to support latin as well as Russian,Japanese and Korean strings -

i need create installer using wix create shortcut entry. name of shortcut vary language property specified user while installing. have taken approach of replicating component tag different languages. product codepage 1252. <component id='xyzappshortcutfr' guid='xxxxxx'> <condition>language="fr"</condition> <shortcut id='shortcutfr' name='démarrer $(var.shortcutname)' target='[installdir]$(var.targetexe)' workingdirectory='installdir' > </shortcut> </component> <component id='xyzappshortcutfr' guid='xxxxxx'> <condition>language="ru"</condition> <shortcut id='shortcutfr' name='начало$(var.shortcutname)' target='[installdir]$(var.targetexe)' workingdirectory='installdir' > </shortcut> </component> it fails error:a string provided characters not available in specified database code page. how mak

Making Columns inside a cell in html table -

i have searched around , havnt found anythign define. have alot of information need put in single cell in table. there way can format cell has own columns? something simlular im trying at c1........ | c2 .........| ..................c3............................| ..value...|..value... | horse:"value"....unicorn:"value" | ............................. | dog:"value".......hippie:"value".. | ............................. | cat:"value"........hispster:"value"| ............................. | title:"value".......yoga:"value"... | ............................. | t-rex:"value"....me:"value"...... | c1........ | c2 .........| ..................c3............................| ..value...|..value... | horse:"value"....unicorn:"value" | ............................. | dog:"value".......hippie:"value".. | ...........

c# - When using e.Entity in an EntityDataSource Inserted event, is it good practice to wrap it in using()? -

if i'm doing inserted values during entitydatasource's inserted event, should wrap e.entity in using() statement? can't tell. "in context"? should (as i've seen in other examples): myentity newrecord = (myentity)e.entity; myvar = newrecord.datavalue; or appropriate practice do: using (myentity newrecord = new e.entity()) { myvar = newrecord.datavalue; } (don't think syntax totally correct. don't want have how work ask.) from msdn documentation, can gather e.entity object ... entity. helpful. open new connection , whole rest of package assume new entity require? in general, i'd yes it. best practice? yes sure. however, answer more "it depends". rule, anytime use object implements idisposable 1 should wrap in using statement unless plan keep object between method invocations. in stateless world of web (mvc) tend live, try wrap dbcontext in using statement. in winforms/wpf i'm sure there reasons p

ios - Core Data sync with JSON API -

my data model named "person" , has 3 attributes "id", "firstname", , "lastname" when importing json data using afnetworking want able check whether entity exists or not within core data using "id" identifier. if isn't there create it, , if there merge item or update it. right have method called duplicatecheck looks like: nspredicate *predicate = [nspredicate predicatewithformat:@"id==%@", _person.id]; nsfetchrequest *fetch = [[nsfetchrequest alloc] init]; nserror *error = nil; [fetch setentity:[nsentitydescription entityforname:@"person" inmanagedobjectcontext:self.managedobjectcontext]]; [fetch setpredicate:predicate]; nsarray *items = [self.managedobjectcontext executefetchrequest:fetch error:&error]; (nsmanagedobject *object in items) { // not sure how check here , insert or update // save , call during api request? } i have predicate set not sure go here. looping on each item right way go or

ruby - How do I use the DateTime class? -

can tell me why can use datetime class when gem use returns datetime object? when in documentation don't see listed under classes. need require specific use it? datetime class in standard library. isn't automatically included, kernel , example, need require 'date' before becomes available. the documentation datetime can found in stdlib 1.9.3 docs .

.net - Is it possible to determine whether a read from SecureStream will block? -

can determine whether reading single byte securestream block? underlying stream networkstream , has dataavailable property, expect securestream needs buffer bytes operate correctly, don't think can rely on underlying stream's dataavailable . alternatively, there way perform read never block? i'm pretty sure there isn't; i've hated stream api, maybe i'm missing something? why: have tcp server implementation highly optimized paths handling requests. in particular, original code used beginread every request, found replacing read whenever data available (which happens time short requests) increased our maximum throughput more 20%. i'd same ssl variant of code. i wonder why read faster beginread when data available. shouldn't drastic. you can @ underlying stream's available data, , if it's more few bytes, can assume data available , use read . otherwise, use beginread . on safe side, set readtimeout millisecond, won't

postgresql - New to Postgres. Can you help me with a couple simple statments? -

i'm familiar mssql need work postgres stuff today. end goal return new id of table use elsewhere since i'm unfamiliar syntax of postgress, seem having trouble. problem 1: in mssql would: delcare @test_number int select @test_number = 42 print @test_number in postgres i'm trying: test_number integer; test_number := 42 print test_number but doesnt first line: error: syntax error @ or near "test_number" line 1: test_number integer; if can figure out, think i've got real problem solved like: problem 2: in mssql would: declare @new_id int insert some_table (data1. data2) select @new_id = @@identity -- use @new_id w/e want in postgres i'm trying: new__id integer; new_id := insert some_table (data1, data2) returning id; -- use new_id w/e want a quick search on google gives following answer. how use variables in simple postgresql script? it looks declare anonymous inline pgsql function in query. looks it's new postg

sql server - What's wrong with this PHP vote script? -

this vote script game: http://pastebin.com/p8df7svk just lines check function is: $num_rows = $adb->doquery('select ' . account . ' ' . account_table . ' datediff(dd, createdate, getdate()) <= 1 , ' . account . ' = ?', $_session[account]); if ($num_rows != 0) { debug_log(__method__, 'account registered! account = %s, ip = %s', $_session[account], $this->site->getremoteip()); header('location: ' . $url); return; } but somehow everytime wants vote. says in logs: account registered! , doesn't add points voting .. so, wrong should check not able understand exactly. i've tried set account 1 month old, 1 year old , etc still same. vote, check shows in log it's new account (no matter if account 1 year old even) , doesn't add points. check line 123-129, check function is. appreciated if let me know what's wrong check new accounts. i've been using t

php - Easily extract data from string formatted a specific way -

what easy way take string formatted way: c:7|bn:99 and able use string easily? if wanted number behind c:, how easily. same, thing number behind bn:? $arr = array(); $str = "c:7|bn:99"; $tmp1 = explode('|', $str); foreach($tmp1 $val) { $tmp2 = explode(':', $val); $arr[$tmp2[0]] = $tmp2[1]; } //print ur array print_r($arr); //accessing specifc value echo $arr['c']." ".$arr['bn'];

image - Has anyone seen GAE fail to respect the deadline attribute of an RPC? -

i timeouts when trying transforms or resizes on large images using image.execute_transforms_async ( https://developers.google.com/appengine/docs/python/images/imageclass#image_execute_transforms_async ). i tried adding deadline create_rpc call, seems ignore it. here's code snippet: image_data_rpc = images.create_rpc(deadline=5) image.execute_transforms_async(output_encoding=image_output_type, quality=95, rpc=image_data_rpc) i've seen work urlfetch, wonder if i'm missing here. we figured out. wasn't deadline wasn't being respected, call execute_transforms_async timing out. call image_data_rpc.get_result() occurring after deadline exceeded error. still trying figure out cause of timeout on execute_transforms_async , deadline parameter seems working expected.

ruby: how to convert hash into array -

i have hash contains numbers such: {0=>0.07394653730860076, 1=>0.0739598476853163, 2=>0.07398647083461522} it needs converted array like: [[0, 0.07394653730860076], [1, 0.0739598476853163], [2, 0.07398647083461522]] i tried hash.values gets me: [0.07398921877505593, 0.07400253683443543, 0.07402917535044515] i have tried multiple ways started learning ruby. try this: {0=>0.07394653730860076, 1=>0.0739598476853163, 2=>0.07398647083461522}.to_a #=> [[0, 0.07394653730860076], [1, 0.0739598476853163], [2, 0.07398647083461522]]

visual studio 2008 - How do I turn debugging in disassembly off permanently? -

Image
whilst debugging console app in c# , vs2008, disassembly window appears uninvited. i debugging code line line using f11. have break points set , starts off after call in method open database connection, debugger opens disassembly window , stays there. have right-clicked on disassembly tab , selected hide window pops again hit f11. how turn debugging in disassembly off permanently? go debug->options , settings , uncheck box enable address-level debugging , should want. you may want check enable code if not checked.

difference between aggregate ($match) and find, in MongoDB? -

what difference between $match operator used inside aggregate function , regular find in mongodb? why doesn't find function allow renaming field names aggregate function? e.g. in aggregate can pass following string: { "$project" : { "ordernumber" : "$purchaseorder.ordernumber" , "shipdate" : "$purchaseorder.shipdate"}} whereas, find not allow this. why not aggregate output return dbcursor or list? , why can't count of documents returned? thank you. why not aggregate output return dbcursor or list? the aggregation framework created solve easy problems otherwise require map-reduce. this framework commonly used compute data requires full db input , few document output. what difference between $match operator used inside aggregate function , regular find in mongodb? one of differences, stated, return type. find operations output return dbcursor . other differences: aggregation result

mysqli - How to bold some php string -

i trying make string bold in text. went through php book , looked online, no solutions helped problem. variable $mapname , $post_title change because they're in while loop working fine replacing characters, 1 example: $data_p = "select * posts verified='yes' order (posvotes - negvotes) desc $max"; $exec_p = $mysqli->query($data_p); while($row = $exec_p->fetch_object()) { $post_id = $row->post_id; $maps = "select name maps id='$post_id'"; $getmaps = $mysqli->query($maps); $mapname = $getmaps->fetch_object(); $post_title = preg_replace('/(free )/',"<b>\\0</b>", $post_title); but when try replace string $post_title = str_replace($mapname,'<b>'.$mapname.'</b>', $post_title); i don't output @ all. ideas on doing wrong? when disable str_replace , var_dump variables, correct variables. i browsed web solutions , str_replace function should working according man

security - Protecting web-server from ssh brute force attacks -

i have server acting reverse-proxy connected directly internet. access computer through ssh on non-standard port. doesn't seem secure. if found ssh port brute-force , gain access computer. is there more secure way configure this? i recommend tool denyhosts or sshguard , watch logs failed logins, , auto ban ips based on rules set.

android - Spring @ResponseBody: format JSON to put status -

i trying map pojos json jackson technology using spring create web service, have problem, when map list json creates malformed json like: ["idline":"a61dcedb-4a6b-4f8f-bbdd-32cc51e861b2", "name":"line1", "code":"pru1" ] i want create mapper , filter or similar response like: { status:"ok", data:[ {"idline":"a61dcedb-4a6b-4f8f-bbdd-32cc51e861b2", "name":"line1", "code":"pru1" }] } i have tryed objectmapper no result. thanks. update line 1 parses , invokes malformed exception (it belongs external library) result = (jsonobject) new jsontokener(str).nextvalue(); and json i'm trying parse is: [{"idline":"a61dcedb-4a6b-4f8f-bbdd-32cc51e861b2","name":"linea1","code":"pru1","colour":"#ff3200","means":"bus",&q

javascript - In KnockoutJS, is there a specific order in which computed values must be declared? -

i javascript runtime error when run code below. uncaught typeerror: cannot read property 'name' of null in dep3 when accessing self.dep2().name . the error goes away if move declaration of dep2 above of dep1 . bug in knockout or i'm doing wrong? seems me dep3 being recomputed result of dep1 changing before dep2 has been recomputed have expected knockout able handle scenario. function viewmodel () { var self = this; self.root = ko.observable(null); self.dep1 = ko.computed(function () { return self.root() ? self.root().prop1 : null; }); self.dep2 = ko.computed(function () { return self.root() ? self.root().prop2 : null; }); self.dep3 = ko.computed(function () { if (self.dep1()) { return self.dep2().name; } }); } globalviewmodel = new viewmodel(); globalviewmodel.root({ prop1: {name: "thisispropone"}, prop2: {name: "thisisproptwo"} }); you rig

ruby - Undefined method `validates_attachment_content_type' in Rails model class -

using rails 2.3.* (legacy project, adding features) , i'm getting error paperclip plugin. i'm not sure why telling me method undefined. paperclip 2.4.5 installed when check gems using gem list. error is: undefined method `validates_attachment_content_type' #<class:0x107d4e1c8> extracted source (around line #122): 119: <%= link_to 'printable', { :action => 'print', :id => @incident.id }, { :target => '_blank', :class => "button" } %> 120: <% if isviewable?(@incident) %> 121: 122: <%= link_to "pictures (#{@incident.pictures.count})", incident_pictures_path(@incident), :class => "button" %> 123: <%= link_to "suspects (#{@incident.suspects.count})", incident_suspects_path(@incident), :class => "button" %> application trace: /usr/local/rvm/gems/ruby-1.8.7-p371/gems/activerecord-2.3.11/lib/active_record/base.rb:1998:in `method_missing' /

c - Is not passing all the arguments to a function bad? -

i've been experimenting 'dynamically calling functions' using source code below. after testing code testing_function accepting first 2 arguments, added in third , decided 'not supply argument' when call function. i've noticed when this, value of third argument not (necessarily) 0, 'random' value not know origin of. questions follow: where these values originating from? additionaly, how arguments passed functions? is bad practice not pass arguments? can 1 prepared additions function's arguments without recompiling code utilizing function? (example: dynamically loaded library's function gains accepted argument code utilizing function isn't going recompiled). foreword source code follows: i running using linux, compiling/calling linker gcc 4.6.3, , receive no compilation/linking warnings/errors when utilizing code. code executes 'perfectly'. call gcc following: gcc -x c -ansi -o (output file) (input file, .c suff