Posts

Showing posts from August, 2015

linux - (bash) how to add some iteraion to filename -

i have script creates .html , .txt files every day. 1 file html , txt changed content, need every day new html&txt file date oof creation in file name : index_22-05-2013.html , have these variables in shell script: destination_html="./daily/html/index_$(date +"%f").html" destination_txt="./daily/txt/index_$(date +"%f").txt" and line in shell script running 1 python script , creates html file python `somescript.py` -m ${filelist[0]} ${filelist[1]} > $destination_html and i`m getting file created: index_$(date +"%f").html what must file name : index_22-05-2013.html sorry, not following you, since echo "index_$(date +%f).html" outputs index_2013-08-20.html instead of index_22-05-2013.html need, want use command instead: echo "index_$(date +%d-%m-%y).html" hope helps! :)

python - How to get background of textview in pygobject “gtk3”? -

i'd current background color of textview change , restore later. here tried: context = textview.get_style_context() state = gtk.stateflags.normal color = context.get_background_color(state) i tried possible states, none returns correct background color (white in case) any idea how it? i'm not sure specific problem without seeing more code, here quick example overrides background , restores on button click: from gi.repository import gtk, gdk import sys class mywindow(gtk.applicationwindow): def __init__(self, app): gtk.window.__init__(self, title="textview example", application=app) self.set_default_size(250, 100) self.set_border_width(10) self.view = gtk.textview() self.style_context = self.view.get_style_context() self.default_bg_color = self.style_context.get_background_color(gtk.stateflags.normal) self.view.override_background_color(gtk.stateflags.normal,

.net - AccessViolationException with GLFW in C# -

i have problem glfwsetcharcallback function. whenever call it, glfwpollevents throws accessviolationexception saying: "attempted read or write protected memory. indication other memory corrupt." i have created simple wrapper demonstrate problem: using system; using system.runtime.interopservices; using system.security; namespace test { public delegate void glfwcharcallback(glfwwindow window, char character); [structlayout(layoutkind.explicit)] public struct glfwmonitor { private glfwmonitor(intptr ptr) { _nativeptr = ptr; } [fieldoffset(0)] private readonly intptr _nativeptr; public static readonly glfwmonitor null = new glfwmonitor(intptr.zero); } [structlayout(layoutkind.explicit)] public struct glfwwindow { private glfwwindow(intptr ptr) { _nativeptr = ptr; } [fieldoffset(0)] private readonly intptr _nativeptr; public static

Html5 submit form button-send input to file? -

i have multi-page website, i'm still new programming have learned quite bit of html , css. question is: how can have submit form button take users input-data, , send .txt file on computer while offline? this can test form , sure can send input data. form model application , includes text boxes, radio buttons, select lists, passwords, emails etc... and moment not need salt-hashing or security, off-line form testing, thanks! edit: have submit button set in, not send input data anywhere if offline, there no way computer receive data. however, if web site on web server out on internet, data can saved text file on server, access later. the form needs action tag, tells form data should sent processing. has few important tags within well: <form method="post" action="http://www.yoursite.com/script-to-process-submission.php"> one: <input type='text' name='inputbox1'/> two: <input type='text' name=&

codeigniter - Updating field in Active Record -

i want write query like "update table tbl_name set amount = amount + 100 id = 10"; i found no documentation in ci active record library, possible such query using acitve record? looking forward responses. this model function: function update($id) { $this->db->set('amount', 'amount+100', false) $this->db->where('id ', $id); $this->db->update('tbl_name'); } you can read ci active record here

c++ - for_each pointer in a vector of pointers -

i'd initialize vector of pointers in for_each() function: #include <stdlib.h> #include <vector> #include <iostream> #include <algorithm> using namespace std; class cow{ public: cow(){ _age = rand()% 20; } int get_age() { return _age;} private: int _age; }; void add_new(cow* cowp) { cowp = new cow; } int main() { srand(time(null)); const int herd_size=10; vector<cow*> herd(herd_size); for_each(herd.begin(), herd.end(),add_new); cout << "age: " << herd[0]->get_age() << endl; // line 27 } however, runtime "segmentation fault" error @ line 27. herd vector seems uninitizlized. why? your function takes pointers in value, reassigns copies. need take them in reference in order affect pointers in vector. void add_new(cow *& cowp)

c++ - Segfault when <ctrl> + <leftflick> an unfocused window of a CygwinX QT app -

when ctrl + leftclick unfocused window of qt application launched via cygwin x, noticing repeatable segfault. @ point i've trimmed off of application code , can still see same behavior while running simple qmainwindow holding few empty textedits. simple left click unfocused window (while holding ctrl) cause segfault ~50% of time. has noticed similar behavior? i'm curious since don't seem see behavior documented or reported elsewhere. note: i've noticed behavior applies modifier keys (alt, ctrl, shift, etc). #0 0x00007f8429cf614b in ?? () /usr/local/lib/qt5/5.0.2/gcc_64/plugins/platforms/libqxcb.so #1 0x00007f8429cee501 in ?? () /usr/local/lib/qt5/5.0.2/gcc_64/plugins/platforms/libqxcb.so #2 0x00007f8429ce9e20 in ?? () /usr/local/lib/qt5/5.0.2/gcc_64/plugins/platforms/libqxcb.so #3 0x00007f8429ceb0cb in ?? () /usr/local/lib/qt5/5.0.2/gcc_64/plugins/platforms/libqxcb.so #4 0x00007f84306c955e in qobject::event(qevent*) () /usr/local/lib/qt5/5.0.2/gcc_64/li

c# - Generate Linq Or Clause from List of Enumeration -

greetings overflowers, i working on application allows user generate custom report , have scenario need generate linq or clause list of enumeration values. problem i'm having cannot see elegant way of generating or clause. for example: //enumeration of possible 'or' conditions public enum conditions { byalpha, bybeta, bygamma } //'entity' i'm querying against. class resultobject { public bool alphavalue { get; set; } public bool betavalue { get; set; } public bool gammavalue { get; set; } public string name { get; set; } } class program { static void main(string[] args) { //create list of desired conditions. //basically want mimic query, // "show me of resultobjects alphavalue true or gammavalue true". var conditions = new list<conditions> { conditions.byalpha, conditions.bygamma }; //sample collection of objects.

xaml - MVVM and WPF - how to combine sources for a DataGrid -

i new wpf/mvvm have read through lot of tutorials , done small projects have gained elementary understanding. my problem: i have model class holds collection of data. main view must display several of models' data on datagrid. current approach making datagrid in model's view defining datatemplate datagrid itemssource model's collection. this approach sort of works creates datagrid each model. know of way have single datagrid? if view should display single grid might want make viewmodel single collection , fill collection several model collections. that viewmodel for.

Advanced day query with CouchDB -

i have problem views in couch db (all versions 1.01 - 1.31). my data looks : { "_id": "9a12b7fa4b886640be06f74b814306a6", "_rev": "1-420c723f8c8f7921ead3df04bfc9ade5", "client_id": "008", "day": 1, "month": 1, "year": 2013, "comment": "cool" } and want see transactions client has done in span of time, lets 1 month : so map function : function(doc) { emit([doc.client_id, doc.day,doc.month, doc.year], doc); } so query startkey , endkey like http://localhost:5984/test/_design/clients/_view/by_cid_day_month_year?startkey=[%22007%22,1,1,2013]&endkey=[%22007%22,32,1,2013] but instead of getting documents january client_id = 007, records matching 007. so there has misunderstanding. wrong query ? how should ? my thinking see logs specific date, or 1st jan 6th jan. i have tried make keys day, month , year strings, result same, or weir

asp.net mvc - check member existence in Mvc ViewBag -

sometimes have check existence of member inside viewbag inside mvc view, see if problem action forgot assign member. inside razor view have: @if(viewbag.utente.ruolo.sysadmin) how can check viewbag.utente defined? you must check objects null or not. utente , utente.ruolo , utente.ruolo.sysadmin may null: @if (viewbag.utente != null) { if (viewbag.utente.ruolo != null) { if (!string.isnullorempty(viewbag.utente.ruolo.sysadmin)) { //viewbag.utente.ruolo.sysadmin has value..you can use } } }

mysql - Sort a View by two date columns and add a rank column -

i have mysql table 1 below. id name firstdate seconddate == ===== ========= ========== a1 carol 2000-07-24 1956-07-24 a2 victor 2000-07-24 1980-01-13 a3 paul 1999-12-10 1985-01-10 a4 mia 2000-06-17 1945-10-22 a5 luke 2000-07-24 1960-03-19 i need create view following format: sorted on ascending order firstdate column. if 2 or more records have same value on firstdate column records use seconddate column decide witch record placed first, second , on. a column rank added after seconddate column consecutive number. like this id name firstdate seconddate rank == ===== ========= ========== ==== a3 paul 1999-12-10 1985-01-10 1 a4 mia 2000-06-17 1945-10-22 2 a1 carol 2000-07-24 1956-07-24 3 a5 luke 2000-07-24 1960-03-19 4 a2 victor 2000-07-24 1980-01-13 5 as try this set @rank := 0; select * , @rank := @rank + 1 rank ( select id , name , firstdate , second

mysql - SQL query to select distinct rows from left table after inner join to the right table -

i have 2 mysql tables. first 1 [products] (primary = id): [id] | title | description and second [sizes] (primary = id & size): [id] | [size] size can have values [1,2,3,4,5,6] . i have php array has size values. reshape comma-separated values string this: $size_list = implode(",", $sizes); for not familiar php, above code generate string this: "1,4,5" , query database this: $query = "select t1.id,t1.title,t1.description,t2.size products t1 inner join sizes t2 on t1.id=t2.id size in(".$size_list .")"; but query replicates products each size have in sizes table. want to: return records products table have @ least 1 available size in sizes table, without duplicate and of course want sizes in variable show client for example: products: 1 | product1 | description1 2 | product2 | description2 3 | product3 | description3 4 | product4 | description4 sizes: 1 | 1 1 | 2 1 | 4 1 | 5 2 | 1 2 | 5 given $sizes_lis

Maven release plugin with git repository ignores scm.user scm.password -

i trying run maven release build jenkins using m2 release plugin git. jenkins has read-only access git repository, need specify credentials manually during build. passed maven release plugin via -dusername=\*\*\*\* -dpassword=\*\*\*\* , creates scm.username , scm.password in release.properties when run release:prepare , release:perform manually , in order. however, these seem ignored release:perform task. is there other way maven release plugin accept credentials in build? you're hitting mrelease-832 , regression since 2.4. have wait next release or fall 2.3.2

java - How to change a variable via a worker thread -

is there elegant way that? or can avoided because 1 can use better design patter? import java.util.arraylist; import java.util.list; public class fortest { list<string> ls = new arraylist<string>(); public static void main(string[] args) { fortest fortest=new fortest(); system.out.println(fortest.ls.size()); new thread(new worker(fortest.ls)).start(); //size() not change @ system.out.println(fortest.ls.size()); } } class worker implements runnable{ list<string> list; public worker(list<string> li) { this.list = li; } public void run(){ this.list.add("newitem"); } } there several issues code (in particular use arraylist not thread safe without proper synchronization). but obvious 1 second println statement going called before run method has had chance executed.

java - How to create an application log and save it? -

this question has answer here: how save android application log file on physical device? 1 answer i have android application , want save error logs in file can solve errors , bugs , know happening users while using app. how can make this? this guide through of it; https://blogs.oracle.com/nickstephen/entry/java_redirecting_system_out_and the main focus point rebinding of system.out , system.err output streams goto file. with; system.setout() and system.seterr()

Excel - Go from ELSEIF, to a nested IF, then to ELSE -

elseif numcol1 = numcol2 dim integer = 14 33 if cells(i, 6) <> "" , cells(i, 7) = "" msgbox "please indicate if subs allowed.", vbcritical cancel = true exit sub end if next else 'do if numcol1 = numcol2 valid (this counting number of values in each column) , should go else bit however, want check if cells next each filled in rather e.g. 2 2 col1 col2 value1 value1 value2 value2 this valid, 2 above each column count of how many values in each column 2 2 col1 col2 value1 value1 value2 (blank) (blank) value2 this not valid, though count still two, last value2 should in row above a bit confusing, appreciated! thanks! you need perform validity test every row. point out, counting values in each c

performance - SQL Server Query running slow when changing constant in where clause -

hello , in advance. have view when queried no clause takes on 0 seconds return ~8600 rows. however, when query clause such as: select * myview myid = 123 depending on constant put in place of 123 query execution time changes considerably. now, "considerably" in case means difference between above 0 seconds , 3 4 seconds. view called , repeatedly tasks makes 3 seconds turn 30 or more seconds. while cannot give code view itself, can confirm that: the view comprised of joining of 6 standard tables (no special qualities). while there may not records in table link table b, creating null columns in results, have confirmed such instances not consistently resulting in longer or shorter query times. the view has no clauses beyond standard select , from , , left outer join clauses. certain ids result in long query times , others result in short query times i have dropped , created view in between queries on off chance there cached execution plan sub-optimal. if

c# - Amazon S3, Syncing, Modified date vs. Uploaded Date -

we're using aws sdk .net , i'm trying pinpoint seem having sync problem our consumer applications. have push-service generates changeset files uploaded s3, , our consumer applications supposed download these files , apply them in order sync correct state, not happening. there's conflicting views on what/where correct datestamps represented. our consumers written @ s3 file's "lastmodified" field sort downloaded files processing, , don't know anymore field represents. @ first thought represented date modified/created of file uploaded, (as seen here ) represents new date stamp of when file uploaded, , likewise in same link seems imply when file downloaded reverts old datestamp (but cannot confirm this). we're using snippet of code pull files // list of latest changesets since last successful full update. amazon.s3.amazons3client client = ...; list<amazon.s3.model.s3object> listobjects = client.getfullobjectlist( this.settings.gets3lis

c# - Visual Studio not using Visual Studio Command Prompt for post-build events -

i wondering why visual studio won't it's been told recognized, visual studio uses standard windows command prompt , not own vs cmd prompt. this results in an 'csc' not recognized internal or external command error message in build output window. so.. there way tell vs use own command line tool csc usable or have set additional system variables run? the easiest way call out thing normal vsxxxx command prompt uses: ex: call ""%programfiles(x86)%\microsoft visual studio 10.0\vc\vcvarsall.bat"" x86 (edit: updated per hans's comment)

neo4j - Cypher: Return path where begin and end may be equal -

i have taxonomy neo4j graph. basic structure this: taxonomyname -has_root_term-> root -is_broader_than-> term -is_broader_than-> term'-is_broader_than-> term'' - ... now want given term - e.g. term'' - path taxonomy root (or multiple paths; please note there may multiple taxonomies multiple eligible roots, structure poly-hierarchy): start n=node:index("id:term''id") match p = taxonomy-[:has_root_term]->r-[:is_broader_than*]->n return tail(extract(n in nodes(p) : n.id)) the tail excludes first node don't taxonomy node itself. works fine, except when directly query root term. nothing returned. of course: search path @ least 3 elements, taxonomy node, root node , descendant of root. i'd need express r , n may equal. tried make is_broader_than relationship optional, null returned because pattern cannot found. so how restrict query paths including root term , allowing paths of length one, containing root term?

Determine when Visual Studio has entered design mode VB.NET -

i trying create add-in in visual studio 2012 perform operations after program has been executed. requires me know when design mode has been entered. have code below works in c#, , working in vb.net. public void onconnection(object application, ext_connectmode connectmode, object addininst, ref array custom) { . . . //initialize event handlers host _debuggerevents = _applicationobject.events.debuggerevents; _debuggerevents.onenterdesignmode += new _dispdebuggerevents_onenterdesignmodeeventhandler(onenterdesignmode); } /// <summary>handles when host application object's debugger enters design mode (is done debugging).</summary> /// <param name="reason">the reason host application object entering design mode.</param> public static void onenterdesignmode(dbgeventreason reason) { system.windows.forms.messagebox.show("add-in debug: debugger enters design mode.

javascript - Multiple jQuery document.read event handlers running in wrong order -

i added feature our asp.net mvc web application. there's page displayed when user clicks on item in table. page uses ajax display partial view in single div in page's html. partial view uses telerik kendo ui define , display dialogs , dropdownlist controls. complicated in javascript imports on view page, while partialview builds html displayed in div . the javascript wrote on page includes jquery document.ready event handler: $(document).ready( function () { if ( $('#details-map').val() != '' ) $('#details-map').remove(); var urltail = '?t=' + (new date().gettime()); // make ajax call , load result details box. $('#detailsbox').load('<%= url.action("details") %>' + '/' + '<%: model.id %>' + urltail, displaydetails); } ) this works fine when run application on localhost. problem appears when deploy page our development s

using sql count in a case statement -

i have table , need present output in following fashion. tb_a: col1 | reg_id | rsp_ind count of rows rsp_ind = 0 'new' , 1 'accepted' the output should new | accepted 9 | 10 i tried using following query. select case when rsp_ind = 0 count(reg_id)end 'new', case when rsp_ind = 1 count(reg_id)end 'accepted' tb_a and m getting output new | accepted null| 10 9 | null could me tweak query achieve output. note : cannot add sum surrounding this. part of bigger program , cannot add super-query this. select count(case when rsp_ind = 0 1 else null end) "new", count(case when rsp_ind = 1 1 else null end) "accepted" tb_a you can see output request here

ruby on rails - SQL group uniquely by type and by position -

given dataset: id type_id position 1 2 7 2 1 2 3 3 5 4 1 1 5 3 3 6 2 4 7 2 6 8 3 8 (there 3 different possible type_ids) i'd return dataset 1 of each type_id in groups, ordered position. so grouped so: results (id): [4, 6, 5], [2, 7, 3], [null, 1, 8] so first group consist of each of entries type_id's highest (relative) position score, second group have second highest score, third consist of 2 entries (and null) because there not 3 more of each type_id does make sense? , possible? something that: with cte ( select row_number() on (partition type_id order position) row_num, * test ) select array_agg(id order type_id) cte group row_num sql fiddle of, if absolutely need nulls in arrays: with cte ( select row_number() on (partition type_id order position) row_num, * test ) select array_agg(c.id order t.type_id) (select distinct row_num c

mstest - How to unit-test BizTalk maps containing e.g. DB functoids? -

i exploring possibilities of unit-testing biztalk server 2010 artifacts mstest. so testing maps (thanks testablemapbase ) , comparing outputs (using xmldsigc14ntransform 's digested output) , works fine – now – but: how can unit-test map containing e.g. databaselookupfunctoid , databasevalueextractfunctoid , or perhaps datecurrentdatefunctoid ? i experimented bit moles framework , allows me solve problem datecurrentdatefunctoid , since suffices deroute datetime.now that. still, need further check possibilities or alternatives, without pulling out big guns typemock or justmock…

php - Custom user agent parser -

for parsing user agent found ua-parser , powerfull, don't want parse browser user agent, want parse custom user agent : paperl installer (windows; p; 32bit; ver 2.0.3; os: 5.1.2600 sp 3.0 nt; x32c;) bookl installer (windows; b; 64bit; ver 1.0; os: 6.1.7601 sp 1.0 nt; x64c;) now how can fetch paperl or bookl , ver , x32c or x64c agent ? this thing :) not need regex. can other strings easily. function trim_string($s) { $s = trim($s, ";"); $s = trim($s, ";)"); return $s; } $string = "paperl installer (windows; p; 32bit; ver 2.0.3; os: 5.1.2600 sp 3.0 nt; x32c;)"; $array = explode(" ", $string); $firstitem = trim_string($array[0]); // return paperl $version = trim_string($array[6]); // return 2.0.3 $last = trim_string(end($array)); // return x32c echo $firstitem. " ". $version. " ". $last; // return paperl 2.0.3 x32c

cordova - Zxing barcode plugin phonegap, encode code128? -

can code128 , code39 encoded zxing barcode plugin, if so, how? i searching through internet , few said possible few not, don't realy know :) thank you to encode data code_128 fomat, change needs done in zxing barcode plugin navigate captureactivity in eclipse. src -> com.google.zxing.client.android.encode -> qrcodeencoder.java replace 'barcodeformat.qr_code ' barcodeformat.code_128 ~anandaraja

Drawing a custom bar chart graph in iOS(PowerPlot vs Core plot) -

Image
i have been looking around net open source graph plot framework ios, struggling of now. have worked on app , used powerplot graph plot framework http://powerplot.nua-schroers.de/examples/webtraffic.html i trying draw bar graph chart showing 2 years @ once without stacking each, in image below: can see there problem of resizeing , scaling isnt uniform. make chart bigger , y axis more formatted. any suggestions because hear core plot can achieve such(see below), hear coreplot flexibility , customization issues. you can produce bar plot core plot. give try , ask specific questions here on stackoverflow if stuck.

java - Does throwing an exception change its state? -

i've run simple experiments this: public static void main(string[] args) { try { nullpointerexception n = new nullpointerexception(); system.out.println(lists.newarraylist(n.getstacktrace())); n.printstacktrace(); system.out.println(lists.newarraylist(n.getstacktrace())); throw n; } catch (nullpointerexception e) { e.printstacktrace(); system.out.println(lists.newarraylist(e.getstacktrace())); } } and output this: java.lang.nullpointerexception @ mytest.main(mytest.java:231) java.lang.nullpointerexception @ mytest.main(mytest.java:231) [mytest.main(abstractscannertest.java:231)] [mytest.main(abstractscannertest.java:231)] [mytest.main(abstractscannertest.java:231)] but wonder if done exception when thrown. academic question, though relevant under circumstances if exception part of api , may or may not have been thrown when provided implementation. no, throwable object not modified thro

java - What Is The Difference Between .equals() and ==? -

i read .equals() compares value(s) of objects whereas == compares references (that -- memory location pointed variable). see here: what difference between == vs equals() in java? but observe following piece of code: package main; public class playground { public static void main(string[] args) { vertex v1 = new vertex(1); vertex v2 = new vertex(1); if(v1==v2){ system.out.println("1"); } if(v1.equals(v2)){ system.out.println("2"); } } } class vertex{ public int id; public vertex(int id){ this.id = id; } } output: (nothing) shouldn't printing 2? you need implement own .equals() method vertex class. by default, using object.equals method. from docs, does: the equals method class object implements discriminating possible equivalence relation on objects; is, non-null reference values x , y, method returns true if , if x , y r

javascript - Node.js not connecting with mobile browsers -

i've been working on small radio player uses node.js create websocket pushes through updates song , artist when xml file updated , work great on desktop browsers.however when tried testing on ipad , windows phone, node.js doesn't connect or acknowledge trying connect. what's causing , how fix it? please , thank you server.js app.listen(8080); function handler(req, res) { fs.readfile(__dirname + '/wp-content/themes/c/page-player.php', function(err, data) { if (err) { console.log(err); res.writehead(500); return res.end('error loading index.php'); } console.log("connection!"); res.writehead(200); res.end(data); }); } client.js $(document).ready(function(){ var localurl = 'http://***.**.**.**:8080'; var socket = io.connect(localurl);// creating new websocket edit: forgot metion: else on page loads, websockets aren't connecting.

ipad - Facebook event subscriber: FB.event doesn not appear to work on Ipdas -

fb.event.subscribe('egde.create', function(response) { alert('can see me on ipad??'); }); has else had trouble getting code work on ipads? trying react facebook 'like' event. , exact code works everywhere except on ipads. know workaround this?

network programming - Measuring # of dropped packets for individual TCP connections -

i'm interested in measuring network performance. have little tool speed tests , such interested in measuring quality of connection seeing how many packets dropped or re-transmitted. i know using netstat , such can aggregate numbers, how do individual connections? language: c (not counting on api hey!) os: linux (if there method works mac/win that'd awesome!) you can use tcpdump , listen specific port, , works wireshark (applying filters specific protocols, ports, network etc )and if not wrong think wireshark use tcpdump on backend.

linux - perl not executing in cron -

ok i'm pull hair out. have perl script not run in crontab have written perl script runs fine every day on same box. have checked of given solutions on site , others around web , nothing seems make difference. here cron , first part of script 55 13 * * * su oracle; cd /u02/oraclebackup;./move_em_bkup.pl >> /u02/oraclebackup/move_em_backup.log > move_em_bkup.dbg 2>$1 it touches .dbg file not put in there. there no errors or can use go by. #!/usr/bin/perl use strict; use archive::tar; use net::scp qw/ scp /; use net::scp::expect; use datetime; can help? the command you're running is: su oracle; cd /u02/oraclebackup; ... su oracle launches interactive shell under oracle account (assuming have permission so). i'm not sure in non-interactive cron environment, assuming works, cd /u02/oraclebackup , following sub-commands executed after shell terminates, i.e., under account owns crontab. su oracle either block rest of command or nothing.

c# - Alternative to Load Data Inline -

i've been trying speed way customer records added c#/mysql application i've put together. application relies heavily on arrays of 2 dimensional strings (string[,]) , point i've built customized functions produce insert statements , handle them in groups of forty or time (separated semicolons). discovered load data infile command , lot simpler, lot faster, , can use replace password set whether update existing records or not. export arrays csv file , upload them appropriate tables using load data infile. however, seems awfully mettlesome , have believe there way either tweak load data inline or use different command works use either upload 2 dimensional array or formatted string printout of array without having export file. thanks in advance! generate xml blob, have sql server parse xml using xquery can bulk load data. simpler load data infile.

css - Bad content width on mobile devices -

i have website in wordpress , have small problem content. on computers main content shows fine. can see on mobile device, content has approx. 50% of width , don't know why.. can me please? website: http://www.djreneek.com mobile screenshot: https://dl.dropboxusercontent.com/u/19898988/screenshot_2013-07-31-21-41-18.png thank much edit: see diacritics doesn't work on mobile devices too... (ščťžýá etc..) ensure have set viewport within <head> of document catering mobile browsers. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

ember.js - emberjs - nested tables info -

i have irregular table structure nest (either using actual tables or using div tables). have list of 'parent' classes, each of has many 'children' instances, , want show them in same table, single set of headers. output (simplified - have many more columns display). <table> <tr> <th>parent</th> <th>child</th> <th>remove</th> </tr> <tr> <td colspan="2">parent one</td> <td>child one</td> </tr> <tr> <td>child two</td> </tr> </table> but can't figure out how accomplish in handlebars because of fact need have new <tr> element around every child except first one. easy enough figure out in code, can't see how cleanly in handlebars. possible or should write custom view?

c++ - boost mutable_queue not compiling -

i have managed work through (what appears be) of initial problems, due fact of answers came other people's (unanswered) questions, not sure if heading in right direction. working boost's mutable queue , having issues when compiling. my code, stands, is: typedef struct _mycomparator { bool operator() (const prioritystruct* arg1, const prioritystruct* arg2) const { return arg1->key < arg2->key; } } mycomparator; class priorityqueue { typedef prioritystruct* entry; typedef boost::typed_identity_property_map<entry> prop_map; typedef boost::mutable_queue<entry, std::vector<entry>, mycomparator, prop_map> priority_queue_notamb; priority_queue_notamb* pq; boost::mutex mut; public: priorityqueue(void); } priorityqueue::priorityqueue() { pq = new priority_queue_notamb(sizeof(entry)*2, mycomparator(), prop_map()); prioritystruct* ps = new prioritystruct; pq->push(ps); } when remove final

apache - Why doesn't Google serve adsense over SSL? -

i curious why google doesn't allow use version of adsense code served via ssl, wondering if there cost involved or something? i'm asking because used serve website on ssl displayed warning in google chrome because ads weren't being served on ssl. thanks in advance, francis :d enabling ssl may seem quick , easy fix, ssl places significant load on server , each request take longer without encryption. on small site minimal traffic, won't notice overhead. on platform big adsense, decisions require great deal more planning; not mention more powerful servers or load-balancing ssl appliances. can't imagine there's enough demand justify costs involved.

php - Issue with Reddit API and cURL creating an account -

i'm working on app allows users create account on reddit (and more). use curl , php interface reddit api, code: function create_account($username, $password, $captcha_iden, $captcha_answer){ $url = "http://reddit.com/api/register"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_post, true); $data = "user=$username&passwd=$password&passwd2=$password&rem=false&reason=redirect&api_type=json&iden=$captcha_iden&captcha=$captcha_answer"; curl_setopt($ch, curlopt_postfields, $data); $curl_scraped_page = curl_exec($ch); die($curl_scraped_page); curl_close($ch); } however, receive reddit servers this: http/1.1 302 moved temporarily server: akamaighost content-length: 0 location: http://www.reddit.com/api/register

java - Send image with HttpUrlConnection by chunks and other parameters -

the thing i'm trying upload image server. image has uploaded chunks of 256kb , need pass chunks count , id every call. can total number of chunks upload , i'm using bufferedinputstream chunks bytes. when finish upload chunks image showed corrupted. my code far: int chunksize = 255 * 1024; final long size = mfile.length(); final long chunks = mfile.length() < chunksize? 1: (mfile.length() / chunksize); int chunkid = 0; bufferedinputstream stream = new bufferedinputstream(new fileinputstream(mfile)); string lineend = "\r\n"; string twohyphens = "--"; string boundary = "rqdzaaihjq7xp1kjraqf";// random data (chunkid = 0; chunkid < chunks; chunkid++) { url url = new url(urlstring); // open http connection url conn = (httpurlconnection) url.openconnection(); conn.setreadtimeout(20000 /* milliseconds */); conn.setconnecttimeout(20000 /* milliseconds */); // allow inputs conn.setdoinput(true);

asp.net mvc 4 - Default Role Provider could not be found when using SimpleMembershipProvider -

i'm trying authorization working on asp.net mvc4, try use websecurity. websecurity.initializedatabaseconnection("tradefairindia", "users", "id", "username", false); i've put global.asax, , error comes, "default role provider not found". on internet read had add line of code web.config <rolemanager enabled="true" defaultprovider="aspnetsqlroleprovider"> . had added because of previous errors. how can resolve problem?? edit: when change defaultprovider="simpleroleprovider" gives me new error. says the type or namespace name 'data' not exist in namespace 'webmatrix' (are missing assembly reference?) i fixed changing defaultprovider simpleroleprovider . second error fixed adding webmatrix.data reference, , going property's , put copy local on true. dont know how fixes it, if can elaborate nice. here web.config bumps same prob: <system.web

php - calculate average rating from mysql and show it as a graph -

Image
please me solve this. in learning phase of php/mysql. i have php feedback form rating system 1-5. can find form here http://innovatrix.co.in/feedback_priyajit/feedback%20form1.html every time user provide feedback saves form values mysql database. below database structure. now want calculate average data of every row (like waiting) , show on php file graph , separate graph every option on same page. i know can use query select avg(waiting) feedback average of " waiting " but how can every options same file , show graph. database updated frequently, should reflect graph also. please me concept achieving this. below php file using store form values database. <title>process</title> <?php $host="localhost"; $user_name="pramir_feedback"; $pwd="feedback"; $database_name="pramir_feedback"; $db=mysql_connect($host, $user_name, $pwd); if (mysql_error() > "") print mysql_error() . "<br&

javascript - Problems with option selection in Chrome and Opera -

i've problems thise code, it's working fine in firefox , internet explorer doesn't work opera , chrome browsers... <script> function planetselect() { optionen=document.getelementbyid('pstart').options; for(i=0;i<optionen.length;i++) { if(optionen[i].value==67080) { optionen[i].setattribute('selected','selected'); } } optionen=document.getelementbyid('pdest').options; for(i=0;i<optionen.length;i++) { if(optionen[i].value==67080) { optionen[i].setattribute('selected','selected'); } } }</script> change optionen[i].setattribute('selected','selected'); to optionen[i].selected = true; more generally, avoid use of setattribute change dom properties. works, doesn't. from the mdn : using setattribute() modify attributes, notably value in xul, works inconsistently, attribute specifies default value. access or modify current values, should use properties.

VB.Net Parse/Replace a substring in a line -

i know should simple yet little stuck. reading in text file line line. each line formated same based off icd. need take data @ specific location , replace x's. for example: line = "first name last name street address state zip other data" this fixed length icd address starts @ lets position 100 , goes through 150 need replace position 100 150 x's. from there writing line out new file , part working fine. thank help. use this: dim newline string = line.substring(0, 100) & new string("x"c, 50) & line.substring(150)

android - splash activity instead of white screen -

in start of app have white screen 2 seconds. after searched figured out that's because of heavy layouts. want know possible replace white screen custom splash screen. thanks if wish use splash screen because wants user see while it's being loaded, should reconsider , use theming instead. instead of seeing splash image user don't care about, show them frame closely resembles see in actual app (which apple ios apps , google android apps). see this article argument why splash screen bad.

android - How do i solve repeating footer button in the listview -

Image
i'm new @ android development. after spending time figured out how make custom listview. here code. <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="15dp"

perl - Efficient way to check if elements of an array is a substring of elements in another array -

i have 2 arrays: @array1 contains blah1 through blah100 . @array2 contains name: creating "blah1" through name: creating "blah100" . i need check each element @array1 in @array2 name: creating part getting in way. what best route make sure elements @array1 in @array2 ? maybe use of regexes matching while looping through @array1 against @array2 ? there faster way? do array_diff , intersect , or unique work when there noisy string in 1 of arrays? or maybe manipulate @array2 gets rid of name: creating part each data? which way faster? die if @array1 != @array2; (0..$#array1) { die if $array2[$_] ne qq{name: creating "$array1[$_]"}; } or if name part variable, die if @array1 != @array2; (0..$#array1) { die if $array2[$_] !~ /: creating "\q$array1[$_]\e"$/; }

c# - show Yes/NO instead True/False in datagridview -

there datagridview in form shows content of table of database, 1 column of table type boolean, in datagridview shows true/false, want customize show yes/no. way suggest? when comes custom formatting, 2 possible solutions comes in mind. 1.handle cellformatting event , format own. void datagridview1_cellformatting(object sender, datagridviewcellformattingeventargs e) { if (e.columnindex == yourcolumnindex) { if (e.value bool) { bool value = (bool)e.value; e.value = (value) ? "yes" : "no"; e.formattingapplied = true; } } } 2.use custom formatter public class boolformatter : icustomformatter, iformatprovider { public object getformat(type formattype) { if (formattype == typeof(icustomformatter)) { return this; } return null; } public string format(string format, object arg, iformatprovider formatprovider)

powershell - Setting Permissions for a user who hasn't propagated yet -

i'm trying set permissions folder in powershell. problem setting these permissions on active directory account created on 1 of our head domain controllers. since account brand new, hasn't propagated down of our local dcs yet. causing problem me, since trying set folder allow user have modify access , powershell tossing "some or identity references not translated." error when try call setaccessrule on folder's acl. example code shown below. #i'm setting more details account, abbreviated #the command make little more readable new-aduser -name "testy testerson" -server master-dc.domain.ca $directorylocation = '\\fileserver\somedirectory' new-item "filesystem::$directorylocation" -itemtype directory $aclneedingmodification = get-acl "filesystem::$directorylocation" $newaclrule = new-object system.security.accesscontrol.filesystemaccessrule('domain\testy testerson', 'modify', 'allow') $aclnee

maven - Jenkins - How to pass values from pom.xml to downstream job (free style) -

i've set 2 free style jobs, build-app , deploy-app. build-app poll scm , builds app, maven based, , install artifact in web server (internal repository server), calls deploy-app. pass version of pom file () downstream job can download correct artifact , install on machine. found answers suggesting put version string in properties file , use injectenv plugin, prefer read pom itself. ideas? thanks! when build inside maven, have access pom file version ${program.version} , can wish it. the downstream freestyle job can run maven using same pom different target. version should same if take care keep changing in interim. (this suggests procedure should followed.) so, example, maven target can run groovy script or ant script pick correct file repo , deploy it.

asp.net - Local paths for the files are different from the paths on the server -

we have changed domain our staging website , turns out paths on server pointing old paths no longer valid. wondering if there have been better way paths @ begining did not have go through whole website fix paths. server paths hard-coded!! example : name1.staging.com/somepath/file.css is changed name2.staging.com/name3/somepath/file.css so paths used like: /somepath/file.css now need changed /name3/somepath/file.css when you're writing asp.net application, important path need aware of following one: ~/ this return root of current application, whether pass response.redirect() , page.resolveurl() or use part of hyperlink in <asp:hyperlink /> tag. example: <link href='<%= page.resolveurl("~/somepath/file.css") %>' rel='stylesheet' /> note works within code handled .net itself; other files, need ensure use relative paths. example if have following structure images , css: / /images logo.gif

ios - Some links not showing properly in uiwebview -

i have links below: http://www.linkedin.com/groups?gid=4186012&mostpopular=&trk=tyah for reason uiwebview not recognizing links properly. links without question marks work, question marks don't. meaning, not show proper linkedin page. what should do? here's code: nsstring *urladdress = @"http://www.linkedin.com/groups?gid=4186012&mostpopular=&trk=tyah"; //create url object. nsurl *urlstring = [nsurl urlwithstring:urladdress]; //url requst object nsurlrequest *requestobj = [nsurlrequest requestwithurl:urlstring]; //load request in uiwebview. [self.webview loadrequest:requestobj]; have tried this: "uiwebview won't load page." ? here link explains question marks in url are: query_string .

javascript - block multiple instances of firefox app -

i have built firefox 22 application in javascript/html5 , block user opening multiple instances of (whether in separate tab or separate browser). currently works extent when try open instance of it, redirects about:blank, brings original instance of application focus (switches tab or window), , displays alert (on original instance). done checking displaystate variable i've set in localstorage. the problem i've run while alert up, user can open many instances of application he/she wants. is there better way using (a displaystate check in) localstorage this? or there way keep alert timing-out application? alert blocks script execution in firefox (this not e.g. opera), hardly can change this. therefore should use different. nonetheless may set localstorage key on application startup , unset on shutdown ( window.onunload ). user can stuck, though, if browser crashes. may try sessionstorage , automatically cleaned when browser closed.

PHP Zip: Extract contents of a directory -

i need extract contents of directory within zip archive in output directory. the directory name inside zip anything. directory in base of zip archive. there number of files in directory, in zip archive, though. the file structure inside zip along theses lines: - d0001 - folder - view.php - tasks.txt - file1.txt - picture1.png - document.doc the contents of output directory needs this: - folder - view.php - tasks.txt - file1.txt - picture1.png - document.doc the code have deletes contents of output directory , extracts entire zip archive in directory: function unzip($source, $destination) { $zip = new ziparchive; $res = $zip->open($source); if($res === true) { $zip->extractto($destination); $zip->close(); return true; } else { return false; } } function rrmdir($dir, $removebase = true) { if(is_dir($dir)) { $objects = scandir($dir); foreach($objects $object) { if($ob