Posts

Showing posts from March, 2014

ruby on rails - What value should I pass to paperclip to make it so that the file does not update? -

when update file in app, deletes , re-saves paperclip file. wan't pass in update_attributes allows paperclip ignore it, not delete current file. pass in? i passing in file, deletes , resaves. you might using class user < activerecord::base has_attached_file :attachment, :url => :attachment_url, :path => :attachment_path, :default_url => "/images/sheet.png" end try adding :preserve_files => false . way when add new file previous file reserved , not deleted. final result class user < activerecord::base has_attached_file :attachment, :preserve_files => false, :url => :attachment_url, :path => :attachment_path, :default_url => "/images/sheet.png" end check http://www.codesapling.com/blog/2014/01/10/saving-all-uploaded-attachments-with-paperclip/

php - tag friends 2 jquery multiple tagFormat -

i using jquery - tag friend 2 plugin auto-complete action. working fine strings starting @, have use same logic tagformat # same field. result should tracj both @ , # symbols , curresponding ajax urls different. here deafault way of callinf plugin $(function() { $('#post').tagfriends2({ url: 'userlist.php', debug: false, placeholder: '', onupdate: function(data) { $('#count').text(data.count); }, suggclass: 'suggetions', sugtpl: '<li><a data-val="{id}" href=""><table><tr><td><img src="{profile_image}"></td><td>{profile_name}</td></tr></table></a></li>' }); }); this track @ symbols , giving auto-complete facebook. want autocomplete option # symbols. purpose: @symbols used tagging users , # symbol brands. how can this? currently can

java - How to use Ajax with select option tags in Jsp page ? -

in jsp page , have 2 different select option tags menü . fill first 1 list mysql database. when select 1 value list ,i want fill second select tag list sended mysql . , in ajax , when send list servlet jsp , how fill second select option menu list in jsp page ? use javascript library jquery (that known , used/tested) http://api.jquery.com/jquery.ajax/

asp.net mvc - W3C Validation Not working for RazorView -

i using mvc4 project , doing url rewrite on server side in routeconfig , appending .html @ end of url of every page.. www.mysite.com/home.html i have couple of pages , pages linked home page (every think working find in browser). but when validate using w3c link checker, broken link error message. i don't know can issue. 1 more thing if replace .html .aspx or other extension validated w3c. don't know issue. my code is: routes.maproute( name: "features", url: "features.html", defaults: new { controller = "home", action = "features", page = urlparameter.optional } ); web.config : <add name="htmlfilehandler" path="*.html" verb="get" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" /> any highly appreciated ok solved this. i r

javascript - How can I use jquery events on a list of ids? -

i have html list of ids like: <div id="id0" value="myval0">click me</div> <div id="id1" value="myval1">click me</div> <div id="id2" value="myval2">click me</div> <div id="id3" value="myval3">click me</div> the list can generated server. trying jquery of form send server id has been clicked: $( "#id0" ).click(function() { var urlstring = '/getresult'; alert($("#id0").val()); $.ajax({ type: "post", url: urlstring, data: { draft_no: $("#id0").val(), }, success: function(result){ alert("function returned success!") } }); }); in case have sent id of form "id0". how can generalise "id n" n integer? try jquery selector e[a^=v] match elements e possess attribute a value starts width v your html: <div id="id-1"

c# - NEST - Index individual fields -

i'm transitioning elasticsearch on website , using nest c# .net interface. in writing code index content, can't figure out how map fields individually. suppose have following: var person = new person { id = "1", firstname = "martijn", lastname = "laarman", email = "martijn@gmail.com", posts = "50", yearsofexperience = "26" }; rather indexing entire dataset using: var index = client.index(person); i want index firstname , lastname can searched upon, don't need other fields in index (other id) because take space. can me code map these fields individually? you should add mapping when create index initially. 1 way can using nest attributes on class this: public class person { public string id { get; set; } public string firstname { get; set; } public string lastname { get; set; } [elasticproperty(store=false, index=fieldindexoption.not_analyzed)]

user interface - UI Windows 8 Look in JAVA -

im creating system standalone , not online. java based system. want make ui in windows 8. possible? using java fx , css can mimic windows 8 metro interface. see here : http://code.makery.ch/java/javafx-2-tutorial-part4 or here : http://pixelduke.wordpress.com/

jquery - API vs. the Cached Web -

i working on site pages html , interact server using ajax calls. works great - pages responsive , page loads minimized. what's best way deal cached html page when api has changed? tell pages never cache? work, slow things down. any other suggestions? if don't want cached, don't let cached. won't slow things down applications in way describe... you're loading page once per session. another thing worry when user has page backend server has been updated. common method client include version parameter requests. api can request client reload if newer version available.

JSON Serialization in Swift iOS -

how can serialize json in swift? trying serialize using method, causing exc_bad_instruction . downloading json data, using nsurlconnection. var sjson : nsdictionary = nsjsonserialization.jsonobjectwithdata(nsmutdata, options: nsjsonreadingoptions.mutablecontainers, error: nil) nsdictionary how can solve it? regards your root-level data array of dictionaries -- not dictionary; therefore replace line with: var sjson = nsjsonserialization.jsonobjectwithdata(nsmutdata, options: .mutablecontainers, error: nil) nsarray i tested , works data. here's how tested after having created "json.txt" file in project: var filepath = nsbundle.mainbundle().pathforresource("json", oftype:"txt") var nsmutdata = nsdata(contentsoffile:filepath) var sjson = nsjsonserialization.jsonobjectwithdata(nsmutdata, options: .mutablecontainers, error: nil) nsarray

Invalid and/or missing SSL certificate when using Google App Engine -

update : please, if can help: google waiting inputs , examples of problem on bug tracking tool. if have reproducible steps issue, please share them on: https://code.google.com/p/googleappengine/issues/detail?id=10937 i'm trying fetch data stackexchange api using google app engine backend. may know, of stackexchange's apis site-specific, requiring developers run queries against every site user registered in. so, here's backend code fetching timeline data these sites. feed_info_site variable holds stackexchange site name (such 'security' , 'serverfault' , etc.). data = json.loads(urllib.urlopen("%sme/timeline?%s" % (self.api_base_url, urllib.urlencode({"pagesize": 100, "fromdate": se_since_timestamp, "filter": "!9wwbr (nmw", "site": feed_info_site, "access_token": decrypt(self.api_access_token_secret, self.access_token), "key": self.ap

file - Problems with $_FILES in PHP -

i trying make site can upload pictures. <form action="edit.php" method="get" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value="submit"> </form> in edit.php -file have chosen use example w3schools ( http://www.w3schools.com/php/php_file_upload.asp ). when editor-page won't upload because file invalid type (filetype not found in array). after many different tries putted code @ top of file: if (!isset($_files['file'])) { die("not found!"); } when loaded editor page again got error-message had put there myself. seems file sending index.php -page won't founded in edit.php . can me? it should , in edit.php file can try print $_files array. //edit.php print '<pre>'; print_r($_files); // index.php <html> <body> <form action="edit.php" method="post" enctype=&

swift - Add a method to Card that creates a full deck of cards, with one card of each combination of rank and suit -

so have been doing experiments in apple swift book. i have been able of them, except 1 far. below have tried, can't figure out how working. add method card creates full deck of cards, 1 card of each combination of rank , suit. // playground - noun: place people can play enum rank: int { case ace = 1 case two, three, four, five, six, seven, eight, nine, ten case jack, queen, king func simpledescription() -> string { switch self { case .ace: return "ace" case .jack: return "jack" case .queen: return "queen" case .king: return "king" default: return string(self.toraw()) } } } enum suit { case spades, hearts, diamonds, clubs func simpledescription() -> string { switch self { case .spades: return "spad

php - My code is not inserting custom object -

i working pdo, want insert using feature can provide custom object/class parameters isnert. no error thrown in catch block. if try raw insert entering fields table works fine. here custom class want create instance of , insert using pdo class user { public $email; public $username; public $fname; public $sname; function __construct($e,$u,$fn,$sn) { $this->email = $e; $this->username = $u; $this->fname = $fn; $this->sname = $sn; } } here code use try , insert try{ $dbh = new pdo("mysql:host=localhost;dbname=mydb", "myuser", "mypass"); $dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); $user = new user('the email','the username','the fname','the sname'); $sth = $dbh->("insert user (email, username, fname, sname) value (:email, :username, :fname, :sname)"); $sth->execute((array)$user); } catch(

Does ruby have nor? -

ruby has conditional unless . does have nor ? e.g. unless 1 == 2 nor 1 == 3 "nothing equal" else "something's equal" end ruby doesn't have built-in nor, extend built-in booleans so: class trueclass def nor(other) false end end class falseclass def nor(other) !other end end and write unless (1 == 2).nor(1 == 3) "nothing equal" else "something's equal" end

Hosting a Java Skype Bot -

so have created basic show-off type of bot, runs off of skype api , requires skype running in order work properly. have tested bot hosting off of own computer no problem, issue don't want have computer running 24/7. that's why looked @ ovh.com hosting. small $3 vps , host bot off of that. have tried on other servers them (centos/debian) skype running seems quite struggle. in end need (os/program/whatever) bot hosted on ovh vps using 1 of provided operating systems. you have have skype installed on vps, requires have desktop package setup along vnc configure skype. might find article on how setup sevabot, skype bot, useful how setup , install necessary programs, https://github.com/opensourcehacker/sevabot/blob/master/docs/source/ubuntu.rst#id8 . keep in mind if running both skype , extensive java program, cheap vps might not cut it. know vps wasn't able handle skype bot running in large chats, 256mb vps, may have contributed.

Tarjan's algorithm: do lowest-links have to be similar for two or more nodes to be inside the same SCC -

i'm having trouble homework question involving using tarjan's algorithm on provided graph find particular scc's graph. while (according professor) have found correct scc's using pseudo-code algorithm found here , of nodes in scc's not share same lowest-link number root node scc. from can gather pseudo-code, because if un-referenced node i (which input node current recursive call algorithm) has arc visited node i + 1 not root node, algorithm sets i s ll = min(i.lowestlink, (i + 1).index) , , (i + 1).index may not equal own lowest-link value anymore. for example (this similar part of graph problem i'm trying solve): if have nodes in n = {a, b, c, d} , , arcs in e = {a ⇒ c, c ⇒ b, c ⇒ d, b ⇒ a, d ⇒ b} , , our root node start algorithm a , then: 1.1) set a.index = 1 (using 1 rather 0), a.ll = 1 , , push a onto stack; a has single arc c , check c ; finding undiscovered, call algorithm on c . 2.1) set c.index = 2 , c.ll = 2 , , push c onto stack; c

tfs - How to prevent users from viewing settings and permissions on Visual Studio Team Services (formerly Team Foundation Service) -

Image
i administering visual studio team services. have 1 defaultcollection, , 1 project called smash. i wish add project managers project. want them able manage, edit has project management, i.e. pbis, sprints, etc however, secure code entirely no project manager has access to, prevent them viewing settings nor permissions used secure code. i'm using test account if project manager. created group project managers, denied them of permissions except view collection-level (which essential them access project first place) all works fine, i.e. test account can manage pbis, sprints, etc, however, test account still see settings , permissions. see below please prevent project managers viewing settings , permissions used. thanks lot this not can do. users have access project have access view permissions , settings. there no conceivable security risk this, can't change anything, available all. if want have feature should sugest on http://visualstudio.uservoice

linux - Explanation about multiple su -

i'm bit confused when multiple su happen. lets situation happen: fikrie su root : ps -ef | grep su: root 15524 15388 0 10:15 pts/0 00:00:00 su root i know pid su 15524 , parent pid 15388. when multiple su happen. eg : situation. fikrie su root: root su fikrie2: fikrie 2 su root: ps -ef | grep su: root 15450 15388 0 10:15 pts/0 00:00:00 su root fikrie2 15468 15458 0 10:15 pts/0 00:00:00 su fikrie2 root 15478 15476 0 10:15 pts/0 00:00:00 su root i thought when root su fikrie2, first pid ppid second su. somehow when tried grep process, confuses me. ppid became 15458 instead of 15450 or 15388 . none of ppid connected/related ppid or pid before it. tried google , read process relationship in advanced programming in unix environment book. can give me explanation or maybe link me understand more on process relationship. i'm trying write code find user su user. answer so, find original user, eg. fikrie. if second situation

How to get the name of enumeration value in Swift? -

if have enumeration raw integer values: enum city: int { case melbourne = 1, chelyabinsk, bursa } let city = city.melbourne how can convert city value string melbourne ? kind of type name introspection available in language? something (this code not work): println("your city \(city.magicfunction)") > city melbourne as of xcode 7 beta 5 can print type names , enum cases default using print(_:) , or convert string using string 's init(_:) initializer or string interpolation syntax. example: enum city: int { case melbourne = 1, chelyabinsk, bursa } let city = city.melbourne print(city) // prints "melbourne" let cityname = "\(city)" // or `let cityname = string(city)` // cityname contains "melbourne" so there no longer need define & maintain convenience function switches on each case return string literal. in addition, works automatically enum, if no raw-value type specified. debugprint(_:) &

Visual Studio crash when clicking on Debug in the menu bar -

my visual studio 2010 crashing in strange way. how happens: start visual studio 2010 open project start debugging click on debug menu in menu bar crash if same without debugging works fine, crashes when debugger attached , stumped. i have installed few additional extensions visual studio 2010 before did not happen. are: python tools visual studio codemaid javascript parser nuget package manager i couldn't find setting me track down problem. there way print out more information visual studio 2010 trying do? i start uninstalling plugins, 1 one, , trying reproduce bug after each. if through of plugins , can still reproduce bug, reinstall visual studio. if bug still happens, preform full check of ram defects.

spring - org.hibernate.HibernateException: save is not valid without active transaction -

i have problem save data hibernate spring. when save data error: exception in thread "main" org.hibernate.hibernateexception: save not valid without active transaction https://gist.github.com/ruzievbakhtiyor/f3009dbc6a9c31090b59 spring beans config: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd "> <import resource="hibernate.xml"/> <import resource="datasource.xml"/> <bean id="transactionmanager" class="org.springfram

php - Theme is not appearing in Appearance for multi site in Drupal 7 -

i using drupal 7 , trying make multisite using same database, using domain access , domain theme modules. default site using /sites/all folder theme , module , site have created folder in location /sites/example.com , create module , theme folder , setting.php example.com folder , place theme & module relevant folder. now theme put directory /sites/example.com/themes is not appearing appearance section end main site. , domain site showing appearance section. when enable theme domain site enabled after refreshing main site again disable domain site. for condition did not find theme domain theme setting section .and if go setting of home/administration/appearance section , select example theme showing following error. notice: undefined index: example in system_theme_settings() (line 404 of /modules/system/system.admin.inc). notice: trying property of non-object in system_theme_settings() (line 404 of /modules/system/system.admin.inc). warning: in_array() expe

javascript - NodeJS - setTimeout(fn,0) vs setImmediate(fn) -

what difference between two, , when use 1 on other? settimeout calling function after delay has finished. whenever function called not executed immediately, queued executed after executing , queued eventhandlers finish first. settimeout(,0) means execute after current functions in present queue executed. no guarantees can made how long take. setimmediate similar in regard except doesn't use queue of functions. checks queue of i/o eventhandlers. if i/o events in current snapshot processed, executes callback. queues them immedieately after last i/o handler process.nexttick. faster. also (settimeout,0) slow because check timer @ least once before executing. @ times can twice slow. here benchmark. var suite = require('benchmark').suite var fs = require('fs') var suite = new suite suite.add('deffered.resolve()', function(deferred) { deferred.resolve() }, {defer: true}) suite.add('setimmediate()', function(deferred) { setimmedia

java - SOAP MalformedURIException with character ^ -

Image
i have call webservice soap happens have ^ in url. url has structure string url = "http://sampleurl.com?type=entry&version=1.0&sender.service=senderservice&interface=sampleurl/abc^servicerequest"; this gives me following exception: com.sun.xml.messaging.saaj.util.jaxmuri$malformeduriexception: query string contains invalid character:^ 11:47:10,670 error [stderr] @ com.sun.xml.messaging.saaj.util.jaxmuri.initializepath(jaxmuri.java:690) 11:47:10,670 error [stderr] @ com.sun.xml.messaging.saaj.util.jaxmuri.initialize(jaxmuri.java:407) 11:47:10,670 error [stderr] @ com.sun.xml.messaging.saaj.util.jaxmuri.<init>(jaxmuri.java:194) 11:47:10,670 error [stderr] @ com.sun.xml.messaging.saaj.util.jaxmuri.<init>(jaxmuri.java:178) 11:47:10,670 error [stderr] @ com.sun.xml.messaging.saaj.client.p2p.httpsoapconnection.post(httpsoapconnection.java:254) the thing puzzle me out calling webservice soap ui gives me correct answer if put ^

Bat script to rename files -

i have folder many images (jpg format) imported smartphone, , want rename them in team_# # increasing number. want team_1.jpg, team_2.jpg, ... what did this: set /a count=1 setlocal enabledelayedexpansion %%j in (*.jpg) ( ren "%%j" "team_!count!.jpg" set /a count=count+1) endlocal but result quite strange. "misses" number! means example have team_1.jpg, team_2.jpg, ..., team_7.jpg, team_9.jpg skips 8. , if relaunch script, skips number, different one. i tried removing underscore file name , works ok, need underscore. any idea? thanks! try, in place of for %%j in (*.jpg) ( for /f "delims=" %%j in ('dir /b /a-d *.jpg') ( if you echo ren... instead of ren , just temporarily, batch report required rename, not execute it. remove the echo to perform rename what believe happening ren renaming to team_8.jpg, renaming team_8.jpg team_somethingelse.jpg. the dir command build list of .jpg names, then for/f

binding - WPF ItemSource Not Working in XAML -

Image
i writing chess ui in wpf. i have set window datacontext in xaml: <window.datacontext> <local:mainviewmodel /> </window.datacontext> i've defined 'local' namespace namespace holds view model. xmlns:local="clr-namespace:chessui" the view model has 1 property, collection of chess pieces: public class mainviewmodel { public observablecollection<chesspiece> chesspieces { get; set; } public mainviewmodel() :this(new observablecollection<chesspiece>()) { } public mainviewmodel(ienumerable<chesspiece> chesspieces) { this.chesspieces = new observablecollection<chesspiece>(chesspieces); } } i've tried bind chesspieces chessboard (an itemscontrol) this: <viewbox renderoptions.bitmapscalingmode="highquality"> <itemscontrol name="chessboard" itemssource="{binding chesspieces}"> [...] </itemscontrol&g

phalcon - Increment in volt showing error -

{% set counter = 0 %} {% remain_todolist in remain_todolists %} {% if counter == countrem_todolist %} ['{{ remain_todolist.project_name }}', {{ remain_todolist.remaining_todos }}] {% else %} ['{{ remain_todolist.project_name }}', {{ remain_todolist.remaining_todos }}], {% endif %}~ {% counter++ %}//showing error {% endfor %} volt increment statement showing error "unknown expression 279" what doing wrong ? have tried without do keyword? anyway, volt loops have counters available use (see loop context ), here's version using it: {% list in remain_todolists %} ['{{ list.project_name }}', {{ list.remaining_todos }}]{{ loop.last ? '' : ',' }} {% endfor %}

c++ - Is it a bug for g++ and clang++ optimization? -

#include <unistd.h> #include <pthread.h> #include <stdio.h> bool m_ok = false; void* run(void*) { usleep(1000000); m_ok = true; printf ("good bye!\n"); return nullptr; } int main() { pthread_t my_thread; pthread_create(&my_thread, nullptr, &run, nullptr); while (!m_ok) continue; printf("yes!!!\n"); return 0; } when compiled above code following commands, good: $ g++ test.cpp -lpthread -std=c++11 $ clang++ test.cpp -lpthread -std=c++11 but when tried use optimization flags, program didn't finish. tested of following commands: $ g++ test.cpp -lpthread -std=c++11 -o1 $ clang++ test.cpp -lpthread -std=c++11 -o1 $ g++ test.cpp -lpthread -std=c++11 -o2 $ clang++ test.cpp -lpthread -std=c++11 -o2 also versions of g++ , clangs were: $ g++ --version g++ (ubuntu/linaro 4.8.1-10ubuntu9) 4.8.1 copyright (c) 2013 free software foundation, inc. free software; see source copying conditi

localization - Spring Framework - How to change locale in controller -

i new spring, , confusing localization. i'm using following code text messages_jp.properties file. <bean id="messagesource" class="org.springframework.context.support.resourcebundlemessagesource"> <property name="basename" value="messages" /> </bean> and want switch text messages_en.properties file, there ways change locale in controller within if...else... block, not using url params "?lang=en", like: if (user.getlang() == 1) { // set locale en } else { // set locale jp } thanks in advance! try one <util:properties id="yourfilenameid" location="classpath:/yourfilename.properties"/> in controller @value("#{yourfilenameid['message_id']?:1}") private int smalltext;

Swift set delegate to self gives EXC_BAD_ACCESS -

i'm going through , learning swift porting existing application. i'm stuck on setting delegate , cannot work out issue is. i have class extends uitableviewcell import uikit protocol switchcelldelegate{ func switchchanged(switchcell: switchcell, state: bool) } class switchcell: uitableviewcell { @iboutlet var swtselector: uiswitch @iboutlet var lbltitle: uilabel var delegate: switchcelldelegate? init(style: uitableviewcellstyle, reuseidentifier: string) { super.init(style: style, reuseidentifier: reuseidentifier) } @ibaction func switchchanged(){ delegate?.switchchanged(self, state: swtselector.on) } } then in viewcontroller defined class settingsviewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource, switchcelldelegate { and within method func tableview(tableview: uitableview!, cellforrowatindexpath indexpath: nsindexpath!) -> uitableviewcell! { we have case 2: storecredentia

python - How to reduce execution time using thread? -

i have program finding pointwise mutual information of word pairs. code have done follows: temp_list = co_occurrence_dict.values() n=0 item in temp_list: n += item main_dict = {} temp_dict = {} word in all_opinion_words: key,value in co_occurrence_dict.iteritems(): if ((word == key.split()[0]) or (word == key.split()[1])): pmi_eqn_numerator = (value)/float(n) if (key.split()[0] != word): temp_word = key.split()[0] else: temp_word = key.split()[1] if temp_word==word: temp_dict[temp_word] = 0 else: temp_sum = generate_sum_occurrence_values(temp_word,co_occurrence_dict) pmi_eqn_denominator1 = (temp_sum)/float(n) temp_sum = generate_sum_occurrence_values(word, co_occurrence_dict) pmi_eqn_denominator2 = (temp_sum)/float(n)

Jmeter performance testing for application running under LAN network -

is possible test application running under lan network using jmeter? if possible so, settings need do? please suggest.. i have points on question, apache jmeter may used test functional , performance both on static , dynamic resources (servlets, application servers, data bases , queries, jdbc, web services , more,). it can used simulate heavy load on server, network or object test strength or analyze overall performance under different load types. jmeter can use perform functional test on websites, databases, ldaps, webservices etc. jmeter supports distributed load testing different machines. ans: you can use jmeter load testing applications(specified above) in lan network using lan url&port number of application using.

java - How to use memory-only cache provider HashTable in hibernate 4.2 -

i want add such property in hibernate.cfg.xml <property name="hibernate.cache.provider_class">org.hibernate.cache.hashtablecacheprovider</property> but problem hashtablecacheprovider not in classpath. i have hibernate-core.4.2.0.final jar in pom. <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.2.0.final</version> </dependency> what maven dependency ahould add use hashtablecacheprovider ?

postgresql - Postgres 9.3 Foreign table | Not all rows returned from external view -

i have 2 pg databases. on 1st have view v_articles , on second db have created foreign data table ( ft_articles ) reads entries foreign data source view v_articles (with foreign data wrapper). far worked great, today noticed no records view v_articles inside foreign data table. have suggestions cause kind of behavior. in cases works - during last few months there have been few records not "transferred" view v_articles ft_articles . suggestions should start? i managed find temporal solution fix problem. on 1st server created materialized view mv_articles , reads standard view v_articles . on 2nd server read data foreign table ft_articles records materialized view mv_articles rather v_articles . in case have records in ft_articles , doesn't answer question - why there 1 record missing in foreign table when reading standard view..

excel - org.apache.poi writing xls formula of cells sum -

i have write xls formula sum few cells 1 column. output in xls of formula that: sum(f5;f9;f13;f16) i've created formula in org.apache.poi library. cell cell = rowsum.createcell(j); cell.setcelltype(cell.cell_type_numeric); // column number (a or b) in excel use in formula string x = cellreference.convertnumtocolstring(j); cell.setcelltype(hssfcell.cell_type_formula); // total sum row string totalsumformula = "sum("; for(int s=0; s<sumrownumbers.size(); s++) { int tempsumrownumber = sumrownumbers.get(s); tempsumrownumber++; totalsumformula += (x + tempsumrownumber); if(s+1 != sumrownumbers.size()) { totalsumformula += ";"; } else { totalsumformula += ")"; } } cell.setcellformula(totalsumformula); but unfortunatelly getting error cant understand: [formulaparseexception: parse error near char 6 ';' in specified formula 'sum(f5;f9;f13;f16)'. expected ',' or ')'] can give me a

playframework 2.0 - Writing multipart response in SimpleResult in Scala play -

i trying write action multipart response in scala play. should able serve files saved in resposne multipart response. apart writing individual file content headers , writing files stream manually in simpleresult, there existing api can looked into? do mean chunked responses? there few examples in the documentation : def index = action { val data = new fileinputstream(file) val datacontent: enumerator[array[byte]] = enumerator.fromstream(data) ok.chunked(datacontent) }

How to setup Zend 2 ACL roles for single objects -

my simple data model: users can create articles , makes them owner of particular articles object. users can invite other users contribute on articles , makes other users contributors of particular article . so, there roles owner , contributor , there resource article now question is, how implement construct best, using zf2's acl , maybe bjyauthorize ? struggle here, because roles of users not globally valid resource article , have assigned single article instance. generally i think, strength of zf2 acl inheritance of privileges according role structure , there acl-aware modules, menuhelper. if not need inheritance or these other - acl-aware - modules, can create simple solution withouth acl module. solution 1. - acl resources, roles , privileges data. role mean, depends on store role in database or put in role, create structure authorization. the isallowed method of acl object verification base upon data structure (of roles, resources , privile

java - I want to make a dropdown menu -

help me void paint have imported , have imported graphics. public class texttographicconverter { public static void main(string[] args) throws exception { bufferedimage image = new texttographicconverter().converttexttographic("my text", new font("arial", font.plain, 18)); //then want image } public bufferedimage converttexttographic(string text, font font) { bufferedimage img = new bufferedimage(1, 1, bufferedimage.type_int_argb); graphics2d g2d = img.creategraphics(); g2d.setfont(font); fontmetrics fm = g2d.getfontmetrics(); int width = fm.stringwidth(text); int height = fm.getheight(); g2d.dispose(); img = new bufferedimage(width, height, bufferedimage.type_int_argb); g2d = img.creategraphics(); g2d.setrenderinghint(renderinghints.key_alpha_interpolation, renderinghints.value_alpha_interpolation_quality); g2d.setrenderinghint(rende

php - Apache and Symfony date.timezone error -

i trying install symfony apache (ubuntu) error: set "date.timezone" setting in php.ini* (like europe/paris) using phpinfo() in browser says configuration file in /etc/php5/apache2/php.ini modified wtih date.timezone = "europe/paris" i modified file /etc/php5/cli/php.ini i run php app/console cache:clear suggested in question fixing requirements in symfony2 no results. restarted server every time. what else can try? thanks! please see david jacquel correct solution below ! i leave answer historical purposes... in sf1, ran through , got fixed date_default_timezone_set('europe/madrid'); in bootstrap (that projectconfiguration.class.php). in sf2 may modify web/app.php file insert same piece of code. bit hackyish, , running.

Entity Framework DBContext navigation property loaded by different query? -

i have 2 entities, user , messages. load messages , not user message belongs. this works not include related entity in linq query. doesn't work if load user separately query string user (the name). i using ef 6.1.0, poco without proxy generation , wcf services pass data. unwanted navigation property value transferred accidentally. var message = context.messages.firstordefault(m => m.id == 123); var user = contect.users.firstordefault(u => u.id = 456); var message_username_composition = new m_u_c{ m = message, username = user.name }; return message_username_composition; in situation have navigation property (user) of message loaded not so. disabling lazyloading doesn't help, using separate context solves problem. is there way other using 2 contexts? is design? i not manually set navigation properties null fix this, because may forgotten, because 1 did not realize behavior. you'll have disable lazy-load , use asnotracking() follows: ct

c++ - Using defined value in include -

i have #include file structures following: #include <core/mod1/file1.hpp> #include <core/mod1/file2.hpp> #include <core/mod1/mod2/.../modn/filen.hpp> and there such includes in each file. example, in file core/mod1/file1.hpp there might #include <core/mod3/file5.hpp> . here core name of library. want use core_new instead of core in entire project, without modifying files (actually lot). have tried add #define core core_new , hoping kind of substitute need: #define core core_new #include <core/mod1/file1.hpp> #include <core/mod1/file2.hpp> #include <core/mod1/mod2/.../modn/filen.hpp> but not it: core/mod1/file1.hpp being included instead of core_new/mod1/file1.hpp . there way achieve it? you want use file system, not c++ compiler. make new directory , copy/link source files on there. change -i option in compiler to use new directory. of course, have new files in the new core directory. way don't need edit sin

objective c - Terminating app due to uncaught exception 'NSInvalidArgumentException' 5 -

i getting error while running app: code is: - (ibaction)yes:(id)sender { uialertview *msgbox=[[uialertview alloc]initwithtitle:@"warrning" message:nil delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; if ([_usernametextbox.text length]>0) { if ([_passwordtextfield.text length]>0) { nsmutablestring *ms=[[nsmutablestring alloc]initwithformat:url,_usernametextbox.text,_passwordtextfield]; nsurl *serviceurl=[[nsurl alloc] initwithstring:ms]; nserror *error=nil; nsdata *data=[nsdata datawithcontentsofurl:serviceurl options:nsdatareadinguncached error:&error]; nsmutabledictionary *dic=[[nsmutabledictionary alloc]init]; nsstring *jsondata=[[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; sbjson *parsedata=[[sbjson alloc] init]; dic=[parsedata objectwithstring:jsondata error:nil]; if([dic c

Registered COM DLL works in VBA but not in VBScript -

i have created basic com dll atl on vs2012. it's called testcom.dll , has 1 class called csimpleobj. csimpleobj has 1 method called addvalues adds 2 values. i've registered dll windows 7 64-bit. in vba, manually add reference dll , below code works properly dim obj new testcomlib.simpleobj msgbox obj.addvalues(1,2) and give message number 3. now if run vbs includes: dim obj set obj = createobject("testcomlib.simpleobj") it gives error , not able create object. if use "excel.application" progid (as example) createobject method, works fine. i think there issue registering dll. i've checked registry, , keys com , type library there. what should do? there 3 basic requirements com server usable vbscript: you need implement idispatch late binding supported. not problem atl, implements default when use wizards. your registry script (.rgs) must write progid registry. notable didn't report finding (look hkcr\testcomlib.simp

java - Why does Maven warn me about encoding? -

my goal create archetype project. when run goal not involve maven-archetype-plugin, can't see warning: [info] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-archetype-base --- [info] using 'utf-8' encoding copy filtered resources. [info] copying 1 resource [info] [info] --- maven-resources-plugin:2.6:testresources (default-testresources) @ maven-archetype-base --- [info] using 'utf-8' encoding copy filtered resources. [info] copying 0 resource [info] on other end, when run archetype:create-from-project, couple: [info] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-archetype-base-archetype --- [warning] using platform encoding (cp1252 actually) copy filtered resources, i.e. build platform dependent! [info] copying 10 resources [info] [info] --- maven-resources-plugin:2.6:testresources (default-testresources) @ maven-archetype-base-archetype --- [warning] using platform encoding (cp1252 actually) copy filtered

Java Linux Arm Remote Debugging With Eclipse: "Profiling and debugging agents are not supported in this VM" -

i part of team working on library first robotics competition. have series of tools allow teams write , debug robots using eclipse along our own custom eclipse plugins. before now, confined using custom version of jdk 1.3 run programs on crio had built in debug mode. using jdk-linux-arm (a version of java 8 embedded arm chips). in order debug our programs have run remotely on chip because of jni dependencies. the command using run program in debug mode is: killall java killall frcuserprogram sleep 1 nohup /usr/local/frc/jre/bin/java -xdebug -xrunjdwp:transport=dt_socket,address=8998,server=y -jar frcuserprogram.jar however when try following output: [sshexec] killall: java: no process killed [sshexec] profiling , debugging agents not supported in vm [sshexec] error: not create java virtual machine. [sshexec] error: fatal exception has occurred. program exit. are there other methods enable remote debugging jdk linux arm through eclipse? has able run through eclipse breakpoi

json - Best way to change color of a text depending on a value of another string using angular -

i'm using angular js , have problem , have tried many ways , googled related can't work. i'm displaying "name" , "status" in table come json file. want change color of "name" depending on number (string) in "status" column. if "status" -1 "name" should red. best way this. i'm guessing should done inside controller i'm getting json. use ng-class it. for example: <div ng-repeat="item in array" ng-class="{redclass : item.status == -1}"> {{item.name}} </div> .redclass { color: red } this working jsfiddle example. also please see more ngclass .

javascript - html table preview using jquery -

i have html table , want make preview of table display in popup on button click, have searched internet , found plugin not appropriate. please guide me how can preview table content using jquery or else? link have found: http://projects.erikzaadi.com/jqueryplugins/jquery.printelement/ html table <table> <tr> <th>part</th> <th>id</th> </tr> <tr> <td>new part</td> <td>231134</td> </tr> <tr> <td>new part</td> <td>231134</td> </tr> </table> you can clone table contents on click or hover , make sure clone scales little hover element. here's rough cut jquery ui. $('table').on('click', function(e){ e.preventdefault(); var clone = $(this).clone(); $( "#popup" ).dialog({ open: function( event, ui ) { $(this).html(clone); } }); }); http://jsfidd

javascript - Handle Carriage Return from Barcode in Web Browser -

i writing web application needs take input barcode scanner. currently, system printing barcode adding '\13' (i think carriage return) beginning of value. thus, whenever barcode scanned example firefox, cursor jumps search bar , puts value there rather in text field. i cannot modify printed barcodes themselves. there way prevent barcode changing input field text box search bar? thanks! hitting enter not "jump" different input, instead submit formular in focus located. following keypresses go reloaded page, might end in autofocused search bar or so. to prevent such, install keypress listener on barcode input field , call .preventdefault() on event when enter key. see prevent users submitting form hitting enter details.

Every git branch is gone (except master) -

i have been trying delete hidden file in directory , accidentally ran command rm -rf .??* delete hidden file more 2 characters. believe deleted file contains connections branches because have master branch. # terminal $ git branch * master the commands ran prior are: $ rm -rf .ds* $ rm -rf .??* $ git add . $ git add -u did delete file of repositories? if so, how retrieve it? if not, why branches used have gone? edit: should add, on github isn't huge problem, rather understand did , undo if possible. you deleted .git directory has repository in, , left data had checked out (which happens master). to retrieve it, restore backup or repo pushed to.

css - Different colours being displayed for different versions of IE -

i facing issue css styles in ror application in ie 9 , below versions. displaying orange color (#ff5b09)when > ie 9 , in firefox, taking grey color (#666) <= ie9. need make ie 9 , below versions display orange color (#ff5b09). please suggest. new ror. appreciate on same. css making use of filters. style related following: .ui-sortable .lesson, .boxy-inner .block.lesson, .router .slider .lesson { background-color: #666; background: -webkit-gradient(linear, left top, left bottom, from(#ff5b09), to(#f93d1e)); background: -moz-linear-gradient(top, #ff5b09, #f93d1e); /* msie */ filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#ff5b09', endcolorstr='#f93d1e', gradienttype=0); } background-color: #666; do need color(#666)? if don't replace #ff5b09 . if need it, try this: put above statement @ end of styles, ie browser versions ignore filters , gradients once hit background-color style. so,

java - What sources of data/parameters should I use when Unit testing? -

i performing unit tests across large system, made of hundreds of different .java files, forming back-end. in unit tests, should pass variables other methods (calling methods within test method) or test using values created/declared in test method? i'm thinking should come values test method since these unit tests , trying test each method in isolation, i'm not this. need copy functions fetch said data unit tests? generally speaking, should create values in test itself, better isolating system under test. there other kinds of tests, @james mentions, , can use junit integration tests unit tests. @ heart of junit testing unit testing, , proper unit tests isolate system under test. update in response comment: so example if have classes , b: public class { private b b = new b(); public void callb() { b.process(17); b.process(22); } } public class b { public void process(int n) { // stuff n } } your test class b instantiate own b ,

Matlab cell array to string vector - unique -

going nuts cell array, because can't rid of it... however, easy 1 guys out here. so here why: have dataset (data) contains 2 variables: (numbers) , b (cell array). unfortunately can't reconstruct problem nevertheless imported table looks this: data=dataset; data.a = [1;1;3;3;3]; data.b = ['a';'a';'buu';'buu';'a']; where data.b of type 5x1 cell can't reconstruct all want unique rows like ans= [1 a;3 buu;3 a] result should in dataset or 2 vectors rows equivalent. but unique([dataa datab],'rows') can't handle cell arrays , can't find anywhere in www how simple convert cell array b vector of strings (does exist?). cell2mat() didn't work me, because of different word length ('a' vs 'buu'). though, 2 things love learn: making 5x1 cell string vector , find unique rows out of numbers , strings (or cells). thank much! cheers dominik the problem a , b fields of different typ

java - How to use @Inject in Spring MVC Controller? -

i working spring mvc controller. have 1 of controller datacontroller . i thinking add httpservletrequest injectable @ top of datacontroller class using @inject . @controller public class datacontroller { @inject httpservletrequest request; // .. code here @requestmapping(value = "process", method = requestmethod.get) public @responsebody dataresponse processtask(@requestparam("workflow") final string workflow) { string ipaddress = request.getremoteaddr(); system.out.println(ipaddress); } so question - right way use @inject ? have never used @inject before trying learn whether way doing right or not? since everytime, making call processtask method, need grab ipaddress whoever calling processtask method. in terms of acquiring httpservletrequest : semantically speaking, wrong. reason : httpservletrequest object created when users send requests , destroyed once requested user action completed. can s

How can I clear the Python pdb screen? -

let's write (pdb) p dir(object) and, screen taken list of attributes. how can clear text while still in debug mode? importantly, don't want lose place in code. depends on os. if you're on windows should work: import os; os.system('cls') if you're on gnu/linux (i think in mac os too) should trick: import os; os.system('clear') but, if use bash shell interpreter, there handy keymap: ctrl+l

excel vba - Move VBA code to standalone VBS file -

i have macro in excel vba runs shell execute simple pdf editor command line, exports list of page names , numbers, searches keyword find page want, gets page num, , extracts page pdf file. i've realised macro serve better standalone entity, , wondering required take code out of excel, , run .vbs file. i tried direct copy , paste , didnt letter "a" in word "as" in first line. sub pdf_getufplan() dim wsh object set wsh = vba.createobject("wscript.shell") dim waitonreturn boolean: waitonreturn = true dim windowstyle integer: windowstyle = 1 dim errorcode integer wsh.run "c:\users\johnmcs\desktop\pdftk.exe c:\users\johnmcs\desktop\full.pdf burst output c:\users\johnmcs\desktop\output.txt", windowstyle, waitonreturn dim hf integer: hf = freefile dim lines() string, long open "c:\users\johnmcs\desktop\doc_data.txt" input #hf lines = split(input$(lof(hf), #hf), vbnewline) close #hf = 0 ubound(lines) if instrrev(lines(i

javascript - How to Launch famo.us application into iPhone -

i have small application in famo.us framework. having html form , .js files , runs in browser, want run appliction in iphone , android phone. so how publish famo.us application android , apple store ?? thanks you can use adobe phonegap ( aka apache cordova ) scaffold ios/android project. phonegap works wrapping site in native webview, allowing developers create mobile apps can released store using existing web development skillset. you need corresponding native development tools/sdks in order build projects & submit them app store. follow getting started instructions, , once project created, place contents of web project 'www' folder. there platform specific nuances need consider, , make sure don't start doing until 'ondeviceready' event fired cordova, signals webview set correctly , ready go.

javascript - Code not working on Phonegap Application -

currently working on phonegap , have found sample code want make work phonegap could't . 1 more thing want mention here jquery mobile 1.2.0 used want use jquery mobile 1.3.2 , jquery 2.1.1 ,cordova-3.4.0 any apreciated .thanks in advance . <!doctype html> <html> <head> <title>jqm complex demo</title> <meta name="viewport" content="initial-scale=1, maximum-scale=1"/> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> <style> #content { padding: 0; position : absolute !important; top : 40px !important; right : 0; bottom : 40px !important; left : 0 !important; } </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?se