Monday, 15 September 2014

truecrypt - True crypt auto mounting on start-up does not work -



truecrypt - True crypt auto mounting on start-up does not work -

since yesterday true-crypt partition not automount on startup os every time (sometimes works, doesn't).

yes set scheme favorites , checkbox mount on startup set. yes have same password, typed same (en intl) layout. yes worked somehow before few times.

thanks help.

edit: os: windows 8

update seems not work cold starts.

warm starts seem work

i have problem on windows 8 laptop. tracked problem new shutdown process windows 8. won't total shutdown/startup when do, sort of hybrid shutdown (http://superuser.com/questions/496241/are-there-downsides-to-windows-8-hybrid-shutdown)

i found if utilize normal charm -> settings -> powerfulness -> shutdown, fail load encrypted partition when got desktop.

however, if utilize command line "shutdown.exe /s /t 0" shutdown, reliably load next time start up.

i forced prepare way because dropbox on encrypted partition, , dropbox complain couldn't find folder anymore (same google drive , skydrive, worse).

this might prepare problem, haven't tried yet (http://www.askvg.com/fix-windows-8-restart-and-shutdown-problems-by-disabling-hybrid-shutdown-feature/)

truecrypt

html - how to set property value of a Control in ASP.net using Web.config in the web form -



html - how to set property value of a Control in ASP.net using Web.config in the web form -

how can set value of property in asp.net control? assume command is:

<asp:label runat="server" id="label1" text="value"></asp:label>

i want value web.config:

system.configuration.configurationmaneger.appsetting["valuekey"]

what must do?

please excuse me poor , bad english.

try -

<asp:label id="label1" runat="server" text='<%$ appsettings:settingkey%>'></asp:label>

where settingkey key name of appsetting.

asp.net html

machine learning - Feature extraction from a single word -



machine learning - Feature extraction from a single word -

usually 1 wants feature text using handbag of words approach, counting words , calculate different measures, illustration tf-idf values, this: how include words numerical feature in classification

but problem different, want extract feature vector single word. want know illustration potatoes , french fries close each other in vector space, since both made of potatoes. want know milk , cream close, hot , warm, stone , hard , on.

what problem called? can larn similarities , features of words looking @ big number documents?

i not create implementation in english, can't utilize databases.

hmm,feature extraction (e.g. tf-idf) on text info based on statistics. on other hand, looking sense (semantics). hence no such method tf-idef work you.

in nlp exists 3 basic levels:

morphological analyses syntactic analyses semantic analyses

(higher number represents bigger problems :)). morphology known bulk languages. syntactic analyses bigger problem (it deals things verb, noun in sentence,...). semantic analyses has challenges, since deals meaning quite hard represent in machines, have many exceptions , language-specific.

as far understand want know relationships between words, can done via so-called dependency tree banks, (or treebank): http://en.wikipedia.org/wiki/treebank . database/graph of sentences word can considered node , relationship arc. there treebank czech language , english language there some, many 'less-covered' languages can problem find 1 ...

machine-learning nlp feature-extraction

asp.net - How to Check Only one RadioButton of a Row with Different Fileds binded in Row? -



asp.net - How to Check Only one RadioButton of a Row with Different Fileds binded in Row? -

i have grid 5 columns, in 3 radiobuttons of different fileds. want have status of checking 1 radiobutton of row,

my code is

<asp:templatefield itemstyle-horizontalalign="center" headertext="directpol"> <itemtemplate> <asp:radiobutton id="rddirectpol" runat="server" checked='<%#convert.toboolean(eval("pol"))%>'/> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="directpod"> <itemtemplate> <asp:radiobutton id="rddirectpod" runat="server" checked='<%# convert.toboolean(eval("pod")) %>' /> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="indirectpol"> <itemtemplate> <asp:radiobutton id="rdindirectpol" runat="server" checked='<%#convert.toboolean(eval("ispol"))%>' /> </itemtemplate> </asp:templatefield>

in doing can see 3 can checked @ 1 time, want restrict 1 @ time..., can 1 please help me

set groupname property:

<asp:templatefield itemstyle-horizontalalign="center" headertext="directpol"> <itemtemplate> <asp:radiobutton id="rddirectpol" runat="server" checked='<%#convert.toboolean(eval("pol"))%>' groupname="group1" /> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="directpod"> <itemtemplate> <asp:radiobutton id="rddirectpod" runat="server" checked='<%# convert.toboolean(eval("pod")) %>' groupname="group1" /> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="indirectpol"> <itemtemplate> <asp:radiobutton id="rdindirectpol" runat="server" checked='<%#convert.toboolean(eval("ispol"))%>' groupname="group1" /> </itemtemplate> </asp:templatefield>

this way, 1 radiobutton checked each radiobutton same groupname. in case, you'll have set 1 groupname per row.

asp.net gridview datagridview

wpf - XAML - The property 'Content' is set more than once -



wpf - XAML - The property 'Content' is set more than once -

very new wpf , xaml. can't head around why can't place wpf command in next code. issue <canvas></canvas> tags are. set in place gives me 'the property 'content' set more once'

if explain in simple terms content property set helpful.

i have checked out next articles no avail: the property 'content' set more once the property content set more once property content set more once the property 'content' set more 1 time button wpf controltemplate causeing error "the property 'content' set more once"

<window x:class="pdfindexer.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid x:name="parentgrid"> <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition height="1*" /> <rowdefinition height="25" /> </grid.rowdefinitions> <menu grid.row="0" > <menuitem header="file" > <menuitem header="open project" click="menuitem_click_1"></menuitem> <menuitem header="save project"></menuitem> <menuitem header="close project"></menuitem> <separator></separator> <menuitem header="exit"></menuitem> </menuitem> <menuitem header="edit"></menuitem> </menu> <tabcontrol grid.row="1"> <tabitem header="document flow" > outline of entire document placed. <canvas></canvas> </tabitem> <tabitem header="preview"> preview drawn screen. </tabitem> <tabitem header="resources"> resources { graphic files, fonts, info files } </tabitem> <tabitem header="code library"> user can save re-usable bits of code. useful when adding intel barcodes or address blocks etc... </tabitem> </tabcontrol> <statusbar grid.row="2"> items </statusbar> </grid>

by adding text description tabitem added content when added canvas added additional item of content not allowed tabitem. need utilize command can hold collection of children such canvas, grid, stackpanel etc. seek this.

<tabcontrol grid.row="1"> <tabitem header="document flow"> <canvas> <textblock> outline of entire document placed. </textblock> </canvas> </tabitem> <tabitem header="preview"> preview drawn screen. </tabitem> <tabitem header="resources"> resources { graphic files, fonts, info files } </tabitem> <tabitem header="code library"> user can save re-usable bits of code. useful when adding intel barcodes or address blocks etc... </tabitem> </tabcontrol>

wpf

html prevent scrolling also prevents html5 input type range -



html prevent scrolling also prevents html5 input type range -

i have html web app, , adding sliders so:

<form oninput="output1.value=slider1.value"> <input type="range" name="slider1" value="50"/> <output name="output1" for="slider1">50</output> </form>

works great on web, , on device.

now, when add together in preventdefault code stop page scrolling breaks:

document.addeventlistener( 'touchmove' , function(e) {e.preventdefault()} , false );

now, if own control, prepare it, want default behavior of html5 slider, how can back?

not sure duplicate, in case:

function stopscrolling( touchevent ) { if ((touchevent.target.id != "pastgenslider") && (touchevent.target.id != "curgenslider")) touchevent.preventdefault(); } document.addeventlistener( 'touchmove' , stopscrolling , false );

just check id element has, , if want allow process, allow pass/do not phone call preventdefault();

html5 html-input

php - instagram api Real-time challenge get code 200 but void data -



php - instagram api Real-time challenge get code 200 but void data -

my goal create subscription of application , info tag love

class indexcontroller extends app_controller_default

{ public function indexaction() { $data = $this->_getsubscriptiontag(); zend_debug::dump($data); }

public function realtimecallbackaction() { $this->_helper->layout->disablelayout(); $this->_helper->viewrenderer->setnorender(true); $allparams = $this->_getallparams(); $datafile = root_dir.'/data.txt'; file_put_contents($datafile, implode(',',$_get).implode(',',array_keys($_get))); if(isset($_get['hub_challenge'])){ $challenge = $_get['hub_challenge']; $file = root_dir.'/json.txt'; $json = $this->_challenge($challenge); file_put_contents($file, $json); } $request = $this->getrequest(); if($request->ispost()){ $filepostdata = root_dir.'/postdata.txt'; $postdata = file_get_contents("php://input"); file_put_contents($filepostdata, $postdata, file_append | lock_ex); } } protected function _getsubscriptiontag($verifytoken='') { $config = array( 'adapter' => 'zend_http_client_adapter_curl', 'curloptions' => array(curlopt_followlocation => true), ); $uri = 'https://api.instagram.com/v1/subscriptions/'; $request = $this->getrequest(); $callbackurl= $request->getscheme().'://'.$request->gethttphost().$request->getbaseurl().'/index/realtimecallback'; $client = new zend_http_client(); $client->seturi($uri); $client->setconfig($config); $client->setmethod(zend_http_client::post); $client->setparameterpost('client_id', 'my_id'); $client->setparameterpost('client_secret', 'my_secret'); $client->setparameterpost('object', 'tag'); $client->setparameterpost('aspect', 'media'); $client->setparameterpost('object_id', 'love'); $client->setparameterpost('verify_token', $verifytoken); $client->setparameterpost('callback_url', $callbackurl); $response = $client->request(); $httpcode = $response->getstatus(); $httpheaders = $response->getheaders(); $httpbody = $response->getbody(); $data = array(); try{ $data = zend_json_decoder::decode($httpbody,zend_json::type_array); } catch(exception $e){ $data['error_type'] = 'malformed json'; $data['error_message'] = $e->getmessage(); } var_dump($client->getlastrequest()); homecoming $data; } protected function _challenge($challenge) { $config = array( 'adapter' => 'zend_http_client_adapter_curl', 'curloptions' => array(curlopt_followlocation => true), ); $uri = 'https://api.instagram.com/v1/subscriptions/'; $client = new zend_http_client(); $client->seturi($uri); $client->setconfig($config); $client->setparameterget('challenge', $challenge); $client->setparameterget('client_id', 'my_id'); $client->setparameterget('client_secret', 'my_secret'); $response = $client->request(); $httpcode = $response->getstatus(); $httpheaders = $response->getheaders(); $httpbody = $response->getbody(); homecoming $httpbody; }

}

in json.txt file {"meta":{"code":200},"data":[]} , if request https://api.instagram.com/v1/subscriptions?client_secret=client-secret&client_id=client-id same don't know way turn :( can help me, please ?

i tried $client->setparameterget('verify_token', $challenge); doesn't work :(

:)

public function realtimeaction() { $file = root_dir.'/json.txt'; $data = $this->_getsubscriptiontag(); $request = $this->getrequest(); if($request->ispost()){ $filepostdata = root_dir.'/postdata.txt'; $postdata = file_get_contents("php://input"); file_put_contents($filepostdata, $postdata, file_append | lock_ex); } zend_debug::dump($data); } public function realtimecallbackaction() { $this->_helper->layout->disablelayout(); $this->_helper->viewrenderer->setnorender(true); if(isset($_get['hub_challenge'])){ $challenge = $_get['hub_challenge']; echo $challenge; exit; }

}

very http://thegregthompson.com/instagram-real-time-api-php/

php zend-framework

objective c - Setting composite drawing mode causing black holes/patches on NSWindow -



objective c - Setting composite drawing mode causing black holes/patches on NSWindow -

i wanted draw shape, on wanted draw smaller transparent shape.

-(void) drawrect:(nsrect)dirtyrect { //clear { [[nscolor whitecolor] set]; [[nsbezierpath bezierpathwithrect:dirtyrect] fill]; } nsbezierpath *thepath = [nsbezierpath bezierpathwithovalinrect: self.bounds]; [thepath setlinewidth: 30]; [[nscolor bluecolor] set]; [thepath stroke]; [[nsgraphicscontext currentcontext] setcompositingoperation: nscompositecopy]; [[nscolor clearcolor] set]; [thepath setlinewidth: 4]; [thepath stroke]; }

i've tried nsimage forst , on view, still getting same result.

-(void) drawrect:(nsrect)dirtyrect { //clear { [[nscolor whitecolor] set]; [[nsbezierpath bezierpathwithrect:dirtyrect] fill]; } nsimage* image = [[nsimage alloc] initwithsize:self.frame.size]; [image lockfocus]; //clear { [[nscolor whitecolor] set]; [[nsbezierpath bezierpathwithrect:dirtyrect] fill]; } nsbezierpath *thepath = [nsbezierpath bezierpathwithovalinrect: self.bounds]; [thepath setlinewidth: 30]; [[nscolor bluecolor] set]; [thepath stroke]; [[nsgraphicscontext currentcontext] setcompositingoperation: nscompositecopy]; [[nscolor clearcolor] set]; [thepath setlinewidth: 4]; [thepath stroke]; [image unlockfocus]; [image drawinrect:self.frame fromrect:nszerorect operation:nscompositecopy fraction:1.0]; }

the oval appears black because windows opaque default. you've cutting oval track in window, because window opaque, without industrial laser cutting same oval in monitor, mac has show some color there instead. color shows color of clearcolor: black.

the solution set window's opaque no.

the default yes, nice , efficient (well, actually, because) prevents other windows' contents showing through. setting no allow see behind window through lean oval track. (it'll work improve if fill oval, giving larger window in the… er… window.)

(why track filled gray? that's window's shadow you're seeing there. when seek real, you'll able see other windows on scheme through track move window around.)

objective-c cocoa drawing quartz-2d

php - Calculate 2 timestamp in attendance -



php - Calculate 2 timestamp in attendance -

any ideas how calculate attendance datetime in mysql.

for example: want total hours person worked in day. in given.

mysql structures:

----------------------------------------------------- id | datetime | status | employeeid ----------------------------------------------------- 1 | 18-feb-13 8:00:00 | check in | 100a 2 | 18-feb-13 10:00:00 | check in | 100a 3 | 18-feb-13 17:00:00 | check out | 100a

still total hours 8 hours excluding break time 12:00 pm.

here's php way date math:

$datetime1 = datetime::createfromformat('d-m-y g:i:s', '18-feb-13 8:00:00'); $datetime2 = datetime::createfromformat('d-m-y g:i:s', '18-feb-13 17:00:00'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%h hours %i minutes %s seconds'); echo $elapsed;

see in action

you'll need more math deal breaks should started.

reference

datetime dateinterval

php mysql date datetime

php - Using a regular expression to validate an email address -



php - Using a regular expression to validate an email address -

over years have developed regular expression validates email addresses correctly, assuming don't utilize ip address server part.

i utilize in several php programs, , works of time. however, time time contacted having problem site uses it, , end having create adjustment (most realized wasn't allowing 4-character tlds).

what's best regular look have or have seen validating emails?

i've seen several solutions utilize functions utilize several shorter expressions, i'd rather have 1 long complex look in simple function instead of several short look in more complex function.

there no simple regular look problem: see this rfc‑822–compliant regex, simple. (it written before days of grammatical patterns.) grammar specified in rfc 5322 complicated primitive regular expressions.

the more sophisticated grammatical patterns in perl, pcre, , php can manage correctly parse rfc 5322 without hitch. python , c# should able manage it, utilize different syntax first three. however, if forced utilize 1 of many less powerful pattern-matching languages, it’s best utilize real parser.

it's of import understand validating per rfc tells absolutely nil whether address exists @ supplied domain, or whether person entering address true owner. people sign others mailing lists way time. fixing requires fancier kind of validation involves sending address message includes confirmation token meant entered in same web page address.

confirmation tokens way know got address of person entering it. why mailing lists utilize mechanism confirm sign-ups. after all, can set downwards president@whitehouse.gov, , parse legal, isn't person @ other end.

for php, should not utilize pattern given in validate e-mail address php, right way quote:

there danger mutual usage , widespread sloppy coding found de facto standard e-mail addresses more restrictive recorded formal standard.

that no improve other non-rfc patterns. isn’t smart plenty handle rfc 822, allow lone rfc 5322. this one, however, is.

if want fancy , pedantic, implement finish state engine. regular look can deed rudimentary filter. problem regular expressions telling valid e-mail address invalid (a false positive) because regular look can't handle rude , impolite user's perspective. state engine purpose can both validate , right e-mail addresses otherwise considered invalid disassembles e-mail address according each rfc. allows potentially more pleasing experience, like

the specified e-mail address 'myemail@address,com' invalid. did mean 'myemail@address.com'?

see validating email addresses, including comments. or comparing e-mail address validating regular expressions.

debuggex demo

php regex email email-validation

android - Saving file to windows-viewable folder rather than emulated/0/[foldername] -



android - Saving file to windows-viewable folder rather than emulated/0/[foldername] -

i doing android development work , have been saving files sdcard using code:

environment.getexternalstoragedirectory()

this works great problem is, app creates lot of images want able grab when phone attached usb stick windows pc instead of going storage/emulated/0/ want info go windows-viewable folder (the parent of dcim etc.)

what safest way of doing this? (so work on many devices without millions of hacks)

thanks time,

poncho

android save storage local-storage

asp.net - ClientID via FindControl() different from Generated ID in html -



asp.net - ClientID via FindControl() different from Generated ID in html -

i have literal defined in usercontrol embedded in aspx , embedded in masterpage.

this.parent.findcontrol("literror") returns me control... client id "phcontent_literror". find command on server side code...

when generated html, see "ctl00_ctl00_phcontent_literrorpanel"

is normal ?

my question because added initiator command ( button) dynamically in ajaxsettings of ajaxmanager update literror... however, when there error, update literror.text... wouldnt update on browser... led me check literror control...

the server side find command has ability find server controls name , have observed generated in page in order unique. normal. advertisement why field in ajax command not updating, need post more code.

asp.net findcontrol

node.js - npm local install package to custom location -



node.js - npm local install package to custom location -

is possible specify custom bundle destination npm install, either through command flag or environment variable?

by default, npm local installs end in node_modules within current directory, want install node_modules within different directory, illustration vendor/node_modules. how can create happen?

tl;dr

you can using --prefix flag , --global* flag.

pje@friendbear:~/foo $ npm install bower -g --prefix ./vendor/node_modules bower@0.7.0 /users/pje/foo/vendor/node_modules/bower

*even though "global" installation, installed bins won't accessible through command line unless ~/foo/vendor/node_modules exists in path.

tl;r

every configurable attribute of npm can set in of 6 different places. in order of priority:

command-line flags: --prefix ./vendor/node_modules environment variables: npm_config_prefix=./vendor/node_modules user config file: $home/.npmrc or userconfig param global config file: $prefix/etc/npmrc or userconfig param built-in config file: path/to/npm/itself/npmrc default config: node_modules/npmconf/config-defs.js

by default, locally-installed packages go ./node_modules. global ones go prefix config variable (/usr/local default).

you can run npm config list see current config , npm config edit alter it.

ps

in general, npm's documentation helpful. folders section structural overview of npm , config section answers question.

node.js npm

position - jquery inconsistent positioning using offset().top -



position - jquery inconsistent positioning using offset().top -

i trying position #elementa relative #elementb. half time ends 1 top value, half time gets another, , can't figure out why. #elementa begins css:

#elementa { display: block; opacity: 0; position: absolute; clear: both; margin-left: -49px; }

then, on $(document).ready(), set top value , fade in.

var p = $('#elementb').offset(); $('#elementa').css({ top: p.top - 2 }); $('#elementa').animate({opacity: 1}, 400);

why getting inconsistent results? there improve way this?

i found problem. thought because executing on $(document).ready() wouldn't have worry assets loading affecting positioning. turned out image above #elementa throwing off when didn't load in time. waiting $('other image').load() fixes it.

jquery position positioning offset

java - Any alternative for Rundeck for running commands on multiple servers? -



java - Any alternative for Rundeck for running commands on multiple servers? -

i implementing workflow of tasks in java program. 1 of tasks running commands on multiple linux servers.

the servers determined dynamically - read xml file. examined rundeck's api, seems have configure servers in advance, doesn't suit needs.

any ideas?

one reply utilize rundeck, think need rundeck dynamically load nodes.

to create dynamic need refresh project. restart rundeck or utilize api refresh method. haven't tried latter think improve solution. resource model supports files , getting node list of servers external source url.

but if rolling own improve reply maybe ssh , consider ssh library java

java rundeck

javascript - Make Fabric.js object draggable but not "selectable" -



javascript - Make Fabric.js object draggable but not "selectable" -

fabric.js has cool aspect allows, default, objects "selectable", means able dragged, resized, , rotated. however, them draggable only, no resizing or rotating. possible? don't mind mucking source if what's needed, improve reimplementing myself.

nevermind, have found reply here: http://fabricjs.com/customization/

this line it

canvas.item(0).hascontrols = false;

javascript fabricjs

swing - Double click listener on JTable in Java -



swing - Double click listener on JTable in Java -

i curious how phone call valuechanged overridden method if row in jtable has been double clicked. below code snippet achieves 1 click action or event arrow key navigate through list of people , adjust jlabel accordingly. i'm trying similar did 1 click, time if , if row has been double clicked dto alter else nil happens. how do :(

class listdataui { public void addlistselectionlistener(listselectionlistener listselectionlistener) { summarytable.getselectionmodel().addlistselectionlistener(listselectionlistener); public t getselecteddto() { final int selectedrowindex = summarytable.getselectedrow(); if (selectedrowindex != -1) { homecoming data.get(summarytable.convertrowindextomodel(selectedrowindex)); } else { homecoming null; } } } } class mainmenu extends javax.swing.jframe { private void initlisteners() { searchtable.addlistselectionlistener(new listselectionlistener() { @override public void valuechanged(listselectionevent e) { if (!e.getvalueisadjusting()) { academicdto dto = (academicdto) searchtable.getselecteddto(); acimglabel.seticon(new imageicon()); label_name.settext(dto.gettitle() + " " + dto.getforename() + " " + dto.getsurname()); label_role.settext("role: " + dto.getrole()); label_phone.settext("phone: " + dto.getphone()); label_room.settext("room: " + dto.getroom()); label_hours.settext("hours: " + dto.gethours()); label_mobile.settext("mobile: " + dto.getmobile()); if (dto.getimage() != null) { acimglabel.seticon(new imageicon(dto.getimage())); } } } }); } } private void initlisteners() { contacttable.addmouselistener(new mouseadapter() { @override public void mouseclicked(mouseevent e) { contactdto dto = (contactdto) contacttable.getselecteddto(); if (e.getclickcount() == 2) { system.out.println(dto.getforename()); } else { } } }); }

not sure of rest above...

try this:

mytable.addmouselistener(new mouseadapter() { public void mousepressed(mouseevent me) { jtable table =(jtable) me.getsource(); point p = me.getpoint(); int row = table.rowatpoint(p); if (me.getclickcount() == 2) { // valuechanged overridden method } } });

java swing jtable double-click listselectionlistener

node.js - nodejs 'forever' just doesn't do anything -



node.js - nodejs 'forever' just doesn't do anything -

i trying run nodejs app on amazon ec2 instance using forever. installed nodejs npm, , ran sudo npm install forever -g. installation didn't homecoming errors, go ahead , seek running app using forever start server.js, won't - no output what-so-ever, not error. tried forever --help , forever, none of them giving me response...

when running app regularly using nodejs - nodejs init.js works expected, need running using forever won't shut downwards when disconnect server.

edit : since problem having nodejs closing when closed terminal session ec2 server, solved using linux nohup command : nohup sudo nodejs server.js & kept nodejs running in kid process after closed terminal window.

thanks help though! :)

i not receiving stdout input forever command , prepare nailed it:

sudo ln -s /usr/bin/nodejs /usr/local/bin/node

hope helps someone.

node.js amazon-ec2 forever

python - Detecting ImportError in imported module -



python - Detecting ImportError in imported module -

i want import python module if exists, ignore importerror if not. however, if imported module raises importerror, error ignored too, , that's not need (i.e. if module exists, has bug, want know).

for app in installed_apps: try: module = __import__('{}.mycustommodule'.format(app)) # except importerror: traceback = sys.exc_info()[2] if ( ? ): # if exception occurred in app.mycustommodel, raise raise pass # otherwise, ignore

i checked docs sys.exc_info , traceback didn't find useful info. how can done?

if exception occurred in same function catching it, stack trace have 1 frame. otherwise, have multiple frames. after looking @ related questions , making tests, found out it's plenty check if tb_next none:

except importerror: traceback = sys.exc_info()[2] if ( traceback.tb_next ): raise pass

note: although documentation on tb_next scarce (saw reference in docs inspect, nil specifying constitutes traceback "level"), behavior above consistent between python 2.7.3, python 3.2.3, jython 2.5.3, ironpython 2.7.3 , pypy 1.8.0.

python exception-handling stack-trace

c# - MS.Internal.WrappedException in .itemsSource -



c# - MS.Internal.WrappedException in <Pivot>.itemsSource -

i trying utilize pivot view image. when run code, debugger breaks @ line:

mainviewer.itemssource = queueingimages;

and thrown weird exception:

an exception of type 'ms.internal.wrappedexception' occurred in system.windows.ni.dll , wasn't handled before managed/native boundary

this xaml used:

<phone:pivot grid.row="1" name="mainviewer"> <phone:pivot.headertemplate> <datatemplate> <textblock text="" fontsize="0" /> </datatemplate> </phone:pivot.headertemplate> <phone:pivot.itemtemplate> <datatemplate> <grid> <grid.rowdefinitions> <rowdefinition height="*" /> <rowdefinition height="10" /> </grid.rowdefinitions> <image source="{binding imgsource}" stretch="uniform" grid.row="0"> <toolkit:gestureservice.gesturelistener> <toolkit:gesturelistener flick="{binding imageflick}" dragdelta="{binding imagepan}" pinchdelta="{binding imagezoom}" tap="{binding imagetap}" doubletap="{binding imagedoubletap}" /> </toolkit:gestureservice.gesturelistener> </image> <progressbar grid.row="1" value="{binding downloadpercentage}" maximum="100" minimum="0" smallchange="1" visibility="{binding iscompleted}"/> </grid> </datatemplate> </phone:pivot.itemtemplate> </phone:pivot>

the "queueingimages" is:

private observablecollection<imageview> queueingimages

here imageview class:

class imageview { public imageview(string id) { id = id; } public string id { get; private set; } public imagesource imgsource { get; private set; } public int downloadpercentage { get; set; } public visibility iscompleted { get; set; } public event eventhandler flicked; /* flick="{binding imageflick}" dragdelta="{binding imagepan}" pinchdelta="{binding imagezoom}" tap="{binding imagetap}" doubletap="{binding imagedoubletap}" */ public void setsource(system.io.stream s) { bitmapimage bi = new bitmapimage(); bi.setsource(s); imgsource = bi; } public void progresshandler(object sender, downloadprogresschangedeventargs e) { downloadpercentage = e.progresspercentage; } /////// image controls public void imageflick(object sender, flickgestureeventargs e) { // pass out event if (flicked != null) flicked(sender, e); } public void imagepan(object sender, dragdeltagestureeventargs e) { system.diagnostics.debug.writeline("panning"); } public void imagezoom(object sender, pinchgestureeventargs e) { system.diagnostics.debug.writeline("zooming"); } public void imagetap(object sender, gestureeventargs e) { system.diagnostics.debug.writeline("tapped"); } public void imagedoubletap(object sender, gestureeventargs e) { system.diagnostics.debug.writeline("double tapped"); } }

can point out doing wrong?

alright, figured out. error caused next code.

<toolkit:gestureservice.gesturelistener> <toolkit:gesturelistener flick="{binding imageflick}" dragdelta="{binding imagepan}" pinchdelta="{binding imagezoom}" tap="{binding imagetap}" doubletap="{binding imagedoubletap}" /> </toolkit:gestureservice.gesturelistener>

it seems cannot utilize binding under toolkit:gesturelistener. remove bindings , everything's working perfectly:)

c# xaml windows-phone-8

Resizing a Image to selection rectangle Delphi -



Resizing a Image to selection rectangle Delphi -

hi cant figure out why wont work. have image , selection , want image same size , position selection set code in timer:

procedure tfrmmainui.tmrupdatetimer(sender: tobject); var : integer; begin image1.width:=selection1.width; image1.height:=selection1.height; image1.position.x:=selection1.position.x; image1.position.y:=selection1.position.y; end;

but doesn't work.

what supposed happen image resizes selection , position follows selection. happens can move , resize selection , image stays , doesn't resize.

as @mike sutton pointed out in comments, should using ontrack event of tselection trigger updates image.

the documentation says:

the event handler of ontrack event called cyclically mousemove method while tselection object in process of moving or resizing.

write custom ontrack event handler perform specific action when tselection in process of moving or resizing.

you state in comment, components created dynamically @ runtime, rather on designtime surface. need assign handler in code. this:

selection1.ontrack := selectiontrack;

your event handler this:

procedure tfrmmainui.selectiontrack(sender: tobject); begin image1.width:=selection1.width; image1.height:=selection1.height; image1.position.x:=selection1.position.x; image1.position.y:=selection1.position.y; end;

you in comments need track selection changes number of linked images , selections. can modify event handler this:

procedure tfrmmainui.selectiontrack(sender: tobject); var selection: tselection; image: timage; begin selection := sender tselection; image := imagefromselection(selection);//you need implement function image.width:=selection.width; image.height:=selection.height; image.position.x:=selection.position.x; image.position.y:=selection.position.y; end;

image delphi firemonkey

ios - How can I simulate app being killed in background? -



ios - How can I simulate app being killed in background? -

i'm trying verify app (app1) behaves correctly when shut downwards scheme after launches app (app2). there way simulate or forcefulness behavior?

telling simulator simulate memory warning while app2 running doesn't until app1 brought foreground. killing app1 debugger simulate same sequence of app events?

edit: app placed in background when launches sec app handle file. sec app relaunches app, , i'm trying verify app behaves correctly when scheme has shut downwards while sec app executing.

yes, if app in background already. app killed scheme while in background terminated no warning-- no app delegate methods called, no state changes made-- happens when debugger stop while app in background. (this presupposes you've set app in background clicking home button on simulator or cmd-shift-h)

(as @inafziger notes, can same effect using simulator's interface forcefulness quit running app.)

ios ios-simulator

How can I add a note to a Visual Studio bookmark or line? -



How can I add a note to a Visual Studio bookmark or line? -

when in middle of debugging find more 1 area can improved (or fixed) , mark them in such away can come later , create improvement.

currently add together bookmark line can't include notes can used remind me why bookmark there (you can alter name of bookmark isn't enough). suppose want able add together todo code while code running although edit , continue enabled not available in asp.net webforms (3.5) project.

are there visual studio features or extensions enable this?

instead of enabling edit , go on entering todo: source code, can create task list shortcut (key cord ctrl + k, ctrl + h).

this adds entry shortcuts section of task list window. there can alter description of task remind why created it.

visual-studio visual-studio-2012

php - How to extract data from POP3 email? -



php - How to extract data from POP3 email? -

i receive email pop3 server php. have raw string containing headers , body. how can headers , body parsed in form of class or array?

example of have:

return-path: envelope-to: x@x.de delivery-date: wed, 06 feb 2013 09:35:37 +0100 received: mail service host6.toxpress.com spam-scanned (exim 4.80.1) (envelope-from ) id 1u30tc-0003sh-lq x@x.de; wed, 06 feb 2013 09:35:36 +0100 x-spam-checker-version: spamassassin 3.3.2 (2011-06-06) on host6.toxpress.com x-spam-level: x-spam-status: no, score=-1.9 required=5.0 tests=bayes_00,freemail_from, rcvd_in_dnswl_none,tvd_space_ratio autolearn=ham version=3.3.2 received: moh3-ve2.go2.pl ([193.17.41.86] helo=moh3-ve1.go2.pl) host6.toxpress.com esmtp (exim 4.80.1) (envelope-from ) id 1u30tc-0003rk-2b x@x.de; wed, 06 feb 2013 09:35:32 +0100 received: moh3-ve1.go2.pl (unknown [10.0.0.157]) moh3-ve1.go2.pl (postfix) esmtp id bc734af611b ; wed, 6 feb 2013 09:34:31 +0100 (cet) received: unknown (unknown [10.0.0.108]) moh3-ve1.go2.pl (postfix) smtp ; wed, 6 feb 2013 09:34:31 +0100 (cet) received: 43.dynamic.chello.pl [89.69.42.127] poczta.o2.pl esmtp id jtigfv; wed, 06 feb 2013 09:34:31 +0100 message-id: <51121593.3090008@o2.pl> date: wed, 06 feb 2013 09:34:27 +0100 from: tomasz reply-to: tomasz_smykrowski@o2.pl organization: tomasz user-agent: mozilla/5.0 (windows nt 6.1; rv:20.0) gecko/20100101 thunderbird/20.0a2 mime-version: 1.0 to: x@x.de subject: adaads content-type: text/plain; charset=iso-8859-1; format=flowed content-transfer-encoding: 7bit x-o2-trust: 2, 64 x-o2-spf: neutral dsadasdsaas .

and want able do:

echo $from; echo $replyto; echo $date; echo $body; echo $subject; echo $charset;

have @ mime e-mail message parser class. according author's description:

this class can used parse , decode mime e-mail messages. supports decoding single rfc 2822 mime messages or archives aggregate multiple messages in mbox format. the decoded message info returned array describes 1 or more messages found in message file or info string. bodies of multipart messages can decoded distinct sub-messages. message body info can decoded , saved separate files, class can handle messages larger available memory.

php email pop3

php - How to set default value for form fields- Magento? -



php - How to set default value for form fields- Magento? -

i have admin form field(textbox),

$fieldset->addfield('ajax_time_interval', 'text', array( 'label' => mage::helper('dealroom')->__('page refresh time interval'), 'class' => 'required-entry', 'required' => true, 'name' => 'ajax_time_interval', ));

i need set default value text field. tried, setting 'value' => '120', in it. not working.

$fieldset->addfield('ajax_time_interval', 'text', array( 'label' => mage::helper('dealroom')->__('page refresh time interval'), 'class' => 'required-entry', 'required' => true, 'name' => 'ajax_time_interval', 'value' => '120', ));

how set defalt value in field?

in case, setvalues() function overriding 'value' had set field.

cause:

in _prepareform() function, set value below:

$fieldset->addfield('ajax_time_interval', 'text', array( 'label' => mage::helper('dealroom')->__('page refresh time interval'), 'class' => 'required-entry', 'required' => true, 'name' => 'ajax_time_interval', 'value' => '120', ));

at end of _prepareform() function, there next line of code reset form values:

$form->setvalues($model->getdata());

solution:

set model info before setvalues() function below:

if (!$model->getid()) { $model->setdata('ajax_time_interval', '120'); } $form->setvalues($model->getdata());

php magento

java - File not found Exception in linkedin integration -



java - File not found Exception in linkedin integration -

i tried integrate linkedin sharing info using many tutorials , posts, nil helped, after login not able move next page instead redirecting previous, checked keys, using other users key m able share posts problem in giving callback url

public static final string oauth_callback_url = "x-oauthflow-linkedin" + "://" + "litestcalback";

does know how give url?

stack trace

02-06 16:18:49.786: e/androidruntime(393): @ droid.os.handler.dispatchmessage(handler.java:92) 02-06 16:18:49.786: e/androidruntime(393): @ , roid.os.looper.loop(looper.java:123) 02-06 16:18:49.786: e/androidruntime(393): @ android.app.activitythread.main(activitythread.java:3683) 02-06 16:18:49.786: e/androidruntime(393): @ jav a.lang.reflect.method.invokenative(native method) 02-06 16:18:49.786: e/androidruntime(393): @ java.lang.reflect.method.invoke(method.java:507) 02-06 16:18:49.786: e/androidruntime(393): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 02-06 16:18:49.786: e/androidruntime(393): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 02-06 16:18:49.786: e/androidruntime(393): @ dalvik.system.nativestart.main(native method) 02-06 16:18:49.786: e/androidruntime(393): caused by: oauth.signpost.exception.oauthcommunicationexception: communication service provider failed: https://api.linkedin.com/uas/oauth/requesttoken 02-06 16:18:49.786: e/androidruntime(393): @ oauth.signpost.abstractoauthprovider.retrievetoken(abstractoauthprovider.java:214) 02-06 16:18:49.786: e/androidruntime(393): @ oauth.signpost.abstractoauthprovider.retrieverequesttoken(abstractoauthprovider.java:69) 02-06 16:18:49.786: e/androidruntime(393): @ com.google.code.linkedinapi.client.oauth.linkedinoauthserviceimpl.getoauthrequesttoken(linkedinoauthserviceimpl.java:172) 02-06 16:18:49.786: e/androidruntime(393): ... 12 more 02-06 16:18:49.786: e/androidruntime(393): caused by: java.io.filenotfoundexception: https://api.linkedin.com/uas/oauth/requesttoken 02-06 16:18:49.786: e/androidruntime(393): @ org.apache.harmony.luni.internal.net.www.protocol.http.httpurlconnectionimpl.getinputstream(httpurlconnectionimpl.java:521) 02-06 16:18:49.786: e/androidruntime(393): @ org.apache.harmony.luni.internal.net.www.protocol.https.httpsurlconnectionimpl.getinputstream(httpsurlconnectionimpl.java:258) 02-06 16:18:49.786: e/androidruntime(393): @ oauth.signpost.basic.httpurlconnectionresponseadapter.getcontent(httpurlconnectionresponseadapter.java:18) 02-06 16:18:49.786: e/androidruntime(393): @ oauth.signpost.abstractoauthprovider.handleunexpectedresponse(abstractoauthprovider.java:228) 02-06 16:18:49.786: e/androidruntime(393): @ oauth.signpost.abstractoauthprovider.retrievetoken(abstractoauthprovider.java:189)

java android url oauth linkedin

java - Implementing idempotency for AWS Spot Instance Requests -



java - Implementing idempotency for AWS Spot Instance Requests -

i'm using java aws sdk create ec2 spot instance requests. opposed on demand instances, api spot requests not have similar clienttoken , not back upwards idempotency out of box.

the straightforward way think of set launchgroup property unique uuid; when check phone call describespotinstancerequests , see if have request same launch group.

to surprise, seems there's delay before describe phone call returns spot requests sent before. wrote junit test , seems in order consistent have set timeout of @ to the lowest degree 60s between 2 calls (request spot instance , describe spot instance requests). need have granularity of 10s, because requests can repeated application @ interval, in case of failure - i.e. breaks after sent request before read result got amazon. in case don't want have request repeated, want see got registered , move on.

@test public void testrunspotinstances() throws exception { activity.execute(execution); timeout(timeout); // shouldn't activity.execute(execution); timeout(timeout); describespotinstancerequestsresult result = client.describespotinstancerequests( new describespotinstancerequestsrequest().withfilters(new filter() .withname("launch-group").withvalues(business_key))); assertthat(result.getspotinstancerequests()).hassize(1); timeout(timeout); }

the test works every time if timeout set 60s; 40-50s works intermittently. below fails every time.

has managed work around delay? implementing idempotency spot requests possible using aws api , not having state saved in client application?

in case don't want have request repeated, want see got registered , move on.

if got 200 back, it's registered. may not show right away, it's registered , can move on in flow.

is implementing idempotency spot requests possible using aws api , not having state saved in client application?

i don't believe so. have same sort of issue amazon's emr. way work around have component who's job observe clusters. when create request emr cluster, cluster id, pass off observer. observer phone call other components when cluster changes state. not beingness acknowledged emr right away valid case , not treated exception.

i have no thought if that's appropriate you. perhaps seek maintaining spotinstancerequestid. in case, maintain them in memory, maintain them somewhere persistent if need be.

java amazon-web-services amazon-ec2

progress bar - Recommendations Bar opening over the main content area -



progress bar - Recommendations Bar opening over the main content area -

i have problem positioning of fb recommendations bar. lastly few days bar opening on main content area (near middle of page), instead in corner. i’ve noticed happening on several other pages, not mine. there solution problem?

progress-bar facebook-recommendations

vb.net - Does not taking the update data -



vb.net - Does not taking the update data -

i have 1 dataset binding in reportviewer, dataset have 2 paramters, in study loud info displays in set problem when pass paremeters in new values reportviewer , click search button previous info in reportviewer meat changes. means newer searched info not displayed!

here code:

protected sub page_load(byval sender object, byval e system.eventargs) handles me.load mysession() reportviewer1.processingmode = processingmode.local dim rep localreport = reportviewer1.localreport rep.reportpath = "leaving report.rdlc" dim ds1 dataset = getdata() dim empreplt new reportdatasource() empreplt.name = "proldataset_lrepoert" empreplt.value = ds1.tables("empdata") rep.datasources.add(empreplt) end sub private function getsalesdata() dim ds new dataset dim sql string = "select * laeve status='" & dropdownlist1.selectedvalue & "' , agent='" & session("agence") & "'" dim command new sqlcommand(sql,con) dim mysqladapter new sqldataadapter(command) mysqladapter.fill(ds, "empdata") mysqladapter.dispose() command.dispose() end using homecoming ds end function end sub protected sub search_click(byval sender object, byval e eventargs) handles button2.click reportviewer1.localreport.refresh() end sub

try place .ispostback using webforms reportviewer control

protected sub page_load(byval sender object, byval e system.eventargs) handles me.load mysession() if not page.ispostback reportviewer1.processingmode = processingmode.local dim rep localreport = reportviewer1.localreport rep.reportpath = "leaving report.rdlc" dim ds1 dataset = getdata() dim empreplt new reportdatasource() empreplt.name = "proldataset_lrepoert" empreplt.value = ds1.tables("empdata") rep.datasources.add(empreplt) end if end sub

vb.net webforms reportviewer rdlc

Simple Flip buffer (Vertically) issue in C\C++ -



Simple Flip buffer (Vertically) issue in C\C++ -

i trying flip buffer, buffer doesn't processed. buffer of pixels , need flip vertically. can spot doing wrong? in advance.

void flipvertically(unsigned int* buffer, const unsigned int width, const unsigned int height) { const unsigned int rowwidth = width; // length of row const unsigned int rows = height / 2; // iterate half buffer total flip unsigned int* temprow = (unsigned int*)malloc(rowwidth); (int rowindex = 0; rowindex < rows; rowindex++) { memcpy(temprow, buffer + (rowindex * rowwidth), rowwidth); memcpy(buffer + (rowindex * rowwidth), buffer + (height - rowindex - 1) * rowwidth, rowwidth); memcpy(buffer + (height - rowindex - 1) * rowwidth, temprow, rowwidth); } free(temprow); }

will work?

void flip(unsigned* buffer, unsigned width, unsigned height) { unsigned rows = height / 2; // iterate half buffer total flip unsigned* temprow = (unsigned*)malloc(width * sizeof(unsigned)); (unsigned rowindex = 0; rowindex < rows; rowindex++) { memcpy(temprow, buffer + rowindex * width, width * sizeof(unsigned)); memcpy(buffer + rowindex * width, buffer + (height - rowindex - 1) * width, width * sizeof(unsigned)); memcpy(buffer + (height - rowindex - 1) * width, temprow, width * sizeof(unsigned)); } free(temprow); }

c++ c pixels memcpy flip

Android make part of activity transparent -



Android make part of activity transparent -

i have next layout:

<relativelayout> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <linearlayout android:layout_width="fill_parent" android:layout_height="200dip" android:layout_alignparentbottom="true" > </linearlayout> </relativelayout>

i want create linear layout transparent, meaning, content previous activity on activity stack should visible in linear layout region.

i have tried using setalpha(0) linear layout; create transparent, shows activity background color in linear layout region.

i have tried setting android:theme activity @android:style/theme.translucent.notitlebar, create whole activity show content of previous activity.

can suggest way?

thanks.

just clear, activities not visible objects. views see on screen -- in particular see view attached activity. in case view relativelayout , contents.

when create linearlayout transparent, shows background color of relativelayout. if want see behind relative layout create background color transparent, too.

<relativelayout android:backgrond="#00000000"> ... <linearlayout android::background="#00000000"> ... </linearlayout> </relativelayout>

of course of study want utilize named color resource rather "#00000000"

android android-activity transparency

php - How to appropriately respond when a query fails in a webapp? -



php - How to appropriately respond when a query fails in a webapp? -

half of mysqli functions homecoming false on failure. problem shooting when developing great, when released how , should used? illustration if user encounters error technical info may not relevant should removed final product? part of me afraid if script problem happened included script, confuse people , mess scalability.

if(!$link) die('can\'t connect mysql: '.mysql_error()); $db_selected = mysqli_select_db($link, 'storage1'); if(!$db_selected) die('can\'t utilize storage1: '.mysql_error());

you should never show these messages visitor / user.

instead should log error on server , display friendly message user seek 1 time again / seek 1 time again later / apologize / etc.

php sql web-applications error-handling user-experience

html - printing an image in HTML5/Javascript -



html - printing an image in HTML5/Javascript -

i new in web development world , had next question

i implement button in html5 print image ( , not whole html page)

i tried code in question print image on website

but got unhandled exception :

0x800a138f - microsoft jscript runtime error : umable value of property 'innerhtml':object null or undefined

can guide me how ?

thanks!

edit : when print , mean prininting on physical printer , , not displaying on screen

something this? whipped up

<!doctype> <html> <body> <button onclick="showimage()">click here image</button> </body> <script type="text/javascript"> function showimage() { var _body = document.getelementsbytagname('body') [0]; var img = document.createelement('img'); //you can replace link image want img.setattribute('src', 'http://i.123g.us/c/cute_teddy/card/109882.gif'); img.setattribute('alt', 'picture'); _body.appendchild(img); } </script> </html>

jsfiddle here

if need help understanding how works, don't hesitate ask. basically, have button , create img tag , set appropriate attributes. 1 time have done that, can append body of html document displays. suggest understanding of dom (document object model) since new web development/javascript.

javascript html html5

vim: using a regular key as a modifier -



vim: using a regular key as a modifier -

i utilize <space> modifier, ctrl, alt or shift.

for example, hjkl keys jump 10 times instead of 1 when space pressed. like:

nnoremap <space-h> 10h nnoremap <space-j> 10j nnoremap <space-k> 10k nnoremap <space-l> 10l

this works:

nnoremap <space>j 10j

but need release <space> , press 1 time again repeat custom movement.

arpeggio vim plugin lets define keymappings of simultaneous keys other keys, e.g. j , k @ same time have same effect <esc>.

vim

java - converting pdf files to multiple images with itext -



java - converting pdf files to multiple images with itext -

i working on application in need convert pdf files multiple images itext only..can 1 help itext? because have used itext in other functionality compaction of application want itext not pdfbox.

thank in advance...

java pdf itext

webgl - text in three.js: transparency lost when rotating -



webgl - text in three.js: transparency lost when rotating -

i'm trying sec approach use text in three.js, drawing on canvas , using result texture. works, except next problem -don't know if it's bug:

i create 2 texts, transparent background, , overlap then. show ok, when rotate 1 of them, transparency messed up.

i create text objects next (excerpt) function

function createtext(text, ...){ var textholder = document.createelement( 'canvas' ); var ctext = textholder.getcontext('2d'); ... var tex = new three.texture(textholder); var mat = new three.meshbasicmaterial( { map: tex, overdraw: true}); mat.transparent = true; mat.map.needsupdate = true; var textboard = new three.mesh(new three.planegeometry(textholder.width, textholder.height),mat); textboard.dynamic = true; textboard.doublesided = true; homecoming textboard; }

and add together them scene. see demonstration total code in jsfiddle

transparency tricky in webgl.

the best solution in case next transparent text material:

mat.depthtest = false;

updated fiddle: http://jsfiddle.net/sxa8n/4/

three.js r.55

three.js webgl

php - Parse error: syntax error, unexpected end of file on line 60 -



php - Parse error: syntax error, unexpected end of file on line 60 -

i don't why error: parse error: syntax error, unexpected end of file in c:\xampp\htdocs\sitelinks\top_links.php on line 60

parse error: syntax error, unexpected end of file in c:\xampp\htdocs\sitelinks\top_links.php on line 60

<div id="topbar"> <div id="navigation" class="ddsmoothmenu"> <ul> <li><a href="/index.php" class="main">home</a></li> <?php if (isset($_session['login'])) { ?> <li><a href="/services" class="main">servizi</a> <ul> <li><a href="/services/?p=details" class="sub">profilo</a></li> <li><a href="/services/?p=atcdocs" class="sub">documentazione atc</a></li> <li><a href="/services/?p=pildocs" class="sub">documentazione piloti</a></li> <li><a href="#" class="sub">training</a></li> <li><a href="#" class="sub">membri</a></li> </ul> <? } ?> </li> <?php if (isset($_session['login'])) { ?> <li><a href="#" class="main">members</a> <ul> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> </ul> <? } ?> </li> <?php if (isset($_session['login'])) { ?> <li><a href="#" class="main">databases</a> <ul> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> </ul> <? } ?> </li> <?php if (isset($_session['login'])) { ?> <li><a href="#" class="main">divisions</a> <ul> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> </ul> </li> <? } ?> <?php if (isset($_session['login'])) { ?> <li><a href="#" class="main">airlines</a> <ul> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> <li><a href="#" class="sub">put link here</a></li> </ul> </li> <? } ?> <li><a href="#" class="main">forum</a></li> </ul> <? if (isset($_session['login'])) { ?> <? } else { ?> <a href="/?p=login" class="login">login</a> <? } ?> </div> </div>

can help me??

thank youuuuu

by replacing every occurrence of <? <?php script parses fine, seems case have short_open_tag set off. can either turn on in php.ini file (you can't utilize ini_set), or switch using total open tag (which i'd recommend allows you, example, utilize <?xml version="1.0" ?> in html files without having echo it.).

php parsing

authentication - Adding Spring Security @Secured annotation with the Spring Web Service disables Web Service endpoint -



authentication - Adding Spring Security @Secured annotation with the Spring Web Service disables Web Service endpoint -

problem: when add together @secured annotation @ web service method, endpoint disabled means no endpoint mapping found error when invoking ws endpoint.

background: spring web service secured authenticate consumers using usernametoken , timestamp works absolutely fine until add together @secured enforce role based authorization. interceptors configured in spring-ws-servlet.xml using <sws:interceptors>. framework versions:

spring ws: 2.0.5.release spring ws security: 2.0.5.release spring security: 3.0.7.release wss4j: 1.5.12

here's sample of i'm trying do.

endpoint: ... @endpoint public class xyzendpoint implements xyzservice{ @override @payloadroot(localpart = xyz_request, namespace = namespace_xyz) //@secured({"role_xyz"}) public xyzresponse producexyz(xyzrequest request) { ... homecoming new xyzresponse(); } } ...

i using global-method-security below enable @secured annotation described spring docs.

spring-ws-servlet.xml ... <security:global-method-security secured-annotations="enabled" /> ....

i got same issue , able prepare

<security:global-method-security proxy-target-class="true" secured-annotations="enabled"/>

authentication soap spring-security authorization spring-ws

slidingmenu - Use a container for Android activities -



slidingmenu - Use a container for Android activities -

i want know if android back upwards possibility create container static components , include activities in it. have sliding menu onclicklistener events , don't want set these events each activity.

if understood correctly, have functionality mutual several activities, , don't want repeat same code in of them. instead, want in 1 place.

one way accomplish create superclass activity, place mutual code in activity, , extend other activities. example,

public class baseactivity extends activity implements onclicklistener { private button button; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button = (button) findviewbyid(r.id.my_button); button.setonclicklistener(this); } ... @override public void onclick(view view) { int id = view.getid(); switch(id) { case r.id.my_button: // perform action break; } }

}

then extend as

public class activity1 extends baseactivity { /... } public class activity2 extends baseactivity { /... } public class activity3 extends baseactivity { /... }

android slidingmenu

Magento Collection on Mysql4 = No such file or directory -



Magento Collection on Mysql4 = No such file or directory -

in downloaded module there specific phone call mage::getmodel('module/statistic_collection'), gives me failed open stream: no such file or directory error path namespace/module/model/statistic/collection.php exists in namespace/module/model/mysql4/statistic/collection.php. how can tell magento need add together mysql4 folder ?

you have 2 options:

mage::getresourcemodel('module/statistics_collection')

or

mage::getmodel('module/statistics')->getcollection()

magento

Error while compiling macro __COPYRIGHT with gcc -



Error while compiling macro __COPYRIGHT with gcc -

here simple echo.c source code:

#include <sys/cdefs.h> #ifndef lint __copyright( "@(#) copyright (c) 1989, 1993\n\ regents of university of california. rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)echo.c 8.1 (berkeley) 5/31/93"; #else __rcsid("$netbsd: echo.c,v 1.7 1997/07/20 06:07:03 thorpej exp $"); #endif #endif /* not lint */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main __p((int, char *[])); int main(argc, argv) int argc; char *argv[]; { /* *main code no error @ */ }

when compiling gcc 4.4.6, study errors:

echo.c:4: error: expected declaration specifiers or â...â before string constant echo.c:3: warning: info definition has no type or storage class echo.c:12: error: expected declaration specifiers or â...â before string constant echo.c:12: warning: info definition has no type or storage class

line 3 , 4 __copyright macro. line 12 __rcsid macro.

if delete these 2 macro, compiles , runs correctly.

after googling, know these 2 macros defined in sys/cdefs.h , kind of comment message.

but why won't compile in gcc?

well after going throuhg sys/cdefs.h (ubuntu 11.10), found no __copyright or __rcsid defination. guess these 2 macros defined in netbsd sys/cdefs.h. added them in new header file (i name "aeodefs.h") following:

#ifndef _aeodefs_h_ #define _aeodefs_h_ #include <sys/cdefs.h> #define __idstring(name,string) \ static const char name[] __attribute__((__unused__)) = string #ifndef __rcsid #define __rcsid(s) __idstring(rcsid,s) #endif #ifndef __copyright #define __copyright(s) __idstring(copyright,s) #endif #endif /* !_aeodefs_h_ */

then alter #include <sys/cdefs.h> #include "aeodefs.h".

it's done!

gcc macros

cron - Ubuntu Crontab Command not working -



cron - Ubuntu Crontab Command not working -

on command line, next line works charm:

cd /opt/server/apache2/htdocs/newapp/ && php oil refine dealer:handler

after confirming command on command line added next line crontab on ubuntu server (with blank line after it):

*/1 * * * * cd /opt/server/apache2/htdocs/newapp/ && php oil refine dealer:handler

my syslog says (every minute):

feb 8 15:34:01 ip-xx-xx-xx-x cron[5549]: (username) cmd (cd /opt/server/apache2/htdocs/newapp/ && php oil refine dealer:handler)

nevertheless, command crontab doesn't work. thought wrong it?

ubuntu cron command crontab

perl - Using Windows line endings in Perl6::Form -



perl - Using Windows line endings in Perl6::Form -

i'm using perl6::form generate table , output text file. no matter do, seems, can't output windows line endings. i've tried local $output_record_separator = "\r\n"; i've tried appending \r\n format strings. no dice.

my code:

use english; local $output_record_separator = qq{\r\n}; @column_headings = @{ shift $args->{'data'} }; @rows = @{ $args->{'data'} }; $header_format = bring together q{|}, (q/{]]]][[[[}/) x scalar @column_headings; $field_format = bring together q{|}, (q/{]]]]]]]]}/) x scalar @column_headings; # formatting starts headers followed double line @format_data = ( $header_format, @column_headings, ); force @format_data, bring together q{|}, (q/==========/) x scalar @column_headings; foreach $row (@rows) { force @format_data, ( $field_format, @{$row} ); } $text = form @format_data; ( $fh, $tempfile ) = file::temp::tempfile; $fh->print($text) or croak(qq/failed write tempfile: $os_error/); close $fh;

according docs,

the file returned file::temp have been opened in binary mode if such mode available. if not correct, utilize c function alter mode of filehandle.

as such, re-add :crlf nowadays on file handles opened in windows using next after open before print.

$fh->binmode(':crlf');

windows perl line-endings

html - Add instruction to drop down select box in Rails? -



html - Add instruction to drop down select box in Rails? -

i displaying list of users (from users model) in rails 3 application. in helper (in case it's faults) have following:

def user_all_select_options user.all.map{ |user| [user.name, user.id] } end

in view have following:

<%= f.select :user_id, user_all_select_options %>

this creates drop downwards list first users name pre-selected @ top of list. trying add together instruction(?) @ top of list unselectable. thought prevent top user getting accidentally set required user when don't want be.

so rather select box looking this:

i this:

is possible, if so, how??

pass :prompt option.

<%= f.select :user_id, user_all_select_options, :prompt => 'select user' %>

html ruby-on-rails-3 select helper

android - Why this array throws an array out of bound exception -



android - Why this array throws an array out of bound exception -

when phone call function timer why seek throw array our of bound exception.

how can solve query. code called in between run function. list<address> addresses go out of bound array exception. tell me way solve query

public string get_address(double latitude ,double longitude) { string address = null; if(geocoder.ispresent()) { try{ geocoder geocoder2 = new geocoder(mcontext, locale.getdefault()); list<address> addresses; addresses = geocoder2.getfromlocation(latitude, longitude, 2); if(addresses != null) { address returnedaddress = addresses.get(0); stringbuilder strreturnedaddress = new stringbuilder("address:\n"); for(int i=0; i<returnedaddress.getmaxaddresslineindex(); i++) { strreturnedaddress.append(returnedaddress.getaddressline(i)).append("\n"); } /*if(returnedaddress.getmaxaddresslineindex() > 0){ strreturnedaddress.append(returnedaddress.getaddressline(0) + ", "); } strreturnedaddress.append(returnedaddress.getlocality() + ", "); strreturnedaddress.append(returnedaddress.getcountryname()); */ address=strreturnedaddress.tostring(); } else{ address="no address returned!"; } //return address; } catch(exception e) { log.e("myapp", "reverse geo lookup failed", e); address="reverse geo failed"; //return address; } } else { address="geocoder not present"; //return address; } homecoming address; }

addresses can empty(so different null can't first item)

replace if(addresses != null) if(addresses != null && !addresses.isempty())

android android-layout android-intent android-emulator

"Slow motion" effect on Windows phone -



"Slow motion" effect on Windows phone -

is possible record video "slow motion" effect on windows phone devices? tried find info feature didn't find anything

windows-phone-7 windows-phone-8 windows-phone

PHP object serialization and unserialization not working properly -



PHP object serialization and unserialization not working properly -

i have 3 source files follows:

first 1 source_class.php

class macmini { public $memory = "16 gigabytes"; public $cpu = "intel core i7 @ 2.6ghz"; public $hd = "1tb @ 5200 rpms"; public function mem() { homecoming $this->memory; } public function centralpu() { homecoming $this->cpu; } public function hard_drive() { homecoming $this->hd; } }

///////////////////////////////////////////////////

second 1 serialize.php

include "source_class.php"; $mymini = new macmini; $mymini->cpu = "intel core i7 @ 3.4ghz"; $serialized = serialize($mymini); file_put_contents("store", $serialized);

//////////////////////////////////////////////

third 1 unserialize.php

include "source_class.php"; $data = file_get_contents("store"); $unserialized = unserialize($data); $mymini = new macmini; echo $mymini->cpu;

it produces next output: "intel core i7 @ 2.6ghz"

why, if property of cpu changed in serialize.php file, not reflected in unserialization? checked raw info contents of serialized file, "store" , cpu property reflected in serialized file when it's unserialized in unserialize.php property alter not reflected. why that? can explain?

the problem create new $mymini object , output cpu properity of newly created object. serialization/ unserialization doesn't create sense way.

change unserialize.php :

include "source_class.php"; $data = file_get_contents("store"); $mymini = unserialize($data); echo $mymini->cpu;

php serialization

ios - Echo cancellation on Twilio platform -



ios - Echo cancellation on Twilio platform -

we're thinking of using twilio place , receive calls ios app. twilio platform handle echo cancellation, or need implement? documentation not specify this.

rob twilio here.

stoked you're looking @ building twilio client on ios. our sdk uses coreaudio api takes advantage of hardware echo cancellation available on each device.

you don't need configure utilize it. if you're looking started quickly, sense free check out our quickstart guide here or leverage colleague devin's twilio client cocoapod. hope helps!

ios audio codec twilio

java - Writing data to cell in existing excel through hssf/xssf. -



java - Writing data to cell in existing excel through hssf/xssf. -

i in dilemna. have been trying write info existing excel file through hssf/xssf in java. have no errors still when run can't alter made excel sheet. can help me out this? code is:

try { fileinputstream inp = new fileinputstream("c:/users/training/desktop/saurav.xlsx"); workbook wb = null; seek { wb = workbookfactory.create(inp); } grab (invalidformatexception e) { e.printstacktrace(); } sheet sheet = wb.getsheetat(0); row row = sheet.getrow(3); cell cell = row.getcell(4); if (cell == null) cell = row.createcell(4); cell.setcelltype(cell.cell_type_string); cell.setcellvalue("a test"); // write output file fileoutputstream fileout = new fileoutputstream("c:/users/training/desktop/saurav.xlsx"); wb.write(fileout); fileout.close(); } grab (filenotfoundexception e) { e.printstacktrace(); } grab (ioexception e) { e.printstacktrace(); }

someone please help me out this.trying out since lastly 2 days.

instead of utilize this, working in system.

try { fileinputstream inp = new fileinputstream("c:/users/training/desktop/saurav.xlsx"); workbook wb = null; seek { wb = workbookfactory.create(inp); } grab (invalidformatexception e) { e.printstacktrace(); } sheet sheet = wb.getsheetat(0); row row = sheet.getrow(3); cell cell = row.getcell(4); cell = row.createcell(4); cell.setcelltype(cell.cell_type_string); cell.setcellvalue("a test"); // write output file fileoutputstream fileout = new fileoutputstream("c:/users/training/desktop/saurav.xlsx"); wb.write(fileout); fileout.close(); } grab (filenotfoundexception e) { e.printstacktrace(); } grab (ioexception e) { e.printstacktrace(); }

also create sure refresh excel file after every run.

java eclipse eclipse-plugin

populate a select box with php mysql -



populate a select box with php mysql -

i'm having difficulty populating select box within form display existing "forenames" of nurses "nurses" table. tell me im doing wrong? in advance!

here form

<form method="post" action="insert.php"> <br> <tr><td align="left"><strong>nurse information</strong></td> </td> <tr> <td>nurse_name</td> <td><select name="valuelist"> <option value="valuelist" name="nurse_name" value='<?php echo $nurse_name; ?>'></option> </select></td> <tr>

the query should populate nurse_forename:

<html><head><title>connect database</title></head><body> <font size="4">query gets forename of nurse</font> <br><br><font size="4">choose name</font><br><br> <form action="insert.php" method="post"> <select name="valuelist">; <?php $value=$_post ["valuelist"]; $con = mysql_connect("localhost","root","") or die('could not connect: ' . mysql_error()); mysql_select_db("a&e", $con) or die('could not select database.'); $fetch_nurse_name = mysql_query("select distinct $nurse_name nurse"); $result = mysqli_query($con, $query) or die("invalid query"); while($throw_nurse_name = mysqli_fetch_array($fetch_nurse_name)) { echo '<option value=\"'.$nurse_name['nurse_name'].'">'.$throw_nurse_name['nurse_name'].'</option>'; } echo "</select>"; mysqli_close($con); ?> <input type="submit" value="submit"> </form></body></html>

try this:

<html><head><title>connect database</title></head><body> <font size="4">query gets forename of nurse</font> <br><br><font size="4">choose name</font><br><br> <form action="insert.php" method="post"> <select name="valuelist">; <?php $value=$_post ["valuelist"]; $con = mysql_connect("localhost","root","") or die('could not connect:'.mysql_error()); mysql_select_db("a&e", $con) or die('could not select database.'); $fetch_nurse_name = mysql_query("select distinct forename nurse"); while($throw_nurse_name = mysql_fetch_array($fetch_nurse_name)) { echo '<option value=\"'.$throw_nurse_name[0].'">'.$throw_nurse_name[0].'</option>'; } echo "</select>"; ?> <input type="submit" value="submit"> </form></body></html>

dont utilize mysql , mysqli together....you should utilize mysqli or pdo, not mix of both ;) ps: edited ;)

saludos.

php mysql forms select

windows - Modify list of directories name from Command Prompt -



windows - Modify list of directories name from Command Prompt -

i have 1 requirement modify name list of directories through command prompt. operating scheme windows server 2008 r2.

example - have next directory construction

root 123#5 11 22 123#6 11 22 33 123#7 123#8 44

i want update above mentioned directory construction next construction through batch file or command prompt.

root 123~5 11 22 123~6 11 22 33 123~7 123~8 44

can help me on this?

try this:

@echo off setlocal enabledelayedexpansion /r "c:\root" %%d in (.) ( set dirname=%%~nxd echo !dirname! | findstr "#" >nul if !errorlevel! equ 0 ( set newname=!dirname:#=~! ren "%%~dpnd" "!newname!" ) ) endlocal

windows directory cmd

Http POST works on std Java does not work correctly on Android -



Http POST works on std Java does not work correctly on Android -

i banging head on next code works on std java command line not work in android on galaxy nexus running 4.2. i'm including 2 variations of attempting perform post http://cleverbot.com/webservicemin. original post logic taken chatterbot api revised logic effort utilize different http apis available in java. naive effort @ including chatterbot api in test project. original works main app on cmd line using standard java while neither version work in android.

private static string revisedpostlogic(string url, map<string, string> parameters) throws ioexception { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(parameters.size()); for(map.entry<string,string>eachentry : parameters.entryset()) namevaluepairs.add(new basicnamevaluepair(eachentry.getkey(),eachentry.getvalue())); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpresponse response = httpclient.execute(httppost); bytearrayoutputstream rawresponse = new bytearrayoutputstream(); response.getentity().writeto(rawresponse); homecoming rawresponse.tostring(); } private static string old_post_logic(string url, map<string, string> parameters) throws exception { urlconnection connection = new url(url).openconnection(); ((httpurlconnection) connection).setrequestmethod("post"); connection.setdooutput(true); connection.setdoinput(true); outputstreamwriter osw = new outputstreamwriter(connection.getoutputstream()); osw.write(parameterstowwwformurlencoded(parameters)); osw.flush(); osw.close(); reader r = new bufferedreader(new inputstreamreader(connection.getinputstream())); stringwriter w = new stringwriter(); char[] buffer = new char[1024]; int n = 0; while ((n = r.read(buffer)) != -1) { w.write(buffer, 0, n); } r.close(); homecoming w.tostring(); }

with revised logic no response server exception , original logic eofexception.

update

i tried running android , desktop java , discrepancy:

new java.net.url("http://cleverbot.com/webservicemin").openconnection().getresponsecode()

on desktop java response code 200. (i haven't tried reading stream i'm guessing homecoming text "denied") on android "eofexception". on desktop java (using groovy shortcut now), dump response code, headers , response content , get:

response code: 200 headers: [null:[http/1.1 200 ok], sc:[6870], rps:[server52054], mime-version:[1.0], content-length:[29], expires:[mon, 18 feb 2013 20:07:20 gmt], set-cookie:[rps=server52054, jsessionid=6c765c93a085f67d69f800d9eb76646c; path=/], connection:[keep-alive], server:[jabberwacky], rlm:[2416], cache-control:[no-cache;no-store], pragma:[no-cache], date:[mon, 18 feb 2013 19:56:42 gmt], content-type:[text/html;charset=iso-8859-1]] response: denied

again cannot passed response code if seek same on android. can connect root url without path without issue, it's when effort nail path off of root url when eofexception either or post. i've tried moving outputstreamwriter close() phone call toward end can read response code before closing output stream. still eofexception in case. (i've learned experience closing outputstream prematurely in mobile app can shut downwards entire connection.)

java android http

Make Camel xslt component use xml catalogs for resolving DTDs -



Make Camel xslt component use xml catalogs for resolving DTDs -

we utilize camel xslt component transform xhtml file. transforming file, used xmlreader downloads xhtml dtd w3c website.

is possible, tell xslt component, configure xml reader utilize local version (e.g. using xml catalogs)?

i've found way, using processor, creates xmlreader using catalogresolver , puts saxsource using xmlreader exchange.

@override public void process(exchange exchange) throws exception { inputstream inputstream = exchange.getin().getbody(inputstream.class); xmlreader xmlreader = xmlreaderfactory.createxmlreader(); xmlreader.setentityresolver(new catalogresolver()); exchange.getin().setbody(new saxsource(xmlreader, new inputsource(inputstream))); }

the transformer used xsltcomponent utilize xmlreader.

apache-camel

Using field values in a Word template -



Using field values in a Word template -

i building template documents more pages long. using 'rich text' , 'text' content command fields. want text of 1 of these content command field appear in footer of document. tried utilize styleref field in footer , display text having specific style, 1 in field want show, not work. seems word not looking within fields style (or sees different style associated field ?).

how else can achive ?

thank !

i able selecting whole content command using side tab of command , inserting new bookmark (via insert bookmark) , inserting ref field in footer using aforementioned bookmark name.

ms-word

java - Why am I getting a "cannot find symbol" error when creating an object? -



java - Why am I getting a "cannot find symbol" error when creating an object? -

when i'm trying create new object class defined, maintain getting "cannot find symbol" error, , there's arrow pointing towards "s" in first "snowfallreport" in constructor. i've had problem when trying create other objects in other programs , wanna throw laptop! sense it's simple solution, don't know is.

the code follows:

import java.util.random; public class snowfallreport { // random amount of snow private double snowamount; // default constructor creates random amount , assigns snowamount public void snowfallreport() { random snowfall = new random(); snowamount = (snowfall.nextdouble()) * 20; } public double getsnow() { homecoming snowamount; } public void getstars() { (int staramount = 0; staramount == snowamount; staramount++) { system.out.print("*"); } } public static void main(string[] args) { **snowfallreport day1 = new snowfallreport();** } }

java case sensitive language snowfallreport != snowfallreport

your class name snowfallreport create object like:

snowfallreport ref = new snowfallreport ();

also, constructor name should same class name , don't have homecoming type not void.

// default constructor creates random amount , assigns snowamount public void snowfallreport() {

should be

public snowfallreport() {

java

python - How can I configure ipython to display integers in hex format? -



python - How can I configure ipython to display integers in hex format? -

here's default behavior:

in [21]: 255 out[21]: 255

and here's like:

in [21]: 255 out[21]: ff

can setup ipython that?

you can registering special display formatter ints:

in [1]: formatter = get_ipython().display_formatter.formatters['text/plain'] in [2]: formatter.for_type(int, lambda n, p, cycle: p.text("%x" % n)) out[2]: <function ipython.lib.pretty._repr_pprint> in [3]: 1 out[3]: 1 in [4]: 100 out[4]: 64 in [5]: 255 out[5]: ff

if want always-on, can create file in $(ipython locate profile)/startup/hexints.py first 2 lines (or 1 avoid assignments):

get_ipython().display_formatter.formatters['text/plain'].for_type(int, lambda n, p, cycle: p.text("%x" % n))

which executed every time start ipython.

python ipython

node.js - How to insert new tr every third iteration in Jade -



node.js - How to insert new tr every third iteration in Jade -

i'm new in node.js , jade.

i searched solutions without success (maybe asked wrong questions in google, don't know).

i want create table rows in each loop in jade. thing after every 3rd td want insert new tr. it's quite simple jade can't accomplish that.

my jade file: table thead tr td header tbody each item, in items if (i % 3 === 0) tr td a(href="#{baseurl}/admin.html?id=#{item.id}")

i know wrong if statement. tried many configurations without luck. i'm sure quite easy issue.

thanks in advance help!

edit

based on @laurent perrin reply modified little code. creates tr, 3 td , new tr it's little closer...

new jade if (i % 3 === 0) tr td: a(href="#{baseurl}/admin.html?id=#{item.id}") dsdsd #{i} generated html <tr></tr> <td><a href="...">0</a></td> <td><a href="...">1</a></td> <td><a href="...">2</a></td> <tr></tr>

edit: code should want, it's not elegant:

table thead tr: td header tbody - for(var = 0, nbrows = items.length/3; < nbrows; i++) { tr if items[3*i] td: a(href="#{baseurl}/admin.html?id=#{items[3*i].id}") if items[3*i + 1] td: a(href="#{baseurl}/admin.html?id=#{items[3*i + 1].id}") if items[3*i + 2] td: a(href="#{baseurl}/admin.html?id=#{items[3*i + 2].id}") - }

what instead tweak model create more jade-friendly, grouping items rows:

function getrows(items) { homecoming items.reduce(function (prev, item, i) { if(i % 3 === 0) prev.push([item]); else prev[prev.length - 1].push(item); homecoming prev; }, []); }

this turn:

[{id:1},{id:2},{id:3},{id:4},{id:5}]

into:

[ [{id:1},{id:2},{id:3}], [{id:4},{id:5}] ]

then jade code becomes much simpler:

table thead tr: td header tbody each row in rows tr each item in row td: a(href="#{baseurl}/admin.html?id=#{item.id}")

node.js jade

filter - How can I show the horizontal scrollbar on a kendo ui grid after filtering? -



filter - How can I show the horizontal scrollbar on a kendo ui grid after filtering? -

i have kendo ui grid many columns. columns overflow can viewed scrolling horizontally. however, if

1) scroll column not displayed and

2) filter on column such no rows match filter criteria

the grid no longer allow scrolling horizontally. column had filter applied cannot cleared.

how can show horizontal scrollbar after such filtering?

here's jsfiddle can see issue

http://jsfiddle.net/9sxkg/1/

here's code:

class="lang-js prettyprint-override">var dataitem = {}; var columns = []; (var = 0; < 20; i++) { dataitem['col' + i] = i; columns.push( { field: 'col' + i, width: 80, filterable: true, type: 'number' } ); } $("#grid").kendogrid({ scrollable:true, columns: columns, filterable: true, datasource: [dataitem] });

for example, go column 18 , filter on equal 20 see issue.

i had same problem, solved adding empty row grid. code:

class="lang-js prettyprint-override">var dataitem = {}; var columns = []; (var = 0; < 20; i++) { dataitem['col' + i] = i; columns.push( { field: 'col' + i, width: 80, filterable: true, type: 'number' } ); } $("#grid").kendogrid({ scrollable:true, columns: columns, filterable: true, datasource: [dataitem], databound: function(e) { if(this.datasource.view().length == 0) { var colspan = this.content.find("table col").length; this.content.find("table").append("<tr><td colspan=" + colspan + "></td></tr>"); } $("#grid").find(".k-grid-footer-wrap").scrollleft($("#grid").find(".k-grid-content").scrollleft()); this.content.bind('scroll', function () { $("#grid").find(".k-grid-footer-wrap").scrollleft(this.scrollleft); }); } })

filter grid kendo-ui

Transposing a matrix in C++ -



Transposing a matrix in C++ -

i'm writing programme transpose given matrix using allocated memory. function works perfect square matrix nxn (rows==cols) crashes mxn matrix (rows != cols). please help

void transpose(int **matrix, int *row, int *col) { // dynamically allocate array int **result; result = new int *[*col]; //creates new array of pointers int objects // check error if (result == null) { cout << "error allocating array"; exit(1); } (int count = 0; count < *col; count++) { *(result + count) = new int[*row]; } // transposing (int = 0; i<*row; i++) { (int j = i+1; j<*col; j++) { int temp = *(*(matrix + i) + j); *(*(matrix + i) + j) = *(*(matrix + j) + i); *(*(matrix + j) + i) = temp; } } (int = 0; i<*row; i++) { (int j = 0; j<*col; j++) { *(*(result + i) + j) = *(*(matrix + i) + j); cout << *(*(result + i) + j) << "\t"; } cout << endl; } }

the lines:

for (int = 0; i<*row; i++) { (int j = i+1; j<*col; j++) { int temp = *(*(matrix + i) + j); *(*(matrix + i) + j) = *(*(matrix + j) + i); *(*(matrix + j) + i) = temp; } }

are issue. problem matrix indexed j, not j doing in sec , 3rd line in while loop. image matrix 2x3 matrix, seek perform matrix[2][3] = matrix[3][2], matrix[3][2] not exist.

it best go initializing result straight in loop:

for (int = 0; i<*row; i++) (int j = 0; j<*col; j++) result[j][i] = matrix[i][j];

then can output below, or delete matrix , reassign matrix result wish. entire transpose function became next code (row , col need not pointers int pass value fine. accessing matrices should utilize array subscripts nicer style):

void transpose(int **matrix, int row, int col) { // dynamically allocate array int **result; result = new int *[col]; //creates new array of pointers int objects (int = 0; < col; i++) result[i] = new int[row]; // transposing (int = 0; i<row; i++) (int j = 0; j<col; j++) result[j][i] = matrix[i][j]; //output resulting matrix (int = 0; i<col; i++) { (int j = 0; j<row; j++) cout << result[i][j] << "\t"; cout << endl; } }

c++ matrix transpose