Friday, 15 August 2014

php - How to read ip address of the incoming emails -



php - How to read ip address of the incoming emails -

i have set continuous project class available online students , parents can interact with. inquire students email project progress everyday. utilize imap info , display online.

i understand email addresses can spoofed. how can find out if mail service did come yahoo, gmail or hotmail. imap function use. tried this

imap_headerinfo($inbox, $emails[$x])

but not give me ip address of servers passed through.

i appreciate help.

$mailinfo = imap_headerinfo($inbox, $emails[$x]); print_r($mailinfo->from);

should give you: personal, adl, mailbox, , host

any of next should help $mailinfo->...: (for total reference, check http://php.net/manual/en/function.imap-headerinfo.php)

->to - array of objects to: line, next properties: personal, adl, mailbox, , host

->from - array of objects from: line, next properties: personal, adl, mailbox, , host

->ccaddress - total cc: line, 1024 characters

->cc - array of objects cc: line, next properties: personal, adl, mailbox, , host

->bccaddress - total bcc: line, 1024 characters

->bcc - array of objects bcc: line, next properties: personal, adl, mailbox, , host

->reply_toaddress - total reply-to: line, 1024 characters

->reply_to - array of objects reply-to: line, next properties: personal, adl, mailbox, , host

->senderaddress - total sender: line, 1024 characters

->sender - array of objects sender: line, next properties: personal, adl, mailbox, , host

->return_pathaddress - total return-path: line, 1024 characters

->return_path - array of objects return-path: line, next properties: personal, adl, mailbox, , host

why hostname important:

(sorry shaky image, sitting on train)

php cakephp imap

R - Simple XML parse -



R - Simple XML parse -

let's ran code below :

url.df_1 = htmltreeparse(url_1, useinternalnodes = t)

and got below htmltree :

<!-- ******************* related ******************* --> <div class="more-related-box"> <div id="app_related"> <h3>customers bought</h3> <ul> <li><a href="/app/ios/flick-golf/" title="flick golf!"><img src="http://a2.mzstatic.com/us/r1000/067/purple/v4/25/a8/91/25a891df-fed4-9dc4-0d86-1c8f5acf893f/mzl.fcctkywr.75x75-65.jpg" class="app_icon"><span class="app_name">flick golf!</span><span class="category">games</span></a></li> <li><a href="/app/ios/minecraft-pocket-edition/" title="minecraft – pocket edition"><img src="http://a1.mzstatic.com/us/r1000/070/purple2/v4/3f/56/07/3f56074b-af27-8ba3-7ef8-c97314c13ee7/mzl.rfhcaysw.75x75-65.jpg" class="app_icon"><span class="app_name">minecraft – pocket edition</span><span class="category">games</span></a></li>

what want grab above "flick-golf" , "minecraft-pocket-edition". (so above part of htmltree , want grab these names , want create them list or dataframe eventually.)

so far tried (and bunch of others)

getnodeset(url.df_1, "//div[@id = 'app_related']//h3 ")

but ended getting

[[1]] <h3>customers bought</h3> attr(,"class")

any advice? give thanks you!

first need create sure xml formed. assuming take care of that. after need right xpath arguement, in case //li/a/@title

> str <- '<div class="more-related-box"> + <div id="app_related"> + <h3>customers bought</h3> + <ul> + <li> + <a href="/app/ios/flick-golf/" title="flick golf!"> + <img src="http://a2.mzstatic.com/us/r1000/067/purple/v4/25/a8/91/25a891df-fed4-9dc4-0d86-1c8f5acf893f/mzl.fcctkywr.75x75-65.jpg" class="app_icon" /> + <span class="app_name">flick golf!</span> + <span class="category">games</span> + </a> + </li> + <li> + <a href="/app/ios/minecraft-pocket-edition/" title="minecraft – pocket edition"> + <img src="http://a1.mzstatic.com/us/r1000/070/purple2/v4/3f/56/07/3f56074b-af27-8ba3-7ef8-c97314c13ee7/mzl.rfhcaysw.75x75-65.jpg" class="app_icon" /> + <span class="app_name">minecraft – pocket edition</span> + <span class="category">games</span> + </a> + </li> + </ul> + </div> + </div>' > doc <- xmlparse(str) > getnodeset(doc, "//li/a/@title") [[1]] title "flick golf!" attr(,"class") [1] "xmlattributevalue" [[2]] title "minecraft – pocket edition" attr(,"class") [1] "xmlattributevalue" attr(,"class") [1] "xmlnodeset"

xml r xml-parsing

How to run this DFB image example on Ubuntu 12.04 64-bit with DirectFB 1.6.3? -



How to run this DFB image example on Ubuntu 12.04 64-bit with DirectFB 1.6.3? -

this same illustration runs no problem in older ubuntu 10.10 directfb 1.4.11 , shows yellowish line in center of black screen:

#include <iostream> #include <stdio.h> #include <unistd.h> #include <directfb.h> using namespace std; static idirectfb *dfb = null; static idirectfbsurface *primary = null; static int screen_width = 0; static int screen_height = 0; #define dfbcheck(x...) \ { \ dfbresult err = x; \ \ if (err != dfb_ok) \ { \ fprintf( stderr, "%s <%d>:\n\t", __file__, __line__ ); \ directfberrorfatal( #x, err ); \ } \ } int main(int argc, char **argv) { dfbsurfacedescription dsc; dfbcheck(directfbinit (&argc, &argv)); dfbcheck(directfbcreate (&dfb)); dfbcheck(dfb->setcooperativelevel (dfb, dfscl_fullscreen)); dsc.flags = dsdesc_caps; dsc.caps = dfbsurfacecapabilities(dscaps_primary | dscaps_flipping); dfbcheck(dfb->createsurface( dfb, &dsc, &primary )); dfbcheck(primary->getsize (primary, &screen_width, &screen_height)); dfbcheck(primary->fillrectangle (primary, 0, 0, screen_width, screen_height)); dfbcheck(primary->setcolor (primary, 0xff, 0xff, 0x00, 0xff)); dfbcheck(primary->setsrccolorkey(primary, 0xff, 0xff, 0x00)); dfbcheck(primary->setblittingflags(primary, (dfbsurfaceblittingflags) ( dsblit_blend_alphachannel | dsblit_src_colorkey))); dfbcheck(primary->drawline (primary, 0, screen_height / 2, screen_width - 1, screen_height / 2)); primary->flip(primary, null, dfbsurfaceflipflags(0)); sleep(3); primary->release(primary); dfb->release(dfb); cout << "done!\n"; homecoming 23; }

but same illustration show black screen, no line, in ubuntu 12.04, using directfb 6.3.

the console output is:

# ./a.out ~~~~~~~~~~~~~~~~~~~~~~~~~~| directfb 1.6.3 |~~~~~~~~~~~~~~~~~~~~~~~~~~ (c) 2012-2013 directfb integrated media gmbh (c) 2001-2013 world wide directfb open source community (c) 2000-2004 convergence (integrated media) gmbh ---------------------------------------------------------------- (*) directfb/core: single application core. (2013-02-07 11:05) (*) direct/memcpy: using libc memcpy() (*) direct/thread: started 'fusion dispatch' (-1) [messaging other/other 0/0] <8388608>... (*) direct/thread: started 'vt switcher' (-1) [critical other/other 0/0] <8388608>... (*) direct/thread: started 'vt flusher' (-1) [default other/other 0/0] <8388608>... (*) directfb/fbdev: found 'svgadrmfb' (id 0) frame buffer @ 0x00000000, 15360k (mmio 0x00000000, 0k) (*) direct/thread: started 'ps/2 input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: imps/2 mouse (1) 1.0 (directfb.org) (*) direct/thread: started 'ps/2 input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: imps/2 mouse (2) 1.0 (directfb.org) (*) direct/thread: started 'linux input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: powerfulness button (1) 0.1 (directfb.org) (*) direct/thread: started 'linux input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: @ translated set 2 keyboard (2) 0.1 (directfb.org) (*) direct/thread: started 'linux input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: vmware vmware virtual usb mouse (3) 0.1 (directfb.org) (*) direct/thread: started 'linux input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: vmware vmware virtual usb mouse (4) 0.1 (directfb.org) (*) direct/thread: started 'linux input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: imps/2 generic wheel mouse (5) 0.1 (directfb.org) (*) direct/thread: started 'hotplug linux input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: hot-plug detection enabled linux input driver (*) direct/thread: started 'joystick input' (-1) [input other/other 0/0] <8388608>... (*) directfb/input: joystick 0.9 (directfb.org) (*) directfb/input: hot-plug detection enabled input hub driver (*) direct/thread: started 'keyboard input' (-1) [input other/other 0/0] <8388608>... (!!!) *** 1 time [joystick sends js_event_init events, create sure has been calibrated using 'jscal -c' ] *** [joystick.c:99 in joystick_handle_event()] (*) directfb/input: keyboard 0.9 (directfb.org) (*) directfb/genefx: mmx detected , enabled (*) directfb/graphics: mmx software rasterizer 0.7 (directfb.org) (*) directfb/core/wm: default 0.3 (directfb.org) (*) fbdev/mode: setting 800x600 rgb32 (*) fbdev/mode: switched 800x600 (virtual 800x600) @ 32 bit (rgb32), pitch 8192 (*) fbdev/mode: setting 800x600 rgb32 (*) fbdev/mode: switched 800x600 (virtual 800x600) @ 32 bit (rgb32), pitch 8192 (*) fbdev/mode: setting 800x600 rgb32 (*) fbdev/mode: switched 800x600 (virtual 800x1200) @ 32 bit (rgb32), pitch 8192 (*) fbdev/mode: setting 800x600 rgb32 (*) fbdev/mode: switched 800x600 (virtual 800x600) @ 32 bit (rgb32), pitch 8192 done!

any thought why line not drawn? wonder if it's problem 64-bit system?

you meant 1.6.3 version. dont know configure options. illustration mmx support. can reconfigure , reinstall --enable-debug and/or --enable-trace run programs --dfb:debug more info. directfb lot of system call while running can see them strace. old question lately these suggested methods find related problems run directfb apps. goog luck.

directfb

joomla2.5 - How to: open article in modal when using firefox -



joomla2.5 - How to: open article in modal when using firefox -

hi have problem opening article in modal in joomla 2.5 template when using firefox.

when utilize crome or ie everyting fine, firefox , opera, doesnt work, thought how solve problem?

link website

try changing modal.js file or uncompressed-modal.js file. there if statement sets condition.

for reference, please, here.

i hope helps you.

try changing lines. worked me.

firefox joomla2.5

ruby on rails - KineticJS: no method '_addId' in anonymous function -



ruby on rails - KineticJS: no method '_addId' in anonymous function -

so, trying work through kineticjs.image tutorial, run issue.

this works:

$(document).ready( function() { var icon = new image(); icon.onload = function() { var stage = new kinetic.stage({ container: 'canvas', width: 730, height: 700, }); var layer = new kinetic.layer(); var im = new kinetic.image({ x: -14, y: -13, image: icon, width: 30, height: 30 }); layer.add(im); stage.add(layer); }; icon.src = '#{asset_path "icons.png"}'; });

this, tutorial code, not:

$(document).ready( function() { var stage = new kinetic.stage({ container: 'targetcanvas', width: 730, height: 700, }); var layer = new kinetic.layer(); var icon = new image(); icon.onload = function() { var im = new kinetic.image({ image: icon, width: 30, height: 30, }); layer.add(im); stage.add(layer); }; icon.src = '#{asset_path "designer_icons.png"}'; });

it throws:

uncaught typeerror: object #<object> has no method '_addid' kinetic.js:28 kinetic.container.add kinetic.stage.add icon.onload

i have messed in environment, since in serious hack job of project (rails w/backbone,require,bootstrap , kinetic), , don't know javascript or various libraries, i'm fumbling around in dark.

any ideas what's causing , how prepare it?

it seems stage not initialized kinetic.node properly. create sure exists?

<div id="targetcanvas"></div>

and also, please create sure using version 4.3.1? don't see 4.3.1 has line.

if above not help, please post example, can take @ it.

ruby-on-rails kineticjs

javascript - What is a Finite State Machine and What is it Used For? -



javascript - What is a Finite State Machine and What is it Used For? -

recently, i've begun doing research finite state machines in javascript , found library makes them easier implement. while think i've grasped thought state machine used tracking , changing "state" of object (e.g., 'ready', 'complete', 'inactive', etc.,), don't think understand practical implications of them. please help clarifying following:

what exactly finite state machine [or called state machine? i've heard referred both ways]? what practical uses finite state machines (in javascript)? when not want utilize finite state machine? what books, articles, tutorials, etc., offer more in-depth @ finite state machines (in javascript)?

a finite state machine abstract concept. such, concept of state machine orthogonal particular language. if look @ wikipedia, says "is mathematical model of computation used design both computer programs , sequential logic circuits".

this means fsm used mathematical concept used computer scientists address questions discipline, "can xyz computed @ all?"

based on question, , link, think mean inquire state diagram (or statechart) different. when create state diagram, dividing programme in series of states, , events can occur in states. example, programme might in "editingform" state, receive event "dosave", , go "saving" state, receive event 'save complete", , go "viewing" state.

this abstraction incredibly useful because allows programmer conceptually organize things should happen when, when implemented correctly, leads cleaner , more organized code. in turn leads fewer bugs. state diagram, depending on implementation, can prevent unintended effects handling events defined state -- example, "viewing" not have 'save' event defined, if programme in "viewing" state save meaningless, should happen in "editing" state.

if @ overview of framework link, notice there bunch of handlers can utilize hook entering states, leaving states, actions happening, etc. allows things correspond state/action. example, on entering "editing" state might nowadays form user , enable save button. on entering "saving" state might disable button , fire request save. on receiving "savecomplete" event might transition "viewing" state, remove form, , show else.

javascript state-machines finite-state-machine

Xpage the Domino bookmarks nsf -



Xpage the Domino bookmarks nsf -

i trying create xpage version of domino bookmarks.nsf used creating home page in client. users want able see used databases link go straight there.

does know how domino favorites works , how consume info it?

the bookmark.nsf beaten in mystery desktop.dsk :-) entries in open button stored outline design elements. outlines read/write in lotusscript/java/ssjs api, grab them in ssjs library. don't know when/how favorites updated

xpages

[C++]How to use std::stack to deal with the file/directory hierarchy? -



[C++]How to use std::stack to deal with the file/directory hierarchy? -

i have 3 class, root, cfile, subdirectory. root abstract class. cfile , subdirectory derived root. cfile has attributes: name:string , size:int, level:int. subdirectory has attributes: name:string, size:int, level:int,a vector, contains both files , directories , function void add() force file or directory vector. if file in directory, file's level higher directory's one. setters , getters defined.

now, have file called dirread.h can struct entries in current diretory (computer's folder). each entry has filename, size, level , type (either file or directory). in main function, i'm asked utilize info dirread input build hierarchy of file scheme (using cfile , subdirectory). dirread.h conducts pre-order triversal. recursion not accepted in case (i tried, , dirread.h reported error). i'm asked utilize stack deal input, don't know how. apparently level of import here. have tried create stack , force files , directories stack, compare level form hierarchy. root doesn't have add together function, there's no way add together cfile subdirectory because root*. knows how this? thx.

you utilize stack maintain track of directories haven't explored yet. can utilize next algorithm:

push root directory onto stack.

pop top entry off stack. if stack empty, stop, you're done.

traverse directory pulled off stack. add together every file , directory in info structure. also, force every directory find onto stack.

go step 2.

c++ stack composite

equinox - OSGi - Is it possible to override a bundle's import package version using a fragment? -



equinox - OSGi - Is it possible to override a bundle's import package version using a fragment? -

i have bundle (jersey-server) imports bundle (org.objectweb.asm) resolution of optional , no version specified:

org.objectweb.asm;resolution:=optional

currently, our application deployed apache karaf (using equinox framework), exports new version of bundle (org.objectweb.asm), namely version 4.0. problem attempting solve since jersey-server bundle not specify version bundle wiring 4.0. however, version of jersey-server using (1.12) incompatible version. have 3.1 version of bundle available in container need jersey-server bundle wire to.

i have attempted utilize fragment suit needs, not appear working. don't understand how fragment import-package conflict resolution works in equinox (or felix) know if i'm trying possible. perhaps there way?

no, fragments additive only. i.e. can add together imports host bundles, cannot replace or remove imports of host.

the jersey-server bundle broken , must fixed.

osgi equinox apache-karaf

regex - Find and print lines in a file exactly matching string or regexp (Ruby) -



regex - Find and print lines in a file exactly matching string or regexp (Ruby) -

in ruby 1.9.3, i'm trying write programme find words n number of characters taken arbitrary set of characters. instance, if i'm given characters [ b, a, h, s, v, i, e, y, k, s, ] , n = 5, need find 5-letter words can made using characters. using 2of4brif.txt word list http://wordlist.sourceforge.net/ (to include british words , spellings, too), have attempted next code:

a = %w[b h s v e y k s a] a.permutation(5).map(&:join).each |x| file.open('2of4brif.txt').each_line |line| puts line if line.match(/^[#{x}]+$/) end end

this nil (no error message, no output, if frozen). have attempted variations based on next threads:

what's best way search string in file?

ruby find string in file , print result

how search exact matching string in text file using ruby?

finding lines in text file matching regular expression

match content regexp in file?

how open file , search word [ruby]?

every variation have tried has resulted in either:

1) freezing;

2) printing words list contain 5-character permutations (i assume that's it's doing; didn't go through , check of thousands of printed words); or

3) printing 5-character permutations found within words in list (again, assume that's it's doing).

again, i'm not looking words contain 5-character permutations, i'm looking 5-character permutations finish words in , of themselves, line in text file should printed if perfect match permutation.

what doing wrong? in advance!

this works me using english.0 file on page (sorry, couldn't find specific file mentioned):

a = %w[b h s v e y k s l d n] dict = {} a.permutation(5).each |p| dict[p.join('')] = true end file.open('english.0').each_line |line| line.chomp!.downcase! puts line if dict[line] end

the construction should pretty clear - build dictionary of permutations front end in 1 giant hash (you may need revisit depending on input sizes, memory inexpensive these days), , used fact input "one word per line" key hash.

also note, in version, read through file once. in yours scan file 1 time per permutation, , there thousands of permutations.

ruby regex file-io

C++ search vector for MAX, and get same position form a second vector -



C++ search vector for MAX, and get same position form a second vector -

i using c++ , have 2 vectors related each other:

vector<double> val = {.3,.5,.2,.4}; vector<string> str = {'a','b','c','d'};

i search val max, , homecoming string str in same position:

vector<double>::const_iterator it; = max_element(val.begin(), val.end());

so, how can utilize it within str letter?

string lettter; letter = str.at(it-> ????? );

thank!!!

you can find out how far it origin of val , utilize index str:

str[std::distance(std::begin(val), it)]

by using std::distance, still work if alter type of val container iterator not provide random access. however, when using on random access iterator, still constant time complexity. using std::begin allows alter val c-style array if ever wanted to.

it's worth mentioning should initialising str with:

vector<string> str = {"a","b","c","d"};

std::string has no constructor takes char.

c++ vector

jquery - AngularJS Instant Search Incredibly Laggy -



jquery - AngularJS Instant Search Incredibly Laggy -

i'm working on database web front-end. having used jquery previous versions of project, i've moved using angularjs "instant-search" feature this:

function searchctrl($scope, $http) { $scope.search = function() { $scope.result = null; $http({method: 'get', url: 'api/items/search/' + $scope.keywords }). success(function(data, status, headers, config) { $scope.result = data; }). error(function(data, status, headers, config) { $scope.status = status; }); }; } ... <div id="searchcontrol" ng-controller="searchctrl"> <form method="get" action="" class="searchform"> <input type="text" id="search" name="search" ng-model="keywords" ng-change="search()"/> <input type="submit" value="search" /> </form> <div ng-model="result"> <a href="javascript:void(0)" ng-repeat="items in result.items" > <div class="card"> <span ng-show="items.id"><b>item id: </b>{{items.id}}<br></span> <span ng-show="items.part_id"><b>part id: </b>{{items.part_id}}<br></span> <span ng-show="items.description"><b>description: </b>{{items.description}}<br></span> <span ng-show="items.manufacturer"><b>manufacturer: </b>{{items.manufacturer}}<br></span> <span ng-show="items.product_range"><b>range: </b>{{items.product_range}}<br></span> <span ng-show="items.borrower"><b>borrower: </b>{{items.borrower}}<br></span> <span ng-show="items.end_date"><b>end date: </b>{{items.end_date}}<br></span> </div> </a> </div> </div> ...

this works great 1 issue: because i'm calling search function on "ng-change" extremely laggy when typing search term, crashing browser. on old version (using jquery) had used flags test if there request running , if there aborted before starting new one. i've looked @ angularjs documentation aborting requests still none wiser. if has got advice on how accomplish or prepare i'd appreciate it.

thanks.

well 1 time request sent, it's sent. afaik, there's not yet way abort processing result of http request native angular. here's feature request labelled "open": https://github.com/angular/angular.js/issues/1159

that said, can abort processing of response this:

class="lang-js prettyprint-override">var currentkey= 0; $scope.test = function (){ $http({ method: 'get', url: 'test.json', key: ++currentkey }) .success(function(data, status, headers, config) { if(config.key == currentkey) { //you're within recent call. $scope.foo = data; } }); };

on flip side of that, i'd recommend implementing timeout of sort on over alter event, maintain beingness "chatty".

jquery ajax search get angularjs

javascript - Jquery : Same class number on two different links -



javascript - Jquery : Same class number on two different links -

i have next function

$('.link1-**number**').click( function() { $(".link2-**number**").hide() });

when click on link1-number want hide link2-number if number same value.

so <a class="link1-1987">link 1</a> hides <a class="link2-1987">link 2</a>

<a class="link1-1">link 1</a> hides <a class="link2-1">link 2</a>

<a class="link1-5">link 1</a> hides <a class="link2-5">link 2</a>

etc

answer edit:

$('a[class^=link1]').click(function(){ var number = this.classname.split('-')[1]; $('a.link2-' + number).hide(); });

demo

note work if:

there 1 class link1 anchors. that anchor doesn't have more 1 hyphen.

javascript jquery

Need help in regex pattern which excludes special character in android -



Need help in regex pattern which excludes special character in android -

i want regular look restrict user accepting special character in android.

i have tried this:

!phonenumber.matches("[/,'*:<>!~@#$%^&()+=?()\"|!\[#$-]")

but homecoming true regardless of whether phone number contains special character or not.

your regex [/,'*:<>!~@#$%^&()+=?()\"|!\[#$-] matches of listed character occuring 1 time , negation. !phonenumber.matches("[/,'*:<>!~@#$%^&()+=?()\"|!\[#$-]") evaluates true whether a or aa or a! aa , a! not one of characters specified. case evaluating false a single occurrence of of these characters.

you have take characters other these. should utilize ^ next character class opening bracket ([) , add together + next closing bracket. regex matches 1 or more characters other listed ones.

required regex "[^/,'*:<>!~@#$%^&()+=?()\"|!\\[#$-]+" matches patterns 1 or more characters other these.

note: implementation seems in java. regex works in java.

another thing : why have added \" instead of "? if escape " within string, can't give \[ requires \\[ think.

regex

xcode - iOS: specify code signing identity with .xcconfig file -



xcode - iOS: specify code signing identity with .xcconfig file -

i'm working on ios application within team of several developers. have our developer certificates belong same development provisioning profile. when build app we're working on in order test on device, need specify explicitly code signing identity use. otherwise, if select automatic profile selector, code signing mismatch error when uploading app services hockeyapp. indeed, when select automatic profile selector, seems select ios team provisioning profile instead of development provisioning profile specific app i'm building.

when developer of application, fixed issue hardcoding right code signing entity utilize in build settings. problem i'm not developer on project anymore. problem hardcoding code signing identity in project settings have remove every time commit alter project's settings, or if don't teammates errors when sign app saying code signing identity can't found on computer.

so i'm trying setup .xcconfig file each of team members specify code signing identity use. file not versioned set code signing identity explicitly without causing issue other developers within same team.

i managed include .xcconfig file in project , processed during build phase. however, haven't been able write .xcconfig file solves code signing entity issue. tried set next line in .xcconfig file:

code_sign_identity = iphone developer: firstname name (xxxxxxxxxx)

where firstname name (xxxxxxxxxx) result of copy/pasting code signing identity want utilize build settings .xcconfig file. later realized code signing identities development profiles (one each application or bundle identifier) give same result when copy/paste them build settings .xcconfig file.

i looking way differentiate them, didn't manage find 1 works. have thought of how solve problem ?

i tried using [sdk=iphoneos*] modifier, no success.

i avoid using different build configurations because sense have merge changes made main configuration new build configuration made purpose of using right code signing identity. however, i'm not familiar how build configurations work within xcode, sense free educate me on if think solution.

thank you!

instead of selecting code_sign_identity, doesn't matter, instead specify provisioning_profile , leave xcode sign whatever identity matches. our internal build system

specify profile with:

provisioning_profile=cb65516b-ee34-4334-95d6-6fba5f2df574

where long hex number uuid of profile. if within provisioning profile you'll find of ascii, though it's binary file, , has section this

uuid 395525c8-8407-4d30-abbd-b65907223eec

ios xcode

php - doctrine2 constraint violation -



php - doctrine2 constraint violation -

i have next entity rekation:

/** * acme\demobundle\entity\book * * @orm\table(name="book") * @orm\entity(repositoryclass="acme\demobundle\repository\bookrepository") * @orm\haslifecyclecallbacks * @uniqueentity(fields="publickey", groups={"publickey"}) */ class p1guestlistentry { /** * @var p1guestlistentrystatistic * * @orm\onetoone(targetentity="p1guestlistentrystatistic", orphanremoval=true, cascade={"all"}, fetch="eager") * @orm\joincolumns({ * @orm\joincolumn(name="fkstatistic", referencedcolumnname="pkid", nullable=false) * }) */ private $fkstatistic;

when seek remove object here:

$this->getentitymanager()->getconnection()->begintransaction(); try{ $book = $this->getentitymanager()->getrepository('achmedemobundle:book')->find(3928); $this->getentitymanager()->remove($book); $this->getentitymanager()->flush(); $this->getentitymanager()->getconnection()->commit(); }catch(exception $e){ $this->getentitymanager()->getconnection()->rollback(); echo $e->getmessage(); } exit;

i can whatever want, next error:

an exception occurred while executing 'delete book pkid = ?' params {"1":3928}: sqlstate[23000]: integrity constraint violation: 1451 cannot delete or update parent row: foreign key constraint fails (p1.book, constraint fk_f51a442f78734022 foreign key (fkstatistic) references bookstatistic (pkid))

has anbybody thought i'm doing wrong? tried lot of methods nil helps.

in case runs similar issue, here solution:

/** * @var statistic * * @orm\onetoone(targetentity="statistic", cascade="all") * @orm\joincolumns({ * @orm\joincolumn(name="fkstatistic", referencedcolumnname="pkid", ondelete="set null") * }) */

the ondelete alternative remove relation first , doctrine cascade operation.

php symfony2 doctrine2

mysql - Left Join Drupal 7 -



mysql - Left Join Drupal 7 -

i have problem regarding drupal 7 mysql queries on left join.

i found solution can't seem apply on problem since i'm not aware how syntax goes.

http://drupal.stackexchange.com/questions/4317/how-do-i-write-a-left-join-query

this solution found on link above.

$terms = db_select('taxonomy_index', 'ti') ->fields('ti', array('tid', 'name')) ->leftjoin('taxonomy_term_data', 'ttd', 'ti.tid = ttd.tid') ->condition('vid', 2) ->condition('nid', $nid) ->execute(); foreach ($terms $term) { // $term contains object taxonomy term. }

yet i'm having problem on how apply query.

here left bring together query on mysql.

$query = "select sweep_table.end_offer, sweep_table.title, embed.fbp_id, embed.sweep_stat sweep_table, embed sweep_table.uid=embed.uid , sweep_table.promo_id=embed.sweep_id";

i did first few lines rest, don't know how.

$terms = db_select('sweep_table', 'embed') ->fields('sweep_table', array('end_offer', 'title')) ->fields('embed', array('fbp_id', 'sweep_stat')) ->leftjoin('taxonomy_term_data', 'ttd', 'ti.tid = ttd.tid') //don't know how apply query. ->condition('vid', 2) ->condition('nid', $nid) ->execute(); foreach ($terms $term) { }

also, wondering how retrieve info after left bring together it?

would glad if help me guys.

wouldn't have thought work though. rekire hint.

$query = "select sweep_table.end_offer, sweep_table.title, embed.fbp_id, embed.sweep_stat sweep_table, embed sweep_table.uid=embed.uid , sweep_table.promo_id=embed.sweep_id"; $result = db_query($query); foreach ($result $row) { echo $row->end_offer . " " . $row->title . " " . $row->fbp_id . " " . $row->sweep_stat . "<br>"; }

mysql drupal-7 left-join

java - I need to hold this window until the done button has been pressed :/ -



java - I need to hold this window until the done button has been pressed :/ -

the first code here comes prerec of main code cannot figure out.

boolean companyloaded, startingnum = true; firstcheck newwin = new firstcheck(); public collectnumbers() { if (startingnum = true) firstcheck = newwin.firstcheck(); <----runs firstcheck okay if (companyloaded = true) loadcompany();

from here on out have firstcheck class i'll post below. have tried abstract overiding actionperformed, have tried thread sleep, wait, , cannot figure out how firstcheck() method wait until actionperformed() homecoming string(int). help appreciated!

import java.awt.event.*; import java.awt.*; import javax.swing.*; import java.io.*; import java.util.*; abstract class firstcheck extends jframe implements actionlistener { static int num; static boolean bnum = true; jtextfield numberentry; toolkit tools = toolkit.getdefaulttoolkit(); dimension windowlocvar = tools.getscreensize(); public int firstcheck() { jframe frame = new jframe(); numberentry = new jtextfield(); jbutton done = new jbutton("done"); done.addactionlistener(this); jlabel label = new jlabel("starting check number?"); label.setverticaltextposition(jlabel.bottom); label.sethorizontaltextposition(jlabel.center); jpanel panel = new jpanel(); panel.setlayout(new gridlayout(3,1)); panel.add(numberentry); panel.add(label); panel.add(done); frame.add(panel); frame.pack(); frame.setvisible(true); frame.setsize(250,150); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setlocation(windowlocvar.width/2-300,windowlocvar.height/2-100); //try { // thread.sleep(5000); // } //catch(interruptedexception e) { // // restore interrupted status // thread.currentthread().interrupt(); // } } public int actionperformed(actionevent e) { bnum = false; num = integer.parseint(numberentry.gettext()); homecoming num; } }

instead of jframe frame = new jframe() utilize jdialog frame = new jdialog((frame)null, true).

this create modal dialog block code execution @ the point of of frame.setvisible(true) until dialog closed.

take @ how utilize dialogs more information.

in actionperformed method, need store "return" value can interrogated application 1 time dialog closed...

public void actionperformed(actionevent e) { bnum = false; num = integer.parseint(numberentry.gettext()); object source = e.getsource(); if (source instanceof component) { // close dialog.... swingutilities.getwindowancestor((component)source).dispose(); } }

updated

equally, utilize joptionpane instead...

take at

display array in joptionpane joptionpane , reading integers - beginner java

as couple of examples

java swing user-interface actionlistener

USB communication between Android 2.1 phone and Windows 7 PC -



USB communication between Android 2.1 phone and Windows 7 PC -

is there way send info android 2.1 phone windows 7 pc via usb? have found android usb api not supported android 2.1. can send info pc, not know how on mobile side.

you want read through this, developer site.

android supports usb host mode on api 12 , (3.1 honeycomb).

android supports usb accessory mode on api 10 , (2.3.4 gingerbread).

the difference in host versus accessory mode device provides power. not sure 1 wanted use, if android host (host mode) provide powerfulness computer (probably not want). in accessory mode, android draw powerfulness computer.

unfortanetly, don't think able on 2.1 @ all.

android usb

joomla - jomsocial disable activity stream for certain user(s) -



joomla - jomsocial disable activity stream for certain user(s) -

i have website (perfect10essee.com) don't want show recent activity of user. user admin, if there way hide site activity admins work too.

is there way without modifying core?

joomla jomsocial

html - My body background color disappears when scrolling -



html - My body background color disappears when scrolling -

i hope can help. i've set body height property 100% fine when content on screen @ 1 time. when need scroll (when minimizing window) body color disappears, leaving color set html background. know solution?

html { background-color: #07ade0; } body { background-color: #7968ae; width: 900px; margin-left: auto; margin-right: auto; font: 20px verdana, "sans serif", tahoma; }

if body set height: 100%, 100% of window, not ideal since background on longer pages cutting off, mentioned. take off height property , should set.

you can set height: 100% on both html, body , create container within body. move html styles body, , body styles new container.

this preferred, since not considered best practice set pixel width on body element.

html

<body> <div id="container">your well-endowed content goes here.</div> </body>

css

html, body { height: 100%; } body { background: #07ade0; } #container { background: #7968ae; width: 900px; margin-left: auto; margin-right: auto; font: 20px verdana, "sans serif", tahoma; overflow: hidden; }

see demo.

html css vertical-scrolling document-body

python - Getting the table name to select on from the user -



python - Getting the table name to select on from the user -

my problem have select query table select info needs specified user, html file. can suggest way this?

i querying postgres database , sql queries in python file.

create variable table_name , verify contains characters allowed in table name. set sql query:

sql = "select ... {} ...".format(table_name) # replace ... real sql

if don't verify , user sends nasty, you run risk.

python sql postgresql

ssl - How does the communication with an HTTPS Web Proxy Work? -



ssl - How does the communication with an HTTPS Web Proxy Work? -

i wish setup https proxy , have http clients send requests securely proxy. example, browser can initiate http request should encrypted request proxy , proxy removes encryption , passes request end-site. squid proxy can set work (info here).

i have set such https enabled proxy. unable write own http clients work it. same link above mentions chrome browser supports such proxy. tested chrome , able work such https proxy.

i wish gain understanding of how such proxy works can write own http clients.

as understand it, it's connection regular http proxy connection made on tls. client indeed needs back upwards scheme explicitly , existing clients as-is can't tuned (without coding).

ssl https proxy squid

jquery - click sound on tag before it moves to another page -



jquery - click sound on <a> tag before it moves to another page -

i want give click sound tags on page before moves page.

i play click sound using tag.. doesn't work because page moves linked page before hear sound.

my code play sound follows:

<audio id="audio" hidden> <source src="./sound/sound.mp3" type="audio/mpeg"> </audio> $('#menu li a').click(function(e) { e.preventdefault(); // if utilize this, doesn't goes page. can here sound. want play sound , link both. var sound = $("#audio"); sound.get(0).play(); });

any tip appreciated. thanks.

here need... play sound , 1 time sound finishes playing, goes target location...

html

<audio id="audio" hidden> <source src="./sound/sound.mp3" type="audio/mpeg"> </audio> <div id="menu"> <li> <a href="http://www.google.com">click play...</a> </li> </div>

jquery

var target; function checkaudio() { if($("#audio")[0].paused) { window.location.href = target; } else { settimeout(checkaudio, 1000); } } $('#menu li a').click(function(e) { e.preventdefault(); target = $(this).attr('href'); console.log("let's play"); var sound = $("#audio"); sound.get(0).play(); settimeout(checkaudio, 1000); });

the code checks state of sound each second, can alter value of timeout check less frequently.

jquery html5 audio

MAMP and Git git-http-push -



MAMP and Git git-http-push -

i want git server running on imac remote access (from work or somewhere else). completed steps create git repository (git init --bare) , opened ports. imported git-files (nothing in it) when made local changes (not remote one) , want force server, gives me error (i replaced ip):

pushing http://name@[ip]:8888/gitprojects/test.git error: cannot access url http://name@[ip]:8888/gitprojects/test.git/, homecoming code 22 fatal: git-http-push failed

i searched on net solution, found no solutions solving mamp.

git mamp

ejb 3.0 - DATE_SUB named query MYSQL -



ejb 3.0 - DATE_SUB named query MYSQL -

have named query written this

select u user u u.creationdate < date_sub(curdate(),interval :upperdate day) , status=:status , reminder_counter =:counter

but syntax error parsing.

any ideas`?

p

the function date_sub using mysql specific, resulting in parsing error.

create named native query utilize date_sub function. else, can calculate duration explicitly & setting parameter.

ejb-3.0 named-query

python - What is wrong with my Genetic Algorithm -



python - What is wrong with my Genetic Algorithm -

i trying understand how genetic algorithms work. larn attempting write on on;however, knowledge limited , not sure if doing right.

the purpose of algorithm see how long take half of herd infected disease if half of population infected. illustration came in head not sure if viable example.

some feedback on how can improve knowledge nice.

here code:

import random def disease(): herd = [] generations = 0 pos = 0 x in range(100): herd.append(random.choice('01')) print herd same = all(x == herd[0] x in herd) while same == false: same = all(x == herd[0] x in herd) animal in herd: try: if pos != 0: after = herd[pos+1] before = herd[pos-1] if after == before , after == '1' , before == '1' , animal == '0': print "infection at", pos herd[pos] = '1' #print herd pos += 1 except indexerror: pass pos = 0 generations += 1 random.shuffle(herd) #print herd print "took",generations,"generations infect members of herd." if __name__ == "__main__": disease()

your code not implement geneticalgorithm. suggest start first open source library understand how work before implement own (if needed)

to have genetic algorithm need following:

1- objective function trying minimize

2- chromosome representation (e.g. real value) model decision variables in objective function. target find best chromosome minimize objective function

3- initial population of chromosomes start search (can random)

4- genetic operators i.e. selection, crossover , mutation apply current population next generation

5- iterate until reach stopping criterion e.g. maximum number of generation or desired fitness value

this brief description genetic algorithm implementation should have.

python algorithm genetic-algorithm genetic

How to use 2 OpenCL runtimes -



How to use 2 OpenCL runtimes -

i want utilize 2 opencl runtimes in 1 scheme (in case amd , nvidia, question pretty generic).

i know can compile programme sdk. when running program, need provide libopencl.so. how can provide libs of both runtimes see 3 devices (amd cpu, amd gpu, nvidia gpu) in opencl program?

i know must possible somehow, didn't find description on how linux, yet.

thanks lot, tomas

the smith , thomas answers correct; expanding on information: when enumerate opencl platforms, you'll 1 each installed driver. within each platform enumerate devices. amd , intel drivers expose cpu devices. on populated machines, might see amd platform (with cpu , gpu devices), nvidia platform (with gpu device), , intel platform (with cpu , gpu devices). code creates context on whichever devices want use, , 1 or more command queues feed them work. can maintain them busy working on things, can share info buffers between devices same platform. share info across platforms, must nail cpu memory in between.

opencl

haskell - Breaking POST request into parts in Yesod -



haskell - Breaking POST request into parts in Yesod -

i'm struggling split post response (multipart) apart, should used set contents of files sent yesod server database (after farther processing). current code:

import qualified data.bytestring.lazy lz import qualified data.bytestring.lazy.char8 lc ... processlines :: string -> [string] -> string processlines delim (l:rest) = case l of delim -> "" _ -> l ++ "\n" ++ processlines delim rest processfile :: [string] -> string processfile (delim:some:other:line:txt) = processlines delim txt postimpexr :: systemsid -> handler repplain postimpexr sysid = wr <- wairequest bss <- lift $ requestbody wr $$ consume allow file = lz.fromchunks bss    return $ repplain $ tocontent $ processfile $ map lc.unpack $ lc.lines file

edit: managed prepare 1 problem, seems i'm on way understand handlers. what's problem types here?? there more elegant way done this?

if you're looking multipart support, that's built yesod, there's no need resort manual parsing. consider using filefield or lookupfile.

haskell post yesod

If color value is not valid - JavaScript -



If color value is not valid - JavaScript -

i have problem javascript code if come in wrong code ( color value) must black. when come in somthing "blablabla" typed lastly exemple: write reddish red circle, after when write blablabla reddish too, want when write wrong color word black think have write rgb code funktion check if write right or wrong

function getpos(canvas, event){ var = new number(); var b = new number(); var canvas= document.getelementbyid("can1"); if (event.a != undefined && event.b != undefined) { = event.a; b = event.b; } else { = event.clientx + document.body.scrollleft + document.documentelement.scrollleft; b = event.clienty + document.body.scrolltop + document.documentelement.scrolltop; } -= canvas.offsetleft; b -= canvas.offsettop; var ctx = canvas.getcontext("2d"); var color1 = document.getelementbyid('color'); var size = document.getelementbyid('size'); ctx.beginpath(); if ( size.value > 0) { ctx.arc(a,b,size.value, 275*(math.pi/180), 635*(math.pi/180), false); } else { ctx.arc(a,b,15, 275*(math.pi/180), 635*(math.pi/180), false); } if (color1.value.length < 0) { ctx.fillstyle = "#000000"; } else if (color1.value.length == 0) { ctx.fillstyle = '#000000'; } else { ctx.fillstyle = color1.value; } ctx.fill(); ctx.stroke(); ctx.closepath(); window.localstorage['img'] = canvas.todataurl(); }

the problem here guess:

if (color1.value.length < 0) { ctx.fillstyle = "#000000"; } else if (color1.value.length == 0) { ctx.fillstyle = '#000000'; } else { ctx.fillstyle = color1.value; }

you should check valid hex or color names. solution build out of 2 answers , written heart:

javascript function convert color names hex codes how check if string valid hex color representation? function colornametohex(color) { var colors = { "aliceblue":"#f0f8ff","antiquewhite":"#faebd7","aqua":"#00ffff","aquamarine":"#7fffd4","azure":"#f0ffff","beige":"#f5f5dc","bisque":"#ffe4c4","black":"#000000","blanchedalmond":"#ffebcd","blue":"#0000ff","blueviolet":"#8a2be2","brown":"#a52a2a","burlywood":"#deb887","cadetblue":"#5f9ea0","chartreuse":"#7fff00","chocolate":"#d2691e","coral":"#ff7f50","cornflowerblue":"#6495ed","cornsilk":"#fff8dc","crimson":"#dc143c","cyan":"#00ffff","darkblue":"#00008b","darkcyan":"#008b8b","darkgoldenrod":"#b8860b","darkgray":"#a9a9a9","darkgreen":"#006400","darkkhaki":"#bdb76b","darkmagenta":"#8b008b","darkolivegreen":"#556b2f","darkorange":"#ff8c00","darkorchid":"#9932cc","darkred":"#8b0000","darksalmon":"#e9967a","darkseagreen":"#8fbc8f","darkslateblue":"#483d8b","darkslategray":"#2f4f4f","darkturquoise":"#00ced1","darkviolet":"#9400d3","deeppink":"#ff1493","deepskyblue":"#00bfff","dimgray":"#696969","dodgerblue":"#1e90ff","firebrick":"#b22222","floralwhite":"#fffaf0","forestgreen":"#228b22","fuchsia":"#ff00ff","gainsboro":"#dcdcdc","ghostwhite":"#f8f8ff","gold":"#ffd700","goldenrod":"#daa520","gray":"#808080","green":"#008000","greenyellow":"#adff2f","honeydew":"#f0fff0","hotpink":"#ff69b4","indianred":"#cd5c5c","indigo":"#4b0082","ivory":"#fffff0","khaki":"#f0e68c","lavender":"#e6e6fa","lavenderblush":"#fff0f5","lawngreen":"#7cfc00","lemonchiffon":"#fffacd","lightblue":"#add8e6","lightcoral":"#f08080","lightcyan":"#e0ffff","lightgoldenrodyellow":"#fafad2","lightgrey":"#d3d3d3","lightgreen":"#90ee90","lightpink":"#ffb6c1","lightsalmon":"#ffa07a","lightseagreen":"#20b2aa","lightskyblue":"#87cefa","lightslategray":"#778899","lightsteelblue":"#b0c4de","lightyellow":"#ffffe0","lime":"#00ff00","limegreen":"#32cd32","linen":"#faf0e6","magenta":"#ff00ff","maroon":"#800000","mediumaquamarine":"#66cdaa","mediumblue":"#0000cd","mediumorchid":"#ba55d3","mediumpurple":"#9370d8","mediumseagreen":"#3cb371","mediumslateblue":"#7b68ee","mediumspringgreen":"#00fa9a","mediumturquoise":"#48d1cc","mediumvioletred":"#c71585","midnightblue":"#191970","mintcream":"#f5fffa","mistyrose":"#ffe4e1","moccasin":"#ffe4b5","navajowhite":"#ffdead","navy":"#000080","oldlace":"#fdf5e6","olive":"#808000","olivedrab":"#6b8e23","orange":"#ffa500","orangered":"#ff4500","orchid":"#da70d6","palegoldenrod":"#eee8aa","palegreen":"#98fb98","paleturquoise":"#afeeee","palevioletred":"#d87093","papayawhip":"#ffefd5","peachpuff":"#ffdab9","peru":"#cd853f","pink":"#ffc0cb","plum":"#dda0dd","powderblue":"#b0e0e6","purple":"#800080","red":"#ff0000","rosybrown":"#bc8f8f","royalblue":"#4169e1","saddlebrown":"#8b4513","salmon":"#fa8072","sandybrown":"#f4a460","seagreen":"#2e8b57","seashell":"#fff5ee","sienna":"#a0522d","silver":"#c0c0c0","skyblue":"#87ceeb","slateblue":"#6a5acd","slategray":"#708090","snow":"#fffafa","springgreen":"#00ff7f","steelblue":"#4682b4","tan":"#d2b48c","teal":"#008080","thistle":"#d8bfd8","tomato":"#ff6347","turquoise":"#40e0d0","violet":"#ee82ee","wheat":"#f5deb3","white":"#ffffff","whitesmoke":"#f5f5f5","yellow":"#ffff00","yellowgreen":"#9acd32" }; if (typeof colors[color.tolowercase()] != 'undefined') homecoming colors[color.tolowercase()]; homecoming false; } function checkhex(color) { homecoming /(^#[0-9a-f]{6}$)|(^#[0-9a-f]{3}$)/i.test(color); } var color = color1.value; if (checkhex(color) || colornametohex(color)) { ctx.fillstyle = color; } else { ctx.fillstyle = "#000000"; }

javascript colors hex rgb

.htaccess - Convert htaccess file to web.config to run Php on IIS 7 -



.htaccess - Convert htaccess file to web.config to run Php on IIS 7 -

i need convert .htaccess web.config in order run php on iis 7. ideas?

options +followsymlinks +symlinksifownermatch rewriteengine on rewritebase /test rewritecond %{script_filename} !-f rewritecond %{script_filename} !-d rewriterule ^(.*)$ index.php

the url rewriting module's import rules .htaccess wizard generated next rules:

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <rule name="non-existent paths index.php"> <match url="^test/(.+)$" /> <conditions> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> </conditions> <action type="rewrite" url="test/index.php" appendquerystring="true" /> </rule> </rules> </rewrite> </system.webserver> </configuration>

the request /test/ cause iis fire /test/index.php (.*) unnecessary , (.+) more appropriate.

.htaccess iis iis-7 web-config url-rewrite-module

sql - Oracle Table Partitioning -



sql - Oracle Table Partitioning -

suppose have next table:

table name: item columns: id, item_num, item_color, item_spec, item_status

and item table (list) partitioned on item_status column. values item_status can have are: active, inactive, suspended id pk, hence there index on it.

now, when execute query:

select * item item_color="green"

please help me with 1. how oracle determine partition go to, since partition not on item_color column? 2. above query not benefit partitioning @ all? 3. necessary sql queries have partitioned column in clause benefit partitions. 4. how utilize indexes in case of partitions?

if there no way determinate if query needs info coming specific partitions, oracle must @ partitions of table.

the concept of partition can't explained simple answer, improve read documentation have understanding.

anyway before getting sure have performance problems first, if not leave tables unpartitioned.

go

http://docs.oracle.com/cd/e11882_01/server.112/e25789/schemaob.htm#cfagceci or http://docs.oracle.com/cd/e11882_01/server.112/e25554/parpart.htm#i1007993 or http://docs.oracle.com/cd/e11882_01/server.112/e16638/data_acc.htm#i21879.

sql oracle database-design partitioning

javascript - Fusion Charts Issues -



javascript - Fusion Charts Issues -

hi using bullet charts in fusion charts.i using same sample code given bullet graphs , instaed of taking info values file in info folder trying set info on html page itself.

<div align="center"> <script type="text/javascript"> var mychart = new fusioncharts ("charts/vbullet.swf", "mychart4", "80", "270", "0", "0"); mychart.setdataurl("data/wageincrease.xml"); mychart.render("chartdiv4"); </script> </div>

replaced

</div><div align="center"> <script type="javascript"> var mychart = new fusioncharts ("charts/vbullet.swf", "mychart4", "80", "270", "0", "0"); mychart.setdataxml("<chart> <value>13</value> <target>74</target> </chart>"); mychart.render("chartdiv4"); </script>

but not working doing wrong????

please seek removing new line characters , provide without space in between tags, when providing xml in info string method.

</div><div align="center"> <script type="javascript"> var mychart = new fusioncharts ("charts/vbullet.swf", "mychart4", "80", "270", "0", "0"); mychart.setdataxml("<chart><value>13</value><target>74</target></chart>"); mychart.render("chartdiv4"); </script>

javascript html fusioncharts

dcg - Prolog Roman Numerals (Attribute Grammars) -



dcg - Prolog Roman Numerals (Attribute Grammars) -

i working on assignment in prolog scans list of numerals , should homecoming whether list valid roman numeral , decimal value of numerals. ex)

1 ?- roman(n, ['i'], []). n = 1 true. 2 ?-

when run programme sense should work, decimal value right, i'm guessing got synthesized attributes part right, returns false numeral lists should homecoming true. i'd add together aborts when supposed if more 3 is, xs, or cs present.

1 ?- roman(n, ['i'], []). n = 1 ; false. 2 ?- roman(n, ['i','i','i','i'], []). error: many i's % execution aborted 3 ?-

when take out n , throw in {write('n = '), write(n)}, works fine , returns true.

1 ?- roman(['i'], []). n = 1 true.

when remove {n valh + valt + valu} returns true, however, no longer displays decimal value. here top line of code (because current assignment, prefer show little necessary answer):

roman(n) --> hundreds(valh), tens(valt), units(valu), {n valh + valt + valu}.

why returning false n, true without, , how prepare it?

assignment: the next bnf specification defines language of roman numerals less 1000:

<roman> ::= <hundreds> <tens> <units> <hundreds> ::= <low hundreds> | cd | d <low hundreds> | cm <low hundreds> ::= e | <low hundreds> c <tens> ::= <low tens> | xl | l <low tens> | xc <low tens> ::= e | <low tens> x <units> ::= <low units> | iv | v <low units> | ix <low units> ::= e | <low units>

define attributes grammar carry out 2 tasks:

a) restrict number of x’s in <low tens>, i’s in <low units>, , c’s in <low hundreds> no more three.

b) provide attribute <roman> gives decimal value of roman numeral beingness defined.

define other attributes needed these tasks, not alter bnf grammar.

did noticed grammar formed of same pattern (group//5) repeated 3 times, different symbols ? compactness...

roman(n) --> group('c','d','m',100, h), group('x','l','c',10, t), group('i','v','x',1, u), {n h+t+u}. group(a,b,c, scale, value) --> ( g3(a, t) ; [a, b], {t = 4} % daniel , catching bugs ; [b], g3(a, f), {t 5+f} ; [b], {t 5} ; [a, c], {t = 9} ; {t = 0} ), {value scale * t}. g3(c, 1) --> [c]. g3(c, 2) --> [c,c]. g3(c, 3) --> [c,c,c].

some test

?- atom_chars('cmxxx',l), phrase(roman(n),l). l = ['c', 'm', 'x', 'x', 'x'], n = 930 ; false. ?- atom_chars('cmxlviii',l), phrase(roman(n),l). l = ['c', 'm', 'x', 'l', 'v', 'i', 'i', 'i'], n = 943 ; false.

just curiousity, showing dcg @ work...

edit after daniel , comments...

?- atom_chars('viii',l), phrase(roman(n),l). l = ['v', 'i', 'i', 'i'], n = 8 . ?- phrase(roman(x), ['l','i','x']). x = 59 .

prolog dcg roman-numerals

Create function names using paste() in R -



Create function names using paste() in R -

this question has reply here:

what ways there edit function in r? 5 answers creating look tree in r 2 answers

i following

x = matrix(0, nrow = p, ncol = n) p=5 n=100 (i in 1:n) { x[1,i] = e1(t[i]) x[2,i] = e2(t[i]) x[3,i] = e3(t[i]) x[4,i] = e4(t[i]) x[5,i] = e5(t[i]) }

where e1(). e2(), e3(), e4() , e5() specific functions.

i have tried next code:

for(j in 1:p) { (i in 1:n) { x[j,i] = as.symbol(paste("e", j, sep = ""))(t[i]) } }

but not work.

thanks help

carole

one way utilize do.call :

r> myfun <- function(x) print(x) r> do.call(paste0("my","fun"), list("foo")) [1] "foo"

the first argument of do.call name of function (you can utilize paste here), , sec 1 list of arguments pass.

r function

r - Convert a factor to indicator variables? -



r - Convert a factor to indicator variables? -

this question has reply here:

automatically expanding r factor collection of 1/0 indicator variables every factor level 7 answers

how convert factor in r several indicator variables, 1 each level?

one way utilize model.matrix():

model.matrix(~species, iris) (intercept) speciesversicolor speciesvirginica 1 1 0 0 2 1 0 0 3 1 0 0

....

148 1 0 1 149 1 0 1 150 1 0 1 attr(,"assign") [1] 0 1 1 attr(,"contrasts") attr(,"contrasts")$species [1] "contr.treatment"

r

c# - How to query the current size of the MySQL's .Net connector's connection pool? -



c# - How to query the current size of the MySQL's .Net connector's connection pool? -

is there programmatic way find current number of open connections database beingness maintained .net connector/mysql.data.dll?

i'm interested in collecting info within same programme library used.

connection pooling performed on client side. access it, you'll need utilize reflection mysqlpoolmanager , mysqlpool classes, both internal mysql.data assembly.

essentially, you'll want utilize reflection pool. here's how:

assembly ms = assembly.loadfrom("mysql.data.dll"); type type = ms.gettype("mysql.data.mysqlclient.mysqlpoolmanager"); methodinfo mi = type.getmethod("getpool", bindingflags.static | bindingflags.public); var pool = mi.invoke(null, new object[] { new mysqlconnectionstringbuilder(connstring) });

you'll notice have pass in mysqlconnectionstringbuilder object. creates separate pool each connection string, utilize same connection string utilize in app (it needs identical).

you can access private pool fields , properties (again, using reflection), info need. in particular, "available" field , "numconnections" properties of involvement you. there's "idlepool" (a queue<>) , "inusepool" (a list<>) can access well, particularly counts.

c# mysql

sql - Adding check constraints without "create assertion" in MYSQL -



sql - Adding check constraints without "create assertion" in MYSQL -

i'm trying add together check constraint tables orders , results in database, mysql won't take assertions. how edit fit mysql's accepted syntax? can done alter table?

create assertion check (not exists select * orders, results, orders.order_number = results.order_number , orders.order_date > results.date_reported);

mysql not back upwards check constraints, ignored. @ mysql doc see allowed syntaxes. can seek using trigger instead check inserted info @ insert/update time!

mysql sql constraints

java - integrating hsqlDB into netbeans 7 IDE -



java - integrating hsqlDB into netbeans 7 IDE -

i building simple desktop application java swing front end end , utilize hypersql db database system. using netbeans 7 ide develop system.

is possible integrate hsqldb netbeans ide , able connect application interface database?

will happy have tutorial or article this.

create library entry database, shown here h2. open window > services > database panel found properties connection , examine available schemata.

java database swing netbeans-7 hsqldb

How to select a child in jquery? -



How to select a child in jquery? -

this sample structure!

<div id ="div1"> <div class="div1-child"> <div class="div1-sub-child"> </div> </div> </div>

can help me how apply jquery effects on div1-sub-child when hover div1?

try

$("#div1").hover( function() { $(this).find('div.div1-sub-child').filter(':not(:animated)').animate( { marginleft:'9px' },'slow'); }, function() { $(this).find('div.div1-sub-child').animate( { marginleft:'0px' },'slow'); });

hover has 2 callbacks 1 fire when hover , sec fire when hoverout.

jquery

ios - How can I tell if the main thread has gone away? -



ios - How can I tell if the main thread has gone away? -

i'm performing few steps background thread, updating view on completion of each using:

[self performselectoronmainthread:@selector(updateprogress) withobject:nil waituntildone:no];

the problem if user dismisses view. background thread continues run, , crashes app when gets 1 of these actions. how can tell if thread has gone away?

do intend run method updateprogress in main thread or background thread? simple trick check. total proof should utilize nsoperationqueue instead of performselector

synthesize bool in viewcontroller

bool isbackgroundthreadstop;

initialize no somewhere relevant

self.isbackgroundthreadstop = no;

when user pressed button dismiss view:

-(void)dismissview { self.isbackgroundthreadstop = yes; [self dismissmodalviewcontrollerwhatever]; }

so in method

-(void)updateprogress { if(!self.isbackgroundthreadstop){ //run programme if background thread not stop //it won't run if isbackgroundthreadstop set yes } }

ios objective-c

java - jackson exclude subclass field -



java - jackson exclude subclass field -

given follwing pojo:

class="lang-java prettyprint-override">class { private string name; private string desc; private list<a> subclasses; }

i produce kind of json, excluding field desc` subclass :

class="lang-js prettyprint-override">{ name : "aname" desc: "adesc", subclasses : [{ name : "aname" },{ name : "anotherame" }] }

or field parent class , not kid class

to exclude field utilize @jsonignore annotation. more on here -

http://forum.springsource.org/showthread.php?92684-exclude-bean-field-from-json-response

and here -

http://jackson.codehaus.org/1.0.0/javadoc/org/codehaus/jackson/annotate/jsonignore.html

java json jackson

ios , Attach Audio file aac format to Email -



ios , Attach Audio file aac format to Email -

i seek send sound record file aac (kaudioformatmpeg4aac) format file attached it's doesn't send

*mystring = file://localhost/private/var/mobile.......

here code

mfmailcomposeviewcontroller *picker = [[mfmailcomposeviewcontroller alloc] init]; picker.mailcomposedelegate = self; [picker setsubject:@"my sound file"]; nsstring *filename = @"rec.aac"; nsstring *documentsdirectory = mystring ; nsstring *path = [documentsdirectory stringbyappendingpathcomponent:filename]; nsdata *data = [nsdata datawithcontentsoffile:path]; [picker addattachmentdata:data mimetype:@"audio/aac" filename:filename]; nsstring *emailbody = @"aac format sound file attached."; [picker setmessagebody:emailbody ishtml:yes]; [self presentmodalviewcontroller:picker animated:yes]; [picker release];

nsdata *data = [nsdata datawithcontentsoffile:path];

you're passing in file:// url, won't understood method. method expects standard file path, i.e. /private/var/mobile/.

you utilize file path, if you're provided url form string, can create url object , utilize nsdata.

nsurl* fileurl = [nsurl urlwithstring:mystring]; nserror* error = nil; nsdata* info = [nsdata datawithcontentsofurl:fileurl options:0 error:&error]; if (error) { nslog(@"unable load file provided url %@: %@", mystring, error); }

ios email avaudioplayer email-attachments mfmailcomposeviewcontroll

domain driven design - Drools vs DDD: Does Drools require Flat Object Models? -



domain driven design - Drools vs DDD: Does Drools require Flat Object Models? -

in our e-commerce domain, have hierarchy of entities modeled using nested arrays. using principles of domain-driven design (as explained eric evans). central concepts in our e-commerce domain are:

contracts, have exchanges, each of has both services , payments. services, in turn, have features describe each service.

this hierarchical model enables express contract, no matter how complex, including have multiple agreements (that is, exchanges) part of overall understanding (or, contract).

does drools not back upwards such hierarchical object models? should invert object model flat object model no arrays (like "fires have rooms" & "sprinklers have rooms" example in drools expert documentation) follows?

contracts. exchanges, each of has single contract. services , payments, each of has single exchange. features, each of has single service.

am right inverting hierarchical object models in way, flat object models atomic assertions, supported , works best in drools? drools doesn't appear back upwards rule lhs conditions on fact , fact in subcollection.

if so, why doesn't drools back upwards more hierarchical object models? because drools comes ai world (not object-oriented world) in first-order logic expresses facts atomic subject-predicate-value statements, , not object-oriented world in entity objects have identity, value objects don't have identity, , entity objects composed of other entity , value objects?

you can define rules against java object model.

the documentation provides examples based on toy problems avoid distraction it's explaining. not because drools incapable of dealing more complex models. if read bit farther through manual, see examples dealing lists using syntax such 'contains' or accumulators.

it's how model this. can insert contracts, exchanges, services, payments , features separate facts, reference each other. alternatively, insert complex contract fact, contains lists of exchanges, contain lists of services, etc.

which works improve depends on whether rules match on contract little chaining, or whether want rule react such alter in feature, or insertion of payment fact.

domain-driven-design drools object-model

java - JDBC MySQL connection without specifying password -



java - JDBC MySQL connection without specifying password -

is possible connect mysql database without specifying username , password in java code :

connection con=drivermanager.getconnection("database url","username","password");

or there way alter username , password using java?

i don't know if can setup default user, can set user no password.

as sec question, assuming connection has adequet rights in mysql, can set password on user. basic way do:

update user set password=password('new_pass') user = 'someuser';

optionally may want specify host field in clause. needs ran in msql database.

java mysql connection

javascript - jQuery - catch and override links with target=_blank -



javascript - jQuery - catch and override links with target=_blank -

we have legacy pages have links target="_blank". on clicking these i'd ignore , run javascript have opening windows.

is possible jquery, if methods/terms should research?

thanks in advance

$('a[target=_blank]').click(function(e){ e.preventdefault(); //do want here });

demo: http://jsfiddle.net/kkhnr/1/

javascript jquery html

ios - AVQueuePlayer: Loop last item in a queue (and eliminate hiccup) or loop last seconds of a video -



ios - AVQueuePlayer: Loop last item in a queue (and eliminate hiccup) or loop last seconds of a video -

i using avqueueplayer play videos in sequence (although have hiccups between plays). i'd to:

1) loop lastly item in sequence (not total one).

2) in doing so, i'd eliminate hiccups.

below code play videos sequence. how accomplish 2 goals?

[super viewdidload]; nsstring *secondvideopath = [[nsbundle mainbundle] pathforresource:@"vid_1" oftype:@"mov"]; nsstring *firstvideopath = [[nsbundle mainbundle] pathforresource:@"vid_2" oftype:@"mov"]; avplayeritem *firstvideoitem = [avplayeritem playeritemwithurl:[nsurl fileurlwithpath:firstvideopath]]; avplayeritem *secondvideoitem = [avplayeritem playeritemwithurl:[nsurl fileurlwithpath:secondvideopath]]; queueplayer = [avqueueplayer queueplayerwithitems:[nsarray arraywithobjects:firstvideoitem, secondvideoitem,nil]]; avplayerlayer *layer = [avplayerlayer playerlayerwithplayer:queueplayer]; avplayer.actionatitemend = avplayeractionatitemendnone; layer.frame = cgrectmake(0, 0, 1024, 768); [self.view.layer addsublayer:layer]; [queueplayer play];

another method i'm thinking of play 1 long video , loop lastly few seconds of it. perhaps avoid hiccups way. approach achievable? if so, how adapt code below (that plays 1 video)?

[super viewdidload]; nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"vid_long" oftype:@"mov"]; nsurl *fileurl = [nsurl fileurlwithpath:filepath]; avplayer = [avplayer playerwithurl:fileurl]; avplayerlayer *layer = [avplayerlayer playerlayerwithplayer:avplayer]; avplayer.actionatitemend = avplayeractionatitemendnone; layer.frame = cgrectmake(0, 0, 1024, 768); [self.view.layer addsublayer: layer]; [avplayer play];

here solution play video in loop:-

queueplayer.actionatitemend = avplayeractionatitemendnone; int k=0; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(itemplayended:) name:avplayeritemdidplaytoendtimenotification object:[queueplayer currentitem]]; - (void)itemplayended:(nsnotification *)notification { k++; if(k<10-15 times) { avplayeritem *p = [notification object]; [p seektotime:kcmtimezero]; } }

by edited answer:- above reply play same files works me. play lastly added file in loop:

- (void)itemplayended1:(nsnotification *)notification { nsstring *secondvideopath = [[nsbundle mainbundle] pathforresource:@"video2" oftype:@"mp4"]; k=0; avplayeritem *secondvideoitem = [avplayeritem playeritemwithurl:[nsurl fileurlwithpath:secondvideopath]]; // avplayeritem *p = [notification object]; nsmutablearray *currentitemarray = [nsmutablearray arraywithobjects:secondvideoitem,nil]; avqueueplayer* queueplayer = [[avqueueplayer alloc] initwithitems:currentitemarray]; [queueplayer play]; queueplayer.actionatitemend = avplayeractionatitemendnone; avplayerlayer *layer = [avplayerlayer playerlayerwithplayer:queueplayer]; avplayer.actionatitemend = avplayeritemstatusreadytoplay; layer.frame = cgrectmake(0, 0, 1024, 768); [self.view.layer addsublayer:layer]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(itemplayended:) name:avplayeritemdidplaytoendtimenotification object:[queueplayer currentitem]]; }

ios video sequence layer avqueueplayer

Options for simple but essential search in .net Server application -



Options for simple but essential search in .net Server application -

i have .net server based application, needs able total text 'fuzzy' search of single db column only. underlying db engine sql server 2008 r2.

the info column write once (never modified), , expected under 'load' there 10 new strings beingness added per minute.

the strings capped @ 1000 characters. in western languages, planned add together others in future.

the consuming client pass search term (most space separated keywords) server, homecoming list of matching records client.

the 'complicated' part of misspellings , similar words need catered for.

it feels if rolling own using doublemetaphone work, require development effort.

so i'm wondering if people think of existing search 'apps' out there may suitable? (lucene.net example). or if overkill such little search requirement.

i utilize sql server full-text search. it's powerful, adjustable, supports linguistic features of different languages , on.

i think should start this: http://msdn.microsoft.com/en-us/library/ms142571(v=sql.105).aspx

very general steps apply application be:

install full-text search component sql server installation.

create , adjust full-text index in database.

define search query necessary predicates.

integrate application!

.net search fuzzy-search

sql - To select the wp-option table from the database -



sql - To select the wp-option table from the database -

i have select table wordpress database. how can select wp-option database table database.

global $wpdb; $wpdb->query( "select * $wpdb->$options" );

but question vague. want achieve?

if getting value option, have api so.

http://codex.wordpress.org/function_reference/get_option

e.g. echo get_option('option_name', 'default_value');

sql wordpress

How to convert letters to numbers in javascript? -



How to convert letters to numbers in javascript? -

i have been trying create simple javascript programme user types in words/sentences, , programme shows numbers come in text in flip phone. instance, if entered "add" output "122".

how this? have tried lot of different things, , nil works. seems should simple program. can either help me this, or link me similar program?

thanks.

function str2num(mystr) { mystr = mystr.touppercase(); var conv = []; var l = mystr.length; (var i=0; conv[i] = mystr.charcodeat(i)-65; } homecoming conv; }

read this

http://www.yaldex.com/fsequivalents/phonenumberconverter.htm phone converter

in case link breaks here's code:

<script language="javascript" type="text/javascript"> <!-- begin function convert(input) { var inputlength = input.length; input = input.tolowercase(); var phonenumber = ""; (i = 0; < inputlength; i++) { var character = input.charat(i); switch(character) { case '0': phonenumber+="0";break; case '1': phonenumber+="1";break; case '2': phonenumber+="2";break; case '3': phonenumber+="3";break; case '4': phonenumber+="4";break; case '5': phonenumber+="5";break; case '6': phonenumber+="6";break; case '7': phonenumber+="7";break; case '8': phonenumber+="8";break; case '9': phonenumber+="9";break; case '-': phonenumber+="-";break; case 'a': case 'b': case 'c': phonenumber+="2";break; case 'd': case 'e': case 'f': phonenumber+="3";break; case 'g': case 'h': case 'i': phonenumber+="4";break; case 'j': case 'k': case 'l': phonenumber+="5";break; case 'm': case 'n': case 'o': phonenumber+="6";break; case 'p': case 'q': case 'r': case 's': phonenumber+="7";break; case 't': case 'u': case 'v': phonenumber+="8";break; case 'w': case 'x': case 'y': case 'z': phonenumber+="9";break; } } document.myform.number.value = phonenumber; homecoming true; } // end --> </script> <form name=myform> <table border=0> <tr> <td>alphanumeric #:</td> <td><input type=text size=20 maxlength=20 name=alphabet value="rachel"></td> </tr> <tr> <td>converted #:</td> <td><input type="text" size=20 maxlength=20 name="number"></td> </tr> <tr> <td align=center colspan=2><input type=button value="convert" onclick="return convert(document.myform.alphabet.value)"></td> </table> </form>

javascript

windows - Deploying a FIPS enabled Apache/OpenSSL -



windows - Deploying a FIPS enabled Apache/OpenSSL -

i've built apache mod_ssl/openssl fips compliance (i'm building , installing in windows environment) , works locally. can following:

openssl md5 c:\path\to\random\file.txt # succeed , spit out hash info set openssl_fips=1 openssl md5 c:\path\to\random\file.txt # fail , spit out error md5 beingness disabled in fips mode openssl sha1 c:\path\to\random\file.txt # succeed , spit out hash info

but when re-create apache build (the entire bin directory , modules directory) existing internal ssl testbed have effort run same commands, utilize of openssl perform hash (md5 or sha1) give me next error:

1444:error:2d06b06f:fips routines:fips_check_incore_fingerprint:fingerprint not match:.\fips\fips.c:232:

what causing break when re-create machine? thoughts?

windows openssl fips

c# - mvc client access without browser or view -



c# - mvc client access without browser or view -

i have mvc4 c# application want allow client access through code (no browser or view). client send user id used record , 3 fields returned. both incoming , outgoing info sensitive info need solution secure. application running on site ssl (https), protect me json hijacking if utilize json solution 2 answers have suggested?

public actionresult inaction(string id) { // code retrieve record , homecoming 3 fields field1, field2, field3 homecoming (what go here?) }

can utilize controller action handle this? need total blown webservice this, if links mvc tutorials helpful?

the client works in asp (webforms) , talking responder page key value pairs, how equivalent in mvc.

any help on getting me going appreciated.

thank you

update: i’ve marked brett’s json suggestion answer. returning string (not array) , entire transaction taking place on ssl connection believe possibility of json hijacking not issue.

string response = field1 + "," + field2 + "," + field3; homecoming json(response), jsonrequestbehavior.allowget; }

if i'm mistaken on please allow me know.

as nikeaa mentions, create action within controller returns jsonresult

public jsonresult inaction(string id) { // object repository var repository = new objectrepository(); var returnobj = repository.getobject(id); homecoming json(returnobj, jsonrequestbehavior.allowget); }

you need specify jsonrequestbehaviour.allowget override default .denyget. opens security vulnerability when returning json request though. see stackoverflow reply details.

c# asp.net-mvc web-services asp.net-mvc-4

classification - Learning and using augmented Bayes classifiers in python -



classification - Learning and using augmented Bayes classifiers in python -

i'm trying utilize forest (or tree) augmented bayes classifier (original introduction, learning) in python (preferably python 3, python 2 acceptable), first learning (both construction , parameter learning) , using discrete classification , obtaining probabilities features missing data. (this why discrete classification , naive classifiers not useful me.)

the way info comes in, i'd love utilize incremental learning incomplete data, haven't found doing both of these in literature, construction , parameter learning , inference @ answer.

there seem few separate , unmaintained python packages go in direction, haven't seen moderately recent (for example, expect using pandas these calculations reasonable, openbayes barely uses numpy), , augmented classifiers seem absent have seen.

so, should save me work implementing forest augmented bayes classifier? there implementation of pearl's message passing algorithm in python class, or inappropriate augmented bayes classifier anyway? there readable object-oriented implementation learning , inference of tan bayes classifiers in other language, translated python?

existing packages know of, found inappropriate are

milk, back upwards classification, not bayesian classifiers (and defitinetly need probabilities classification , unspecified features) pebl, construction learning scikit-learn, learns naive bayes classifiers openbayes, has barely changed since ported numarray numpy , documentation negligible. libpgm, claims back upwards different set of things. according main documentation, inference, construction , parameter learning. except there not seem methods exact inference. reverend claims “bayesian classifier”, has negligible documentation, , looking @ source code lead conclusion spam classifier, according robinson's , similar methods, , not bayesian classifier. ebay's bayesian belief networks allows build generic bayesian networks , implements inference on them (both exact , approximate), means can used build tan, there no learning algorithm in there, , way bns built functions means implementing parameter learning more hard might hypothetical different implementation.

i'm afraid there not out-of-the-box implementation of random naive bayes classifier (not aware of) because still academic matters. next paper nowadays method combine rf , nb classifiers (behind paywall) : http://link.springer.com/chapter/10.1007%2f978-3-540-74469-6_35

i think should stick scikit-learn, 1 of popular statistical module python (along nltk) , documented.

scikit-learn has random forest module : http://scikit-learn.org/stable/modules/ensemble.html#forests-of-randomized-trees . there submodule may (i insist of uncertainty) used pipeline towards nb classifier :

randomtreesembedding implements unsupervised transformation of data. using forest of random trees, randomtreesembedding encodes info indices of leaves info point ends in. index encoded in one-of-k manner, leading high dimensional, sparse binary coding. coding can computed efficiently , can used basis other learning tasks. size , sparsity of code can influenced choosing number of trees , maximum depth per tree. each tree in ensemble, coding contains 1 entry of one. size of coding @ n_estimators * 2 ** max_depth, maximum number of leaves in forest.

as neighboring info points more lie within same leaf of tree, transformation performs implicit, non-parametric density estimation.

and of course of study there out-of-core implementation of naive bayes classifier, can used incrementally : http://scikit-learn.org/stable/modules/naive_bayes.html

discrete naive bayes models can used tackle big scale text classification problems total training set might not fit in memory. handle case both multinomialnb , bernoullinb expose partial_fit method can used incrementally done other classifiers demonstrated in out-of-core classification of text documents.

python classification bayesian-networks

sql - where clauses in max statement -



sql - where clauses in max statement -

how possible add together query , converting or replacing or max value!

max(convert(int,replace(( queuenum ),'-',''))) [queue]

i want homecoming max of records have special , in clauses queuenum .

edited :

data :

1981-1-1232 1981-1-1235 1981-1-1234 1981-2-1 1981-2-2 1981-2-13

how possible homecoming max value of record started 1981-2

i guess mssql database in case seek utilize next statement without conversion:

sqlfiddle demo

select top 1 queuenum queue queuenum '1981-2-%' order len(queuenum) desc, queuenum desc

sql

bundling and minification - ASP.Net MVC Style Bundle Not Including Most Files -



bundling and minification - ASP.Net MVC Style Bundle Not Including Most Files -

recently, local re-create of project lost of styling. took me while figure out, of styling done in 1 file , rest minor things kendo , jquery ui.

the other, minor stuff wasn't beingness added page. thought styles had been modified developer (haven't touched project in while) testing web api stuff , not ui have wrecked , never known, tracked downwards problem: site.css file beingness included in bundle , none of other ones. tried rearranging order of css files included in bundle , include site.css.

i rebuilt project, cleared cache, etc., seeing changes. remember updating nuget packages or vs packages or lately - perchance mvc package?

my question is: did alter made happen? what's causing this?

edit: code bundleconfig.cs:

public static void registerbundles(bundlecollection bundles) { bundles.add(new stylebundle("~/content/css").include( "~/content/site.css", "~/content/themes/kendo/kendo.common.min.css", "~/content/themes/kendo/kendo.default.min.css", "~/content/themes/base/minified/jquery.ui.core.min.css", "~/content/themes/base/minified/jquery.ui.resizable.min.css", "~/content/themes/base/minified/jquery.ui.selectable.min.css", "~/content/themes/base/minified/jquery.ui.accordion.min.css", "~/content/themes/base/minified/jquery.ui.autocomplete.min.css", "~/content/themes/base/minified/jquery.ui.button.min.css", "~/content/themes/base/minified/jquery.ui.dialog.min.css", "~/content/themes/base/minified/jquery.ui.slider.min.css", "~/content/themes/base/minified/jquery.ui.tabs.min.css", "~/content/themes/base/minified/jquery.ui.datepicker.min.css", "~/content/themes/base/minified/jquery.ui.progressbar.min.css", "~/content/themes/base/minified/jquery.ui.theme.min.css")); }

code _layout.cshtml:

@styles.render("~/content/themes/base/css", "~/content/css")

by default, files names ending in ".min.css" included in release builds.

the recommended bundle configuration include non-minified .css , .js files, .min version automatically selected (if exists) in release builds, i.e. <compilation debug="false">in web.config.

you can command behavior clearing , adding ignore rules bundlecollection.ignorelist. illustration bundleconfig this:

public static class bundleconfig { public static void registerbundles(bundlecollection bundles) { configureignorelist(bundles.ignorelist); // setup bundles... } public static void configureignorelist(ignorelist ignorelist) { if (ignorelist == null) throw new argumentnullexception("ignorelist"); ignorelist.clear(); // clear list, add together new patterns. ignorelist.ignore("*.intellisense.js"); ignorelist.ignore("*-vsdoc.js"); ignorelist.ignore("*.debug.js", optimizationmode.whenenabled); // ignorelist.ignore("*.min.js", optimizationmode.whendisabled); ignorelist.ignore("*.min.css", optimizationmode.whendisabled); } }

you can explicitly enable/disable optimization setting bundletable.enableoptimizations.

asp.net-mvc bundling-and-minification

Python: Regex findall returns a list, why does trying to access the list element [0] return an error? -



Python: Regex findall returns a list, why does trying to access the list element [0] return an error? -

taken documentation, next snippet showing how regex method findall works, , confirms homecoming list.

re.findall(r"\w+ly", text) ['carefully', 'quickly']

however next code fragment generates out of bounds error (indexerror: list index out of range)when trying access zeroth element of list returned findall.

relevant code fragment:

population = re.findall(",([0-9]*),",line) x = population[0] thelist.append([city,x])

why happen?

for more background, here's how fragment fits entire script:

import re thelist = list() open('raw.txt','r') f: line in f: if line[1].isdigit(): city = re.findall("\"(.*?)\s*\(",line) population = re.findall(",([0-9]*),",line) x = population[0] thelist.append([city,x]) open('sorted.txt','w') g: item in thelist: string = item[0], ', '.join(map(str, item[1:])) print string

edit: read comment below background on why happened. quick prepare was:

if population: x = population[0] thelist.append([city,x])

re.findall homecoming empty list if there no matches:

>>> re.findall(r'\w+ly', 'this not work') []

python regex

MySQL 5.5 : Which one of the following is a better storage for a text/varchar field in innodb? -



MySQL 5.5 : Which one of the following is a better storage for a text/varchar field in innodb? -

requirement :

page#1 -> display users , 1-2 line preview of latest 10 blog posts

page#2 -> display single blogpost total text.

method 1 : mysql table -> userid -> varchar 50 post_id -> integer post_title -> varchar 100 post_description -> varchar 10000

for page#1 , select user_id, post_title , post_description blog_table . , substring of post_description used show preview in listing.

for page#2 , select user_id , post_title, post_description post_id = n

method 2 : mysql table -> userid -> varchar 50 post_id -> integer post_title -> varchar 100 post_brief -> varchar 250 post_description -> text

for page#1 , select user_id, post_title , post_brief blog_table .

for page#2 , select user_id , post_title, post_description post_id = n

does storing 2 columns, 1 brief varchar , 1 total text ( since accesses file scheme , , should queried when needed ) , worth performance benefit ?

since, method 2, store pointer text in row, whereas method 1 store total varchar 10k string in row. impact amount of table info can reside in ram , hence impact read performance of queries ?

the performance of sql queries depends on joins, clauses, grouping bys , order bys, not on columns retrieved. columns have noticable effect on query's speed if more info retrieved might have go on network processed programming language. not case here.

short answer: difference in performance between 2 proposed setups small.

for speed, post_id column should have (unique) index. not selecting, sorting or grouping other column, info can come straight table, fast process.

you talking "pages" here, i'm guessing going presented users - seems unlikely want show table of thousands of blog posts on same page human, therefor have order and/or limit clauses in statements didn't include in question.

but lets bit deeper whole thing. lets assume reading tons of text columns straight hard disk, wouldn't nail drive's maximum reading speed? wouldn't retrieving varchar(250) faster, since saves left() call?

we can left() phone call off table real quick. string functions fast - after all, cpu cutting off of data, fast process. times when produce noticable delay when they're used in clauses, joins etc., not because functions slow, because have run lots (possibly millions) of times in order produce single row of results, , more so, because uses prevent database using indexes properly.

so in end comes downwards to: how fast can mysql read table contents database. , in turn depends on storage engine using , settings. mysql can utilize number of storage engines, including (but not limited to) innodb , myisam. both of these engines offer different file layouts big objects such text or blob columns (but funnily enough, varchars). if text column stored in different page rest of row, storage engine has retrieve 2 pages every row. if stored along rest, it'll 1 page. sequential processing major alter in performance.

here's bit of background reading on that:

blob storage in innodb myisam dynamic vs. compressed info file layouts

long answer: depends :)

you have number of benchmark tests on own hardware create phone call layout quicker. given sec setup introduces redundancy additional column, perform worse in scenarios. perform improve if - , if - table construction allows shorter varchar column fit same page on disk while long text column on page.

edit: more on text columns , performance

there seems mutual misconception blobs , in-memory processing. quite number of pages (including answers here on stackoverflow - i'll seek find them, , give additional comment) state text columns (and other blobs) cannot processed in memory mysql, , such performance hog. not true. what's happening this:

if run query involves text column and query needs temporary table processed, then mysql have create temporary table on disk rather in memory, because mysql's memory storage engine cannot handle text columns. see this related question.

the mysql documentation states (the paragraph same versions 3.2 through 5.6):

instances of blob or text columns in result of query processed using temporary table causes server utilize table on disk rather in memory because memory storage engine not back upwards info types (see section 8.4.3.3, “how mysql uses internal temporary tables”). utilize of disk incurs performance penalty, include blob or text columns in query result if needed. example, avoid using select *, selects columns.

it lastly sentence confuses people - because bad example. simple select * not affected performance problem because won't utilize temporary table. if same select illustration ordered non-indexed column, would have utilize temporary table , would affected problem. utilize explain command in mysql find out whether query need temporary table or not.

by way: none of affects caching. text columns can cached else. if query needed temporary table , had stored on disk, result still cached if scheme had resources so, , cache not invalidated. in regard, text column else.

edit 2: more on text columns , memory requirements ...

mysql uses storage engine retrieve records disk. buffer results , hand them sequentially client. next assumes buffer ends in memory , not on disk (see above why)

for text columns (and other blobs), mysql buffer pointer actual blob. such pointer uses few bytes of memory, requires actual text content retrieved disk when row handed client. varchar columns (and else blobs), mysql buffer actual data. utilize more memory, because of texts going more few bytes. calculated columns, mysql buffer actual data, varchars.

a couple of notes on this: technically, blobs buffered when handed on client, 1 @ time - , big blobs perchance not in entirety. since buffer gets freed after each row, not have major effect. also, if blob stored in same page rest of row, may end beingness treated varchars. honest, i've never had requirement homecoming lots of blobs in single query, never tried.

now lets reply (now edited) question:

page #1. overview of users , short blog post snippets.

your options pretty much these queries

select userid, post_title, left(post_description, 250) `table_method_1` <-- calculated based on varchar column select userid, post_title, left(post_description, 250) `table_method_2` <-- calculated based on text column select userid, post_title, post_brief `table_method_2` <-- precalculated varchar column select userid, post_title, post_description `table_method_2` <-- homecoming total text, allow client produce snippet

the memory requirements of first 3 identical. 4th query require less memory (the text column buffered pointer,) more traffic client. since traffic on network (expensive in terms of performance,) tends slower other queries - mileage may vary. left() function on text column might sped telling storage engine utilize inlined table layout, depend on average length of text beingness stored.

page #2. single blog post

select userid, post_title, post_description `table_method_1` post_id=... <-- returns varchar select userid, post_title, post_description `table_method_2` post_id=... <-- returns text

the memory requirements low begin with, since 1 single row buffered. reasons stated above sec require tiny bit less memory buffer row, additional memory buffer single blob.

in either case, i'm pretty sure you're not concerned memory requirements of select that'll homecoming single row, not matter.

summary

if have text of arbitrary length (or requires more few kilobytes), should utilize text columns. that's they're there for. way mysql handles columns beneficial most of time.

there 2 things remember everyday use:

avoid selecting text columns, blob columns , other columns may have lots of info (and yes, includes varchar(10000)) if don't need them. habit of "select * whatever" when need couple of values set lot of unnecessary stress on database. when are selecting text columns or other blobs, create sure select not utilize temporary table. utilize explain syntax when in doubt.

when stick rules, should decent performance mysql. if need farther optimation that, you'll have @ finer details. include storage engines , respective table layouts, statistical info on actual data, , knowledge hardware involved. experience, rid of performance hogs without having dig deep.

mysql innodb