Posts

Showing posts from May, 2013

Text file into Excel VBA empty line new column -

i have sheets of data in txt files single column. need import excel , break each field break new columns @ empty line. not sure if best in import or after import. foobar detail1 detail2 val1 val2 val3 val4 randominfo widget detail1 detail2 val1 val2 val3 val4 randominfo you'll want read file in line line , move on when read empty line. edit: forgot answer question...just on import. other way makes scan list again , not efficient. dim r integer dim c integer ''initialize r = 2 c = 1 ''i'm assuming have row headers or row starts @ two. ''change 1 if want data in first row. open [your file path here] input #1 until eof(1) line input #1, readline if readline = "" 'index on 1 column 'start row indexer on c = c + 1 r = 2 else 'output "readline" sheet activesheet.cells(r, c).value = readline 'index down 1 row r = r + 1

java - Returns a new HashMap that maps the words in list to their number of occurrences -

counts() return type: hashmap parameter list: arraylist parameter list action: returns new hashmap maps words in list number of occurrences public static hashmap<string,integer> counts( arraylist<string> words ) { hashmap<string, integer> map = new hashmap<string, integer>(); ( string w : words ) { if( !map.containskey( w ) ) { map.put( w, 1 ); } else{ map.put( w, map.get( w ) + 1 ); } } return map; } it doesn't display anything. if want display "results" of method, need iterate through keys, display output of values console: public static hashmap<string,integer> counts( arraylist<string> words ) { hashmap<string, integer> map = new hashmap<string, integer>(); ( string w : words ) { if( !map.containskey( w ) ) { map.put( w, 1 ); } else

Where are all the XMPP user name and password saved -

when there domain created , username , password domain registered chat on xmpp. these username , password saved. are these stored on jabber server's database, or create database on our server , store them. like sunil@sunil.com stored in jabber server database or on sunil.com database. any link through more light on full cheers sunil that depends on jabber server used. jabber servers able store usernames , passwords in internal database, server implementations let configure external database, such mysql or postgres, or let use ldap user database.

postgresql - Heroku Django application slower after moving postgres database to Amazon free RDS -

i have pilot django project installed on heroku using free tier , free postgres database. due size limitation on heroku, moved database amazon rds free tier offers lot more space , no row limit. after move notice slow performance in django app! there way reconfigure setup make application/database go faster? if it's "free tier" of rds, using small database (in terms of cpu , memory) shouldn't come surprise slow. specifically, free tier t2.micro, has 1 virtual cpu , 1gb of memory. also, storage type (magnetic, ssd, provisioned iops) may make substantial difference. can observe disk stats in cloudwatch rds instance see if that's problem.

java - illegal reference to static field from initializer -

i new enums in java , confused why code compiles fine enum scale5 { good(), better(), best(); static scale5 s=good; } but code fails: enum scale5 { good(), better(), best(); scale5 s=good; } and error : illegal reference static field initializer. dont understand reason.i relatively inexperienced in enums please dump down me.thanks lot! the question asked here cannot refer static enum field within initializer? exact opposite of have asked.in case declaring s static compiles code fine. think of enum this: public final class scale5 { public static final scale5 = new scale5(); public static final scale5 better = new scale5(); public static final scale5 best = new scale5(); static scale5 s = good;//works because initialized first; scale5 ss = good;//doesn't work because in order initialize good, //ss must assigned object not yet initialized; }

In c# How do I control which Excel opens? -

i have excel 2010 , excel 2013 (via office 365) on machine (windows 7 home premium) is there way control excel opens when var excelapp = new excel.application(); is called? thanks time, kw one of possible approaches rely on dynamic com automation: type exceltype = type.gettypefromprogid( "excel.application.[v]" ); dynamic excel = activator.createinstance( exceltype ); where excel.application.[v] is excel.application.14 or excel.application.15 depending on version want run. since excel dynamic, use in same way, despite actual version: excel.visible = true; ...

Wait for process to end and continue code in CMD/BATCH -

i trying wait process end, can't use "start /w" because process opens program. so in all, need kind of scanner if process in waitsession , continue code killsession @echo off color 02 cd /d c:\windows\system32 timeout -t 1 ***waitsession*** (wait process end) mightyquest.exe ***killsession*** taskkill /f /im publiclauncher.exe taskkill /f /im awesomiumprocess.exe thanks this should it: @echo off color 02 cd /d c:\windows\system32 timeout -t 1 set tempfile="%temp%\%random%.txt" :waitsession rem fetch current process list. store in temp file easy searching. tasklist > %tempfile% rem reset process "flag" variable. set "process=" rem check process target name searching task list target process name. rem if output returned, put process "flag" variable. /f "usebackq tokens=1 delims=-" %%a in (`findstr /i "mightyquest.exe" %tempfile%`) set process=%%a rem if nothing returned, means proces

java - Redirect Jersey JUL logging to Log4j2 -

i need redirect jersey request/response log log4j2. i have jersey logging enabled using code on applicationjaxrs extends application : @override public set<class<?>> getclasses() { return new hashset<class<?>>() {{ add(loggingfilter.class); }}; } it seems jersey uses jul (java logging) internally , default output stdout. @ moment can see stdout on eclipse console. the log4j2 documentation have section jdk logging adapter . says to use jdk logging adapter, must set system property java.util.logging.manager org.apache.logging.log4j.jul.logmanager this must done either through command line (i.e., using -djava.util.logging.manager=org.apache.logging.log4j.jul.logmanager argument) or using system.setproperty() before calls made logmanager or logger. to call system.setproperty(*) before logger call i've tried put on @postconstruct in aplication class. @postconstruct public void init() { system.setpro

powershell - Passing string variable to Sharepoint command without desired outcome -

i have number of fields using build string extraction of values sharepoint 2013 list. i use build string. foreach($column in $stringcolumns){ $fields=$fields+"`""+$column+"`"" if($loop -ne $columncount){ $fields=$fields+"," $loop++} } i take built $fields [string] variable , pass command. $splist.getitems($queryfromsource)[$itemnumber][$fields] the result receive no output command. makes odd can confirm $fields has appropriate string in command. have done calling in console , copying output sharepoint command directly. when that, receive output looking for. this seems should incredibly simple driving me insane. would work? foreach ($column in $stringcolumns) { $fields+= "`"$($column)`"" if ($loop -ne $columncount) { $fields+= "," $loop++ # use write-host debugging write-host "column $loop of $columncount" } } do initialize $l

How you set the application_name attribute for PostgreSQL in Laravel? -

how set application_name defined here http://www.postgresql.org/docs/9.1/static/libpq-connect.html , in laravel? see can "set application_name = 'application'" not work me. tried setting in app/config/database.php file in 'connections' array. doing wrong?

Python compare objects in C API -

given 2 pyobject* s, how can compare them in c api? i thought of a == b @ first, it's incorrect since compare pointer , not object. i'm looking a == b (not a b ) python equivalent in python c api. you looking pyobject_richcompare function: pyobject *result = pyobject_richcompare(a, b, py_eq); from documentation : pyobject* pyobject_richcompare(pyobject *o1, pyobject *o2, int opid) return value: new reference. compare values of o1 , o2 using operation specified opid , must 1 of py_lt , py_le , py_eq , py_ne , py_gt , or py_ge , corresponding < , <= , == , != , > , or >= respectively. equivalent of python expression o1 op o2 , op operator corresponding opid . returns value of comparison on success, or null on failure. you might interested in pyobject_richcomparebool function , same pyobject_richcompare returns integer rather pyobject * . specifically, 1 returned true, 0 false, , -1 error.

Finding strings in a file using regex and grep in Linux -

i trying find proper regexes use grep command on file text.txt . question find occurrences of words in text have substring ad, bd, cd, dd, ed. find occurrences of numbers > 100 find occurrences of numbers > 100 contain digit 0 or 5 my approach grep -io '[a-e]*d' text prints words proper substrings, doesn’t print whole string/word. ad d d ed d d ed d d d d ed d d grep -io '[199][1-9]*' text i believe way off on regex, still prints correct result. 1973 197 17775 grep -io '[05][1-9]*' text this continuation of 2., don’t understand 2. part in 3., believe have string containing digit 0 or 5 correct. 0 0 0 5 a) find occurrences of words in text have substring ad, bd, cd, dd, ed. grep -ow '.*\(a\|b\|c\|d\|e\)d.*' text or egrep -ow '.*(a|b|c|d|e)d.*' text b) find occurrences of numbers > 100 grep -ow '[1-9][0-9][0-9]\+' text c) find occurrences of numbers > 100 contain digit 0 or

What is the maximum resolution of C# .NET Bitmap? -

theoretically, should 65,535 x 65,535 given have enough memory, 17gb. however, creating .net 4.5 console application test out, throws system.argumentexception: parameter not valid. the application built 64bit platform. running on 64bit platform 32gb of memory. maximum resolution i've been able 22,000 x 22,000 pixels. i not find documentation on this. and odd behavior @ 22,000 x 22,000 pixels, doesn't work. works, , throws exception. make me think it's related contiguous memory allocation, there 30gb of free memory. does have experience this? , if wanted work say, 100,000 x 100,000 pixel image , larger, best way besides implementing own bitmap? edit: problem isn't .net maximum object size. can overcome targeting 64bit platforms, , setting gcallowverylargeobjects flag in application config. in way, can application consume on 15gb of memory single array of integers. far, answer seems lie in underlying implementation of gdi+, how around it? this gdi

java - Calculating an object's position, velocity and other derivatives of motion efficiently -

ok, here's programming/physics puzzle in, let's java (although doesn't matter - consistency, use java). i have array of doubles each element represents successive derivates of object's position. so: d[0] // position d[1] // velocity d[2] // accelleration etc ... there @ least 1 , potentially number of elements (but in practice, not more 5). elements beyond end of array assumed zero. we have double t time. so if d.length 3 specifically: d[0] += d[1] * t + d[2] * t * t / 2 d[1] += d[2] * t but how can write iterative solution (no recursion!) update of elements of array time t length of a? votes should awarded efficiency , conciseness. edit: laws of motion on physics pages of site, each term has form: power(t,n) / factorial(n) so next term of first equation d[3] * t*t*t / 6 if not familiar these equations, please don't ask me explain. a test case: final static double[] d = { 5.0, 4.0, 3.0, 2.0, 1.0 }; double t = 10.0 should give:

wolfram mathematica - Adding a new column which depends on other elements in the same row -

Image
i have problem handling dataset in mathematica. basically, want create new column "newcolumn" depends on 2 other columns, "a" , "b". values in "a" can either x or y. if x, want write b^2 new column , otherwise sqrt(b). thanks, appreciate help! a small example be: column "a": x,y,y,x column "b": 1,3,4,5 and new column should be: 1,sqrt(3),2,25 (example = { { x, 1 } , {y, 3} , {y, 4} , {x, 5 } }) // matrixform (switch[ #[[1]] , y , sqrt[#[[2]]] , x , #[[2]]^2] & /@ example )//matrixform

Query in MySQL Father and son -

i have table have 3 levels in structure example: 1 son 2 , 2 have son 4 , 6 3 father , son 5 , 1 have other son 7 4 doesn't have son because rule of structure. well table this: |id_father|   |id_son|          1              2          2              4          3              5          2              6          1              7 only want bringme query every father have 1 son, part of query: select r.* getname r not exists (select 1 estructura r2 r.id = r2.id_son) , exists (select 1 estructura r2 r.id = r2.id_father , not exists (select 1 estructura r3 r2.id_son = r3.id_father )) and query : 1 , 3 want 3. try one: select id_father estructura group id_father having count(distinct id_son) = 1

java - List of Objects, how to set list[index].setter in for loop? -

good evening everyone. have little problem list in java. let's start beggining. here method returns list query in hql : public list<praktykientity> getpracticeofstudent(long nralbumu) { query query = em.createquery("select p praktykientity p p.nralbumu=?1"); query.setparameter(1, nralbumu); list list = query.getresultlist(); if (!list.isempty()) { return list; } else { return null; } } then helper class : public class praktykainfo { public long idpraktykistudenckiej; //idofstudentpractice public szablonypraktykentity szablonpraktyki; //templateofpractice public praktykodawcyentity praktykodawca; //employer public statusyentity statuspraktyki; //statusofpractice public list<kierunkistudiowentity> kierunek; //course public typypraktykentity typpraktyki; //typeofpractice public lataakademickieentity rokakademicki; //academicyear public list<s

excel - Having trouble with syntax for populating listbox -

i'm beginner programmer , making vba macro senior capstone project. i'm trying populate listbox data in "a column". must dynamic, because user edit data. know simple seasoned coder, i'm having problems syntax. appreciated! private sub userform_initialize() dim lastrowcontrollers, lastrowbrakes integer dim brakes, controllers range worksheets("controllersinventory") lastrowcontrollers = .cells(.rows.count, "a").end(xlup).row end worksheets("brakesinventory") lastrowbrakes = .cells(.rows.count, "a").end(xlup).row end set controllers = range(cells(1, 1), cells(lastrowcontrollers, 1)) set brakes = range(cells(1, 1), cells(lastrowbrakes, 1)) 'populate controller_list worksheets("controllerinventory").select controller_list .rowsource "= controllers" end 'populate brake_list worksheets("brakeinventory").select brake_list .rowsource "= brakes" end end sub i foun

Android TableLayout - How to dynamically determine cells per row? -

i need create tablelayout view can dynamically add columns based upon size of screen. for example, if on phone, maximum number of cells can add per row 5. however, if on tablet, maximum number of cells can add per row 10. the 5 , 10 values magic numbers. ideally, query device determine size of screen, , adjust number of columns based upon size. here code creating tablelayout (it works fine): tablelayout tablelayout = new tablelayout(mcontext); tablelayout.setlayoutparams(new tablelayout.layoutparams(tablelayout.layoutparams.match_parent, tablelayout.layoutparams.wrap_content)); tablerow row = new tablerow(mcontext); row.setlayoutparams(new tablerow.layoutparams(tablerow.layoutparams.match_parent, tablerow.layoutparams.wrap_content)); string[] separated = scheduletimes.split(","); (int s = 0; s < separated.length; s++) { // 5 per row if ((s % itemsperrow) == 0) { tablelayout.addvie

Why does Docker keep around the stopped containers? -

what's reason stopped containers kept around? can restarted in way? because want keep uncommitted changes around recovery, image creation, or general inspection. stopped containers can restarted command docker start <container-name> , can viewed docker ps -a in addition can commit changes container (even if container stopped) local registry docker commit <container-name> <repository>:<tag>

Excel is being closed while connecting to Oracle using VBA -

i trying connect oracle using excel vba when code run, excel closed , reopened @ line msgbox rs.recordcount sub ora_connection() dim con adodb.connection dim rs adodb.recordset dim query string set con = new adodb.connection set rs = new adodb.recordset on error goto final1 query = "select * emp emp_no='998234'" strcon = "driver={oracle in oraclient11g_home1};dbq=smqa;uid=myuserid;pwd=mypassword;" con.open (strcon) rs.cursortype = 1 rs.open query, con rs.movelast msgbox rs.recordcount rs.close set s = nothing con.close set con = nothing final1: msgbox err.number & " " & err.description end sub i running code on windows 7 , trying connect oracle 11g. need additional setup connect oracle db using excel vba or wrong in code?

requirejs - Bundling javascript files -

i have project different modules written closure functions (example of module shown below). trying optimize project, can me bundling suggestion? how bundle them single file? i know requirejs these traditional closure functions , not sure if can use requirejs project not written in commonjs or amd pattern? other option found concat these js files per forums not practice. can suggest me correct way bundling these kind of files? or wrong way write modules @ first? var main = (function(){ //constructor function main(){}; main.prototype.entry = function(){ alert("entry function called"); } return main; })(); thanks in advance.

php - Google-App-Engine MySQL datebase not connecting -

i have google app engine website php , mysql instance database attached. have database connection file , can connect database website in gae development area when deploy application unaware of how connect them. have following code doesn't work. <?php $host = "unix_socket=/cloudsql/application:instancename"; $user = "root"; $password = "password"; $database = "database"; $connect = new mysqli($host, $user, $password, $database ); if ($connect->connect_errno) { echo "failed connect mysql: " . $connect->connect_error; } ?> any ideas? let's follow along guidance @ https://cloud.google.com/appengine/docs/php/cloud-sql/ ... i imagine you've followed https://cloud.google.com/appengine/docs/php/cloud-sql/#create including confirmation of grant of access cloud sql instance app engine app via latter's application id (and they're in same geographical region, &c -- de

Broken Unit Test -

our project in agile environment requirements keep changing every sprint. annoying part unit tests keep failing due requirement change. , takes longer fix , maintain them. do have suggestions in general, better approach situation? in advance. this common issue, , related how committed maintaining unit tests. you mention tests break when requirements change, i'm assuming means update code meet changing requirements, you're not updating tests @ same time. a development approach committed benefits of repeatable unit tests update unit test code @ same time code changes made. if don't, how re-test code changes, or how can prove code changes work? if you're not committed maintaining unit tests @ same time code changes, might embrace fact , throw them away code changes, because @ point, you're finding out, tests become useless. it's common problem , 1 many projects struggle with. tests written 1 time test code when written, after point discarded,

javascript - Overkill? Using indexOf() to discover contents of a string -

i'm learning javascript (fun!) beginning javascript, , particular example in book seems overkill. know things aren't strictly best practice - using document.write - make examples extremely easy understand. seems case of opposite: they're using seems complicated way of doing something, makes me wonder if there's reason don't understand. see example below. purpose of example create 2 images change image source every time click them. question pertains use of indexof search single string (not array) - seems weird. <!doctype html> <html lang="en"> <head> <title>chapter 10: example 1</title> </head> <body> <img src="usa.gif" onclick="changeimg(this)" /> <img src="mexico.gif" onclick="changeimg(this)" /> <script> var myimages = [ "usa.gif", "canada.gif", "jamaica.gif"

java - Set heap size for -jar command -

i want set heap size under linux os in order use on java -jar command. have tried add _java_options property under .bash_profile, property ignored. know can run jar java $_java_options -jar command or create alias alias java='java -xms256m -xmx512m' have found can export _java_options: export _java_options="-xms256m -xmx512m" property not kept between sessions. idea how can set permanent heap size java -jar command?

python - can't find flask.ext.pagedown module with flask -

i trying set sample code flask+python on machine, following website below http://blog.miguelgrinberg.com/post/flask-pagedown-markdown-editor-extension-for-flask-wtf however have problem below. from flask.ext.pagedown import pagedown traceback (most recent call last): file "/users/imacbin/documents/projects/flask/flasky/manage.py", line 3, in <module> app import create_app, db file "/users/imacbin/documents/projects/flask/flasky/app/__init__.py", line 7, in <module> flask.ext.pagedown import pagedown file "/library/python/2.7/site-packages/flask-0.10.1-py2.7.egg/flask/exthook.py", line 87, in load_module raise importerror('no module named %s' % fullname) importerror: no module named flask.ext.pagedown i did install flask-pagedown, markdown , bleach using pip on machine. (venv) $ pip install flask-pagedown markdown bleach i did search online , noticed flask.ext might stale, tried from flask_pagedown i

angularjs - Injecting resolves into directive controllers -

i'm using angularui router (0.2.13) , have state defined such .state('foo', { template:'<div some-directive></div>', resolve:{ foo:function(someservice){ return someservice.something().promise; } }) and directive this: app.directive('somedirective', function(){ return { controller: function(data) { // want `data` injected resolve... // if "standalone" controller } } }) but doesn't work - data parameter causes unknownprovider error. defining directive controller independently , setting name in directive has same result. i more or less why happening, have 2 questions: is there way i'm trying do? should trying it, or have slipped antipattern here? you can't use resolves in directives, can pass result resolved in state down directive think accomplishes you're look

Neo4j cypher query efficiency and syntax -

i attempting query ontology of health represented acyclic, directed graph in neo4j v2.1.5. database consists of 2 million nodes , 5 million edges/relationships. following query identifies nodes subsumed disease concept , caused particular bacteria or of bacteria subtypes follows: match p = (a:objectconcept{disease}) <-[:isa*]- (b:objectconcept), q=(c:objectconcept{bacteria})<-[:isa*]-(d:objectconcept) not (b)-->()--(c) , not (b)-->()-->(d) return distinct b.sctid, b.fsn this query runs in < 1 second , returns correct answers. however, adding 1 additional parameter adds substantial time (20 minutes). example: match p = (a:objectconcept{disease}) <-[:isa*]- (b:objectconcept), q=(c:objectconcept{bacteria})<-[:isa*]-(d:objectconcept), t=(e:objectconcept{bacteria})<-[:isa*]-(f:objectconcept), not (b)-->()--(c) , not (b)-->()-->(d) , not (b)-->()-->(e) , not (b)-->()-->(f) return distinct b.sctid, b.fsn i new cypher co

ios - how to display a new tableview from user selecting row in tableview swift -

Image
i trying figure how segue new view when user selects row in current tableview. thinking done didselectrowatindexpath method can not figure out logic of how work. display view specific courses in subject user selected. think use array? appreciate here thanks. yes, you're right, can responding didselectrowatindexpath. you can have view controller table view delegate implements these methods: func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { if let thing = self.things.objectatindex(indexpath.row) as? thing { self.performseguewithidentifier("openthing", sender: thing) } } where "openthing" segue defined in storyboard. then have overridden prepareforsegue method: override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "openthing" { if let controller = segue.destinationviewcontroller as? thingviewcontroller {

java - Take a String array and split with "," -

this question has answer here: how split string in java 28 answers i need splitting string array @ each , , make result new string array. string [] studentname ={"thui bhu, 100, 90, 80, 100, 89, 99, 88"} convert to: string []studentname2={"thui bhu", "100", "90", "80", "100" "89", "99", "88"} specify index of array element splitting going occur. string [] studentname ={"thui bhu, 100, 90, 80, 100, 89, 99, 88"}; system.out.println(arrays.tostring(studentname[0].split(",")));

Hello world using the Android SDK alone (no IDE) -

my aims to: test basic development tools on simple program expand program useful app i prefer work small, independent tools opposed ides. prefer code in procedural or imperative style (plain old java) opposed declarative (xml). i installed stand-alone android sdk as instructed . have necessary minimum of other tools (text editor, command shell , jdk). starting instructions can find tied android studio, eclipse or other ides. can't follow them. how can write java program text editor display "hello world" on android device? how can test using sdk emulator? please give me instructions. these instructions worked me. got them deconstructing google's ant script, on rob's answer based. the following content "android programming without ide" stack overflow documentation ( archived here ); copyright 2017 geekygenius , michael allan , cascal , doron behar , mnoronha , , androidmechanic ; licensed under cc by-sa 3.0. archive

lag - Android Development: App is lagging when ontouch listener is inactive -

i haven't been able find question online similar this, thought submit question. in cases seems people have opposite problem lag may occurring during touch event, seeing exact opposite. creating air hockey game , each frame pieces moved based on current parameters, , game redrawn while in background override ontouch listener looking motion events. thing there noticeable lag when there no fingers touching screen , watching animated pieces, long there form of motion event happening, if ontouch being called, animation smooth. can not figure why is, best educated guess interrupt checking if ontouch should called consuming more resources should, know nothing how modify or check ontouch interrupt behavior @ might know. a little more background on how organized. overall class located in main.java, created here , requests context view, game class extension of imageview. game class has @override ontouchevent, has defintions depending on state , motion event. class has draw method, , @

php - mySQL INSERT INTO ON DUPLICATE KEY - no idea whats not working -

i tried insert on duplicate key mysql query work. unfortunately no luck. read many posts on matter here in stackoverflow, had @ http://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html , still no luck... i have table this: ------------------------------------------------- | id | option1 | option 2 | option 3 | option 4 | ------------------------------------------------- | 83 | 0 | 1 | 0 | 0 | my id unique value, not auto incrementing. other values booleans describing chosen options. i wanted write function either update table if id existing or write new row if have new id. i'm working existing code database class. $this->db = new pdo($host, $user, $password); $this->db->setattribute(pdo::attr_errmode, pdo::errmode_silent); (don't ask me setattribute. that's in code...) , later on: $this->query = $this->db->prepare("insert mytable (id, option1, option2, option3, option4) values (83, 0, 1, 1, 1) on

how to batch change the field of the table in lua -

in lua, want change field name of table, like in test1.lua local t = { player_id = 2, item_id = 1, } return t in test2.lua local t = require "test1" print( t.item_id ) if want change field name item_id -> item_count of t , i need use application ultraedit , find out lua file contain item_id , , modified 1 one, such modification easy correction or change of leakage, there tools can more modified field name? if understand problem correctly: (what if item_id happens field in different table?) in view, there no generic solution task without interpreting script. field name (e.g., item_id) appear in many places referring different tables. make sure change references correct table need interpret script. given dynamic nature of lua scripts, not trivial task. using editor (or preferably lua script) globally replace occurrences of 1 name work if you're 'old' name has single context. a run-time workaround might add metatable keep both

nullpointerexception - What is the best practice to avoid null pointer /un parsable exception when an array returns a null -

let's have for(object[] ob:bftotobj) { double sal1= double.parsedouble(string.valueof(ob[0])); double sal2= double.parsedouble(string.valueof(ob[1])); double sal2= double.parsedouble(string.valueof(ob[2])); } if array returns null, leads null pointer exception or number parsing exception that. one way surround every thing in try, catch. other way put for(object[] ob:bftotobj) { if(ob[0]!=null) double sal1= double.parsedouble(string.valueof(ob[0])); if(ob[1]!=null) double sal2= double.parsedouble(string.valueof(ob[1])); if(ob[0]!=null) double sal2= double.parsedouble(string.valueof(ob[2])); } to values. is there better way this? or best way it?

Any way to programatically get key of google script? -

i understand how sheet key of google spreadsheet using script, there way key script file associated sheet through script? example: https://script.google.com/macros/d/i_want_this_string/edit no there no way that.

jquery - HTML page not scrolling in windows phone 8 -

i creating hybrid app android , ios , windows phone , working fine android , ios windows phone 8 scroll not working , had added overflow-y:scroll property html pages in windows again affecting jquery swipe , fixed header element , popup feature. issues 1-fixed header-bouncing along whole page 2-jquery swipe- not working when page scrolling 3-popup- showing weird opacity add -ms-touch-action: pan-y body/element needs scrolling. https://msdn.microsoft.com/en-in/library/windows/apps/hh767313.aspx

python - How can I add nothing to the list in list comprehension? -

i writing list comprehension in python: [2 * x if x > 2 else add_nothing_to_list x in some_list] i need "add_nothing_to_list" part (the else part of logic) literally nothing. does python have way this? in particular, there way a.append(nothing) leave a unchanged. can useful feature write generalized code. just move condition last [2 * x x in some_list if x > 2] quoting list comprehension documentation , a list comprehension consists of brackets containing expression followed for clause, 0 or more for or if clauses. result new list resulting evaluating expression in context of for , if clauses follow it. in case, expression 2 * x , for statement, for x in some_list , followed if statement, if x > 2 . this comprehension can understood, this result = [] x in some_list: if x > 2: result.append(x)

Why does a Maven clean (from Eclipse) pull files into the local repository? -

i guess clean might either delete jars repo or leave untouched. when manually deleted existing repo , cleaned existing projects in eclipse, repository recreated. problem @ least takes long time. firstly curious why behavior occurs , secondly wonder if there way not have occur. the maven install little more bootstrap. maven actions implemented plugins, downloaded maven repository, , cached in local repository. architecture makes maven extremely extensible (if know you're doing). to improve build performance best advised setup local maven repository manager. cache jars otherwise have downloaded maven central. running maven repository manager not hard nowadays. offers additional features of providing place manage dependencies may not available remote repo , place share jars between different project builds.

hosting - How to Execute a cmd or sh file in the ssh -

i have got domain hosting , wondering how execute cmd or .sh file. i attempting make game server software requires me execute file. file managers rubbish , have nexus 7 can ftp. think missed let me know if need more information. you must set executable permission .sh file in order execute in console. first of not sure if execute cli ftp connection hosting. you must connnect via ssh, cd directory .sh file is, change permission. if want execute file, , don't care code, give execute permission file user with: chmod 100 file.sh execute ./file.sh if want read code, chmod 500 , , if want full perms user chmod 700 make combination give or deny perms users in own group, or others.

jquery - Why my form start be blocked after submit in yii2? -

i have got form. created of activeform class. blocked standard submit preventdefault(); method , aftervalidate form submit form ajax call: $('#form').on('aftervalidate', function () { var url = $('#form').attr('action'); var data = $('#form').serialize(); $.ajax({ type: "post", url: url, data: data }); }); all works good. works first time. second submit not working other data. how can reset validation of form after every submit ajax?

regex - SOLVED .htaccess URL Rewrite doesn't see get values -

i want rewrite url: http://localhost/api/user/?a=xxx&b=yyy to: http://localhost/?controller=user&a=xxx&b=yyy i wrote rewriterule ^api/([a-z]*)/\\?(.*)$ ?controller=$1&$2 [l] however doesn't see values in first link. possibility that? when trying data queries have match path , add [qsa] in case: rewriterule ^api/([a-z]+)$ ./index.php?controller=$1 [qsa, l] observe, i've added ./index.php , replace original file want execute.

html - How to make float : left work same as table-cell? -

i have made 2 css layouts, 1 using display:table , other using float:left . when using float, black div seems overlap behind colored div 's above it. how make this similar this ? add clear both .image-block { height:300px; background-color:black; clear:both; }

php - how to show insert update messages on same page in codeigniter -

when inserting or updating data in codeigniter want show message whether data inserted or updated message showing in controller want show on view page. , don't want redirect during update , insertion. here update time code in controller i.e. showing message . if($result) { $this->load->view('includes/header'); $this->load->view('includes/menu'); echo "<div class='success'>"; echo "successfully updated"; echo "</div>"; redirect(current_url()); } else { $this->load->view('includes/header'); $this->load->view('includes/menu'); echo "<div class='error'>"; echo "somthins missing"; echo "</div>"; } i want know using redirect(current_url()); correct or without using

if statement - Python: Check second variable if first variable is True? -

i have script checks bools through if statements , executes code. trying make that: if variable true, check if b true , execute code if variable false, execute same code mentioned before a simplified version of have this: if a: if b: print('foo') else: print('foo') is there better way doesn't require me write print('foo') twice? if not or (a , b): print('foo') let's talk step step: when print('foo') executed? when a , b both true . when else executed, else ? opposite of previous if not a . finally wish display 'foo' in 1 case or other. edit: alternatively, simplifying logic equation: note: you might want avoid unless know doing! clarity way better shortness. trust advice! i've been through there! ;) if not or b: print('foo') because if not a not true , a must true (the second part of or ), a , b can simplified in b (because know fact a true

php - Dynamic content replacement in Laravel with masks -

i updating custom cms codeigniter laravel. uses custom masks (currently in single curly brackets) allows user entered content dynamically updated values entered elsewhere. codeigniter gave neat way of doing the page parser passed associative array (such favouritefruit=>'apple') - replace relevant masks on entire page prior output. meant masks used anywhere. trying find neat way of doing in laravel 4.2. ->render() view variable , str_replace prior controller returning it, wondering if there 'native' way perhaps using blade. in short trying run mask replacement twice on same data. thanks! a string replace on whole view pretty easy actually. call render() , view string: $view = view::make('view.name')->render(); $view = str_replace('{mask}', 'value', $view); return $view;

c# - Is there a way to easily inspect and debug nuget packages source code -

when use java's maven , gradle, can download source code artifacts. way can inspect source code , debug it. useful, libraries poor documentation. i'm using xamarin studio , nuget packages , xamarin components. for example, add sqlite-net component project , able browse source files. you try .net reflector. remember had while ago , allowed me see source of libraries. can't remember if there special libraries (debug mode or something).

interact 2 radio buttons 2 different functions Javascript -

i have 2 radio buttons have changed clickable images using label , working great. problem is, when 1 label checked, second not unchecked. here code of 2 functions : var $radiobuttons = $('input[value="2"]'); $radiobuttons.click(function() { $radiobuttons.each(function() { $(this).parent().parent().toggleclass('checked11', this.checked); }); }); var $2radiobuttons = $('input[value="5"]'); $2radiobuttons.click(function() { $2radiobuttons.each(function() { $(this).parent().parent().toggleclass('checked12', this.checked); }); }); you need interlink radio buttons. giving them name attribute. in example i've added 2 sets of radio buttons. changed selector of jquery function select on name attribute. name attribute can same multiple elements in contradiction id attribute must unique throughout entire document. can use advantage when selecting elements usi

javascript - how to autostart nanoGallery from a link -

i know has been asked before answers given did not work me , scenario in case different. i starting evaluate nanogallery, looks requirement run slideshow of inline image references. want run slideshow link rather having display set of thumbnails , clicking/tapping on 1 start slideshow. doesn't seem me particularly unusual requirement, large slideshow set of thumbnails occupy far space on screen. my html simply: <a id="startlink" href="javascript:void(0)" style="margin-bottom: 40px;">run slide show</a> <div id="nanogallery"> <a id="first" href=... data-ngdesc=... /> ... so have tried: $(document).ready(function () { $("#startlink").click(function (e) { $("#nanogallery").nanogallery({ slideshowautostart: true, ... }); $("#first").trigger("click"); }); }); i have tried various alternatives, including

Powerpoint customize Ribbon - Color Picker -

Image
i wondering whether , how possible change colors available customizing ribbons: . using powerpoint 2010. as result, want color palette own colors on ribbon. any suggestions? kind regards, tobias

c# - What are the pros and cons of using closures instead of locks for shared state? -

i'm trying assess fastest solution sharing state across single-writer, single-reader scenario, reader consumes latest value of state variable assigned writer . shared state can of managed type (i.e. reference or value types). ideally synchronization solution work fast naive non-synchronized solution possible, since method used both single-threaded , multi-threaded scenarios potentially thousands of times. the order of read/writes shouldn't matter, long reader receives latest value within time frame (i.e. reader ever read, never modify, update timing doesn't matter long doesn't receive future value before older value...) naive solution, no locking: var memory = default(int); var reader = task.run(() => { while (true) { func(memory); } }); var writer = task.run(() => { while (true) { memory = datetime.now.ticks; } }); what issues naive solution? i've come these far: no guarantee reader sees latest valu

Calculating Covarince matrix using Eigen library, C++ Linux -

i'm trying operations on matrices using matrix library named, "eigen library". i've 50 x 100000 matrix in size , want find covariance matrix. so, can built_in function to find covariance matrix? c++ sample code: #include "eigen/core" #include "eigen/dense" using namespace eigen; using namespace std; int main() { matrixxf my_matrx = matrixxf::random(50,100000); //now, want find function find covariance matrix of "my_matrx", below: matrixxf my_cov_matrix = any_function(my_matrx); }

java - Why am I able to access enum constants directly as case labels of a switch statement in another class -

why able access enum constant hot directly in code below: enum spice_degree { mild, medium, hot, suicide; } class switchingfun { public static void main(string[] args) { spice_degree spicedegree = spice_degree.hot; //unable access hot directly switch (spicedegree) { case hot: //able access hot directly here system.out.println("have fun!"); } } } it's way language defined - when case labels enum values, means switch expression must enum of type, specifying enum type everywhere redundant. from jls 14.11 : every case label has case constant, either constant expression or name of enum constant. and if type of switch statement's expression enum type, every case constant associated switch statement must enum constant of type.

html - Media query and max width 1000px not activating until screen width is approx. 980px? -

all divs used web page layout specified own widths , heights, heights different widths same: 1000px. media query @media screen , (max-width: 1000px) { #container { width: 100%; } #desktop_ul { width: 100%; } .desktop_li { margin: 0 0.5%; } #article { width: 100%; } #footer { width: 100%; } } is supposed make these divs transform percents when browser window shrunk down 1000px or less, when shrink down window, horizontal scroll bar brief second, or 20px , disappears once reach 980px. why doesn't media query activate @ 1000px, why have shrink down window 980px activate?