Posts

Showing posts from July, 2011

javascript - Select box not returning expected value -

i have form display different options depending on first select box. if option 1 selected second dropdown shown option pre selected. if option 2 selected different dropdown 2 options shown. the 2 new dropdowns have same id , name passing option through backend keeps returning wrong values. here jsbin <p class="input_title">i use:</p> <select name="js-rp-use" class="signup-select js-rp-use" id="rp-use" class="signup-select"> <option value="">select plan</option> <option value="solo">manage own items</option> <option value="other">manage others items</option> </select> <div class="js-rentpro-plan-solo"> <p class="input_title">system plan:</p> <select name="plan_id" id="plan_id" class="signup-select"> <option value="-1">select plan</

.htaccess - need help. rewriterule not working with /? -

my url http://example.com/?aff_id=username and want http://example.com/?ap_id=username i have tried possible ways no luck. if removed ? (question mark) works want ? in url. know regular expression tried escape no luck. you can use following in /.htaccess file: rewriteengine on rewritecond %{query_string} aff_id=([\w]+) [nc] rewriterule ^$ /?ap_id=%1 [r,l] if make redirect permanent, change r r=301 .

excel - Index & Match formula does not show the repeated entry with different value -

Image
i have excel spreadsheet - downloadable here contains columns following : column : companies' names column b : project's name when try filter data using combo box show companies in specific area , use index , match show related data in same row company name in search result, since have companies has more project, unlikely index , match repeat first row company name following: company1 project 1 company1 project 1 although company 1 has 2 projects 1 , 2 , must following company1 project1 company1 project2 but formula keep repeating first row finds. pic 1 - search result incorrect pic 2 - main data want appear in search result as @houssam said, can try 1 in s3 : =iferror(index($c$3:$c$22,$n3,columns($r$3:r3)),"") does help?

javascript - How to display the tables one next to the other -

code $(function() { var dmjson = "data.json"; $.getjson(dmjson, function(data) { $.each(data.records, function(i, f) { var $table = "<table border=5></br><tbody><tr>" + "<td>" + f.clue + "</td></tr>" + "<tr><td>" + f.answer + "</td></tr>" + "<tr><td>" + f.status + "</td></tr>" + "<tr><td> " + f.views + "</td></tr>" + "</tbody></table>"; $("#entrydata").append($table) }); }); }); with code dynamically created tables displaying 1 below other want them displayed 1 next other. how solve this? solution appreciated. as table block level elements aligned them next each other can choose display:inline-table or can choose float:left both tables. , parents items mus

sql - database Junction/association table with more data fields -

i not fan of having more 2 fields (eg: pk1 & pk2) in junction/association table. have situation, however, , not sure best approach resolve it. table 1: contract (id, price, description) table 2: person (id, firstname, lastname) table 3 (junction/association) person_contract (person_id, contract_id) so contract can have 1 ore more persons , person can have 1 or more contracts. hence need junction/association table; person_contract. up here there no problem. persons per contract have sequence represents importance given contract. example: - person1, contract1, sequence = 1 - person2, contract1, sequence = 2 - person3, contract1, sequence = 3 - person1, contract2, sequence = 2 - person4, contract2, sequence = 1 the question save person sequence contract? adding sequence junction/association table doesn't right me. looking better approach if possible. there's nothing wrong including other fields in kind of table. specific scenario you've describe

networking - Implementing adaptive power control in OMNeT++ (MIXIM) -

i have form of wireless sensor network designed using mixim framework in omnet++. i've built on host802154 module, using modified ieee802154 standard , custom protocol. i want able programmatically adapt power output of transmitter in 1 node during simulation, leaving other nodes @ original power, giving single node larger broadcast radius. should happen during circumstances, not useful have preset power higher outset. is possible within omnet++? and if so, how, , have examples of working? as adaptive power control isn't unheard of, hoping there can implement it. many thanks. i think this answer here given @floxyz following question: how change configuration of network during simulation in omnet++? should solve problem. the basic idea use somekind within handlemessage() can used check specific condition handlemessage(cmessage *msg){ if(msg->getkind() == yourkind){ // replace yourkind 1 using these messages transmission_rate = new_val

compilation - if 0 is compiled in c program -

i'm trying removed unused code program - can't delete code now, want disable start. let's have following code: if (cond){ dosomething() } and cond false dosomething never called. i want like: #define remove_unused_code 0 if (cond && remove_unused_code){ dosomething() } now obvious (and compiler) code unused. will compiler remove if condition or leave , never in? p.s.: can't use #if 0 purpose gcc explicitly remove conditional blocks have constant expression controlling them, , the gnu coding standards explicitly recommend take advantage of this , instead of using cruder methods such relying on preprocessor. although using preprocessor #if may seem more efficient because removes code @ earlier stage, in practice modern optimizers work best when give them information possible (and of course makes program cleaner , more consistent if can avoid adding phase-separation dependency @ point isn't necessary). decisions very, ver

php - How can I use special character (?) in URL -

i have developed website using raw php. have used special character (? , ~) in url. example: http://webdeveloperszone.com/?~=portfolio . now, want rebuild website using wordpress or codeigniter. want keep existing link live, because google has cached links. means, have create links supports special character (? , ~). can 1 tell me how can this? php string urlencode ( string $str ); string urldecode ( string $str ); javascript encodeuri(uri); decodeuri(encodeuri(uri));

scikit learn - What is the effect of the zero_based parameter in dump_svmlight_file() method in sklearn.datasets? -

i'm making classification experiments using sklearn. during experiments, i'm building csr_matrix objects store data , used logisticregression classifier on these objects , results. dump data using dump_svmlight_file , model using joblib. when load data using load_svmlight_file , model, obtained (very) different results. i realized if dump data setting zero_based parameter false, retrieve original results. effect of parameter? usual have different results modifying value of parameter? the docs pretty explicit: zero_based : boolean or “auto”, optional, default “auto” whether column indices in f zero-based (true) or one-based (false). if column indices one-based, transformed zero-based match python/numpy conventions. if set “auto”, heuristic check applied determine file contents. both kinds of files occur “in wild”, unfortunately not self-identifying. using “auto” or true should safe. your observation seems odd, though. if dump zero_based=false , load z

What is the difference between private method and final method in java? -

what asking "in functionality point of view 'private and final` methods not overriden". can use 1 access modifier i.e private in functionality point of view? private accessibility public or protected or no modifier. final modification during inheritance. private methods not accessible outside of class. final methods can not overridden child class. as private method not accessible child classes cannot overridden final method can or can not accessible based on access modifier.

How can I verify in Postgresql that JSON is valid? -

i've got big database analytics data written in json. i want filter out rows incorrect data: invalid json (some rows has that: '{"hello": "world' some attributes not array take '{"products": [1,2,3]}' , leave out '{"products": 1}' i want that: select * analytics (is_correct_json(json::json)) , (is_array(json::json->>'products')) how can achieve that? this example why choosing appropriate data type right start helps later ;) there no built-in function check if given text valid json. can write own: create or replace function is_valid_json(p_json text) returns boolean $$ begin return (p_json::json not null); exception when others return false; end; $$ language plpgsql immutable; caution: due exception handling not going fast. if call on many invalid values going slow down select massively. however both '{"products": 1}' , '{"products&

java - How to avoid running duplicate tasks in a High Avaliability Clustered JBoss EAP -

im developing application needs have background jobs, example sending emails on pending alerts. in standalone configuration jobs configured , working fine spring scheduler , scheduled-tasks. don't know how make them work synchonized on clustered high avaliability jboss environment. main problem avoid jobs on different nodes run @ same time. i've read quartz: http://quartz-scheduler.org/documentation/quartz-2.x/configuration/configjdbcjobstoreclustering but it's not recomended on on high avaliability scenario: never run clustering on separate machines, unless clocks synchronized using form of time-sync service (daemon) runs regularly (the clocks must within second of each other). see http://www.boulder.nist.gov/timefreq/service/its.htm if unfamiliar how this. by have workarounded synchronization problem self made blocking system ( why pessimistic locking in jpa oracle not working ). wish know if jboss provides solution common problem. you

Constraint Error warning using Enum in ADA -

i'd know why constraint errors warnings prompted in ada when enums used in example below. i've been using enums can replace them better implementation. type uart_instance_type (com1, com2, com3); uart_instance_type use ( com1 => 16#0001# , com2 => 16#0002# , com3 => 16#0003# ); type uart_register_type record sr : half_word; -- usart status register reserved_0 : half_word; dr : half_word; -- usart data register reserved_1 : half_word; brr : half_word; -- usart baud rate register reserved_2 : half_word; end record volatile; uart_register_type use record sr @ 0 range 0 .. 15; reserved_0 @ 2 range 0 .. 15; dr @ 4 range 0 .. 15; reserved_1 @ 6 range 0 .. 15; brr @ 8 range 0 .. 15; reserved_2 @ 10 range 0 .. 15; end record; type uart_register_access access uart_register_type; uarts: array (uart_instance_type ra

Powershell exception using Add-WindowsFeature: could not update the provided feature files in the time allowed -

i've got script adds set of features on windows 2012 r2 server. every night server gets redeployed test script automation. the command i'm running: add-windowsfeature powershell-ise, rsat-ad-powershell, rsat-ad-tools, rsat-adds-tools, rsat-dfs-mgmt-con, rsat-dns-server, server-gui-mgmt-infra, server-gui-shell, snmp-service, snmp-wmi-provider i'm getting different results every night running same command. works expected, , after server reboots features installed. in working scenario operation took 58 minutes , 24 seconds. but quite exception: exception : system.exception: server not update provided feature files in time allowed. targetobject : 86b9dcf8-80b1-436f-9c01-9b924886b384 categoryinfo : operationtimeout: (86b9dcf8-80b1-436f-9c01-9b924886b384:guid) [install-windowsfeature], exception fullyqualifiederrorid : getalterationstate__callcycletimeout,microsoft.windows.servermanager.commands.addwindowsfeature

unit testing - How to test getCookie function with Jasmine and PhantomJS -

i have function on window object so: window.getcookie = function(name){ // cookie name, uses document.cookie this. }; now want test logic in unit tests i'm using jasmine , phantomjs. test looks like: it('should cookie specific name.', function () { // setup document.cookie = 'foo=bar; expires=thu, 01 jan 1970 00:00:00 utc'; // execute var result = window.getcookie('foo'); // test expect(result).tobe('bar'); }); the thing turns out document.cookie '' when code executed within phantomjs. setting cookie on line 1 not doing anything. if log on line 2, value ''. how around this? mmm, it's strange document.cookie '' using phantomjs only. usually, when cookie has expired time no more available in document.cookie.

Apache Log4j in Android gives exception java.lang.VerifyError: org/apache/log4j/config/PropertySetter -

i trying integrate flickr in android using flickr4java library. flickr4java uses log4j logging. when try create instance of flickr, flickr flickr = new flickr(apikey, sharedsecret, new rest()); following stack trace 05-12 01:24:28.714 8449-8449/edu.sdsu.cs.sharepic e/androidruntime﹕ fatal exception: main process: edu.sdsu.cs.sharepic, pid: 8449 java.lang.verifyerror: org/apache/log4j/config/propertysetter @ org.apache.log4j.propertyconfigurator.parseappender(propertyconfigurator.java:805) @ org.apache.log4j.propertyconfigurator.parsecategory(propertyconfigurator.java:768) @ org.apache.log4j.propertyconfigurator.configurerootcategory(propertyconfigurator.java:648) @ org.apache.log4j.propertyconfigurator.doconfigure(propertyconfigurator.java:514) @ org.apache.log4j.propertyconfigurator.doconfigure(propertyconfigurator.java:580) @ org.apache.log4j.helpers.optionconverter.selectandconfigure(optionconverter.java:526) @ org.a

maven - camel-test-spring in intelliJ -

i trying use camel-test-spring maven , intellij my test class looks this: @runwith(springjunit4classrunner.class) @contextconfiguration("classpath:spring-test-config.xml") public class mytest { ... } with maven testcases executed , work fine. problem if try run testcase intellij (right click on testcase/ run "xyz") following error occurs. java.lang.nosuchmethoderror: org.springframework.beans.beanutils.instantiateclass(ljava/lang/class;ljava/lang/class;)ljava/lang/object; @ org.springframework.test.context.contextloaderutils.resolvecontextloader(contextloaderutils.java:118) @ org.springframework.test.context.contextloaderutils.buildmergedcontextconfiguration(contextloaderutils.java:594) @ org.springframework.test.context.contextloaderutils.buildmergedcontextconfiguration(contextloaderutils.java:560) @ org.springframework.test.context.testcontext.<init>(testcontext.java:99) @ org.springframework.test.context.testcontextmanag

Development environment in Docker -

due hardware issue, had change work station mac few weeks. took me couple of hours setup everything: android studio, git, apache, mysql, etc... could use docker image bundle development tools ? (my goal have "backup" of development environment start running right away on machine) could use docker image bundle development tools ? that means dev tools linux tools working in linux container, on linux host. you need provide linux host (on mac) through boot2docker virtual machine. but mean not directly type " git " mac shell, need connect vm first in order launch ' git ' container , run dome docker run --name=git commands. so no, doesn't seem fit backup plan on mac.

linux - scp: how to find out that copying was finished -

i'm using scp command copy file 1 linux host another. run scp commend on host1 , copy file host1 host2. file quite big , takes time copy it. on host2 file appears copying started. can file if copying still in progress. is there reliable way find out if copying finished or not on host2? off top of head, like: touch tinyfile scp bigfile tinyfile user@host: then when tinyfile appears know transfer of bigfile complete. as pointed out in comments, assumes scp copy files 1 one, in order specified. if don't trust it, them 1 one explicitly: scp bigfile user@host: scp tinyfile user@host: the disadvantage of approach potentially have authenticate twice. if issue use ssh-agent .

cordova - Hybrid App platform & technology -

i'm full stack developer php, html5, css3, javascript, jquery, angular , enthusiast lear new technology. got hybrid mobile app project(simpler few curd operations , web services) , plus web app well, need deliver possible. question choosing right tool right job. hybrid app can build platform: phonegap or cordova, cordova extension of phonegap per understanding. technologies: plain html/css/jquery mobile or using of framework ionic angular. so want know tools , technology building hybrid app preferable , easy learn faster. i'm in traineeship , learn hybrid apps in 1 week , i'm in second year of computer science degree guess won't hard you. first of all, if want "light" , complete solution can use cordova . documentation , have bunch of easy understandable exemple. if have leave malus, encountered installation problems. you can check crosswalk fast take in charge ( did 100% hybrid app in 2 days both interactions ). i didn't try

GORM: What is reference:true in Grails domain class mapping block? -

public class address { static mapwith = "mongo" region region; zone zone; static mapping = { id generator: 'identity' region reference:true zone reference:true } } i'm interested in knowing reference:true does. in experience, leaving off gives same result except there's no dbref in actual mongo document. it looks reference controlls how documents linked. when true , related documents referenced db-refs , if false , gorm inserts simple id , aka manual references in mongo

java - regular expressions with words in different lines -

Image
i have following string: >stat f -------------- begin of statistic 3 (f) activate context request tim eouts : 0 attach timeouts : 0 deactivate context request t imeouts : 0 detach timeouts : 0 gmm_attach accepts : 0 gmm_attach completes : 0 gmm_attach congestions : 0 gmm_attach rejects : 0 gmm_attach requests : 0 gmm_authentication failures : 0 gmm_authentication requests : 0 gmm_authentication responses: 0 gmm_detach requests : 0 gmm_detach responses : 0 gmm_id requests : 0 gmm_id responses : 0 gmm_protocol error unspecifi ed : 0 #more here key:value pairs -------------- end of statistic 3 < stat exec'

datetime - How do I simulate an SQL `timestamp` in plain old Ruby? -

i enforcing output of datetime zulu-time doing following object.updated_at.utc.iso8601 # => "2013-05-12t10:47:01z" this works fine datetime when object persisting database timestamp instead get "sun, 12 may 2013 10:47:01 utc +00:00" which not zulu time string. i can fix by object.updated_at.to_time.utc.iso8601 but trying unit test fix, , can't reproduce timestamp format test it. how simulate sql timestamp such .utc.iso8601 returns "sun, 12 may 2013 10:47:01 utc +00:00", without wrapping in whole mess of activerecord etc? turned out problem me not wearing glasses , misreading own test code. i'd close question except there no 'closing question because forgot glasses' option.

Retain Statement Data Spread over multiple lines SAS -

im having trouble dataset. there free form character variable spread on multiple lines. want put variable new variables each observation on own line heres example dataset data have; input ob_ref $ chardata $ linenum 3.; datalines; 321a myname 1 321a john 2 431a myname 1 431a notjohn 2 431a itsfred 3 511a geoff 1 754a cam 1 ; there ob_ref each observation , have linenum variable indicating how many lines observations data spread over. need new dataset 1 observation per line , character variable spread on multiple variables. maximum linenum 56 any appreciated i think you're looking this? create array of character variables, use linenum variable assign values correct character variables. output on last row given ob_ref. data want(keep=ob_ref char1-char56); array _c $ char1-char56; until (last.ob_ref or eof); set have end=eof; ob_ref; _c(linenum)=chardata; end; output; run;

RethinkDB text search? -

i trying study rethinkdb next project. backend in haskell , rethink db haskell driver looks bit better mongodb. want try it. my question how do simple text search rethinkdb? nothing complex. find field value contains these words . assume should built in smallest blog app needs search facility of kind, right?. so looking mongodb equivalent of: var search = { "$text": { "$search": "some text" } }; thank you. edit i not looking regular expressions , match function. it extremely slow more or less large sets. i not have notion of indexes. it not have notion of stemming. with rethinkdb driver documented here run h $ table "table" # r.filter (\row -> match "some text" (row ! "field"))

java - Jackcess -- How to change Column Name? -

i have jackcess table , working fine. can't find on how change column name in jackcess table. the reason want change column name have resultset converted microsoft access using jackcess. column named "relation" when jackcess converts it, name changed "xrelation". must kind of blacklisted word... i want change column name "relation" , changing "relation" else not option. how can ? jackcess cannot alter structure of table after has been created. so, if want column named relation instead of xrelation need explicitly create table first (e.g., using tablebuilder ) relation column name, , use importutil.importresultset import table created: importutil.importresultset(rs, db, "existingtable", new simpleimportfilter(), true); that form of importresultset import existing table instead of creating new one.

java - Android Eclipse not Responding Adding Jar -

i have jar files added in project. add jar files external jar files in java build path project has java.lang.verifyerror when run project: could not find class 'com.sforce.ws.connectorconfig', referenced method add jar files libs folder , add them in java build path , until pc cpu consumption around 90%. i believe add them either external jar or put them internal jar won't give me issue. what's wrong it? note: total jars size around 9mb. some adt version need set libraries/projects should exported do following: right click project -> properties -> java build path -> order , export(tab) -> check your sources , other libraries using. clean project.

swift - Nothing displayed when trying to run a Vimeo video iOS App -

i trying run vimeo video in app, , method makes sense me method example [ https://stackoverflow.com/a/15918011/4856759 ]. so have attempted recreate method in swift own vimeo link, blank screen. as far can tell have created relevant string, converted nsstring , loaded using loadhtmlstring method - missing? @iboutlet weak var webview: uiwebview! override func viewdidload() { super.viewdidload() var embedhtml = "<iframe width=\"300\" height=\"250\" src=\"http://www.vimeo.com/113067409" frameborder=\"0\" allowfullscreen></iframe>" var html: nsstring = nsstring(string: embedhtml) webview.loadhtmlstring(html, baseurl: nil) } your link valid, way embedding html vimeo not correct , have set base url to "http://" instead of nil. here working code:- @iboutlet weak var webview: uiwebview! override func viewdidload() { super.viewdidload() var embedhtml=&

php - One row of data can't be shown -

Image
i newbie , have no idea why nothing shown on "detail" tab did insert data database. 1 me on this? <?php require ("data/taxidata.php"); class taxicontroller { function createoverviewtable() { $result = " <table class='overviewtable'> <tr> <td></td> <td></td> <td><b>id</b></td> <td><b>name</b></td> <td><b>gender</b></td> <td><b>faculty</b></td> <td><b>cartype</b></td> <td><b>car plate number</b></td> <td><b>price</b></td> <td><b>detail</b></td> </tr>"; $itaxiarray = $this->getitaxibytype('%');

html - Images acting weird on specific mobile phone -

Image
i developed responsive website. had no problems checks fine , on mobile phones have seen works fine. customer came me , said website looks weird on mobile phone (she has jiayu type jy-g4s, android 4.2.2.). send screenshot: how supposed (and how see everywhere): the arrows svg files , added this: <div class="white-up"> <img src="/path/to/white_shape_up.svg" alt="" /> </div> the compiled css (from sass): .white-up { bottom: -9px; } .arrows, .white-up { overflow: hidden; position: absolute; width: 100%; z-index: 1; } arrows img, .white-up img { height: auto; left: -1%; width: 102%; } i can't seem find problem website. of have experience such issues on specific phone , have tips on how debug this? i stuck @ moment appreciated. in advance. ps. link live website http://pleun.photo

Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/service/jdbc/connections/spi/ConnectionProvider -

getting following error while trying update hibernate version 3.6.. 4.3.* initial sessionfactory creation failed.java.lang.noclassdeffounderror: org/hibernate/service/jdbc/connections/spi/connectionprovider java.lang.noclassdeffounderror: org/hibernate/service/jdbc/connections/spi/connectionprovider @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:760) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:467) @ java.net.urlclassloader.access$100(urlclassloader.java:73) @ java.net.urlclassloader$1.run(urlclassloader.java:368) @ java.net.urlclassloader$1.run(urlclassloader.java:362) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:361) @ org.eclipse.jetty.webapp.webappclassloader.loadclass(webappclassloader.java:415) @ org.eclipse.jetty.we

javascript - Retrieving posts by id -

i receiving json object wordpress looks this { "id": 4164, "title": "24 horas non-stop con marco carola", "status": "publish", "type": "post", "author": { "id": 11, "username": "vilma quiros", "registered": "2015-04-16t07:04:04+00:00", "meta": { "links": { "self": "http://urbanetradio.com/wp-json/users/11", "archives": "http://urbanetradio.com/wp-json/users/11/posts" } } }, "content": "<p class=\"p2\"><a href= here service .service('freshlypressed', function($http, $q) { return { getblogs: function($scope) { var posts = []; $http.get('http:

javascript - Click handler for element with highest z-index only -

in page i'm creating there webgrid components serving master grids, , on clicking row, details area shown. every row shall have delete button, clicking button, row deleted. now because have click handler #mygrid tbody tr , , button (which image) inside tr , both click handlers executed when click on button. can prevent , execute click handler button, is, "top" element? here jsfiddle demonstrating i'm doing is there elegant way this, or there maybe alternative i'm doing? for reference, here's shorter sample code. html: <table id="tbl"> <tr> <td><img src="someimage.png" class="delete-button" /></td> </tr> </table> javascript: $(document).ready(function () { $("#tbl tr").click(function () { alert("row click"); }); $(".delete-button").click(function () { alert("delete-button click"); }); }) use stopprop

ios - Customizable curved Line Chart that can show image at various point -

Image
i getting trouble showing image on line chart @ point on chart & wanted implement curved line chart customizable color, width & type (shown in dotted line in image) & labels @ x axis & y axis. i wanted know there ios libraries available provides kind of implementation. i know duplicate question cause there lot of questions asked charts ios wanted know there library available there can fulfill above requirement & save me lot of time implementation. so far got following libraries doing search on google. jbchartview bemsimplelinegraph pnchart all off above provides line chart implementation not curved line chart have no provision showing image on chart @ specified point. i new chart in ios appreciated. thanks in advance. following lines can add image @ given points(100,200), serve purpose drawing image. i have developed sample chart library in need, kindly go through it. download library here uiimage *image = [uiimage imagenamed:@&

dll - Pinvoke / call native Windows API function from C# -

from within c#-application use functions of external dll. dll uses network functions. necessary initialise winsock out of c#-application let network sockets work dll. that's how try execute wsastartup initialisation, not seem work: class program { [structlayout(layoutkind.sequential, charset = charset.unicode)] internal struct wsadata { internal int16 version; internal int16 highversion; [marshalas(unmanagedtype.byvaltstr, sizeconst = 257)] internal string description; [marshalas(unmanagedtype.byvaltstr, sizeconst = 129)] internal string systemstatus; internal int16 maxsockets; internal int16 maxudpdg; internal intptr vendorinfo; } [dllimport("ws2_32.dll", charset = charset.auto, setlasterror = true)] static extern int32 wsastartup(int16 wversionrequested, out wsadata wsadata); static void main(string[] args) { wsadata wsadata; wsadata.versio

ios - Error assigning a string array in Swift -

i programmatically presenting view controller , changing value of string array string array value stored in sql (gamegametabledata). stuck on error "cannot assign value of type 'string' value of type [string]". not sure why happening. when println(gamegametabledata[index]), string array, swift telling me not string array. appreciated. var gamegametabledata: [string] = [] override func viewdidload() { super.viewdidload() let index = indexpath.row //error below!!! "cannot assign value of type 'string' value of type [string]" gameviewcontroller.tabledata = gamegametabledata[index] } println(gamegametabledata)[index] returns: [cricket3.png, cricket1.png, cricket1.png, cricket1.png, cricket1.png, cricket1.png, cricket1.png] your array declaration seems wrong. below. var gamegametabledata: [[string]] = [] override func viewdidload() { super.viewdidload() let index = inde

INFORMATICA - Date format conversion -

hello guys have date format of 12/05/2015 i.e., dd/mm/yyyy . need convert 05/12/2015 i.e., mm/dd/yyyy . can 1 give me solution . use function to_date to_date(column_name, 'mm/dd/yyyy')

python - Print value from a list (The truth value of a DataFrame is ambiguous error) -

having question. having list of records , there list of records comparing first list. when write line(inside row reading of first list: index, row in output_merged_po.iterrows(): stock = output_merged_stock[output_merged_stock['pn_stripped']==row['pn_stripped']][['whs']] print stock i result whs 11763 vln where 11763 output_merged_stock id number , whs name of whs pn_stripped matches. but fail extract data further processing. want write simple if statetement can ask if whs = vln . wrote: if stock[['whs']] == 'vln': print stock i got error: the truth value of dataframe ambiguous. use a.empty, a.bool(), a.item(), a.any() or a.all(). i wrote: if stock == 'vln': print stock and got again : the truth value of dataframe ambiguous. use a.empty, a.bool(), a.item(), a.any() or a.all(). how should write if

How to call servlet from jQuery $.ajax without getting HTTP 404 error -

i trying call servlet using ajax call below: $.ajax({ url: 'checkingajax', type: 'get', data: { field1: "hello", field2 : "hello2"} , contenttype: 'application/json; charset=utf-8', success: function (response) { //your success code alert("success"); }, error: function (errorthrown) { //your error code alert("not success :"+errorthrown); } }); however, goes error function , shows alert: not success :not found how caused , how can solve it? when specify relative url (an url not starting scheme or / ), become relative current request url (the url see in browser's address bar). you told servlet available at: http://localhost:8080/fullcalendarproject/checkingajax imagine web page ajax script runs opened via: http://localhost:8080/fullcalendarproject/pages/some.jsp and specify relative url url: "checkingajax" , int

PHP string split into 2 -

i've got string this $str = "cl2" $str2 = "l1" what i'm trying last numeric numer , whatever before numeric number result want is $result[0] = "cl" $result[1] = "2" $result[0] = "l" $result[1] = "1" i've been looking @ explode() , str_split() php functions use cant seem find way last digit, else before thanks this work me.you can split whatever before numeric number <?php $str = "cl2"; $result = preg_split('/(?<=[a-z])(?=\d)/i', $str); ?> another way @marcus's answer <?php $str = "cl2"; $result = preg_split("/(\d+)/", $str , -1, preg_split_no_empty | preg_split_delim_capture); ?> then result : $result[0] = "cl" $result[1] = "2"

c# - Entity Framework: Using multiple Strategies -

is possible use multiple strategies database setinitializer in ef 6.1.2 ? i want use createdatabaseifnotexists , seed add initialisation data , want use dbmigrationsconfiguration on same dbcontext migration purpose. how use in same dbcontext setinitializer ? reason doing coded migration have use database.setinitializer( new migratedatabasetolatestversion<yourcontext, configuration>()); also, database.setinitializer(new dmdbinitializer()); where dmdbinitializer : createdatabaseifnotexists<dmdbcontext>

postgresql - SetQueryTimeout(int) jdbc3 -

i trying establish connection postgres db. ps = con.preparestatement("select * procesar(?, ?, ?, ?, ?, ?, ?, ?, ?)"); ps.setquerytimeout(timeout); but have following error: method org.postgresql.jdbc3.jdbc3preparedstatement.setquerytimeout(int) not yet implemented. aparently, it's driver issue. use jdbc3. question if there way set timeout db query? cannot update driver. yes, running following query: set [local] statement_timeout = '1s'; local means setting applied inside transaction, otherwise need reset after query done.

cvs - read.csv() in R with all character columns and one numeric column -

i having trouble importing cvs file r (using read.csv()). i import csv data file data frame in r , set columns "value" character columns. "value"vector should numeric column. can me please? i have done many times other files 1 reason not cooperate. problem might caused fact file european style (decimal "."). not sure. this link file: https://www.dropbox.com/s/9kqjiy5phj9qkg3/albania_%2b.csv?dl=0 i gave @ file , seems badly formatted. there 3 issues: every line starts unnecessary quote ( " ). every line ends unnecessary quote ( " ). quotes doubled reason. instead of "fieldvalue" have ""fieldvalue"" in file. this workaround read file (don't worry warning you'll receive after first line): textfile<-readlines("albania_+.csv") x<-gsub('"{2}','"',gsub('(^"|"$)',"",textfile)) res<-read.csv(text=x,stringsasfacto

SQL Server controlling spaces when concatenating -

this seems simple question, seem against. when concatenating 2 (or more) fields in sql server adding space between fields like: select field1 + ' ' + field2 table if field1 or field2 may null , can use isnull convert empty string space remains. 1 way have got around add space before checking if null . , trimming ends allow empty strings in fields. e.g: select ltrim(rtriim(isnull(field1 + ' ','') + isnull(field2, ''))) table this handles empty strings in either of fields gets long if there more 2 fields concatenated in way. is there easier way? an easier way: select coalesce(field1 + ' ' + field2, field1, field2, '') table this avoid changes of ltrim , rtrim on fields. but more fields use: select substring(isnull(' ' + field1, '') + isnull(' ' + field2, '') + isnull(' ' + field3, '')