Posts

Showing posts from August, 2012

serialization - Ruby Marshal.dump gives different results for what looks like the same thing -

i'm seeing different results ruby's marshal.dump depending on if called .to_s on or typed in characters. i'm not clear on what's happening here: » marshal.dump(1.to_s) => "\x04\bi\"\x061\x06:\x06ef" » marshal.dump('1') => "\x04\bi\"\x061\x06:\x06et" » 1.to_s == '1' => true so although appears 1.to_s == '1' , don't dump out same thing, difference in last byte. ideas why happening , how can both things dump same byte sequence? marshal.load("\x04\bi\"\x061\x06:\x06ef").encoding # => #<encoding:us-ascii> marshal.load("\x04\bi\"\x061\x06:\x06et").encoding # => #<encoding:utf-8> by default, 1.to_s.encoding not same '1'.encoding . however, both strings in 7-bit ascii range, comparable, , '1' == 1.to_s able give result true , after internal magic. not same thing. marshal.dump(1.to_s.force_encoding('utf-8')) # =...

ios - What does an underscore "_" before a swift variable mean? -

here code: var _selected: bool = false { didset(selected) { let animation = catransition() animation.type = kcatransitionfade animation.duration = 0.15 self.label.layer.addanimation(animation, forkey: "") self.label.font = self.selected ? self.highlightedfont : self.font } } why variable "_selected" instead of "selected"? it's coding style shouldn't apply swift code. developers mark things underscore indicate should private. that said, there practical use underscore _. read more local , external parameter names methods . so how avoid using _selected? right have 2 variables when have 1 need (selected). removing _ require override member variable (how should done). override var selected: bool { didset { println("hello, \(selected)") } } additionally, table view cell have overridable method setselected(selected:animated) might worth exploring. ...

Postgresql rows to columns (UNION ALL to JOIN) -

hello query i'm getting 1 result 4 rows, how can change in order 4 named columns own result every one? select count(*) vehicles cus=1 union select count(*) user cus=1 union select count(*) vehicle_events cus=1 union select count(*) vehicle_alerts cus=1 thanks in advance. select a.ct veh_count, b.ct user_count, c.ct event_count, d.ct alert_count ( select count(*) ct vehicles cus=1 ) a, ( select count(*) ct user cus=1 ) b, ( select count(*) ct vehicle_events cus=1 ) c, ( select count(*) ct vehicle_alerts cus=1 ) d;

extraction - Can Apache Tika (or any JVM library) produce ordered extract data referencing images, as well as text, e.g. from a PDF? -

basically, want able create set of 'slides' based on extracts documents such pdfs or word docs, programmatically. for this, i need know [roughly] in text embed images placed , such, dumping image resources out disk wouldn't help*. i'm java dev, don't fear code ;-) *unless of course there references within [tika] extract output, @ appropriate position(s) or line(s).

rubymotion - Simplest way to set a background image on a ProMotion screen? -

i want set background image on screen placeholder. quickest, easiest, simplest way that? i've tried not seem work. i should mention in redpotion have access rmq. i in redpotion rubytrivia app. set root_view style given redpotion stylesheet. in case i'm setting background image image resource. # in rmq stylesheet def root_view(st) st.background_image = image.resource('retina_wood') end # in promotion screen def on_load find(view).style {|st| st.background_image = image.resource('retina_wood') } end note the rmq implementation of background_image= sets background tiling (repeating) background image. if want fill screen, want use different approach differently on different sized screens. rubytrivia app open source, please enjoy! https://github.com/iconoclastlabs/rubytrivia

alias - MySQL query extreme slow filtering on CASE WHEN formula -

using mysql 5.6 encounter big performance problem when filtering on calculated formula using conditions case when else end syntax. this sql formula mapped hibernate. around 6000 rows in database. table foo has indices on columns product , barcode 1. slow 2-16 s select count(*) foo f ( case when f.product not null 1 else ( case when f.barcode null 0 else ( select exists( select 1 product p p.barcode = f.barcode limit 1 ) ) end ) end ) = 0 explain results: +----+--------------------+-------+------+-------------------------------+-----+---------+-----+-------+---------------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | | +----+---------------...

python - formatting the output for an SQL query -

i have following script use sql query required information,it works fine information not in expected format,please see below expected output,it should space seperated list no new characters ("\n") @ end,how output in required format? db = mysqldb.connect(host="dbhost",user="username",port=3339,passwd="passwordname",db="dbname") # prepare cursor object using cursor() method cursor = db.cursor() gerritlist = [] # prepare sql query gerrits database. sql_get = """select gerrit_id dbname.gerrit_submit_table (si='%s' , component='%s')"""%(si,component) #print sql_get rows = cursor.execute(sql_get) gerrits = cursor.fetchall() print "gerrits db" print gerrits output:- gerrits db (('1258565',), ('1279604',)) expectedoutput:-(space seperated list ,no new character(\n) @ end) 1258565 1279604 at en...

cordova - What causes the "Windows was unable to communicate with target application" error when building out a Windows 8 app? -

i'm building windows 8 app using cordova in visual studio 2015. i'm using cordova project template comes vs 2015. the app i'm building has been fine debug builds, has taken longer usual @ times, haven't had issue yet. i literally updated css , run build , got seemingly generic error "windows unable communicate target application" after waited moment tried again , worked. i'm getting odd build errors. started doing little changes, css (i using grunt compile sass). two build errors i've seen www folder not permitted or a file called thumbs.db not copied (however file doesn't exist , never did in folder build references). i've done android development , can run cleanup fix odd errors sometimes, not sure if need delete files or run command in vs. i've tried starting vs same issues pop at, seems, random times.

ruby - How to iterate through a Hashie::Mash? -

i'd loop through keys , values of hashie::mash. here's attempt so: html = "just @ these subscriptions!" client.subscriptions.each |sub| html << sub.each |key, value| html << key.to_s html << " = " html << value.to_s end end it returns following error: "can't convert hashie::mash string (hashie::mash#to_str gives nilclass)" i've tried sub.keys.to_s , sub.values.to_s produced ["key1", "key2", "key3"] , ["value1", "value2", "value3"] , i'm looking shows pairs matched, in hash, or ["key1: value1", "key2: value2", "key3: value3"]. there way without zipping separate arrays? thanks! sub.to_hash shows exactly hash. :) can whatever can hash; like html << sub.to_hash.to_s or you're doing, in bit more rubyish way: html << sub.map { |key, value| "#{key} = #...

c# - Posting JSON to an Azure Queue via an ApiController -

i'm trying receive post on apicontroller in asp.net web api , add azure queue. problem i'm having don't want todo parameter binding class's properties @ point rather queue json string in azure queue can worker role deal in it's own time. i'm using fiddler post looks this: user-agent: fiddler host: localhost:50348 content-type: application/json content-length: 34 with request body: {"text":"pineapple","user":"fred"} and here's controller (simplified little clarity): public class messagescontroller : apicontroller { // post api/messages public void post([frombody] message message) { var storage = cloudstorageaccount.developmentstorageaccount; var queueclient = storage.createcloudqueueclient(); var queue = queueclient.getqueuereference("messages"); if (queue.createifnotexists()) { trace.writeline("hello world first time...

xcode - iOS Storyboard lags and won't open -

Image
i have project isn't huge, has maybe 6-7 different class files , 5 view controllers. when try open main.storyboard, xcode 6 freezes , lags. i'm running intel i7 4770k , gtx 780, computer should able handle simple this. can open class files , else fine. here image of problem i "application not responding", , can open storyboard on other projects. this quite common problem occurs every once in while in xcode. should try following: (each may solve it) clean project working on using cmd + shift + k close (force-quit cmd + alt + esc if necessary) xcode & restart reboot mac uninstall xcode & re-install newest version of it hope helps :)

javascript - Create event listener that will automatically execute callbacks after first fire -

i create 1 time event listener execute callbacks after event fired first time. main.js: (loaded first thing) $(document).one('plugins_loaded', displaymenu); plugins.js: (loaded time after main.js) $(document).trigger('plugins_loaded'); checkout.js: (loaded asynchronously or after main.js) $(document).one('plugins_loaded', displaycart); i want displaycart execute immediately, if plugins_loaded event triggered before, , if not, displaycart should called after displaymenu , when plugins_loaded event fires. you looking for a promise, created using $.deferred or a $.callbacks list once , memory flags. store either in global variable, best in namespace of application object. need initialise once, can add callbacks whereever , whenever want, , trigger them somewhen later. you cannot use custom event fired on $(document) , past events not observable.

c# - Entity Framework relationships between different DbContext and different schemas -

so, have 2 main objects, member , guild. 1 member can own guild , 1 guild can have multiple members. i have members class in separate dbcontext , separate class library. plan reuse class library in multiple projects , differentiate, set database schema "acc". have tested library extensively , can add, delete, , update members in acc.members table. the guild class such: public class guild { public guild() { members = new list<member>(); } public int id { get; set; } public int memberid { get; set; } public virtual member leadermemberinfo { get; set; } public string name { get; set; } public virtual list<member> members { get; set; } } with mapping of: internal class guildmapping : entitytypeconfiguration<guild> { public guildmapping() { this.totable("guilds", "dbo"); this.haskey(t => t.id); this.property(t => t.memberid); this.hasrequire...

Bin classes from eclipse in android studio .class lost -

hello have project in eclipse , use files in bin folder. when import all, files , imports being useless didn't work. how can add files? for example hace /bin/classes/com/appdupe/ inside folders have custom r.class , need use them in android studio project

ftp client - saving a file via ftp in a git repository -

i using git on server first time can pull updates cms use. i set , cloned repository. i use codeanywhere code editor , have ftp server setup, after editing file 644 perms, permissions denied error. being brand new git, doing wrong here? yes don't use ftp ;)... use git locally , pull changes on server. don't modify files on server. so don't know you've done until now. clone same repository on server , when make changes push them remove repository , pull them on server. can use deployment systems jenkins, travis or else automate deployment. but if upload file on ftp file modified on server. when pull new changes , have modified same file error , pull stops. https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps here short tutorial.

Visual Studio VB.NET Global ADODB.CONN -

i building application requires me query as400 database 100 times per single use. i have functions each of queries right written in following structure. option explicit on shared function query1() dim conn new adodb.connection dim recordset1 new adodb.recordset conn.open("databasename") recordset1.open("select * table",conn) return somevalue end function my application runs pretty slow, around 30-40 seconds. i've done performance profiling using tools built visual studio 2013 , noticed repeatedly opening connections database taking significant portion of time. my question is, can set global connection variable @ top level of routine have open connection once, , close once routine finished queries? think speed application? something following: option explicit on global conn adodb.connection conn.open(dsn = "database") shared function query1(byval conn) dim recordset1 new adodb.recordset recordset1.open(...

python - Pandas Install Issue -

i've run pip install pandas , seemed ton of warnings end seemed have installed successfully. i've run pip install requests . when call function line: getteamroster("http://modules.ussquash.com/ssm/pages/leagues/team_information.asp?id=11325") i error (seems not read_html call , wants me install lxml?): traceback (most recent call last): file "squashscraper.py", line 51, in <module> main() file "squashscraper.py", line 48, in main getteamroster("http://modules.ussquash.com/ssm/pages/leagues/team_information.asp?id=11325") file "squashscraper.py", line 39, in getteamroster tables = pd.read_html(requests.get(teamurl).content) file "/library/frameworks/python.framework/versions/3.3/lib/python3.3/site-packages/pandas/io/html.py", line 865, in read_html parse_dates, tupleize_cols, thousands, attrs, encoding) file "/library/frameworks/python.framework/versions/3.3/lib/python...

mysql - SQL Insert into and Select multiple columns? -

so have tables this: communication: (calls made) timestamp fromidnumber toidnumber generallocation 2012-03-02 09:02:30 878 674 grasslands 2012-03-02 11:30:01 456 213 tundra 2012-03-02 07:02:12 789 654 mountains 2012-03-02 08:06:08 458 789 tundra and want create new table has distinct fromidnumber , toidnumber 's. this sql fiddle it. this works: insert commidtemp (`id`) select distinct communication.fromidnumber communication union distinct select distinct communication.toidnumber communication; and got: id 878 456 789 674 213 654 365 but wonder if there more efficient way, because dataset have has millions , millions of lines , didn't know performance of union distinct . i tried insert commidtemp (`id`) select distinct communication.fromidnumber , communication.toidnumber communication; but didn't work... there other way more efficiently? i'm p...

python - Fastest way to import nodes/edges into a NetworkX DiGraph from CSV? -

i'm trying improve speed of networkx digraph population csv. right i've got straight forward csv reader , graph add situation: g = digraph() nodes = csv.dictreader(open(nodefile, 'ru'), ['index', 'label', 'type']) row in nodes: g.add_node(row['index'], {'index':row['index'], 'label':row['label'], 'type':row['type']}) edges = csv.dictreader(open(edgefile, 'ru'), ['v1', 'v2', 'weight']) row in edges: g.add_edge(row['v1'], row['v2'], row[weight']) the graph data i'm dealing can pretty big. 10,000,000 nodes big. memory isn't issue, simple things importing , exporting can eat time better spent on more important data crunching. does have suggestions? i've been scouring networkx utility methods or techniques can this. i've stripped down import csv requirements these 3 columns , removed value checking. thank in a...

c++ - cmake target_link_libraries() launching error Cannot specify link libraries for target "debug" -

i'm trying link clion , sfml (using windows, mingw w64, sfml 64, cmake) , triied configure cmakelists.txt properly. here's cmakelist : cmake_minimum_required(version 3.2) project(test_utilisation_sfml) set(cmake_cxx_flags "${cmake_cxx_flags} -std=c++11") set(source_files main.cpp) set(cmake_runtime_output_directory "${cmake_current_source_dir}/bin") message(warning "cmake runtime output directory : ${cmake_runtime_output_directory}") add_executable(test_utilisation_sfml.exe ${source_files}) # detect , add sfml set(cmake_module_path "${cmake_source_dir}/cmake_modules" ${cmake_module_path}) #find version 2.x of sfml #see findsfml.cmake file additional details , instructions find_package(sfml 2 required system window graphics network audio) if(sfml_found) include_directories(${sfml_include_dir}) message (warning "lib dir : ${sfml_include_dir}") message (warning "libs : ${sfml_libraries}") ...

html - Is it wise or acceptable to create a table with a different number of columns (td) for each row (tr) -

i wondering if wise or acceptable create table different number of columns (td) each row (tr) using html. example: <table> <tr> <td>title</td> </tr> <tr> <td>text</td> <td>and more text</td> </tr> </table> do have include colspan? you not have include colspan= , however, size of largest <td></td> determine width of column displayed. different browsers (and releases) render table differently (how non-defined area displayed).

ios - AirPlay to Apple TV Fullscreen -

currently, app make iphone/ipad can mirrored apple tv via airplay. however, in landscape mode, takes center part of screen, black on left , right sides. involved getting airplay full-screen, in way apps real racing hd have done? edit: per suggestion, have added in code using, , instead of telling secondwindow use same root view controller normal, set new vc different color see if mechanics set right. not, still normal mirroring, when telling use different vc. here appdelegate.h #import <uikit/uikit.h> @class mainview; @class viewcontroller; @interface appdelegate : uiresponder <uiapplicationdelegate> { uiwindow *window; uinavigationcontroller *tabbarcontroller; } @property (nonatomic, retain) iboutlet uiwindow *window; @property (nonatomic, retain) iboutlet uinavigationcontroller *tabbarcontroller; @property (nonatomic, retain) uiwindow *secondwindow; @end and relevant parts of appdelegate.m - (void)checkforexistingscreenandinitializeifpresent { ...

java - Get the index number of first and last options listed in drop down menu -

i have find options listed first , last in dropdown menu using selenium webdriver. li class="dropdown location" ul class="select" <li> class="dropdown location" <ul> class="select" <li> data-site="http://www.example.com" value="es">europe</li> <li> data-site ="http://www.example.com" value="sg">singapore</li> there more 50 options. wanted find index number of singapore. there way find in webdriver? yes, there way find index of particular value. get options of list. compare text of each element of list describable text, see below select sel = new select(driver.findelement(by.cssselector("select[title='sort by']"))); list<webelement> list = sel.getoptions(); for(int i=0;i<list.size();i++){ if(list.get(i).gettext().equals("price")){ system.out.println("the index of selected option is: ...

spring mvc - Gradle on Netbeans compiling Android Studio scripts -

i added gradle support plugin netbeans try spring framework tutorials. since every time run project on netbeans output throws list of errors. but errors not netbeans projects, they android studio projects! netbeans projects runs expected, android studio projects well, , never thrown warning on error since on android studio. what´s going on?

c# - Are two UPDATE statements in same BEGIN-END block executed at the exact same time? -

if have table follows: cid column1 1 joe 2 john and run following code below. select statement executed (at inopportune precise millisecond half way through running of code) return column1 = john both rows in table? or oracle run both update statements in code "together" speak, never happen. string sqlstr = @"begin update table1 set column1 = 'john' cid = 1; update table1 set column1 = 'joe' cid = 2; end;"; oracleconnection conn = new oracleconnection(oracle_connstr); oraclecommand cmd = new oraclecommand(sqlstr, conn); try { conn.open(); cmd.executenonquery(); } catch (exception ex) { } { if (cmd != null) cmd.dispose(); if (conn != null) conn.dispose(); } the 2 update statements run sequentially. second update won't run until first update finishes. assuming 2 statements part of same transaction (which in example), other sessions prevented rea...

PHP zip results in flat folder structure -

i using php zip function created former employee. compresses files , folders i'm having 2 problems resulting zip file: a. doesn't include 'main' folder b. doesn't keep parent/child folder structure what want have child folders under parent folders, so: parent1 +-- child1a +-- child1b parent2 parent3 +-- child3a +-- subchild3a1 +-- subchild3a2 but i'm ending flat folder structure in zip file: parent1 child1a child1b parent2 parent3 child3a subchild3a1 subchild3a2 how resolve issue using following code: <?php function foldertozip($folder, &$zipfile, $subfolder = null) { if ($zipfile == null) { return false; } $folder .= end(str_split($folder)) == "/" ? "" : "/"; $subfolder .= end(str_split($subfolder)) == "/" ? "" : "/"; $handle = opendir($folder); while ($f = readdir($handle)) { if ($f != "." && $...

c# - There is no ViewData item of type IEnumerable -

i have viewmodel : public class foundviewmodel { public string title { get; set; } public string description { get; set; } public int city { get; set; } public int subgroup { get; set; } public string address { get; set; } public datetime finddate { get; set; } } and in view add 2 dropdown , fill in actionresult when call get: var provinces = _provinces.selectall(); viewbag.provinces = new selectlist(provinces,"id","title",provinces.firstordefault().id); and in view : @html.dropdownlist("drpprovince", (selectlist)viewbag.provinces, new { @onchange="javascript:getcity(this.value);"}) but when click on button , post , getting error: there no viewdata item of type 'ienumerable<selectlistitem>' has key 'drpprovince' i found similar question on stackover flow can't know . what's problem ? thanks. what happens that, @ time of post , reload page show cities acco...

testing - undefined local variable or method `start_test_server_in_background' for #<Object:0x007ffc49a5e130> -

this has been asked before .12.0 getting similar error in .14.2 . up until few weeks ago running calabash.framework 11.4 because worked, stable, , under lock , key on our development server. went through recent state of updating of our gems , services , while our build server still functions calabash no longer recognizing "start_server_in_background" method. @ loss on how remedy this. tried complete wipe , reinstall on local mirror no avail, , considering rolling previous working versions. solve keep date. i have tried following solutions no success. undefined local variable or method `start_test_server_in_background' main:object https://github.com/calabash/calabash-ios/issues/669 https://github.com/calabash/calabash-android/issues/371 this error after scenario runs undefined local variable or method `start_test_server_in_background' #<object:0x007f9a7c07ba48> (nameerror) /users/mycomp/.rvm/gems/ruby-2.2.1@global/gems/rspec-expectations...

java - Save details to Parse.com as Json -

i have small issue understanding how save data user input fields parse.com. using correct methods. however, when click on save button nothing transferred server. need create separate java class containing information looking save? doing right capture user input, store in string , attempt save values in parse.com nothing happening. no errors when attempting save, nothing happens anyway. following code. appreciate guidance. thank you. package com.parse.starter; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.edittext; import com.parse.parseobject; public class crud extends activity { //variables edittext namedetail; edittext emaildetail; edittext phonedetail; string namefield; string emailfield; string phonefield; button save; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.crud); namedetail = (edittext) f...

sql server 2012 - How to get the value for the primary key, which is filled by a default sequence in ms sql? -

for identity create table [sites] ( [siteid] bigint identity(1,1) not null, [name] nvarchar(50) not null) alter table sites add constraint pk_sites primary key ([siteid]) i insert dbo.sites(name) values('test'); select @@identity; and siteid value. create table [sites] ( [siteid] bigint not null default (next value [seqmain]), [name] nvarchar(50) not null) alter table sites add constraint pk_sites primary key ([siteid]) how siteid value if filled default sequence? you can utilize output clause . enables output values delete , insert , update or merge statement. you use this: insert dbo.sites(name) output inserted.siteid values('test')

javascript - variable array duplicating / skipping one item when writing -

var dates =["09/27/2014","12/19/2013","01/13/2015",""]; var departments = ["item1","item2","item3",""]; var writespeed = 400; $('.department_name').html(departments[fade-1]); $('.date_name').html(dates[fade-1]); the issue in following line of code: $('.department_name').html(departments[fade-1]); the issue in loop, " fade ", not incremented. can either use fade++ or assign different variable , increment it.

objective c - How can you shorten repetitive if/else statements? -

how can simplify code? gets lengthy , extremely repetitive, many null checks. id data; data = [dictionary objectforkey:@"firstname"]; if ([data isequal:[nsnull null]]) { self.firstname = @""; } else{ self.firstname = (nsstring *)data; } data = [dictionary objectforkey:@"middlename"]; if ([data isequal:[nsnull null]]) { self.middlename = @""; } else{ self.middlename = (nsstring *)data; } data = [dictionary objectforkey:@"lastname"]; if ([data isequal:[nsnull null]]) { self.lastname = @""; } else{ self.lastname = (nsstring *)data; } ... ideally want put variables in array of sorts, , loop through , apply null check , assignment of them. can't store variables in array. best way shorten code? you wrap each of calls 1 method. - (nsstring *)stringfromdictionary:(nsdictionary *) forkey:(nsstri...

passing HTML embedded PHP w/ innerHTML -

i need able add additional rows following form group on click of button. php statement echos dynamic list of options select input based off records in database. <h3>check 1:</h3> <div class="row" id="check_1"> <div class = "col-md-4 padding-top-10"> <label for="checkjobname_1" class="control-label">job/client name:</label> <select class="form-control" id="checkjobname_1" name="checkjobname_1"> <option selected disabled>choose client/job</option> <?php echo $dynamicjoblist; ?> </select> </div> <div class = "col-md-4 padding-top-10"> <label for="checknumber_1" class="control-label">check #:</label> <input type="text" class="form-control" id="checknumber_1...

combine multiple expressions in R into one big expression -

i new r expression handling. stuck below problem. input appreciated. i trying generate 2 individual equations , combine them 1 expression , pass algorithm find optimal value. old_price elast units 1 59.98 1.3 151 2 59.98 1.3 230 code: for(i in 1:nrow(df)){ o[i] = df$old_price[i] el[i] = df$elast[i] u[i] = df$units[i] assign(paste0("l",i),(substitute((x)*(1-(x-o)*el/o)*u, list(o=o[i],el=el[i],u=u[i])))) } i able generate below 2 equations l1 = (x) * (1 - (x - 59.98) * 1.3/59.98) * 151 l2 = (x) * (1 - (x - 59.98) * 1.3/59.98) * 230 and objective function this eval_obj_f <- function(x){eval(l1)+eval(l2)} i trying figure out how dynamically. if have different dataset of 4 observations, how can generate objective function below dynamically? eval(l1)+eval(l2)+eval(l3)+eval(l4) you need using real r expression 's , @ moment not expressions rather call 's. (check ...

r - Error while trying to target in arules (data is in the format of web addresses) -

i've imported data r transactions, when try targeting specific website, error: error in asmethod(object) : facebook.com unknown item label is there reason why happening? here snippet of code: target.conf80 = apriori(trans, parameter = list(supp=.002,conf=.8), appearance = list(default="lhs",rhs = "facebook.com"), control = list(verbose = f)) target.conf80 = sort(target.conf80,decreasing=true,by="confidence") inspect(target.conf80[1:10]) thanks! here transactions like: 1 {v1=google, v2=google web search, v3=facebook.com} 1 2 {v1=facebook.com, v2=mcafee.com, v3=7eer.net, v4=google} 2 3 {v1=mcafee.com, the problem way read/convert data transactions. transactions should like: 1 {googl...

javascript - Submit button not posting on modal -

i have form on bootstrap modal 2 buttons. form tied action named "deletewidgetconfirmed" trying remove widget database , front end, panel gets removed front end not seem removed database. here modal <div class="modal fade" id="deletewidgetmodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="mymodallabel">delete widget?</h4><!--add depending on panel have clicked--> </div> <div class="modal-body" id="mymo...

google chrome - d3.js transition is not working with property method -

i learning d3.js. in script below, selection.transition() not seem working when selection.property() chained, though works when selection.property() put in transition().each() . doing wrong? or, specifications of transition() ? <input class="property_transition" type="checkbox">property transition test</input><br> <input class="property_transition" type="checkbox">property transition test</input><br> <input class="property_transition" type="checkbox">property transition test</input><br> <input class="property_transition" type="checkbox">property transition test</input><br> <script src="http://d3js.org/d3.v3.min.js"></script> <script> var elements = d3.selectall(".property_transition"); elements .transition()//.delay(function(d,i) { return i/elements.length *50; }) ...

Multi line replacement with Sed -

i have file this: function a() { dosomething(); dosomethingelse(); } now need replace text between function a() { , } other text i tried several ways found here, failed. hope explanation along answer. p.s. trick need compatible both os x , gnu sed. you can standard substitution : sed -i 's/\(\<\)dosomething()/\1somethingelse()/' your_file we use word boundary delimit string : \(\<\)dosomething() and replace string new string (including captured word boundary) : \1somethingelse() the -i flag stands : inline replacement i used sample file : function a() { dosomething(); dosomething(); foo();dosomething(); } output : function a() { somethingelse(); somethingelse(); foo();somethingelse(); }

jqGrid Partial Text Search Not Working -

i need display table sql database following columns: id (integer, primary key) name (varchar) i using jqgrid 3.5.3. not allowed update later version. when use jqgrid search in name column, search function returns exact matches, not partial ones. here code: var mygrid = jquery("#gridview").jqgrid({ url: getrootpath() + 'datahandler.ashx', datatype: "json", colnames: ['id', 'name'], colmodel: [ { name: 'id', index: 'id', width: '45', formatter: 'integer' }, { name: 'name', index: 'name', width: '200', editable: true, stype: 'text', edittype: 'textarea', searchoptions: { sopt: ['cn', 'nc', 'bw', 'bn', 'ew', 'en']}}, ], ignorecase: true }); mygrid.filtertoolbar({ defaultsearch: "cn" }); mygrid[0].tog...

sql server - SQL copying record with out specifying column list; ignoring Identity -

Image
i'm trying copy record tablea tablea, using new identity. don't want specify column list have on 100 columns, , there may more in future. id chunk of code can run when/if things change. after looking similar questions, have attempted code select * #tmp tablea id = 1; alter table #tmp drop column id; insert tablea select * #tmp; drop table #tmp; i still getting error an explicit value identity column in table 'dbo.tablea' can specified when column list used , identity_insert on. running select * #tmp gives me expect. single record columns exception of id column. any ideas? thanks! edit here pictures of properties of id column use dynamic sql: list of columns (except id), build insert statement using list, , call exec on it: select * #tmp tablea id = 1; alter table #tmp drop column id; declare @cols varchar(max); select @cols = coalesce(@cols + ',', '') + column_name information_schema.columns ...

sid - Connecting a 'sent' SMS to a 'received' SMS -

i have built app sends out sms using twilio number(the 1 assigned me) when message sent receive sid number inserted db, along other general information, not know how connect received sms sid sent sms sid tells system user has responded....how connect outgoing message received? update: hello devin, response! however, not me might send lets 1 of 3 different people multiple messages in hour. my app notification app...basically form user fills out basic info. 1 of these fileds choose drop down of 3 different people(who message go to) send message. app inserts form data explained above along smsid returned guys db. the user(one of 3 people descibed above) sent notification above responds message, meaning twilio hits "request url" , save information returned user...however, , problem lies smsid reply not same smsid of sent notification...therefore have no way connect sms sent user response. have looked @ cookies option , not needing...actually documentation acknowledge...

Simplifying Excel Forumulas -

i suspect there better way write formula: =if('table values'!c2='table values'!b12,'table values'!e12,if('table values'!c2='table values'!b13,'table values'!e13,if('table values'!c2='table values'!b14,'table values'!e14,if('table values'!c2='table values'!b15,'table values'!e15,if('table values'!c2='table values'!b16,'table values'!e16,if('table values'!c2='table values'!b17,'table values'!e17,if('table values'!c2='table values'!b18,'table values'!e18,if('table values'!c2='table values'!b19,'table values'!e19)))))))) try this =vlookup(c2,b12:e19,4,false) which means c2, in range b12:e19, return 4th column of same range (e), , (the false means) exact match against leftmost column (in case b).

c# - Xml deserialize does unwanted initialization -

i have class contains list. in constructor add default object list. class { list<b> list; public a() { list = new list<b>(); b b = new b(); list.add(b); } } but seems when xmlserializer deserialize xml file containing a object, loaded object have 2 b object in list. guess calls constructor again , constructor adds next b why happens? how can avoid it? try overloaded constructor. 1 takes nothing , adds nothing list, can used when deserializing. other takes b , adds b list.

ios - Google Maps SDK for Android - Add marker to street view -

i'm looking way add markers streetviewpanorama using google maps sdk android. found way using sdk ios. https://developers.google.com/maps/documentation/ios/streetview (bottom of page), cannot find documentation or sample code on android. nowadays android google maps api v2 can´t add markers, option available ios. markers within street view https://developers.google.com/maps/documentation/ios/streetview#markers_within_street_view one option using google maps javascript api inside webview . https://developers.google.com/maps/documentation/javascript/examples/streetview-overlays

Android- Going back to Previous Activity with different Intent value -

i have application has transition: -> b -> c -> d-> c upon entering c , have check flag. have pass intent (let intentx = false ) d . after doing in d , go c after pressing button. did pass again intentx value true, startactivity c again. happen created activity c. what want happen not have start new activity c, use previous c calling super.onbackpressed() . cannot pass new value of intentx . there other way, achieve want. might have missed some. what want startactivityforresult() . when go c d , instead of using startactivity() use instead startactivityforresult() . when want return d c use setresult() can include intent object extras pass c . i don't recommend doing in onbackpressed() if don't have because not user expects. instead, should return data event such button click. so, in c like intent = new intent(new intent(c.this, d.class); startactivityforresult(i, 0); then in d when ready return intent = new intent(...

ruby - rails generate set default locale -

i need set default locale spanish on application. these lines of file application.rb: class application < rails::application # settings in config/environments/* take precedence on specified here. # application configuration should go files in config/initializers # -- .rb files in directory automatically loaded. # set time.zone default specified zone , make active record auto-convert zone. # run "rake -d time" list of tasks finding time zone names. default utc. # config.time_zone = 'central time (us & canada)' # default locale :en , translations config/locales/*.rb,yml auto loaded. config.i18n.load_path += dir[rails.root.join('config', 'locales', '**', '*.{rb,yml}')] rails.application.config.i18n.default_locale = :es end but, when generate scaffold inflection wrong. it´s english locale. rails g scaffold preparado nombre:string i wrong plural: preparadoes, must be: preparados...

Android - View is moving out of screen post rotation -

hi i'm trying perform translate, scale , rotate on view (framelayout) in android. in brief, i've fresco's simpledraweeview inside framelayout, fresco not supporting matrix transformations, alternative put in framelayout , doing translation, rotation , scaling. i've extended framelayout here.. public class interactiveframelayout extends framelayout { private viewtransformer mviewtransformer; public interactiveframelayout(context context) { super(context); init(context); } public interactiveframelayout(context context, attributeset attrs) { super(context, attrs); init(context); } public interactiveframelayout(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); init(context); } private void init(context context) { // determine dimensions of 'earth' image int baseviewwidth = (int) getresources().getdimension(r.dimen.animation_image_size); int baseviewheight = (int) getresources().ge...

ios - Set of protocols in Swift -

having set of specific interface in java useful: hashset<myinterface> myset; is possible similar in swift? i tried unsuccessfully following: public protocol dialogdelegate : class, hashable { func myfunction() } public final class dialogmanager: nsobject { private var _dialogdelegates: set<dialogdelegate> private override init() { _dialogdelegates = set<dialogdelegate>() super.init(); } } i compiler error: protocol 'dialogdelegate' can used generic constraint because has self or associated type requirements the problem you're having explained in: what "protocol ... can used generic constraint because has self or associated type requirements" mean? to solve use dialogdelegate generic type constraint: public final class dialogmanager<t: dialogdelegate>: nsobject { private var _dialogdelegates: set<t> private override init() { _dialogdelegates ...

.net - Does system.net connectionManagement only apply to web traffic? -

i can't find clear answer on this. msdn documentation not specify types of connections limits, of examples show http traffic. https://msdn.microsoft.com/en-us/library/fb6y0fyc%28v=vs.110%29.aspx?f=255&mspperror=-2147217396 it seems imply if use wildcard '*', applies connections. include, e.g. sql server? no, the doc states: specifies maximum number of connections internet host update on same doc page, in remarks section state: the element (network settings) element contains settings classes in system.net , related child namespaces. settings configure authentication modules, connection management, mail settings, proxy server, , internet request modules receiving information internet hosts.

windows - "Server cannot set status after HTTP headers have been sent" over http but not https -

i migrated .net web service windows server 2003 windows server 2008 r2. when trying access web service page browser wait server request nothing ever happens. request hangs , never timeout or other status code. when checking httperr logs on server, see request cancelled , has no status code. (see below) 2015-06-02 15:20:49 11.127.2.128 50755 11.113.4.14 56272 http/1.1 /humanresourceservices/1_0_0/help/ - 2 request_cancelled humanresourceservices i reviewed question httperr log: request_cancelled (while troubleshooting wcf service) , did suggested logging. svc log file generated stays @ 0 byte size , never changes. checked worker processes in iis , gets request site not see request when go "view current request" it. seems request never getting processed, cancelled , server never responds status code. make things more interesting, if access same site on https, works! happening when try access on http. advice or suggestions on ways further troubleshoot appreciated. upd...

Jenkins: Trigger a downstream project in pipeline view using REST Webservices -

i have jenkins pipeline several projects. first 1 triggers second 1 , stops because next project manually triggered. trigger third project using rest webservice. [i can manually trigger project using build pipeline plugin icon (trigger).] jenkins has rest api build project: jenkins/view/pipeline_name/job/project_name/buildwithparameters however, jenkins starts new build outside pipeline view. thanks! curious know.. figured out ? -sony koithara

osx - How to tell Sublime(Linter) to use ZSH instead of BASH? -

i'm using zsh sublimelinter taking path bash shell, resulting in unfound executables. have example eslint installed using npm globally, , needs find in nvm directory set in .zprofile. debug output of sublime: sublimelinter: user shell: /bin/bash sublimelinter: computed path using /bin/bash: /usr/local/bin /usr/bin /bin /usr/sbin /sbin i've set default shell in system zsh using chsh -s /bin/zsh have no idea why it's using bash , can't find info this. i'm using sublime text 3 on osx. i'm not sure why it's using bash instead of zsh. isn't problem ensure not have bash files such .bash_profile in home folder though you're using zsh. also, i'd try make sure open st via zsh (again, doesn't make difference). if it's still not working, manually specify path linter via sublimelinter's user settings json file: "paths": { "linux": [], "osx": [ "/path-to-l...

java - How to find out where exact young/old gen is located in memory? -

recently able object's address using sun.misc.unsafe class. and trying find programmatically actual generation object located. want know starting , ending points of each generation. if java (oracle jvm) provides tools resolve issue? believe not, since different gcs require different memory structures (e.g. g1), , makes task more interesting :) what want know here couple of numbers representing borders of generations in memory, this: young gen: start point - 8501702198 end point - 9601256348 would love hear craziest ideas black magic allows determine different generation areas placed in memory. this possible hotspot jvm though somehow complicated. the key idea use vmstructs - information hotspot internal constants , types embedded right jvm shared library. for example, parallelscavengeheap::_young_gen vm global variable contains pointer psyounggen structure has _virtual_space member boundaries of parallel collector's young gen...