Monday 15 March 2010

c# - Using a singleton to send messages between any two classes -



c# - Using a singleton to send messages between any two classes -

is using singleton send messages between classes or bad idea?

one side of communication registers listener (listening string or object, perchance parameters) , other side sends messages. there can multiple or no listeners message.

using such pattern means objects in different projects can communicate without having reference 1 another.

a case useful sending errors in application 1 object. can send error part of application , error manager can hear errors have occurred.

what downsides taking such approach?

problems come mind globals create hard testing , possibility of unexpected consequences since in app listening event , in unrelated projects.

for situations similar using observer pattern , making event dispatcher singleton.

c# events design-patterns singleton global-variables

jquery - How to ignore font-size setting changes for Cordova App when runs on Android 4.4+? -



jquery - How to ignore font-size setting changes for Cordova App when runs on Android 4.4+? -

i've developed cordova app cordova version 3.6.3 , jquery. 1 problem still can't best solutions when test app on android 4.4+ , there users love alter font size in setting > display > font-size of device larger normal. causes app layout displays ugly (the best display when font-size setting normal only). there no effect of font-size setting android older 4.4 (4.3,4.2...) app displays on older version.

the solutions i've applied app creating custom plugin observe configuration changed , detects if user uses android 4.4+ , if set font-size setting not normal, i'll utilize jquery forcefulness font-size specified size.

example is....

if (font_scale == huge) { $("div").css("font-size","20px !important"); }

this works fine after page loaded, css doesn't changes want. , suppose if there 30 divs+ on page must insert statement above 30 times , takes much time needlessly.

i want know, there ways solve problem easier using plugin? maybe using xml configuration or css3 properties can makes app displays without side effect font-size setting of android 4.4?

another ways tried , doesn't works

inserting fontscale on androidmanifest.xml > activity tag inserting webkit-text-size-adjust:none; in css

i'd love hear ideas help solve this.

try remove 1 index.html:

target-densitydpi=device-dpi

good luck.

android jquery cordova android-4.4-kitkat

git - Internal github VCS intellij idea issue -



git - Internal github VCS intellij idea issue -

at first using version command scheme subversion on windows in "origin / master" branch, after changed os ubuntu , started using git command system. after 2 successful commit, saw thread have "head" "master" makes possible can not commit main branch. how switch branch "origin / master"?

it seems confusion between how git , svn work.

svn keeps remote history , each commit, stores changes in remote repository.

git keeps local history of each change. @ commit time, changes stored localy. so, if want "push" local history, have git push. in intellij, several ways it, example, right click on project->git->repository->push (or ctrl+alt+k), check ok in window (you have force origin master) , push. if don't want commit force in 2 steps, in commit window, instead of commit, have possibility commit , force (see arrow right of commit button.

if need more details, here's corresponding chapter in git book : http://git-scm.com/book/en/git-basics-working-with-remotes

chapter 2 of book start git sense free read :)

hope helps

git svn github intellij-idea

CSV to image in python -



CSV to image in python -

i want create image out of csv data.

i reading csv with:

f = open('file.csv', 'rb') reader = csv.reader(f)

from here, want create grayscale image translating each row of numbers in list line of intensities in image file.

not sure useful here details csv file: using floats, columns:315, rows: 144

thanks

two steps:

convert csv file numpy array using genfromtxt

from @andrew on how read csv record array in numpy?

from numpy import genfromtxt my_data = genfromtxt('my_file.csv', delimiter=',') then save numpy array image

python image csv

hive - Count and find maximum number in Hadoop using pig -



hive - Count and find maximum number in Hadoop using pig -

i have table contain sample cdr info in column , column b having calling person , called person mobile number need find having maximum number of calls made(column a) , need find number(column b) called most

the table construction below

calling called 889578226 77382596 889582256 77382596 889582256 7736368296 7785978214 782987522

in above table 889578226 have number of outgoing calls , 77382596 called number in such way need output

in hive run below

select calling_a,called_b, count(called_b) cdr_data grouping calling_a,called_b;

what might equalent code above query in pig?

anas, please allow me know expecting or different?

input.txt a,100 a,101 a,101 a,101 a,103 b,200 b,201 b,201 c,300 c,300 c,301 d,400 pigscript: = load 'input.txt' using pigstorage(',') (name:chararray,phone:long); b = grouping (name,phone); c = foreach b generate flatten(group),count(a) cnt; d = grouping c $0; e = foreach d { sortedlist = order c cnt desc; top = limit sortedlist 1; generate flatten(top); } dump e; output: (a,101,3) (b,201,2) (c,300,2) (d,400,1)

hadoop hive apache-pig cdr

tsql - Excel 2010 Pivot Table from MS Query Calculation and Grouping Issue -



tsql - Excel 2010 Pivot Table from MS Query Calculation and Grouping Issue -

first post here, have helped me much.

my issue building sales board in excel 2010 using odbc connection sql server 2008 r2 database. have 2 row groups , 2 column groups. groups in parent kid order.

row groups product grade , product. column groups date , region(east , west). value product cost region. i'm trying add together subtotal after each part grouping gives (east cost - west price). 1 part reported if west subtotal shouldn't exist.

i've tried combination of calculated items, works adds column each region. or doing work in sql server works except product grade grouping spreads products in every parent group. i'd prefer create work in sql server obvious reasons , new building info in excel. i'm sure simple i'm missing. help much appreciated.

;with t ( select info.protype, info.product, case when info.pricecode = 'x' 'east' else 'west' end region, sum(isnull(info.price,0)) price, case when r1.product=r2.product sum(x.price-y.price) else 0 end diff, info.effectdate (select protype, product, pricecode, price, effectdate prc_table pricecode in ('x','y') , protype = 'z') info left bring together prc_table r1 on info.protype = r1.protype , info.product = r1.product , info.effectdate = r1.effectdate , r1.pricecode = 'x' left bring together prc_table r2 on info.protype = r2.protype , info.product = r2.product , info.effectdate = r2.effectdate , r2.pricecode = 'y' info.effectdate >= dateadd(mm, -3, getdate()) , info.effectdate <= getdate() grouping info.effectdate, info.protype, info.product, r1.product, r2.product, info.pricecode, r1.price, r2.price ) select c.codedesc [grade], r.product [product], r.region [region], r.price [price], r.diff [e-w], r.effectdate [date] t r inner bring together pro_item on r.protype = i.protype , r.product = i.product inner bring together pro_duct p on i.protype = p.protype , i.product = p.product , i.1 = p.1 (product grade join) inner bring together xxx_codes c on p.desc3 = c.code , c.prefix = 'xxx' i.protype = 'z' , i.loc = 'loc' , p.desc4 = '' , i.branch = 'm' order r.effectdate desc, codedesc, product

i you're trying do. , you're on right track calculate differences in sql, because it's not possible show/hide subtotals in pivot table depending on whether it's east/west or east. doing in sql good. think have bit of design flaw in query trying set difference in separate column.

the problem is, how nowadays in pivot table? if have both cost , diff value field in pivot table, botch layout completely. want 1 value field - price. , want east, west, , diff column headings, should regions in data.

so, in sql, grade, product, region, price, , date you're doing, set in temp table, insert temp table difference records, region='diff' , price= actual difference value, both east , west record exist product , effective date.

your output should this:

grade product part cost effdt p1 east 1.5 31-oct-14 p2 east 3 31-oct-14 b p3 east 5 31-oct-14 b p4 east 2.44 31-oct-14 c p5 east 3.67 31-oct-14 c p6 east 10.3 31-oct-14 b p3 west 5.5 31-oct-14 b p4 west 2.7 31-oct-14 c p5 west 3.8 31-oct-14 c p6 west 10.7 31-oct-14 p1 east 1.5 30-nov-14 p2 east 3 30-nov-14 b p3 east 5 30-nov-14 b p4 east 2.44 30-nov-14 c p5 east 3.67 30-nov-14 c p6 east 10.3 30-nov-14 b p3 diff -0.5 31-oct-14 b p4 diff -0.26 31-oct-14 c p5 diff -0.13 31-oct-14 c p6 diff -0.4 31-oct-14

you insert difference rows applicable, when pivottable data, show either east+west+diff or east not east+diff.

it looks you're pretty comfortable sql write above query should able implement that. if having problem post , i'll have look.

cheers

excel tsql sql-server-2008-r2 grouping

coffeescript - Convert javascript code into coffescript -



coffeescript - Convert javascript code into coffescript -

im working dashing , need convert javascript code coffescript in order create utilize of rickshaw graph library. (according source code on website http://code.shutterstock.com/rickshaw/examples/x_axis.html)

i'm trying have customized x axis on graph.

default coffescript code= x_axis = new rickshaw.graph.axis.x(graph: @graph)

js code converted

var format = function(n) { var map = { 0: 'zero', 1: 'first', 2: 'second', 3: 'third', 4: 'fourth' }; homecoming map[n]; } var x_ticks = new rickshaw.graph.axis.x( { graph: graph, tickformat: format } );

into coffescript

var format = function(n) { var map = { 0: 'zero', 1: 'first', 2: 'second', 3: 'third', 4: 'fourth' }; homecoming map[n]; } x_axis = new rickshaw.graph.axis.x(graph: @graph,tickformat: format)//make utilize of format

format = (n)-> map = 0: 'zero', 1: 'first', 2: 'second', 3: 'third', 4: 'fourth' map[n]

javascript coffeescript rickshaw

javascript - Java Script add value of variable to object property? -



javascript - Java Script add value of variable to object property? -

i'm new here , javascript. have assignment asks "create new property in foodinfo object plus value of toppings variable, , set ne property's value to value of current element in toppingboxes array."

here code have not working, have tried multiple things cant print out toppings on page:

for (var = 0; < toppingboxes.length; i++) { if (toppingboxes[i].checked) { toppings = toppings + 1; foodinfo.topping[toppings] = toppingboxes[i].value; } }

here code assignment gave me print it, code correct, code above need help with:

foodsummary.innerhtml += "<ul>"; (var = 1; < 6; i++) { if (foodinfo["topping" + i]) { foodsummary.innerhtml += "<li>" + foodinfo["topping" + i] + "</li>"; } } foodsummary.innerhtml += "</ul>";

i know code stops running when hits line "foodinfo.topping[toppings] = toppingboxes[i].value;" know wrong. having problem instructions mentioned above...any help working? give thanks in advance!!

try this:

var toppings = 0; (var = 0; < toppingboxes.length; i++) { if (toppingboxes[i].checked) { toppings = toppings + 1; foodinfo['toppings' + toppings] = toppingboxes[i].value; } }

javascript

php - WooCommerce JSON API get from category -



php - WooCommerce JSON API get from category -

i'm using woocommerce (which not matter much question) , want generate products (posts) in special category json, , want values product (post) , have special names values. so... what's best practice generate custom json wp posts?

one thought create page , utilize page url json, hence i'm thinking of making template , set header('content-type: application/json'); , , exclude usual wp theming stuff, have feeling can done in improve way?

php json wordpress woocommerce wordpress-json-api

Swift and objective-c name clash when using core graphics -



Swift and objective-c name clash when using core graphics -

with xcode 6.1 i'm getting error.

/...-bridging-header.h:5:2: note: in module 'coregraphics' imported /...-bridging-header.h:5: @import coregraphics; ^

/applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator8.1.sdk/system/library/frameworks/coregraphics.framework/headers/cggeometry.h:271:1: error: definition same mangled name definition cgpointmake(cgfloat x, cgfloat y)

it occurs when phone call cgpointmake swift class swift class using objective-c class imported in bridging header imports core graphics.

i've cleared module cache , derived info , restarted measure. if isn't error in module cache , core graphics functions defined in 2 places don't know quite how address apart "just don't utilize objective-c file" i've done in mean time work around :/

don't utilize cgpointmake in swift:

let point = cgpoint(x: 123, y: 456)

objective-c swift xcode6.1

sql - " insert into select " query in korma -



sql - " insert into select " query in korma -

insert customers (customername, country) select suppliername, country suppliers;

customer table has other columns except "customername" , "country"

this simple sql query.

please help me write in korma sql.

you can same sql:

; assuming define entities, customer, suppliers (insert customers (values (select suppliers (fields :suppliername :country))))

sql postgresql korma sqlkorma

tkinter - Paradoxical time intervals in Python -



tkinter - Paradoxical time intervals in Python -

i'm new programming (python) learning exercise, wrote tkinter programme measure time between 2 "simultaneous" keypresses. wanted see how much of measured time artifactual actual processing of program, removed actual input , have programme simulate 1 keypress after another. got short interval expected (25-35 microseconds). here's code gave me (just of import part, not whole program):

def buttonpress1(event): = datetime.datetime.now() asec = a.microsecond press1.set(asec) onepressed.set(true) if onepressed.get() == true , twopressed.get() == true: difference() b = datetime.datetime.now() bsec = b.microsecond press2.set(bsec) twopressed.set(true) if onepressed.get() == true , twopressed.get() == true: difference() def difference(): dif = abs(press1.get() - press2.get()) # difference in times. around 30 microseconds resultstr = str(dif) + " microseconds" result.set(resultstr) # result displayed in label widget onepressed.set(false) twopressed.set(false)

then wanted see how much complexity of code adding interval, tried real simple example, strangely, i'm getting longer intervals (around 300 microseconds), finish opposite of expected. here's code:

import datetime = datetime.datetime.now() b = datetime.datetime.now() asec = a.microsecond bsec = b.microsecond print bsec-asec # result around 300 microseconds

can explain me?

datetime.microsecond microsecond component of datetime object - it's not entire datetime represented in microseconds.

in order difference between datetime objects, subtract them , you'll timedelta object:

>>> d1 = datetime.now() >>> d2 = datetime.now() >>> delta = d2 - d1 >>> delta datetime.timedelta(0, 12, 431220) >>> delta.seconds 12 >>> delta.microseconds 431220

so difference here 12.4 seconds, or 12 seconds , 431220 microseconds.

for measuring elapsed time between 2 events however, time.time() easier use, stated @casualdemon in comments:

>>> import time >>> start = time.time() >>> end = time.time() >>> elapsed = end - start >>> elapsed 5.727240085601807 # in seconds

python tkinter

Migrating c program from linux to windows -



Migrating c program from linux to windows -

i have problem migrating working programme written on linux windows. clean little bit next code snippet give me error.

code snippet:

... struct timeval mytime; gettimeofday(&mytime, (struct timezone*)0); tseconds = (double) (mytime.tv_sec + mytime.tv_usec*1.0e-6); ...

stacktrace:

error 1 error c2079: 'mytime' uses undefined struct 'timeval' warning 2 warning c4013: 'gettimeofday' undefined; assuming extern returning int error 3 error c2224: left of '.tv_sec' must have struct/union type error 4 error c2224: left of '.tv_usec' must have struct/union type 5 intellisense: incomplete type not allowed 6 intellisense: incomplete type not allowed 7 intellisense: incomplete type not allowed

if help me grateful!

@dave link add together code below snippets:

const __int64 delta_epoch_in_microsecs = 11644473600000000; struct timeval2 { __int32 tv_sec; __int32 tv_usec; }; struct timezone2 { __int32 tz_minuteswest; /* minutes w of greenwich */ bool tz_dsttime; /* type of dst correction */ }; int gettimeofday(struct timeval2 *tv/*in*/, struct timezone2 *tz/*in*/) { filetime ft; __int64 tmpres = 0; time_zone_information tz_winapi; int rez = 0; zeromemory(&ft, sizeof(ft)); zeromemory(&tz_winapi, sizeof(tz_winapi)); getsystemtimeasfiletime(&ft); tmpres = ft.dwhighdatetime; tmpres <<= 32; tmpres |= ft.dwlowdatetime; /*converting file time unix epoch*/ tmpres /= 10; /*convert microseconds*/ tmpres -= delta_epoch_in_microsecs; tv->tv_sec = (__int32) (tmpres*0.000001); tv->tv_usec = (tmpres % 1000000); //_tzset(),don't work properly, utilize gettimezoneinformation rez = gettimezoneinformation(&tz_winapi); tz->tz_dsttime = (rez == 2) ? true : false; tz->tz_minuteswest = tz_winapi.bias + ((rez == 2) ? tz_winapi.daylightbias : 0); homecoming 0; }

and code builds correctly :)!

c linux windows visual-studio-2013 openmp

sass - import compass sprite images in one file css and @extend it in another? -



sass - import compass sprite images in one file css and @extend it in another? -

i have icons folder, utilize compass sprites images:

@import "compass/utilities/sprites"; @import "icons/*.png"; @include all-icons-sprites(true);

this in /stylesheets/global/icons.css.scss file

now, in /stylesheets/application/index.css.scss file need use:

@extend .icons-foo;

i include global/ folder before application/ in application/index.css.scss :

/* *= require_tree ../global *= require_tree . */

but have error :

".bar" failed @extend ".icons-foo". selector ".icons-foo" not found.

the solution it's repeat first block set in post in application/index.css.scss.

but if set manualy "icons-foo" in class of dom element, class match , works...

how not repeat same instruction? how can import 1 time sprite , used them in other file?

import sass sprite extend compass

C++ Writing simple coin flip game -



C++ Writing simple coin flip game -

i'm writing code game prompts user pick how many times want flip coin , guess how many times land on heads. wrote of, need help finishing up. tried include count of heads ran problems.

#include <iostream> #include <cmath> #include <ctime> using namespace std; int myrandnumgen(){ int num = rand(); homecoming num; } char cointossfunction( ){ char cointoss; int cointossvalue = (myrandnumgen()%2); // 0 or 1 switch (cointossvalue) { case 0: cointoss = 'h'; break; case 1: cointoss = 't'; break; default: break; } homecoming cointoss; } int calccoin(int n){ int cout_heads=0; for(int i=0;i<=n;i++){ if(cointossfunction() == 'h') ++cout_heads; } homecoming (cout_heads/n); } int main(){ int coinflips, guess; cout << "how many times want flip coin? " << endl; cin >> coinflips; cout << "guess how many times coin land on heads if flipped: " << endl; cin >> guess; if (guess>coinflips) { cout << "guess error"; } for(int i=1;i<=coinflips;i++){ cout << calccoin; }

here few problems code:

for(int i=0;i<=n;i++)

this create i take values 0 n, means come in in loop n+1 times, instead of n times.

return (cout_heads/n);

since both variables cout_headsand n integers, perform integer division, , not floating point division. result 0 or 1 in case.

cout << calccoin;

when phone call function need set parenthesis. calcoin function takes parameter.

c++

mysql - Special characters appearing in HTML format -



mysql - Special characters appearing in HTML format -

i have legacy application developed in perl, apache , mysql.

some of sections in application display html codes character. problem isolated next characters on keyboard:

semicolon comma quotation marks less symbol greater symbol

the table stores info storing info itself. table charset=latin1.

the application using

<meta charset="utf-8" />

in html rendering.

my question "how solve issue"?

should making changes db charset ? ( have multiple places in application broken , multiple tables used in various sections ) should making changes in perl db connection? ( looks best place handle issue mutual module uses db interaction ) module decode/encode special characters.

any other suggestions?

doesn't db charset issue, looks html escaping issue. appears have pre-escaped character entity references in info values unescaped html browser, within text box , escaped. how rendered? ajax code isn't rendering escapes?

https://en.wikipedia.org/wiki/list_of_xml_and_html_character_entity_references#character_entity_references_in_html

html mysql perl browser

EXCEL VBA: IF statement and using reference of other worksheets -



EXCEL VBA: IF statement and using reference of other worksheets -

i have 11 tabs of workbook multiple columns beingness used. worksheets 1200, 1400, 1530, 1600, 1630, 1700, 1730, 1800, 1830, 2000, , 2100. column need focus on column g. want macro scan column g of aforementioned worksheets dollar amounts duplicated, want duplicate dollar amounts alter colors. i'm having problem writing macro if has suggestions i'd appreciate greatly.

excel-vba

javascript - AngularJS jasmine isolateScope() returns undefined -



javascript - AngularJS jasmine isolateScope() returns undefined -

i'm expecting isolated scope out of help-button directive.

it('should contain proper scope, depending on attributes', function() { var el = compile('<help-button context-id="1"></help-button>')(scope); scope.$digest(); console.log("el: " + el); console.log('isolated scope: ' + el.isolatescope()); .. });

-- before each test does

beforeeach(inject(function($compile, $rootscope, $injector) { compile = $compile; scope = $rootscope.$new(); ...

it prints:

'el: [object object]' 'isolated scope: undefined'

the question is: why i'm getting undefined? if there nil in isolated scope, still should empty {} object. anyway - test wrong - not show isolated scope (in real) contains info in there.

i'm stupid.

but reply own question because "a stupid stupid does" - i.e. may 1 1 time same (or myself future).

the problem in helpbutton.html directive using (which did not show/mention in question).

so templateurl referring helpbutton.html file supposed compiled html properly.

once looked @ el.html()'s output got not rendered (there missing tag or something).

thant's why not scope element.

(though nice have kind of exception on log if template not rendered html)

javascript angularjs scope jasmine

c# - CS0161: 'ProductModel.GetProducts(int)': not all code paths return a value -



c# - CS0161: 'ProductModel.GetProducts(int)': not all code paths return a value -

i getting compilation error in next code, please help:

private product getproduct(int id) { seek { using (coffeedbentities db = new coffeedbentities()) { product product = db.products.find(id); } } catch(exception) { homecoming null; } }

you should homecoming product

private product getproduct(int id) { product product =new product(); seek { using (coffeedbentities db = new coffeedbentities()) { product = db.products.find(id); } } catch(exception) { homecoming null; } homecoming product; }

c# asp.net-mvc

graph - How to add a new property to an existing vertex in gremlin? -



graph - How to add a new property to an existing vertex in gremlin? -

i have problem finding way of adding new property existing vertex using gremlin. ex property add: property "name" value "anna".

first seek find vertex want add together property to. by: g.v(id), id id of vertex i'm looking for.

then i've tried adding property vertex doing: g.v(id).property("name","anna"), not work , gives me error saying:

"message":"","error":"javax.script.scriptexception: groovy.lang.missingmethodexception: no signature of method: groovy.lang.missingmethodexception.property() applicable argument types: (java.lang.string, java.lang.string) values:

it says here http://www.tinkerpop.com/docs/3.0.0.m1/#giraph-gremlin under "mutation graph" way add together new property existing vertex.

any suggestions?

you can accomplish sideeffect:

g = tinkergraphfactory.createtinkergraph() g.v[0].map ==>{name=lop, lang=java} g.v[0].sideeffect{it.foo = 'bar'} g.v[0].map ==>{name=lop, foo=bar, lang=java}

i guess in script need add together .iterate() @ end of modification statement.

graph gremlin rexster

jquery - Refresh tag on changing backing Java collection in Struts 2 -



jquery - Refresh <s:select> tag on changing backing Java collection in Struts 2 -

i using 2 <s:select> tags , java collection list in list attribute. on alter of 1 want populate sec dropdown. i've used jquery that, it's called action bean , populated list json response when returned , set values in sec drop down. working fine. jquery code shown below.

$(document).ready(function () { $('#projectnamebox').change(function (event) { var projectnameboxval = $("select#projectnamebox").val(); alert(projectnameboxval); $.getjson('getpackagelistaction.action', { "projectid": projectnameboxval }, function (jsonresponse) { alert(jsonresponse); var packagenameselectbox = $('#packagenamebox'); packagenameselectbox.find('option').remove(); $.each(jsonresponse, function (key, value) { $('<option>').val(key).text(value).appendto(packagenameselectbox); }); }); }); });

now concern when updated sec backing list calling action on alter of first, why have utilize below code set alternative data.

var packagenameselectbox = $('#packagenamebox'); packagenameselectbox.find('option').remove(); $.each(jsonresponse, function (key, value) { $('<option>').val(key).text(value).appendto(packagenameselectbox); });

can refresh component reflect changes of backing list ?

the code used modify element of html dom sec select object reflect changes in info model. , if it's double select scenario, should repopulate info sec select , homecoming in json result. pass parameter projectid in ajax phone call should set first select in value attribute when create alternative selection first select box. parameter set action property can utilize repopulate map sec select box. info has been made one-to-many relationship (project <- package), can have different packages single project. 1 time parameter projectid set can query packages belong project id equals bundle projectid. when info sec select box ready homecoming json result serializes property corresponds sec select box json object. should have different action properties each select box. helps limit json output serialize property sec select box. 1 time json returned client need modify dom of sec select box, can't update json received in ajax callback.

you can see question code example: populating 1 select menu based on select menu using ajax in struts2

java jquery jsp select struts2

php - How to add variables to Twig -



php - How to add variables to Twig -

i want add together values twig object, used when render()/display() template. "assign" function. can find in documentation pass array render()/display().

for example, want flow like:

$twig = makenewtwigetc(); ... ... $twig->assign('error','bad username/password'); ... ... $twig->display('login-form.html'); ... twig template file can output error {{ error }}

your illustration error message not siutable situation, error messages sent flashbags, if want declare global twig variables there ways can do:

in parameters.yml file set variable - ex, sitename: site name, in config.yml file under twig section -> globals section set it,

for ex:

# twig configuration twig: globals: sitename: "%sitename%"

after can utilize in template files sitename

if variable more complicated , can extend twig, add together global variable addglobal() method, can find more info here

php symfony2 templates twig

php - Password Case Sensitivity using BINARY from MYSQL to SQLSRV -



php - Password Case Sensitivity using BINARY from MYSQL to SQLSRV -

i wonder if can help me here.

basically, i'm trying create login script case-sensitive when inputting password.

i made work in php mysql using below code, using binary:

$qry="select * studentrecords username='$login' , password=**binary**'".($_post['password'])."'";

i've tried using in php sqlsrv, not working.

anyone can tell me alternative way or how create work in php sqlsrv?

thanks in advance, i'll appreciate alot.

your sql server database's default search alternative case insensitive. can alter setting query below using collate:

$qry="select * studentrecords username='$login' , password collate latin1_general_cs_as ='".($_post['password'])."'";

you should @ usage of parameterized queries avoiding sql injections. microsoft's official sqlsrv driver api reference has examples.

much more info collate

php mysql case-sensitive sqlsrv

c# - Namespace path in WPF XAML -



c# - Namespace path in WPF XAML -

i have content directory in main solution. in content catalog have 2 catalogs: viewmodels , views

in xaml, have declared:

xmlns:vm ="clr-namespace:appname.content"

now, want reference class in viewmodel catalog:

<datatemplate datatype="{x:type vm:laserpathviewmodel}">

i know thats wrong because namespace of laserpathviewmodel appname.content.viewmodels.

but how reference without add together next 1 namespace declaration?

you don't. have declare other namespace. 1 way adding namespace declaration:

xmlns:vm2 ="clr-namespace:appname.content.viewmodel"

and can utilize this:

<datatemplate datatype="{x:type vm2:laserpathviewmodel}">

but there way declare namespaces. can utilize xmlnsattribute allows map multiple .net namespaces 1 x(a)ml namespace. can find nice explanation here.

c# wpf xaml

Why can traits in scala.collection create an instance? -



Why can traits in scala.collection create an instance? -

i trying next code in scala, coming an overview of collections api.

import collection._ scala> traversable(1, 2, 3) res5: traversable[int] = list(1, 2, 3) scala> iterable("x", "y", "z") res6: iterable[string] = list(x, y, z) scala> map("x" -> 24, "y" -> 25, "z" -> 26) res7: scala.collection.map[string,int] = map(x -> 24, y -> 25, z -> 26) scala> sortedset("hello", "world") res9: scala.collection.sortedset[string] = treeset(hello, world) scala> indexedseq(1.0, 2.0) res11: indexedseq[double] = vector(1.0, 2.0)

the result shows trait can phone call apply method create instance of implementation. after looking scala.collection.package object, found nothing. think there must somewhere binds trait subclass , imports program. can explain is?

you're calling apply on trait's companion object, not on trait.

for example, traversable:

the trait

the object

if click on apply in companion object's scaladoc, can see traversable object inherits apply method genericcompanion, has link source can see how it's implemented.

scala collections

redhat - Drupal core - SQL injection aftermath procedures -



redhat - Drupal core - SQL injection aftermath procedures -

our production site run has potentially been compromised saw big spike in network traffic, brought downwards site.

since theft has potentially happen before our patching, steps should go through informing our client. need create password changes admin login, etc. else relevant? need alter db password on our server etc.

basically yes, of above.

there flow chart on [drupalgeddon project page] (https://www.drupal.org/project/drupalgeddon) can follow help ensure dealing clean site.

good luck

redhat mariadb

spring - ClassCastException: Can't cast oracle.sql.ARRAY to oracle.sql.ARRAY in JBoss 7.1.1.Final -



spring - ClassCastException: Can't cast oracle.sql.ARRAY to oracle.sql.ARRAY in JBoss 7.1.1.Final -

demoapp spring integration project deployed in jboss 7.1.1.final

the result returned stored procedure contains object of oracle.sql.array (object referring ojdbc jar of jboss module)

and tried converting oracle.sql.array throwing exception

code:

url resultjarlocation= resultmap.get("returnobj").getclass().getprotectiondomain().getcodesource().getlocation(); url appjarlocation = oracle.sql.array.class.getprotectiondomain().getcodesource().getlocation(); system.out.println("resultjarlocation : " + resultjarlocation); system.out.println("appjarlocation : " + appjarlocation); oracle.sql.array returnobj=(oracle.sql.array)resultmap.get("returnobj");

exception:

org.springframework.messaging.messagehandlingexception: java.lang.classcastexception: oracle.sql.array cannot cast oracle.sql.array

the application array class referring ojdbc jar in deployed application. result set array class referreing ojdbc jar jboss module sys output:

resultjarlocation : jar:file:/<jboss_home>/modules/com/oracle/ojdbc6/main/ojdbc6.jar appjarlocation : vfs:/<jboss_home>/bin/content/demoapp.war/web-inf/lib/ojdbc6.jar

you trying cast between classes loaded different classloaders. jvm distinguishes classes not name , bundle classloader used. in other words, jvm perspective trying cast string long; cannot. think can configuration. set either same classloader used, or classloaders in same hierarchy, take advantage of delegation.

i not familiar jboss (especially current versions) know has (or used have in past) different classloading strategy other application servers. checking documentation on classloading first option.

spring oracle oracle11g jboss7.x classloader

postgresql - query with not equal doesn't work -



postgresql - query with not equal doesn't work -

this dumb question still, i'm trying write not equal clause postgresql documentation show sign <> or != both homecoming 0 results on integer field.

select userid users usertype <> 2; select userid users usertype != 2;

the table looks this:

create table users( userid bigserial primary key not null, name varchar (50) not null, phonenumber varchar (20) unique not null, usertype integer null );

note: next workaround worka , homecoming results

select userid users usertype < 2 or usertype > 2;

i wondering if encounter same problem?

postgresql

c# - How to determine whether the object is a value type -



c# - How to determine whether the object is a value type -

i utilize type.isvaluetype figure out in straightforward way in .net 4.5, when create universal apps using portable library, doesn't have equivalent method find if type value or not.

is there other trick finding this?

try type.gettypeinfo().isvaluetype. create sure have using statement system.reflection, gettypeinfo() extension method available.

c# .net-4.5 portable-class-library

ios - Centering Bootstrap navbar items only on iPad portrait orientation? -



ios - Centering Bootstrap navbar items only on iPad portrait orientation? -

is possible?

i have been trying center navbar items next media query:

@media screen , (min-device-width : 768px) , (max-device-width : 1024px) , (orientation : portrait) { .navbar .navbar-nav .navbar-right>li { display: inline-block; float: none; vertical-align: top; } .navbar .navbar-collapse { text-align: center; } }

i've tried

margin: 0 auto;

here http://jsfiddle.net/slhxq16p/3/

@media handheld, screen , (min-width: 768px), screen , (min-device-width: 768px), screen , (max-width: 1024px), screen , (max-device-width: 1024px) , (orientation: portrait) { .nav li { text-align: center; } }

ipad portrait ( ipad 3 , 4)

@media screen , (min-device-width : 768px) , (max-device-width : 1024px) , (orientation : portrait) , (-webkit-min-device-pixel-ratio: 2) { .nav li { text-align: center; } }

ipad portrait (ipad 1 , 2)

@media screen , (min-device-width : 768px) , (max-device-width : 1024px) , (orientation : portrait) , (-webkit-min-device-pixel-ratio: 1) { .nav li { text-align: center; } }

ios css twitter-bootstrap ipad

java - Cannot compile openjdk7 source code on CentOS6.5 -



java - Cannot compile openjdk7 source code on CentOS6.5 -

i trying compile openjdk source code on centos6.5, , got next error message while running make. if can help? in advance.

software version: jdk: openjdk-7u40-fcs-src-b43-26_aug_2013 os: linux 2.6.32-431.el6.x86_64

make[6]: leaving directory /usr/local/openjdk/build/linux-amd64-debug/hotspot/outputdir/linux_amd64_compiler2/jvmg' cd linux_amd64_compiler2/jvmg && ./test_gamma using java runtime at: /usr/lib/jvm/java-1.6.0-openjdk.x86_64/jre ./gamma: relocation error: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/amd64/libjava.so: symbol jvm_findclassfromcaller, version sunwprivate_1.1 not defined in file libjvm.so link time reference make[5]: *** [jvmg] error 127 make[5]: leaving directory/usr/local/openjdk/build/linux-amd64-debug/hotspot/outputdir' make[4]: * [generic_build2] error 2 make[4]: leaving directory /usr/local/openjdk/hotspot/make' make[3]: *** [jvmg] error 2 make[3]: leaving directory/usr/local/openjdk/hotspot/make' make[2]: * [hotspot-build] error 2 make[2]: leaving directory /usr/local/openjdk' make[1]: *** [generic_debug_build] error 2 make[1]: leaving directory/usr/local/openjdk'

editor file hotspot/make/linux/makefile,and delete test_gamma in makefile. past!

java centos openjdk

vba - Keeping out VBE Editor Window Flicker -



vba - Keeping out VBE Editor Window Flicker -

there have been posts this, seems i'm doing wrong, window still flickering. here's relevant part of code:

private declare function lockwindowupdate lib "user32" (byval hwndlock long) long private declare function findwindow lib "user32" alias "findwindowa" (byval classname string, byval windowname string) long 170 oexcel.vbe.mainwindow.visible = false 180 vbehwnd = findwindow("wndclass_desked_gsk", oexcel.vbe.mainwindow.caption) 190 if vbehwnd lockwindowupdate vbehwnd 200 mb.vbproject.vbcomponents(mb.worksheets(sht.name).codename).codemodule 210 .insertlines line:=.createeventproc("click", printbut.name) + 1, string:=vbcrlf & "call sheet4.printbutton" 220 end 230 oexcel.vbe.mainwindow.visible = false 240 lockwindowupdate 0&

what doing wrong? (the code based on cpearson's code).

thanks help.

i've tried , couldn't work. alternative (not preferable) ended using is:

170 oexcel.vbe.mainwindow.visible = false 180 curpos = oexcel.vbe.mainwindow.left 190 oexcel.vbe.mainwindow.left = 10000 200 mb.vbproject.vbcomponents(mb.worksheets(sht.name).codename).codemodule 210 .insertlines line:=.createeventproc("click", printbut.name) + 1, string:=vbcrlf & "call sheet4.printbutton" 220 end 230 oexcel.vbe.mainwindow.visible = false 240 oexcel.vbe.mainwindow.left = curpos

vba excel-vba vb6

datetime - How to make MySQL() NOW() function use client's timezone? -



datetime - How to make MySQL() NOW() function use client's timezone? -

i using now() function store date , time, server timezone ( own ) not work whole world.

what want now() utilize client timezone, whichever may be.

how can achieved?

now() executes on current execution timezone (db server timezone). can utilize convert_tz(dt,from_tz,to_tz) function along now() different timezone representation like

select convert_tz(now(),'gmt','est');

either way, unless determine tz info of client; @ db end, db server has no way determining that.

mysql datetime timezone

c# - WPF: Updating private setter variable IS not raising propertyChanged event handler -



c# - WPF: Updating private setter variable IS not raising propertyChanged event handler -

my view model has next code. i'm using mvvmlight

class settingsviewmodel : viewmodelbase { public settingsviewmodel() { } string _customername; public string customername { { homecoming _customername; } set { if (_customername == value) return; _customername = value; raisepropertychanged("customername"); } } private void _changenameprivate() { this._customername = "someprivatename"; } private void _changenamepublic() { this.customername = "somepublicname"; } }

my question when phone call _changenameprivate raisepropertychanged event handler not raised. it's raised when phone call _changenamepublic function. shouldn't updating private variable raise property changed event ?

as @dkozl , @ben said, expected:

the code provided, phone call raisepropertychanged event handler in set section of customername property:

public string customername { { homecoming _customername; } set { if (_customername == value) return; _customername = value; raisepropertychanged("customername"); } }

as such, in _changenamepublic() changes value of property phone call set section , raise raisepropertychanged handler. in _changenameprivate(), assign value field _customername.

c# wpf mvvm

lambda - Usage of function type congruent lamdba expressions in Java 8 -



lambda - Usage of function type congruent lamdba expressions in Java 8 -

i struggle definition , usage of

stream.collect(supplier<r> supplier, biconsumer<r,? super t> accumulator, biconsumer<r,r> combiner)

method in java 8.

the method signature includes biconsumer typed parameters. biconsumer functionalinterface defines 1 functional method accept(object, object). far understand can utilize lambda look congruent functional interface.

but illustration mentioned in stream.collect javadoc e.g.

list<string> aslist = stringstream.collect(arraylist::new, arraylist::add, arraylist::addall);

i not understand why arraylist.add(e e) (single parameter) congruent biconsumer.accept(t t, u u) method (two parameters) , can used accumulator function in collect method.

as see have lack of understanding , appreciate explanation.

the accumulator biconsumer's 2 parameters (1) list , (2) item add together it. this:

list<string> aslist = stringstream.collect( arraylist::new, arraylist::add, arraylist::addall );

is equivalent this:

list<string> aslist = stringstream.collect( () -> new arraylist<>(), (list, item) -> list.add(item), (list1, list2) -> list1.addall(list2) );

which give same result this:

list<string> aslist = stringstream.collect( new supplier<arraylist<string>>() { @override public arraylist<string> get() { homecoming new arraylist<>(); } }, new biconsumer<arraylist<string>,string>() { @override public void accept(arraylist<string> list, string item) { list.add(item); } }, new biconsumer<arraylist<string>,arraylist<string>>() { @override public void accept(arraylist<string> list1, arraylist<string> list2) { list1.addall(list2); } } );

java lambda

Associate array dependency for dependency injection in PHP OOP? -



Associate array dependency for dependency injection in PHP OOP? -

how doing deal class lots of dependency injections?

can store dependencies in an associate array , pass them in one?

class auth { // set props. protected $deps; protected $database; protected $constant; protected $passwordhash; // , on... /** * build data. */ public function __construct($deps) { // set di. $this->deps = $deps; $this->database = $this->deps['database']; $this->passwordhash = $this->deps['passwordhash']; // , on... } }

in container,

// set deps. $deps = [ "database" => $database, "passwordhash" => new passwordhash(hash_cost_log2, hash_portable), // , on... ]; // instantiate auth. // provide deps. $auth = new auth($deps);

i haven't done test unit test before. associate array dependency acceptable in design patter of di. can tested?

or improve solutions have got?

injecting array feels wrong. using constructor injection supposed forcefulness client inject dependencies. injecting array contains dependencies not forcefulness client @ all.

if of methods in auth class depends on objects have passed constructor in array, sense free , define dependencies separate parameters in constructor. if not, consider changing design. may have combined many functionality single class. if ok design of class , lets 2 methods depend on database, other 3 depend on passwordhash, 1 depends on session, etc., utilize setter injection non-common dependencies , inject them need them.

php arrays oop multidimensional-array dependency-injection

java - Translating what an exception catches -



java - Translating what an exception catches -

i have code snippet working on:

public void readfile() { bufferedreader reader = null; bufferedreader reader2 = null; seek { reader = new bufferedreader(new filereader("c:/users/user/desktop/testing.txt")); reader2 = new bufferedreader(new filereader("c:/users/user/desktop/testnotthere.txt")); } grab (filenotfoundexception e) { system.err.println("error: file not found!\n"); } string line = null; seek { while ((line = reader.readline()) != null) { system.out.print(line); } } grab (ioexception e) { e.printstacktrace(); } }

and while understand first exception snippet detects: catch (filenotfoundexception e), looking understand sec exception looking while printing lines of text file:

catch (ioexception e) { e.printstacktrace(); }

can explain sec exception looking for? furthermore, how can test create sure exception thrown in snippet did creating sec bufferedreader reader2?

ioexception thrown when programme interrupted while reading file. may see, io stands "input/output" means reading , writing info on disk. exception of kind means scheme crashed while while doing reading/writing.

source: http://docs.oracle.com/javase/7/docs/api/java/io/ioexception.html

java try-catch

matlab - Calculate a "running" maximum of a vector -



matlab - Calculate a "running" maximum of a vector -

i have next matrix keeps track of starting , ending points of info ranges (the first column represents "starts" , sec column represents "ends"):

mymatrix = [ 162 199; %// represents range 162:199 166 199; %// represents range 166:199 180 187; %// , on... 314 326; 323 326; 397 399; 419 420; 433 436; 576 757; 579 630; 634 757; 663 757; 668 757; 676 714; 722 757; 746 757; 799 806; 951 953; 1271 1272 ];

i need eliminate ranges (ie. rows) contained within larger range nowadays in matrix. illustration ranges [166:199] , [180:187] contained within range [162:199] , thus, rows 2 , 3 need removed.

the solution thought of calculate sort of "running" max on sec column subsequent values of column compared determine whether or not need removed. implemented utilize of for loop follows:

currentmax = mymatrix(1,2); %//set first value maximum [sizeofmatrix,~] = size(mymatrix); %//determine number of rows rowstoremove = false(sizeofmatrix,1); %//pre-allocate final vector of logicals m=2:sizeofmatrix if mymatrix(m,2) > currentmax %//if new max reached, update currentmax... currentmax = mymatrix(m,2); else rowstoremove(m) = true; %//... else mark row removal end end mymatrix(rowstoremove,:) = [];

this correctly removes "redundant" ranges in mymatrix , produces next matrix:

mymatrix = 162 199 314 326 397 399 419 420 433 436 576 757 799 806 951 953 1271 1272

onto questions:

1) seem there has improve way of calculating "running" max for loop. looked accumarray , filter, not figure out way functions. there potential alternative skips for loop (some kind of vectorized code more efficient)?

2) there different (that is, more efficient) way accomplish final goal of removing ranges contained within larger ranges in mymatrix? don't know if i'm over-thinking whole thing...

approach #1

bsxfun based brute-force approach -

mymatrix(sum(bsxfun(@ge,mymatrix(:,1),mymatrix(:,1)') & ... bsxfun(@le,mymatrix(:,2),mymatrix(:,2)'),2)<=1,:)

few explanations on proposed solution:

compare starts indices against each other "contained-ness" , ends indices. note "contained-ness" criteria has either of these 2 :

greater or equal starts , lesser or equal ends lesser or equal starts , greater or equal ends.

i happen go first option.

see rows satisfy @ to the lowest degree 1 "contained-ness" , remove have desired result.

approach #2

if okay output has sorted rows according first column , if there lesser number of local max's, can seek alternative approach -

mymatrix_sorted = sortrows(mymatrix,1); col2 = mymatrix_sorted(:,2); max_idx = 1:numel(col2); while 1 col2_selected = col2(max_idx); n = numel(col2_selected); labels = cumsum([true ; diff(col2_selected)>0]); idx1 = accumarray(labels, 1:n ,[], @(x) findmax(x,col2_selected)); if numel(idx1)==n break; end max_idx = max_idx(idx1); end out = mymatrix_sorted(max_idx,:); %// desired output

associated function code -

function ix = findmax(indx, s) [~,ix] = max(s(indx)); ix = indx(ix); return;

matlab matrix vectorization

security - What are the best practices for avoiding xss attacks in a PHP site -



security - What are the best practices for avoiding xss attacks in a PHP site -

i have php configured magic quotes on , register globals off.

i best phone call htmlentities() outputing derived user input.

i seach database mutual things used in xss attached such as...

<script

what else should doing , how can create sure things trying always done.

escaping input not best can successful xss prevention. output must escaped. if utilize smarty template engine, may utilize |escape:'htmlall' modifier convert sensitive characters html entities (i utilize own |e modifier alias above).

my approach input/output security is:

store user input not modified (no html escaping on input, db-aware escaping done via pdo prepared statements) escape on output, depending on output format utilize (e.g. html , json need different escaping rules)

php security xss

objective c - iCloud Core Data IOS8 Path is outside of any CloudDocs Container -



objective c - iCloud Core Data IOS8 Path is outside of any CloudDocs Container -

my icloud core info app running great on ios7 , ready launch. when test on ios 8 next error , can't seem prepare when trying upload info icloud.

i suspect problem related how getting document directory , changes in doc directory ios8 can't figure out..

014-10-12 15:14:17.862 xxxxxxx [4662:236693] __45-[pfubiquityfilepresenter processpendingurls]_block_invoke(439): coredata: ubiquity: librarian returned serious error starting downloads error domain=brclouddocserrordomain code=6 "the operation couldn’t completed. (brclouddocserrordomain error 6 - path outside of clouddocs container, never sync)" userinfo=0x7f8b1a525f60 {nsdescription=path outside of clouddocs container, never sync, nsfilepath=/users/garyrea/library/developer/coresimulator/devices/9aadfe8e-5ecc-4969-9418-57da45b747c9/data/containers/data/application/ad2e5e62-7295-4371-a08d-1790e8fccd96/documents/coredataubiquitysupport/nobody~sima28745a4-a67f-598c-9260-f9ac36609ecf/icloud/5b8bfa36-1aca-4966-b7ed-a7344d36acf1/container/nobody~sima28745a4-a67f-598c-9260-f9ac36609ecf/icloud/2trlqdmqvpj~wlefilvjwtqfruj8yincd84kw_xiw4a=/f0cf5f29-d437-4728-b0a2-c5bb90bbc239.1.cdt} userinfo { nsdescription = "path outside of clouddocs container, never sync"; nsfilepath = "/users/garyrea/library/developer/coresimulator/devices/9aadfe8e-5ecc-4969-9418-57da45b747c9/data/containers/data/application/ad2e5e62-7295-4371-a08d-1790e8fccd96/documents/coredataubiquitysupport/nobody~sima28745a4-a67f-598c-9260-f9ac36609ecf/icloud/5b8bfa36-1aca-4966-b7ed-a7344d36acf1/container/nobody~sima28745a4-a67f-598c-9260-f9ac36609ecf/icloud/2trlqdmqvpj~wlefilvjwtqfruj8yincd84kw_xiw4a=/f0cf5f29-d437-4728-b0a2-c5bb90bbc239.1.cdt"; } these urls: ( "file:///users/garyrea/library/developer/coresimulator/devices/9aadfe8e-5ecc-4969-9418-57da45b747c9/data/containers/data/application/ad2e5e62-7295-4371-a08d-1790e8fccd96/documents/coredataubiquitysupport/nobody~sima28745a4-a67f-598c-9260-f9ac36609ecf/icloud/5b8bfa36-1aca-4966-b7ed-a7344d36acf1/container/nobody~sima28745a4-a67f-598c-9260-f9ac36609ecf/icloud/2trlqdmqvpj~wlefilvjwtqfruj8yincd84kw_xiw4a=/f0cf5f29-d437-4728-b0a2-c5bb90bbc239.1.cdt" )

my app delegate extension code create persistent store follows. have seed database first time installation.

- (nspersistentstorecoordinator *)createpersistentstorecoordinator{ nspersistentstorecoordinator *persistentstorecoordinator = nil; nsmanagedobjectmodel *managedobjectmodel = [self createmanagedobjectmodel]; persistentstorecoordinator = [[nspersistentstorecoordinator alloc]initwithmanagedobjectmodel:managedobjectmodel]; nsurl *storeurl = [[self applicationdocumentsdirectory] urlbyappendingpathcomponent:@ "coredata.sqlite"]; if (![[nsfilemanager defaultmanager]fileexistsatpath:[storeurl path]]){ nsurl *preloadurl=[nsurl fileurlwithpath:[[nsbundle mainbundle]pathforresource:@"seeddatabase" oftype:@ "sqlite"]]; nserror *error=nil; if (![[nsfilemanager defaultmanager] copyitematurl:preloadurl tourl:storeurl error:&error]){ nslog(@ "file couldnt save"); } } nsubiquitouskeyvaluestore *kvstore=[nsubiquitouskeyvaluestore defaultstore]; if (![kvstore boolforkey:@"seeded_data"]){ nslog (@ "in new database"); nsurl *seedstoreurl=[nsurl fileurlwithpath:[[nsbundle mainbundle]pathforresource:@"seeddatabase" oftype:@ "sqlite"]]; nserror *seedstoreerrpr; nsdictionary *seedstoreoptions=@{nsreadonlypersistentstoreoption: @yes}; nspersistentstore *seedstore=[persistentstorecoordinator addpersistentstorewithtype:nssqlitestoretype configuration:nil url:seedstoreurl options:seedstoreoptions error:&seedstoreerrpr]; nsdictionary *icloudoptions =@{nspersistentstoreubiquitouscontentnamekey: @"icloud", nsmigratepersistentstoresautomaticallyoption:@yes, nsinfermappingmodelautomaticallyoption:@yes }; nsoperationqueue *queue=[[nsoperationqueue alloc] init]; [queue addoperationwithblock:^{ nserror *error; [persistentstorecoordinator migratepersistentstore:seedstore tourl:storeurl options:icloudoptions withtype:nssqlitestoretype error:&error]; nslog(@ "persistant store migrated"); [kvstore setbool:yes forkey:@ "seeded_data"]; // [self checkforduplicates]; }]; }else{ nserror *error; nsdictionary *storeoptions =@{nspersistentstoreubiquitouscontentnamekey: @ "icloud" }; if (![persistentstorecoordinator addpersistentstorewithtype:nssqlitestoretype configuration:nil url:storeurl options:storeoptions error:&error]) { nslog(@ "unresolved error %@, %@", error, [error userinfo]); abort(); } } homecoming persistentstorecoordinator; } - (nsurl *)applicationdocumentsdirectory{ homecoming [[[nsfilemanager defaultmanager] urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lastobject]; }

i able resolve error specifying icloud drive directory (same name 1 on developer.apple.com interface).

-(nsurl *)clouddirectory { nsfilemanager *filemanager=[nsfilemanager defaultmanager]; nsstring *teamid=@"icloud"; nsstring *bundleid=[[nsbundle mainbundle]bundleidentifier]; nsstring *cloudroot=[nsstring stringwithformat:@"%@.%@",teamid,bundleid]; nsurl *cloudrooturl=[filemanager urlforubiquitycontaineridentifier:cloudroot]; nslog (@"cloudrooturl=%@",cloudrooturl); homecoming cloudrooturl; }

and including in icloudoptions dictionary nspersistentstoreubiquitouscontenturlkey

nsdictionary *storeoptions =@{nspersistentstoreubiquitouscontentnamekey: @"icloud", nspersistentstoreubiquitouscontenturlkey:[self clouddirectory], };

i getting unusual errors removed app devices, deleted icloud drive file , re ran on actual device , worked fine. not sure if runs on ios7 since specified nspersistentstoreubiquitouscontenturlkey pretty confident should fine.

objective-c core-data ios8 icloud

seo - Are local robots.txt files read by Facebook and Google? -



seo - Are local robots.txt files read by Facebook and Google? -

i have folder half public: url not linked, people know url few friends (which not link it) , cryptic plenty create sure nobody lands there accident.

however, link send via googlemail , facebook messages. there way tell facebook , google in local robots.txt file not index page?

when add together "global" robots.txt file takes there see in /secret-folder-12argoe22v4 might interesting. not that. facebook / google @ /secret-folder-12argoe22v4/robots.txt?

the content be

user-agent: * disallow: .

or

user-agent: * disallow: /secret-folder-12argoe22v4/

as cbroe mentioned, robots.txt file must @ top level of site. if set in subdirecory, ignored. 1 way can block directory without publicly revealing total name block part of it, this:

user-agent: * disallow: /secret

this block url starts "/secret", including "/secret-folder-12argoe22v4/".

i should point out above not 100% reliable way maintain files out of search engines. maintain search engines straight crawling directory, can still show in search results if other site links it. may consider using robots meta tags instead, won't prevent straight next off-site link. reliable way maintain directory private set behind password.

facebook seo robots.txt

visual studio 2012 - tf.exe info /version:T does not get latest -



visual studio 2012 - tf.exe info /version:T does not get latest -

i using tf.exe latest info of path but

tf.exe info $/path /version:t

only gives me first info. need latest ones obviously. using vs2013 , build-in history can see latest.

what problem?

you're requesting info root directory. such folders created 1 time , such have one history element. when @ history list in visual studio, you're looking @ recursive history (of folder , subfolders , files under it).

tf info has /recursive option, list latest version of each file in source command (which isn't helpful).

i suspect you're after results tf info returns, if update question explain need, there might command can help you.

if you're looking latest changeset number under specific path, tf changeset /latest /noprompt might work you.

visual-studio-2012 tfs tfs2012 tf tfvc

nullpointerexception - Processing button class -



nullpointerexception - Processing button class -

the exercise follows:

rewrite programming exercise 3 lecture 6 creating class called button replace arrays. a) create class , define class variables hold info position, dimensions , color. in add-on class variable should made, contains title of particular button. utilize constructor set initial values of class variables.

so basically, have convert previous exercise have done class. how made previous exercise in case need it: http://pastebin.com/rqm6hj6k

so tried convert class, apparently gives me error , cannot see how prepare it. teached said don't have maintain array, , instead create many variables instead of info in array.

the language processing , gives error code nullpointerexception

class button { int[] nums; button(int n1, int n2, int n3, int n4) { nums[0] = n1; nums[1] = n2; nums[2] = n3; nums[3] = n4; } void display() { fill(255, 0, 0); rect(nums[0], nums[1], nums[2], nums[3]); } }; void setup() { size(800, 800); button butt = new button(75, 250, 200, 200); butt.display(); }

you're declared nums, not initialized it. results in nullpointerexception: in constructor you're accessing nums[0], nums doesn't have length yet. seek this:

class button { //remember initialize/allocate array int[] nums = new int[4]; button(int n1, int n2, int n3, int n4) { nums[0] = n1; nums[1] = n2; nums[2] = n3; nums[3] = n4; } void display() { fill(255, 0, 0); rect(nums[0], nums[1], nums[2], nums[3]); } }; void setup() { size(800, 800); button butt = new button(75, 250, 200, 200); butt.display(); }

in future, create sure variables seek access properties of(arrays/objects) initialized/allocated first(otherwise you'll nullpointerexception 1 time again , it's no fun)

as @v.k. nicely points out, it's improve have readable code , remove of redundancy. before x,y,width , height of button stored in array. array do: store info , that's it! class can not store same info individual easy read properties, can do more: functions! (e.g. display())

so, more readable version:

class button { //remember initialize/allocate array int x,y,width,height; button(int x,int y,int width,int height) { this.x = x; this.y = y; this.width = width; this.height = height; } void display() { fill(255, 0, 0); rect(x,y,width,height);//why don't utilize this.here or everywhere ? } }; void setup() { size(800, 800); button butt = new button(75, 250, 200, 200); butt.display(); }

yeah, it's sorta easier read, what's deal this may inquire ? well, it's keyword allows gain access object's instance (which ever may in future when take instantiate) , hence it's properties (classes version of variables) , methods (classes version of functions). there's quite lot of neat things larn in terms of oop in java, can take 1 step @ time nice , visual approach in processing. if haven't already, check out daniel shiffman's objects tutorial

best of luck learning oop in processing!

class nullpointerexception processing

c# - How to set DataContext in a Dialog Window to its parent's DataContext -



c# - How to set DataContext in a Dialog Window to its parent's DataContext -

i created new window phone call using next code:

nieuwsimulatie niewsimulatiewindow = new nieuwsimulatie() { owner = }; bool? simulatieaangemaakt = niewsimulatiewindow.showdialog();

in window "nieuwsimulatie" i'd have same datacontext in mainwindow, or databind controls straight datacontext using relativesource geuss, ive tried:

<controls:splitbutton x:name="projectnaam" displaymemberpath="projectnaam" itemssource="{binding static.projecten, relativesource={relativesource mode=findancestor, ancestortype=controls:metrowindow}}"/>

but doesn't work.

please help me either prepare databinding or help me set datacontext of window datacontext behind mainwindow.

i've have acces datacontext create window, how that:

nieuwsimulatie niewsimulatiewindow = new nieuwsimulatie() { owner = this, datacontext = yourdatacontext; }; bool? simulatieaangemaakt = niewsimulatiewindow.showdialog();

c# wpf data-binding

Date Validation android java -



Date Validation android java -

i have 2 date time picker in projects, start date , end date, problem allow say, if take 18/10/2014 start date, end date 1/11/2014, end date invalid day 1 invalid smaller day 18. need help this

//start date tablerow r8 = new tablerow(this); textview tvstartdate = new textview(this); tvstartdate.settext("start date: "); final edittext etstartdate = new edittext(this); etstartdate.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub calendar datenow = calendar.getinstance(); int year = datenow.get(calendar.year); int month = datenow.get(calendar.month); int day = datenow.get(calendar.day_of_month); datepickerdialog dp; dp = new datepickerdialog(addpetactivity.this, new ondatesetlistener() { public void ondateset(datepicker datepicker, int selectedyear, int selectedmonth, int selectedday) { // todo auto-generated method stub selectedmonth = selectedmonth + 1; etstartdate.settext("" + selectedday + "/" + selectedmonth + "/" + selectedyear); } }, year, month, day); dp.settitle("select date"); dp.show(); } }); r8.addview(tvstartdate); r8.addview(etstartdate); tb.addview(r8); //end date tablerow r9 = new tablerow(this); textview tvenddate = new textview(this); tvenddate.settext("end date: "); final edittext etenddate = new edittext(this); etenddate.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub calendar datenow = calendar.getinstance(); int year = datenow.get(calendar.year); int month = datenow.get(calendar.month); int day = datenow.get(calendar.day_of_month); datepickerdialog dp; dp = new datepickerdialog(addpetactivity.this, new ondatesetlistener() { public void ondateset(datepicker datepicker, int selectedyear, int selectedmonth, int selectedday) { // todo auto-generated method stub selectedmonth = selectedmonth + 1; etenddate.settext("" + selectedday + "/" + selectedmonth + "/" + selectedyear); } }, year, month, day); dp.settitle("select date"); dp.show(); } }); r9.addview(tvenddate); r9.addview(etenddate); tb.addview(r9); =========================================================================================

for validation part startdate , end date

else if (checkdate(today, etstartdate.gettext().tostring()) == false) toast.maketext(getapplicationcontext(), "invalid start date!", toast.length_short).show(); else{ if (!etenddate.gettext().tostring().matches("")) { if (checkdate( etstartdate.gettext().tostring(), etenddate.gettext().tostring()) == false) toast.maketext(getapplicationcontext(), "invalid end date!", toast.length_short).show(); =========================================================================================

last part

private boolean checkdate(string fromdate, string todate) { simpledateformat sdf = new simpledateformat("dd/mm/yyyy"); date datefrom = null; date dateto = null; seek { datefrom = sdf.parse(fromdate); dateto = sdf.parse(todate); } grab (parseexception e) { // todo auto-generated grab block e.printstacktrace(); } if (dateto.after(datefrom) == true) homecoming true; else homecoming false; }

to compare date utilize methode :date.compareto(anotherdate):

this simple illustration , can utilize method homecoming result

try{ simpledateformat sdf = new simpledateformat("dd/mm/yyyy"); //edit here date date1 = sdf.parse("2009-12-31"); date date2 = sdf.parse("2010-01-31"); system.out.println(sdf.format(date1)); system.out.println(sdf.format(date2)); if(date1.compareto(date2)>0){ system.out.println("date1 after date2"); }else if(date1.compareto(date2)<0){ system.out.println("date1 before date2"); }else if(date1.compareto(date2)==0){ system.out.println("date1 equal date2"); }else{ system.out.println("how here?"); } }catch(parseexception ex){ ex.printstacktrace(); }

for case :

private boolean checkdate(string fromdate, string todate) { boolean result=false; try{ simpledateformat sdf = new simpledateformat("dd/mm/yyyy"); //edit here date datestart = sdf.parse(fromdate); date dateend = sdf.parse(todate); if(datestart .compareto(dateend)>0){ system.out.println("datestart after dateend "); result=false; }else if(datestart .compareto(dateend)<0){ system.out.println("datestart before dateend "); result=true; }else if(datestart .compareto(dateend)==0){ system.out.println("datestart equal dateend "); result=true; }else{ system.out.println("how here?"); } }catch(parseexception ex){ ex.printstacktrace(); } homecoming result; }

java android date

c# - Enums to predicates of lambda expression -



c# - Enums to predicates of lambda expression -

i've been searching how convert enums predicate in lambda expression/linq query ef. example, have below enums:

public enum myenum { [display(displayname="firstdesc") first = 0, [display(displayname="seconddesc")] sec = 1, [display(displayname="thirddesc")] 3rd = 2 }

and linq query is

var query = (from in context.users select new { desc = case when status==(int)myenum.first ? "firstdesc" : case when status==(int)myenum.second ? "seconddesc": case when status==(int)myenum.third ? "thirddesc" : "unknown" });

i want accomplish 1 time add together new item enum, linq query automatically adjust status items in enum.

any help appreciated.

c# linq entity-framework enums

initialization - Custom initialisation with NSMutableArray in Swift -



initialization - Custom initialisation with NSMutableArray in Swift -

i have custom scrollview init below in swift

class customscrollview:uiscrollview,uiscrollviewdelegate { private allow unitlabelwidth:cgfloat = kscreenwidth / 3 private allow displayedunits:nsmutablearray? init(frame: cgrect,unitdata:nsmutablearray,scrolltype:int) { super.init(frame: frame) unitdata.addobject("") unitdata.addobject("") self.pagingenabled = false self.delegate = self self.scrollidentifier = scrolltype self.displayedunits = unitdata } required init(coder adecoder: nscoder) { fatalerror("init(coder:) has not been implemented") } }

as can see, "unitdata" nsmutablearray parameter passed , adding objects array in custom init. it's simple one.

now when creating objects of scrollview class, getting output not able comprehend.

take @ below code

func unitcreation(){ allow units:nsmutablearray = nsmutablearray(objects:"unit1","unit2") allow unitlabelwidth = kscreenwidth / 3 allow fromunitscroll = customscrollview(frame: cgrectmake(0, 0, kscreenwidth, scrollheight),unitdata: units,scrolltype:1) mainview?.addsubview(fromunitscroll) println(units) allow tounitscroll = customscrollview(frame: cgrectmake(0, fromunitscroll.frame.origin.y + scrollheight * 3, kscreenwidth, scrollheight),unitdata: units,scrolltype:2) mainview?.addsubview(tounitscroll) }

i have array constant called "units" 2 objects "unit1" , "unit2". when pass "units" create object "fromunitscroll",data passed ["unit1","unit2"]

now printing "units". here see weird result. expecting see printed output ["unit1","unit2"] in original assignment see ["unit1","unit2","",""].

objects added in custom init method reflected in println statement.

i passing "units" parameter custom init method , not able why add-on of objects init method reflected in "unitcreation" method

thank you

this because nsmutablearray class swift , such passed reference. modifications in init functions modify original array. using swift arrays, passed value, not observe this.

swift initialization

Cassandra UDTs as primary key -



Cassandra UDTs as primary key -

the official documentation tells not utilize udts primary keys. there particular reason this? potential downsides in doing this?

that sentence intended discourage users using udt pk columns indiscriminately. main motivation udt in it's current incarnation (that is, given cassandra supports "frozen" udt) storing more complex values within collections. outside collections, udt can have it's uses, it's worth asking twice if need it. example:

create type mytype (a text, b int);

create table mytable (id uuid primary key, v frozen<mytype>);

is not judicious in lose ability of updating v.a without updating v.b. it's more flexible straight do:

create table mytable (id uuid primary key, text, b int);

this trivial illustration points out udt outside of collections not thing, , extends primary key columns. it's not improve do:

create type mytype (a text, b int);

create table mytable (id frozen<mytype> primary key);

than more simply:

create table mytable (a text, b int, primary key ((a, b)))

furthermore, regarding primary key, complex udt doesn't create sense. consider moderately complex type like:

create type address ( number int, street text, city text, phones set<text> )

using such type within primary key certainly isn't useful since pk identifies rows , 2 addresses same except set of phones wouldn't identify same row. there not many situations desirable. more generally, pk tends relatively simple, , might want have fine-grained command on clustering columns, , udt candidates.

in summary, udt in pk columns not always bad, not useful in context, , users should not looking hard @ ways utilize udt pk columns because it's allowed.

cassandra

stdin - Asking for other inputs after piping a file to a perl script from a shell script -



stdin - Asking for other inputs after piping a file to a perl script from a shell script -

i working on school project involves having main shell script prompt user text file contains 50 words. if the shell script finds file in same directory shell , perl scripts, print menu asking if user wants sort list using shell , outputting sorted list new file (that 1 finished , works), create phone call perl script, perl script take file , print words in file, prompt user word want search for. homecoming line word on in list. have done if user selects sort using perl script, pipe inputted file in shell perl script with:

cat $filename | ./search.pl

which happens pipe file on perl script can utilize it. first while loop access list , print every word/line user see, works fine. but run trouble. after whole list printed, printf line asks word want search print, programme stop without allowing anymore input, , go terminal. logic search script print every word user see can search for, , inquire them want search for, , through inputted file shell script while loop; if find it, print found on line, if don't find go next line, , if nail end without finding print can't found.

why unable come in more input phone call stdin , assign $word utilize in sec while loop? also, when doing sec while loop, using <> after asking different output going mess things up? if so, how create reference 1 time again file sec while loop?

#!/usr/bin/env perl $count = 1; #global variable homecoming value # of words. while (<>) { printf "$_"; } #now have opened file, printed off user see, can come in word in prompt # see line on. printf "\nplease come in word want search for\n"; $word = <stdin>; chomp $word; while ( $line = <> ) { if ( $line =~ m/$word/ ) { print "$word has been found on line $count.\n\n"; } elsif ( $line !=~ m/$word/ ) { $count++; } else { print "$word cannot found."; } }

the shell script (for reference):

#!/bin/bash clear printf "hello. \nplease input filename file containing list of words use. please allow 1 word per line.\n -> " read filename printf "you have entered filename: $filename.\n" if [ -f "$filename" ] #check if file exists in current directory utilize printf "the file $filename exists. file?\n\n" else printf "the file: $filename, not exist. rerun shell script , please come in valid file it's proper file extension. illustration of mywords.txt \n\nnow exiting.\n\n" exit fi printf "main menu\n" printf "=========\n" printf "select 1 sort file using shell , output new file.\n" printf "select 2 sort file using perl , output new file.\n" printf "select 3 search word using perl.\n" printf "select 4 exit.\n\n" echo "please come in selection below" read selection printf "you have selected alternative $selection.\n" if [ $selection -eq "1" ] read -p "what phone call new file? " newfile #asks user want phone call new file have sorted list outputted sort $filename > $newfile echo "your file: $newfile, has been created." fi if [ $selection -eq "2" ] read -p "what phone call new file? " newfile2 cat $filename | ./sort.pl # > $newfile2 #put sorted list new output file user specificed newfile2 fi if [ $selection -eq "3" ] cat $filename | ./search.pl fi if [ $selection -eq "4" ] printf "now exiting.\n\n" exit fi

i have modified code shown below. understanding, have been putting comments seek avoid comments wherever not required.

code:

#!/usr/bin/env perl utilize strict; utilize warnings; #input file passing argument programme $infile = $argv[0]; #opening , reading file using filehandle $fh open $fh,'<', $infile or die "couldn't open file $infile : $!"; while (<$fh>) { printf "$_"; } # seek function shown below reset file handle position origin of file seek($fh, 0, 0); printf "\nplease come in word want search for\n"; $word = <stdin>; chomp $word; $count = 1; #global variable homecoming value of words $val = 0; while (my $line = <$fh>) { if ($line =~ m/$word/) { print "$word has been found on line $count.\n\n"; $val++; } elsif ($line !~ m/$word/) { $count++; } } if ($val == 0) { print "$word cannot found"; } close($fh);

perl stdin piping

Realizing Transaction Management in Mule with self developed connector and java component -



Realizing Transaction Management in Mule with self developed connector and java component -

i'm new mule , have few general questions transaction management in mule 3.5. first of here scenario flow using xa transaction : jms connector ----> java component ---> self-defined connector ----> database connector

questions:

how set java component in same transaction context? illustration have operation persist in file or alter in database if transaction succeeds. have define exception strategy or there way?

how set self-defined connector in transaction context, can configured mule jms oder database connector?

thank you

mule mule-component

ios - Smart App Banner not showing for my application when application is not installed -



ios - Smart App Banner not showing for my application when application is not installed -

i'm using meta tag displaying application ios in app banner iphone/ipad devices.

<meta name="apple-itunes-app" content="app-id=xxxxxxx"/>

when tests using iphone, banner worked if application installed, if it's not installed banner not showing.

i same test others applications facebook , others, banner works fine in cases.

what can problem ?

thank !

"users can dismiss smart app banner tapping x button on left. 1 time dismissed, doesn’t show 1 time again user on website, if website reloaded. way show 1 time again if user clears metadata on ios device" http://www.raywenderlich.com/80347/smart-app-banners-tutorial

ios iphone phone smartbanner

azure - Using the Webjobs SDK in a Web Role -



azure - Using the Webjobs SDK in a Web Role -

we have azure web role needs monitor service bus queue responses before requests (which transmitted client via signalr).

at first wanted utilize message pump (queueclient.onmessage) in webrole.onstart(). however, have grown quite webjobs sdk, how frees programmer of lower level implementation , dashboard too.

for various reasons want maintain web role rather switch website. question arises: how utilize webjobs sdk in azure web role? in little experiment have adapted web role's onstart() in webrole.cs, follows:

class="lang-cs prettyprint-override">public class webrole : roleentrypoint { public override bool onstart() { jobhostconfiguration config = new jobhostconfiguration() { servicebusconnectionstring = "...", storageconnectionstring = "...", dashboardconnectionstring = "..." }; jobhost host = new jobhost(config); host.runandblock(); homecoming base.onstart(); } public static void processqueuemessage([servicebustrigger("myqueue")] string inputtext) { trace.writeline(inputtext); } }

this seems work fine, we're having difficulty assess impact has on web role. there consequences? perhaps in scaling web role?

thanks.

the webjobs sdk should work fine in webrole.

i have 1 suggestion on implementation: not block onstart method. instead of calling runandblock, utilize start/startasync. not block method , create separate thread job host.

the (not sure if compiles):

class="lang-cs prettyprint-override">public class webrole : roleentrypoint { private jobhost host; public override bool onstart() { jobhostconfiguration config = new jobhostconfiguration() { servicebusconnectionstring = "...", storageconnectionstring = "...", dashboardconnectionstring = "..." }; host = new jobhost(config); host.start(); homecoming base.onstart(); } // not sure if signature of onstop // or if method called way public override bool onstop() { host.stop(); homecoming base.onstop(); } public static void processqueuemessage([servicebustrigger("myqueue")] string inputtext) { trace.writeline(inputtext); }

}

azure azure-web-roles azureservicebus azure-webjobssdk

java - How to know when two threads are finished in Swing -



java - How to know when two threads are finished in Swing -

i have perform 2 tasks. 2 threads perform each task simultaneously. tasks don't share data.

before tasks start, shown dialog info "wait, processing...".

here codes:

final jdialog dialog = new jdialog(this, true); swingworker<void, void> worker = new swingworker<void, void>() { @override protected void doinbackground() throws exception { // job homecoming null; } @override protected void done() { // must close dialog? other finished? } }; swingworker<void, void> worker2 = new swingworker<void, void>() { @override protected void doinbackground() throws exception { // job homecoming null; } @override protected void done() { // must close dialog? other finished? } }; worker.execute(); worker2.execute(); dialog.setvisible(true); // must close dialog?

i close dialog when 2 threads ended. how know when ended? , when should close dialog?

update: threads must run simultaneously, not in sequential mode.

create countdownlatch, set 2 create 2 swingworkers, passing each reference countdownlatch. in there done methods, phone call countdown on latch. in done method, called regardless of how doinbackground method exited (ie in case throws exception) create 3rd swingworker, passing reference countdownlatch, in worker wait latch in doinbackground method. 1 time swingworker's done method called, should able dispose of dialog safely

java multithreading swing

session - Undefined variable: _SESSION in the redirected PHP file -



session - Undefined variable: _SESSION in the redirected PHP file -

i quite new php. trying write login script in php. index.html file takes username , password , submits form login.php. login.php file checks if user registered , creates session if so. after redirects file controlpanel.php

my problem proper values on reading session variable in login.php(just before redirecting controlpanel.php). in controlpanel.php, when seek read session variable gives error:

( ! ) notice: undefined variable: _session in d:\work\projects\phpapp\myecom\admin\controlpanel.php on line 2

my code:

login.php

<?php if(!isset($_session)){ob_start(); session_start(); }else{error_log("session set");} require_once("../config/config.php"); ?> <?php require_once("../classes/autoload.php"); $objuser = new user(); if (isset($_post["username"])){ $username = $_post["username"]; $pass = $_post["password"]; error_log("about check registration"); if($objuser->isregistereduser($username, $pass, 2)){ error_log("user registered"); login::loginuser($objuser->id, 2); error_log("session id in login.php: " . $_session["uid"]); header("location:controlpanel.php"); } else{ error_log("not registered"); //redirect registration page } } ?>

controlpanel.php

<?php if(!isset($_session)){ error_log("session not set"); }else{ error_log("session set in controlpanel: " . $_session["uid"]); } ?>

php error_log:

[25-oct-2014 18:08:51 europe/paris] check registration

[25-oct-2014 18:08:51 europe/paris] user registered

[25-oct-2014 18:08:51 europe/paris] session id in login.php: 1

[25-oct-2014 18:08:51 europe/paris] session not set

you didn't start session in controlpanel.php script.

always phone call session_start(); before using $_session.

php session

Android Instagram redirect url does not match error -

This summary is not available. Please click here to view the post.

jquery - How can I assign a tabindex value to all elements starting with a specific element? -



jquery - How can I assign a tabindex value to all elements starting with a specific element? -

the next code snippet assigns tabindex value elements on page starting first element on page. i'd same thing rather origin first element on page i'd begin specific element , loop through remaining elements.

edit additional requirement: i'd chose first element id attribute loop through rest.

$(function(){ var tabindex = 1; $('input,select').each(function() { if (this.type != "hidden") { var $input = $(this); $input.attr("tabindex", tabindex); tabindex++; } }); });

you can utilize :gt(n) psedo selector. next assign tab index starting 10th element:

$(function(){ var tabindex = 1; $(':input:not([type=hidden])').filter('input,select').filter(':gt(8)').each(function() { var $input = $(this); $input.attr("tabindex", tabindex++); }); });

update

as id requirement, have loop through elements , elect alter meet requirement:

$(function(){ var tabindex = 1; $(':input:not([type=hidden])').filter('input,select').each(function() { if( $(this).is('#desired_id') || tabindex > 1 ) { var $input = $(this); $input.attr("tabindex", tabindex++); } }); });

jquery

sublimetext2 - In Sublime, typing after colon causes 'key => "value"' to appear, why? -



sublimetext2 - In Sublime, typing <tab> after colon causes 'key => "value"' to appear, why? -

in sublime (i'm using sublime 3), typing after colon causes text 'key => "value"' appear.

this annoying behaviour.

i simply want indent text after colon.

why happening (it must have key binding shortcut)? , how remove behaviour?

thank you

as it's built in bundle (as @sergiofc said), need extract file , create override. alternatively, utilize https://sublime.wbond.net/packages/packageresourceviewer open file, , remove tab trigger. upon saving place override file in proper location.

sublimetext2 sublimetext3

mathematical expressions - Mathematica wrongly produces complex number instead of real -



mathematical expressions - Mathematica wrongly produces complex number instead of real -

i have next code in mathematica 9.0

in[8]:= funkcja[a_] =integrate[sqrt[z]*1/sqrt[2*pi] exp[-((z - a)^2/2)], {z, 0,infinity}] out[8]= (e^(-(a^2/4)) sqrt[\[pi]/2] (-a^2 besseli[-(1/4), a^2/4] + (2 + a^2) besseli[ 1/4, a^2/4] + a^2 (-besseli[3/4, a^2/4] + besseli[5/4, a^2/4])))/(4 sqrt[-a]) in[9]:= assuming[element[a, reals], simplify[funkcja[a]]] out[9]= (e^(-(a^2/4)) sqrt[\[pi]/2] (-a^2 besseli[-(1/4), a^2/4] + (2 + a^2) besseli[ 1/4, a^2/4] + a^2 (-besseli[3/4, a^2/4] + besseli[5/4, a^2/4])))/(4 sqrt[-a]) in[11]:= funkcja[1.0] out[11]= 0. - 0.104154

could explain me why formula produce complex number? integration on real domain , demand real.

mathematical-expressions

java - tar.gz decompression failing using apache commons-compress -



java - tar.gz decompression failing using apache commons-compress -

hi guys using apache commons-compress 1.9 compress , decompress tar.gz file. issue facing while decompressing file. while decompressing saying files within compressed folder not found. next decompressing code

public static boolean uncompresstargz(string tarfilename, string outputdir, logger log) throws ioexception { seek (tararchiveinputstream tararchiveinputstream = new tararchiveinputstream(new gzipcompressorinputstream(new fileinputstream(tarfilename)))) { tararchiveentry tarentry = (tararchiveentry) tararchiveinputstream.getnextentry(); log.info("outputdir : " + outputdir); log.info("tar file name : " + tarfilename); files.createdirectories(paths.get(outputdir)); while (tarentry != null) { log.info("tarentry : " + tarentry.getname()); file destpath = new file(outputdir, tarentry.getname()); log.info("1"); if (!tarentry.isdirectory()) { destpath.createnewfile(); log.info("2"); seek (fileoutputstream fout = new fileoutputstream(destpath);) { ioutils.copy(tararchiveinputstream, fout); } grab (throwable e) { log.info("error : " + e + " reason : " + e.getmessage()); } log.info("3"); // byte[] buffer = new byte[8192]; // int n = 0; // while (-1 != (n = tararchiveinputstream.read(buffer))) { // fout.write(buffer, 0, n); // } } else { destpath.mkdir(); } tarentry = (tararchiveentry) tararchiveinputstream.getnextentry(); } homecoming true; } grab (throwable e) { log.info("exception while untar : " + e.getmessage()); homecoming false; } }

i getting error /tmp/customtar/customfiles/filessucceeded (no such file or directory).

can please help me figure out might doing wrong.

thanks in advance.

java tar decompression