pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
4,754,341 | 0 | <p><a href="http://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it" rel="nofollow">TIMTOWTDI</a></p> <pre><code>#!/usr/bin/perl use strict; use warnings; my $file = "list.csv"; # Use lexical filehandles, not globals; use 3-arg open; don't quote filename open ( my $fh, '<', $file ) or die "Can't open file: $!\n"; my( @lines ) = <$fh>; close( $fh ); # split takes a regex; also, notice the shift my @headers = split( /,/, shift @lines ); my %hash; # Use perly for loops here foreach my $i ( 0..$#lines ) # This works, too #for my $i ( 0..$#lines ) { # split takes a regex my @strings = split( /,/, $lines[$i] ); # One way (probably best) @{ $hash{$i} }{ @headers } = @strings; # Another way #$hash{$i} = { map { $headers[$_] => $strings[$_] } ( 0 .. $#strings ) }; # Another way #$hash{$i}{ $headers[$_] } = $strings[$_] = for(0..$#strings); } #use Data::Dumper; #print Dumper \%hash; </code></pre> <p>But yes, using <a href="http://p3rl.org/Text%3a%3aCSV" rel="nofollow">Text::CSV</a> (or the faster <a href="http://p3rl.org/Text%3a%3aCSV_XS" rel="nofollow">Text::CSV_XS</a>) would be even better than trying to manually split the CSV yourself (what happens if there are spaces? what happens if the fields and/or headers are quoted? It's a solved problem.)</p> |
32,927,162 | 0 | <p>Try this:</p> <pre><code>var maker = function(){ this.b = function(){return 1;}; this.c = b(); } var a = new maker(); console.log(a.b()); console.log(a.b); console.log(a.c); </code></pre> <p>the keyword 'new' is the key.</p> <p>You can create functions that just get called, without using 'new'</p> <p>or a functions that will create and return a new object and using new is needed, these are typically referred to as constructor functions, but the key thing is the use of keyword new here which changes the behavior of the function, notice that there is no 'return this;' line in the function, it's implied by using 'new'</p> <p>hope that helps. When that makes sense, look at the prototype process a bit deeper and play with it.</p> |
21,270 | 0 | <p>The easiest way is to simply select both fields by selecting the first field, and then while holding down the <kbd>Ctrl</kbd> key selecting the second field. Then clicking the key icon to set them both as the primary key.</p> |
9,439,907 | 0 | <p>As a rule, numpy is used for scientific calculations in python. You probably should test that lib.</p> |
5,035,082 | 0 | <p>Check if ./configure doesn't yell about something missing when checking for openssl librairies. It probably didn't compile right, hence the module not listed.</p> <p>You can also have a look at config.log</p> |
37,209,760 | 0 | <p>Generalizing a little to handle an arbitrary number of sentences, we can align your vectors by creating a list of all the words and then iterating over the counts in that order:</p> <pre><code>>>> texts = [text1, text2] >>> counts = [Counter(text) for text in texts] >>> all_words = sorted(set().union(*counts)) >>> vecs = [[count.get(word, 0) for word in all_words] for count in counts] >>> vecs[0] [0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1] >>> vecs[1] [1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1] </code></pre> |
38,101,257 | 0 | Angular 2 how to remove pasted content from input <p>I'm trying to do some stuff with a pasted string, which works, but when I try to remove the content I can't seem to do it since the pasted content isn't getting bound to the model of the input.</p> <p>How can you clear the input of the pasted content? </p> <p>I tried binding the content to the model and then removing the model but that will still leave the actual pasted content in the event object so it's not a solution. </p> <p>Also tried clearing the input directly using <code>input.value = ''</code> but without luck.</p> <p>Markup:</p> <pre class="lang-html prettyprint-override"><code><input #input [(ngModel)]="newTag[labelKey]" (paste)="onPaste($event)"> </code></pre> <p>Function:</p> <pre class="lang-js prettyprint-override"><code>onPaste(e: any) { let content = e.clipboardData.getData('text/plain'); // Do stuff // Then clear pasted content from the input } </code></pre> |
649,377 | 0 | <p>Here is the full list of <a href="http://msdn.microsoft.com/en-us/library/8edha89s(VS.71).aspx" rel="nofollow noreferrer">overloadable operators from MSDN.</a></p> <p>--- EDIT ---</p> <p>In response to your comment, I believe what you want <a href="http://visual-basic-dox.net/MS.Press-Programming.Microsoft/13580/BBL0037.html" rel="nofollow noreferrer">is here.</a> Search for Table 6-1.</p> |
35,953,120 | 0 | Displaying Go App In The Browser <p>I wrote an app that makes a request to an API and gets a JSON response. When I run the app it displays the json in the terminal.</p> <pre><code>go run main.go </code></pre> <p>I want to make this run in the browser and I found this, which allowed me to print a string to the browser. </p> <pre><code> func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "This is a string") } </code></pre> <p>Then in <code>main</code></p> <pre><code>http.HandleFunc("/", handler) log.Fatal(http.ListenAndServe("localhost:8000", nil)) </code></pre> <p>Now that I have a string being printed to the screen and I have a json response coming from the api I am using, how can I add the json response to the browser instead of the string? </p> <p>Would it be best to put the response into a string then just bring it to the browser?</p> <p>Currently I am printing the json response to the terminal like this,</p> <pre><code>type Payload struct { Page int Results []Data } type Data struct { PosterPath string `json:"poster_path"` Adult bool `json:"adult"` Overview string `json:"overview"` ReleaseDate string `json:"release_date"` GenreIds []int `json:"genre_ids"` Id int `json:"id"` OriginalTitle string `json:"original_title"` OriginalLanguage string `json:"original_language"` Title string `json:"title"` BackdropPath string `json:"backdrop_path"` Popularity float64 `json:"popularity"` VoteCount int `json:"vote_count"` Video bool `json:"video"` VoteAverage float64 `json:"vote_average"` } </code></pre> <p>Then inside <code>main()</code> I do this,</p> <pre><code> for i := 0; i < len(p.Results); i++ { fmt.Println( ImgUrl+p.Results[i].PosterPath, "\n", p.Results[i].Adult, p.Results[i].Overview, "\n", p.Results[i].ReleaseDate, p.Results[i].GenreIds, "\n", p.Results[i].Id, p.Results[i].OriginalTitle, "\n", p.Results[i].OriginalLanguage, p.Results[i].Title, "\n", ImgUrl+p.Results[i].BackdropPath, p.Results[i].Popularity, "\n", p.Results[i].VoteCount, p.Results[i].Video, "\n", p.Results[i].VoteAverage, ) </code></pre> <p>What would be the Go way to do this for building web applications? My end goal here is to take user input and recreate my api call based on the information they provide.</p> |
32,830,924 | 0 | How can I create a bash or zsh alias for git commit, git pull, git push and pull on a remote server? <p>If I type the following into Terminal I can accomplish everything I want:</p> <pre><code>git commit -am "my commit message" ; git pull ; git push ; ssh user@server 'cd /path/to/git/repo/ ; git pull ; exit' </code></pre> <p>I'd like to create the same as an alias in my <code>~/.zshrc</code>. Something like:</p> <pre><code>alias pushit () { git commit -am "$@" ; git pull ; git push ; ssh user@server 'cd /path/to/git/repo/ ; git pull ; exit' } </code></pre> <p>To be run in Terminal like so:</p> <pre><code>pushit "my commit message" </code></pre> <p>Instead every time I reload ~/.zshrc (<code>source ~/.zshrc</code>) or open a new Terminal window I see it loop through my alias dozens of times. It's not clear it actually runs.</p> <p>What am I doing wrong?</p> <p><strong>Notes:</strong></p> <ol> <li>This is not for a mission critical server. It's just for personal use. I know it's poor form.</li> <li>I'd rather not use git's [alias] tools so I can keep all of my aliases in the same place (<code>~/.zshrc</code>).</li> </ol> |
34,708,607 | 0 | Simplexml only shows first array elements even with children() method <p>I'm using PHP 5.6.</p> <p>I'm consuming an amazon API and getting back some products form a product search. </p> <p>I have got the raw xml string back and loaded it in to simplexml with </p> <pre><code>$xml = simplexml_load_string($result); </code></pre> <p>Now if I do </p> <pre><code>print_r($xml->response->Items); </code></pre> <p>I get (condensed):</p> <pre><code>SimpleXMLElement Object ( [Request] => SimpleXMLElement Object ( [IsValid] => True ) [TotalResults] => 8914365 [TotalPages] => 891437 [Item] => Array ( [0] => SimpleXMLElement Object ( [ASIN] => B00QJDO0QC [ParentASIN] => B00U879AII ) [1] => SimpleXMLElement Object ( [ASIN] => B01HDUE8HE [ParentASIN] => 000000000 ) [2] => SimpleXMLElement Object ( [ASIN] => B72HEUD9HE [ParentASIN] => 000000000 ) ) ) </code></pre> <p>So I want to isolate the 'Items' array so I can process the returned items. So I obviously do:</p> <pre><code>$items = $xml->response->Items->Item; </code></pre> <p>But now if I do </p> <pre><code>print_r($items); </code></pre> <p>I don't get the three elements, I just get a print out of the FIRST $items element like so:</p> <pre><code>SimpleXMLElement Object ( [ASIN] => B00QJDO0QC [ParentASIN] => B00U879AII ) </code></pre> <p>I read here: <a href="http://stackoverflow.com/questions/6796797/why-does-simplexml-change-my-array-to-the-arrays-first-element-when-i-use-it">Why does SimpleXML change my array to the array's first element when I use it?</a> that you need to use the ->children() method. So I tried:</p> <pre><code>print_r($items->children()); </code></pre> <p>With still the same output. </p> <p>Can anyone help me out?</p> |
13,508,149 | 0 | Where to Async in PagerAdatper <p>My fragment activity used this adapter to display all the result in a listview. The page will have a title tab and each tab will have the list result. <br>Now the list result I read from internal storage and each time I swipe to next page it will have slight lag or delay, so I am thinking implementing ASYNCTask inside this pageradapter so the experience will be better but I have no idea where to implement. Could you guys point me out?? </p> <pre><code>public class ViewPagerAdapter extends PagerAdapter { public ViewPagerAdapter( Context context ) { //This is where i get my title for (HashMap<String, String> channels : allchannel){ String title = channels.get(KEY_TITLE); titles[acc] = title; acc++; } scrollPosition = new int[titles.length]; for ( int i = 0; i < titles.length; i++ ) { scrollPosition[i] = 0; } } @Override public String getPageTitle( int position ) { return titles[position]; } @Override public int getCount() { return titles.length; } @Override public Object instantiateItem( View pager, final int position ) { String filename = null; ListView v = new ListView( context ); final ArrayList<HashMap<String, String>> items = new ArrayList<HashMap<String, String>>(); DatabaseHandler db = new DatabaseHandler(context); filename = openFile("PAGE1"); //OpenFile function is read file from internal storage switch(position){ case 0: filename = openFile("PAGE1"); break; case 1: filename = openFile("PAGE2"); break; case 2: filename = openFile("PAGE3"); break; } try{ //Use json to read internal storage file(Page1/Page2) and display all the result on the list } }catch(Exception e){ } ListAdapter listadapter=new ListAdapter(context, items); v.setAdapter( listadapter ); ((ViewPager)pager ).addView( v, 0 ); return v; } @Override public void destroyItem( View pager, int position, Object view ) { ( (ViewPager) pager ).removeView( (ListView) view ); } @Override public boolean isViewFromObject( View view, Object object ) { return view.equals( object ); } @Override public void finishUpdate( View view ) { } @Override public void restoreState( Parcelable p, ClassLoader c ) { if ( p instanceof ScrollState ) { scrollPosition = ( (ScrollState) p ).getScrollPos(); } } @Override public Parcelable saveState() { return new ScrollState( scrollPosition ); } @Override public void startUpdate( View view ) { } </code></pre> <p>}</p> |
1,561,112 | 0 | <p>You can use this (C#) code example. It returns a value indicating the compression type:</p> <p>1: no compression<br> 2: CCITT Group 3<br> 3: Facsimile-compatible CCITT Group 3 <br> 4: CCITT Group 4 (T.6)<br> 5: LZW</p> <pre><code>public static int GetCompressionType(Image image) { int compressionTagIndex = Array.IndexOf(image.PropertyIdList, 0x103); PropertyItem compressionTag = image.PropertyItems[compressionTagIndex]; return BitConverter.ToInt16(compressionTag.Value, 0); } </code></pre> |
11,596,612 | 0 | <p>Use <code>JFXPanel</code>:</p> <pre><code> public class Test { private static void initAndShowGUI() { // This method is invoked on Swing thread JFrame frame = new JFrame("FX"); final JFXPanel fxPanel = new JFXPanel(); frame.add(fxPanel); frame.setVisible(true); Platform.runLater(new Runnable() { @Override public void run() { initFX(fxPanel); } }); } private static void initFX(JFXPanel fxPanel) { // This method is invoked on JavaFX thread Scene scene = createScene(); fxPanel.setScene(scene); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { initAndShowGUI(); } }); } } </code></pre> <p>where method <code>createScene()</code> is <code>start(final Stage stage)</code> from your code. Just instead of putting scene to stage you return it.</p> |
18,132,795 | 0 | How to cast child class instance <p>I don't really know exactly how to word this but basically I need to get the child class instance of an Actor without assigning it (if that makes since?). Is this possible?</p> <pre><code>package org.game.world.entity.actor; import java.util.HashMap; import java.util.Map; import org.game.world.entity.Entity; import org.game.world.entity.actor.npc.NPC; import org.game.world.entity.actor.player.Player; import org.game.world.entity.actor.player.PlayerData; public abstract class Actor extends Entity { /** * The type of Actor this Entity should be * recognized as. */ private final ActorType actorType; /** * A map of ActionStates, not necessarily 'Attributes'. */ private final Map<ActionState, Boolean> actionState = new HashMap<ActionState, Boolean>(); /** * Constructs a new Actor {@Entity}. */ public Actor(ActorType actorType) { this.actorType = actorType; actionState.putAll(ActionState.DEFAULT_ACTION_STATES); } /** * Gets the status of a {@Actor} ActionSate. * @param state The ActionState. * @return The ActionState flag. */ public boolean getActionState(ActionState state) { return actionState.get(state); } /** * Sets a {@Actor} ActionState flag. * @param state The ActionState. * @param flag The flag true:false. */ public void setActionState(ActionState state, boolean flag) { actionState.put(state, flag); } /** * Resets all ActionState's for this Actor. */ public void setDefaultActionStates() { actionState.putAll(ActionState.DEFAULT_ACTION_STATES); } /** * Checks if this Actor is a specific ActorType (i.e NPC) * @param actorType The ActorType * @return */ public boolean isActorType(ActorType actorType) { return this.actorType == actorType; } /** * The type of Actor. */ public static enum ActorType { PLAYER, NPC } } </code></pre> <p>An Actor type.</p> <pre><code>package org.game.world.entity.actor.player; import org.game.world.entity.Location; import org.game.world.entity.actor.Actor; import org.game.world.entity.actor.SkillLink; /** * This class represents a Player {@Actor} in the world. * * @author dillusion * */ public class Player extends Actor { /** * This Player objects unique set of stored * data. */ private final PlayerData playerData; /** * Creates a new Player object in the world. * @param playerData The set of data unique to this Player. */ public Player(PlayerData playerData) { super(ActorType.PLAYER); this.playerData = playerData; } /** * Gets the players name. * @return The name. */ public String getName() { return playerData.name; } /** * Gets the players password. * @return The password. */ public String getPassword() { return playerData.password; } /** * Gets the players permission level. * @return The permission. */ public Permission getPermission() { return playerData.permission; } /** * Gets the players SkillLink instance. * @return The SkillLink. */ public SkillLink getSkillLink() { return playerData.skillLink; } @Override public Location getLocation() { return playerData.location; } @Override public Location setLocation(Location location) { return playerData.location = location; } } </code></pre> <p>But let's say I have multiple 'Actors'. I don't want to have to cast if I don't need to.</p> <p>Sorry if I didn't explain this very well.</p> |
34,649,826 | 0 | <p>You probably want something like this:</p> <pre><code>.factory('countries', function($http){ var list = []; $http.get('../test.json').success(function(data, status, headers) { angular.copy(data, list); }) return { list: list } }; </code></pre> <p>Then you can bind to the list like this:</p> <pre><code>.controller('View2Ctrl', function ($scope, countries){ $scope.countries = countries.list; }); </code></pre> <p>An alternative, equally valid approach is this:</p> <pre><code>.factory('countries', function($http){ return { list: function() { return $http.get('../test.json'); } } }; </code></pre> <p>Then in your controller: </p> <pre><code>.controller('View2Ctrl', function ($scope, countries){ $scope.countries = []; countries.list().success(function(data) { $scope.countries = data; }); }); </code></pre> <p>Remember that <code>$http.get('../test.json')</code> is already a promise, which is why you can return it without any unnecessary promise/resolve handling. </p> |
39,609,049 | 0 | how will I erase or to make the border invisible of the cell that I completed using table.completeRow() <p>this is my code where I make an invisible border for the Merchant Column and complete the row, the Merchant column has no border, but the rest of the row had, I don't know to make it invisible. </p> <pre><code>PdfPCell cellMerchantTitle = rowCellStyle("Merchant", fontTitleSize); cellMerchantTitle.setColspan(2); table.addCell(cellSystemTitle); table.completeRow(); public PdfPCell rowCellStyle(String cellValue, Font fontStyle){ PdfPCell cell = new PdfPCell(new Paragraph(cellValue, fontStyle)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(Rectangle.NO_BORDER); return cell; } </code></pre> <p>I already try this</p> <pre><code>table.getDefaultCell().setBorder(Rectangle.NO_BORDER); </code></pre> |
7,475,413 | 0 | <p> Hi. Create the query with <code>SQL_CALC_FOUND_ROWS</code> and then get it via <a href="http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows" rel="nofollow"><code>FOUND_ROWS()</code></a> function.<br /> What I mean is this:</p> <pre class="lang-vb prettyprint-override"><code>Set rsPhotoSearch = _ conn_Object.Execute("Select SQL_CALC_FOUND_ROWS * FROM table LIMIT offSet, rowCount") Dim lngTotalRecords lngTotalRecords = conn_Object.Execute("Select Found_Rows();")(0).Value Response.Write "Total Records : "& lngTotalRecords 'Loop starts 'etc </code></pre> |
35,696,533 | 0 | <p>I figured out that Jitsi and CSipSimple send their INTERNET IP-address instead of sending their VPN IP-address in SDP during INVITE request Altghough CSipSimple has the parameter "Allow SDP NAT rewrite" in Expert mode of account setup. And it should be ticked to avoid this problem. But Jitsi does not have such option</p> |
17,385,395 | 0 | php send get request and get output <p>I want to make a getrequest to www.seatguru.com, which for instance would look like this: <code>http://www.seatguru.com/findseatmap/findseatmap.php?airlinetext=American+Airlines&carrier=AA&flightno=3180&from=Philadelphia%2C+PA+-+Philadelphia+International+Airport+%28PHL%29&to=&date=07%2F03%2F2013&from_loc=PHL&to_loc=&search_type=</code></p> <p>The problem is that when I get the request back, it only shows the 'Loading...', which means that I can check the output. Is there any way I can get around that?</p> <p>Here's my curl:</p> <pre><code>$qry_str = "?airlinetext=American+Airlines&carrier=AA&flightno=3180&from=Philadelphia%2C+PA+-+Philadelphia+International+Airport+%28PHL%29&to=&date=07%2F03%2F2013&from_loc=PHL&to_loc=&search_type="; $ch = curl_init(); // Set query data here with the URL curl_setopt($ch, CURLOPT_URL, 'http://www.seatguru.com/findseatmap/findseatmap.php' . $qry_str); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, '3'); $content = trim(curl_exec($ch)); curl_close($ch); </code></pre> <p>Thanks alot.</p> |
37,788,610 | 0 | <p>Killing from recent apps may be the same as force stop on some devices so no <code>onPause</code> or <code>onStop</code> is called on the activity in this case, so the service is probably not being unbound correctly.</p> <p>If your service is not bound to a running activity and doesn't run in the foreground, the system may stop it at any time.</p> |
16,238,900 | 0 | <p>I do not know if this would cause this problem, but I would mark my similarly structured MessageContract up as follows:</p> <ol> <li>Using the [MessageHeader] attribute is enough on MessageHeader members.</li> <li>If the contract TestsResults is not a top level contract, I would mark it up as a DataContract with DataMember attributes only.</li> </ol> <p>EDIT: 3. TestResult should also be a DataContract, with all members marked up with DataMember. Your enum must be marked up with the EnumMember attribute.</p> <p>I hope this helps.</p> |
15,714,391 | 0 | <p>You've got a difficult task there. <code>.doc</code> <code>.pdf</code> and <code>.xls</code> are not simply readable. To test this try opening a pdf with a basic text editor like <code>notepad</code> or <code>gedit</code>. You will see what appears to be gibberish. This is the same thing PHP sees when you read a file's contents.</p> <p><code>.xls</code> and <code>.doc</code> can probably be parsed with PHPWord and PHPExcel from <a href="https://github.com/PHPOffice" rel="nofollow">PHPOffice</a>. You will need to look in to these libraries. I don't know anything for PDFs but there's probably something. </p> <p>I would suggest writing a series of classes that all implement a similar interface so you can switch them out depending on the extension.</p> |
37,253,636 | 0 | <p>If you are using any IDE for developing Apps then always run that App in sudo mode . for eg . If you are using webstorm then always run it's webstorm.sh in file as follows. <br></p> <blockquote> <p><strong>sudo bash /opt/webstorm/bin/webstorm.sh</strong></p> </blockquote> |
21,638,264 | 0 | <p>If I understand the question, you want to get stories that are currently accepted, but you want that the returned results include snapshots from the time when they were not accepted. Before you write code, you may test an equivalent query in the browser and see if the results look as expected. </p> <p>Here is an example - you will have to change OIDs. </p> <pre><code>https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12352608129/artifact/snapshot/query.js?find={"_ProjectHierarchy":12352608219,"_TypeHierarchy":"HierarchicalRequirement","ScheduleState":"Accepted",_ValidFrom:{$gte: "2013-11-01",$lt: "2014-01-01"}}},sort:[{"ObjectID": 1},{_ValidFrom: 1}]&fields=["Name","ScheduleState","PlanEstimate"]&hydrate=["ScheduleState"] </code></pre> <p>You are correct that a query like this: <code>find={"AcceptedDate":{$gt:"2014-01-01T00:00:00.000Z"}}</code></p> <p>will return one snapshot per story that satisfies it.</p> <pre><code>https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12352608129/artifact/snapshot/query.js?find={"AcceptedDate":{$gt:"2014-01-01T00:00:00.000Z"}}&fields=true&start=0&pagesize=1000 </code></pre> <p>but a query like this: <code>find={"ObjectID":{$in:[16483705391,16437964257,14943067452]}}</code></p> <p>will return the whole history of the 3 artifacts:</p> <pre><code>https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12352608129/artifact/snapshot/query.js?find={"ObjectID":{$in:[16483705391,16437964257,14943067452]}}&fields=true&start=0&pagesize=1000 </code></pre> <p>To illustrate, here are some numbers: the last query returns 17 results for me. I check each story's revision history, and the number of revisions per story are 5, 5, 7 respectively, sum of which is equal to the total result count returned by the query. On the other hand the number of stories that meet <code>find={"AcceptedDate":{$gt:"2014-01-01T00:00:00.000Z"}}</code> is 13. And the query based on the accepted date returns 13 results, one snapshot per story.</p> |
30,339,406 | 0 | <p>For <code>A1:A100</code></p> <pre><code>Set rng1 = Range("A1:A100") rng1.Replace "Payment info", "log Payment info", xlPart </code></pre> |
19,910,292 | 0 | <p>I've created an example of how you can achieve this. There is not an easy way yet, but it's coming in the near future as Spudley mentioned. <a href="http://jsfiddle.net/kUJq8/5/" rel="nofollow">http://jsfiddle.net/kUJq8/5/</a></p> <p>This example is based on the same concept used by <a href="http://www.csstextwrap.com" rel="nofollow">http://www.csstextwrap.com</a> but I created this example to explain what's going on and how to achieve this effect.</p> <p>Basically, you need to create your circle first and some sample text, then create a set of "imaginary" floating div's to give your text guidelines to not exceed and automatically wrap to the next line. Feel free to play around with the widths of the div's so you can achieve the desired effect. Also, if you remove the border, you can see what the text actually looks like. The border helps when setting the widths of the div's.</p> <pre><code><div style="float:left;clear:left;height:15px;width:130px"></div> <div style="float:right;clear:right;height:15px;width:130px"></div> </code></pre> <p>In my example, I didn't create the whole circle, but it should be enough to get you going on the right track. Please let me know if you need any further assistance with this idea. Thanks.</p> |
9,508,116 | 0 | Regex for String with possible escape characters <p>I had asked this question some times back here <a href="http://stackoverflow.com/questions/9423563/regular-expression-that-does-not-contain-quote-but-can-contain-escaped-quote">Regular expression that does not contain quote but can contain escaped quote</a> and got the response, but somehow i am not able to make it work in Java. </p> <p>Basically i need to write a regular expression that matches a valid string beginning and ending with quotes, and can have quotes in between provided they are escaped.</p> <p>In the below code, i essentially want to match all the three strings and print true, but cannot.</p> <p>What should be the correct regex?</p> <p>Thanks</p> <pre><code>public static void main(String[] args) { String[] arr = new String[] { "\"tuco\"", "\"tuco \" ABC\"", "\"tuco \" ABC \" DEF\"" }; Pattern pattern = Pattern.compile("\"(?:[^\"\\\\]+|\\\\.)*\""); for (String str : arr) { Matcher matcher = pattern.matcher(str); System.out.println(matcher.matches()); } } </code></pre> |
35,507,271 | 0 | <p>Short answer: No, not necessarily. </p> <p>I'm not sure exactly what kind of an answer you are expecting here. The way I see it, the general answer is probably "<em>it depends</em>". </p> <p>If the developers of a system intend parts of their solution to be extendable, then they should design it that way. There must be many valid reasons why someone would <em>not</em> want to make it easy to extend and / or override pars of their code. This could be to avoid breaking comparability with other components, or to avoid exposing either data or implementation details that may change in the future, just to mention a couple of admittedly vague and abstract examples.</p> <p>If in doubt, I'd contact the original developers and ask them about it; they may have a good reason for making the design choices they did. Once you know more about the consequences of changing the architecture, you can consider what to do: If practical, you can submit a proposed change to the system. If on the other hand your requirements are different from those of the original developers, you can branch the system and create your own separate version which you can then give back to the community. That is the beauty of open source software.</p> |
36,788,532 | 0 | <p>there is mistake in your json:</p> <p>responseB first object has a <strong>response object</strong> and second object has <strong>response array</strong>. this is creating problem</p> <pre><code>{ "success":true, "error":null, "responseA":{ "responseB":[ { "response":{... ***// This is object*** }, "request":"\/observations\/atlanta,ga" }, { "response":[ ***// This is Array*** { ... } ], "request":"\/forecasts\/atlanta,ga" }, ... ] } } </code></pre> <p>You have make a same structure for arrays object. Hope this help. Thanks</p> |
17,723,286 | 0 | <p>A close equivalent in IronPython would be</p> <pre><code>Clearcore2.Licensing.LicenseKeys.Keys = Array[str]([r"""<?xml version=""1.0"" encoding=""utf-8""?> <license_key> <company_name>Company </company_name> <product_name>ProcessingFramework</product_name> <features>WiffReaderSDK</features> <key_data> 2F923C31D1E7E16B191EF2F87DCA7F15831A3F18DED11E05582A98822== </key_data> </license_key>"""]) </code></pre> <p>The <strong>@</strong> in C# specifies a <a href="http://msdn.microsoft.com/en-us/library/aa691090%28v=vs.71%29.aspx" rel="nofollow">verbatim string literal</a>. This means that no escape sequences etc. are handled and that the string may span multiple lines. A <a href="http://docs.python.org/release/2.5.2/ref/strings.html" rel="nofollow">raw, triple quoted string</a> should be the equivalent literal.</p> <p>Your initial code might fail because of the encoding and or mode you read the file with. Depending on what should happen with the file data, you might want to specify an <a href="http://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files" rel="nofollow">alternate mode</a> for opening the file (e.g. <strong>b</strong> for <em>binary</em>) or use a .NET BCL function like <a href="http://msdn.microsoft.com/de-de/library/ms143369.aspx" rel="nofollow">File.ReadAllText</a> which you can check from C# as well.</p> |
39,503,111 | 0 | <p>Pass it as a string and convert to boolean in Javascript:</p> <pre><code>var myBool = Boolean(@Model.OrderModel.IsToday.ToString().ToLower()); </code></pre> <p>See <a href="http://stackoverflow.com/questions/263965/how-can-i-convert-a-string-to-boolean-in-javascript">here</a></p> |
14,601,496 | 0 | How to get Media controls in Webview in android? <p>I am having Webview in android & currently playing youtube video from the Url. top of the webview, there is an <code>actionbar</code>. I want <code>actionbar</code> to be hidden when video is playing & <code>actionbar</code> to show when video is <code>onPause</code>. is there any way to get the current state of video playing inside the <code>webview</code>. or I can call <code>mediaControls</code> class in <code>webview</code>. Here is my code for webview:</p> <pre><code> mVideoView.getSettings().setJavaScriptEnabled(true); mVideoView.getSettings().setPluginsEnabled(true); mVideoView.getSettings().setAllowFileAccess(true); mVideoView.setWebChromeClient(new ChromeClient()); mVideoView.setWebViewClient(webViewClient); mVideoView.loadUrl("http://www.youtube.com/embed/" + video_id); </code></pre> |
10,845,403 | 0 | Slight error in calculations <p>I'm trying to build a game somewhat like Wheel of Fortune, actually it's done but there seems to a weird issue I can't figure out.</p> <p>Here's the wheel itself, as you can see the values are spaced evenly, each having a 15 ° slice.</p> <p><img src="https://i.stack.imgur.com/i2thO.png" alt="enter image description here"></p> <p>To spin the wheel I generate a random number which will be the amount of rotation in degrees, I animate the wheel and everything is fine but when the rotation stops I have to get the value from the wheel which stops at the top-center position so I though this would solve it:</p> <pre><code>wheelValues = [ 1000, 3250, 1800, 1000, 1200, 3750, 5000, 1000, 3000, 1600, 1000, 3500, 1000, 2000, 1000, 2750, 1000, 4000, -1, 1000, 2500, 1400, 1000, 2250 ]; if (toAngle > 360) { toAngle = toAngle - (Math.floor(toAngle / 360) * 360); } arrIndex = Math.floor(toAngle / 15) + 1; result = wheelValues[arrIndex]; </code></pre> <p>where <code>toAngle</code> is the random spin I generate which can be between 370 and 1440.</p> <p>This method works in about 8/9 times out of 10 and I can actually get the correct value the wheel stops at but I can't really understand why sometimes the value is off (and sometimes really off, not even near the correct value).</p> |
38,616,639 | 0 | Redirect back with changeset <p>i'm working with programming phoenix book examples more specific:</p> <pre><code>def create(conn, %{"user" => user_params}) do changeset = User.registration_changeset(%User{}, user_params) case Repo.insert(changeset) do {:ok, user} -> conn |> put_flash(:info, "#{user.username} created!") |> redirect(to: user_path(conn, :index)) {:error, changeset} -> render(conn, "new.html", changeset: changeset) end end </code></pre> <p>when the form has errors instead of using <code>render(conn, "new.html", changeset: changeset)</code></p> <p>i want to redirect back with changeset the following code works:</p> <pre><code>{:error, changeset} -> conn |> put_flash(:error, "Error") |> redirect(to: user_path(conn, :new)) </code></pre> <p>but it doesn't contains the changeset which is important i think.Another thing is that instead of render users/new it renders users route.</p> <p>Any ideas?</p> |
4,246,861 | 0 | <p>Views can't dynamically add columns based on the data in them. Neither can straight queries. Since you want it to automatically change based on the data in the table, this completely rules out views and queries using constructs like <code>pivot</code>.</p> <p>Pretty much your only choice, given the constraints you've given us, is to generate a temp table with enough columns (dynamically), and populate that. This is still problematic as a sproc can't create and return a temp table since the table would be dropped when the sproc exits.</p> <p>Another option is to write a sproc which dynamically generates a <code>pivot</code> query and executes that. This is going to be pretty messy though. Do new roles get added so often that this is an absolute requirement? That's the only thing that's making it so difficult.</p> <p>A static pivot query to give you the output you want might look something like this:</p> <pre><code>select UserName, [1] as Role1, [2] as Role2, [3] as Role3 -- UpdateMe from ( select u.UserName, r.RoleID IsUserInRole(u.UserName, r.RoleName) RoleFlag from aspnet_users u cross join aspnet_roles r) source pivot ( RoleFlag for RoleID in ([1],[2],[3]) -- UpdateMe ) PivotTable </code></pre> <p>There are two lines that your dynamic SQL generator would have to keep updated, they are marked with the <code>UpdateMe</code> comments.</p> <p>I don't have MSSQL installed here, so I can't test this query, but it should be quite close. The <a href="http://msdn.microsoft.com/en-us/library/ms177410.aspx" rel="nofollow"><code>pivot</code></a> reference might be helpful.</p> <p>Faking pivots in SQL Server 2000 using aggregates and <code>case</code>:</p> <pre><code>select UserName, max(case when src.RoleID = 1 then RoleFlag else 0 end) Role1, --Repeat N times ... from ( select u.UserName, r.RoleID IsUserInRole(u.UserName, r.RoleName) RoleFlag from aspnet_users u cross join aspnet_roles r) src group by UserName </code></pre> |
7,867,273 | 0 | <p><strong>Problem 1</strong>:</p> <p>As Blau stated, your rocks will be sorted from front to back, and because they have the same depth, they will (some times) be sorted randomly. This is probably due to float precision (or lack thereof).</p> <p>Instead of changing the depth of your rocks, you can use <code>SpriteSortMode.Deferred</code>, which will draw the sprites in order, and delay the render until you call End (or until the spriteBatch can't handle any more sprites and needs to flush).</p> <p><strong>Problem 2</strong>:</p> <p>As Blau stated, this is also probably due to float precision. However, the problem <em>can</em> be avoided. Imagine having a moving tile, and your player walks near that tile. The tile then moves on top of your player (because we forgot to code the tile <em>not</em> to). You're player now cannot move, because any direction the player tries to move is an "invalid" move, because he'll be touching that tile.</p> <p>The problem is that we're <em>preventing the character from moving</em>. If the character could always move, we wouldn't have this problem. However, if the character could always move, he could just more right through things. To prevent this, we need an opposite action acting against the character when he moves against a solid object.</p> <p><em>Solution</em>:</p> <p>Allow the player to move into an object, and then scan for all of the objects he's touching. If he's touching any, figure out what direction you should move him <em>away</em> from each object, and combine all of those directions to form a single vector. Scale that vector by some reasonable amount (to prevent the character from being pushed away dramatically). Move the player according to that vector</p> <p><em>Problems with this method</em>:</p> <p>If you have a force from gravity, or the like, you may find your character "sinking" into the ground. This is a result of the gravity pushing against the force that pushed the player back from the tiles. The problem can be solved by <em>displacing</em> the character away from any tiles before applying a force on the player to <em>move</em> him away.</p> <p>This turns out to be a very complex problem, and it is already solved for you.</p> <p><em><strong>Box 2D / Farseer Physics Engine</em></strong>:</p> <p>You've probably heard of these before and thought "Oh, I'll just roll my own, because that sounds super fun!" And while programming your own physics engine can be super fun, it also takes an extremely long time. If you want to get your game up and running quickly with physics (even if they're simple Sonic-like physics), Erin Catto has laid all the ground work for you. :)</p> <p>Check these out:</p> <p>Box2D XNA: <a href="http://box2dxna.codeplex.com/" rel="nofollow">http://box2dxna.codeplex.com/</a></p> <p>Farseer Physics: <a href="http://farseerphysics.codeplex.com/" rel="nofollow">http://farseerphysics.codeplex.com/</a></p> |
4,964,882 | 0 | Message-based domain object collaboration <p>Recently, i was thinking about how to use message to implement the domain object collaboration. And now i have some thoughts:</p> <ol> <li>Each domain object will implement an interface if it want to response one message;</li> <li>Each domain object will not depend on any other domain objects, that means we will not have the Model.OtherModel relation;</li> <li>Each domain object only do the things which only modify itself;</li> <li>Each domain object can send a message, and this message will be received by any other domain objects which are care about this message;</li> </ol> <p>Totally, the only way of collaboration between domain objects is message, one domain object can send any messages or receive any messages as long as it need.</p> <p>When i learn Evans's DDD, i see that he defines the aggregate concept in domain, i think aggregate is static and not suitable for objects interactions, he only focused on the static structure of objects or relationship between objects. In real world, object will interact using messages, not by referencing each other or aggregating other objects. In my opinion, all the objects are equal, that means they will not depend on any other objects. For about how to implement the functionality of sending messages or receive messages, i think we can create a EventBus framework which is specially used for the collaboration of domain object. We can mapping the <strong>event type</strong> to the <strong>subscriber type</strong> in a dictionary. The key is event type, the value is a list of subscriber types. When one event is raised, we can find the corresponding subscriber types, and get all the subscriber domain objects from data persistence and then call the corresponding handle methods on each subscriber.</p> <p>For example:</p> <pre><code>public class EventA : IEvent { } public class EventB : IEvent { } public class EventC : IEvent { } public class ExampleDomainObject : Entity<Guid>{ public void MethodToRaiseAnExampleEvent() { RaiseEvent(new EventC()); } } public class A : Entity<Guid>, IEventHandler<EventB>, IEventHandler<EventC> { public void Handle(EventB evnt) { //Response for EventB. } public void Handle(EventC evnt) { //Response for EventC. } } public class B : IEventHandler<EventA>, IEventHandler<EventC> { public void Handle(EventA evnt) { //Response for EventA. } public void Handle(EventC evnt) { //Response for EventC. } } </code></pre> <p>That's my thoughts. Hopes to hear your words.</p> |
8,160,666 | 0 | <p>So here's what I've come up with:</p> <pre><code>$this->Sql = 'SELECT DISTINCT * FROM `nodes` `n` JOIN `tagged_nodes` `t` ON t.nid=n.nid'; $i=0; foreach( $tagids as $tagid ) { $t = 't' . $i++; $this->Sql .= ' INNER JOIN `tagged_nodes` `'.$t.'` ON ' .$t'.tid=t.tid WHERE '.$t.'.tid='.$tagid; } </code></pre> <p>It's in PHP since I need it to be dynamic, but it would basically be the following if I needed, say, only 2 tags (<code>animals</code>, <code>pets</code>).</p> <pre><code>SELECT * FROM nodes n JOIN tagged_nodes t ON t.nid=n.nid INNER JOIN tagged_nodes t1 ON t1.tid=t.tid WHERE t1.tid='animals' INNER JOIN tagged_nodes t2 ON t2.tid=t.tid WHERE t2.tid='pets' </code></pre> <p>Am I on the right track?</p> |
5,748,542 | 0 | <p>Assuming Test is a Controller and Page is an Action</p> <pre><code>RouteTable.Routes.Add(new Route { Url = "[controller]/[action]/[id]" Defaults = new { action = "Index", id (string) null }, RouteHandler = typeof(MvcRouteHandler) }); </code></pre> <p>but routing is very much context dependent. You need to look into your other routes and ensure that this route is placed in the right order.</p> |
6,416,090 | 0 | Which encoding should I use to convert NSData to NSString and backwards, if the string doesn't need to be beautiful? <p>Cheers,</p> <p>my app needs to send the contents of a NSData object to a webserver as a parameter of a GET request. It should be able to receive that very same data back at a later time. The data will be stored as longtext in a mysql database, the content is not known to me and may be pretty much anything.</p> <p>To achieve this, I'll need to convert it into a NSString, but which encoding should I choose? Does it matter at all which one I choose as long as it is the same for both ways?</p> <p>Thanks!!</p> |
7,593,443 | 0 | Which one is better for social networking integration in iOS development? <p>I have searched on net for social networking integration in iOS projects (For example: Facebook, Twitter, etc)</p> <p>I found there are also SDKs available for particulars and some OpenSource projects/frameworks are also available for the same which combines all into one like (ShareKit).</p> <p>What is the difference in those two? Which one is better to use? Is there any problem to upload an app on AppStore which is using ShareKit framework/code?</p> <p>Thanks in advance.</p> <p>Mrunal</p> |
30,590,428 | 0 | Chrome Extension : How to intercept requested urls? <p>How can an extension intercept any requested URL to block it if some condition matches?</p> <p><a href="http://stackoverflow.com/questions/30585385/firefox-extension-intercepting-url-it-is-requesting-and-blocking-conditionally">Similar question for Firefox.</a></p> <p>What permission needs to be set in manifest.json?</p> |
33,798,526 | 0 | <p>First of all you need to make sure, that your Players query returns only unique records (<code>Unique Values=Yes</code> on query properties). Then the query like on picture should work fine.</p> <p><a href="https://i.stack.imgur.com/BfebT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BfebT.png" alt="This query works fine"></a></p> |
36,823,951 | 0 | uint8_t VS uint32_t different behaviour <p>I am currently working on project where I need to use uint8_t. I have found one problem, could someone explain to me why this happens ?</p> <pre><code>//using DIGIT_T = std::uint8_t; using DIGIT_T = std::uint32_t; std::uint8_t bits = 1; DIGIT_T test1 = ~(DIGIT_T)0; std::cout << std::hex << (std::uint64_t)test1 << std::endl; DIGIT_T test2 = ((~(DIGIT_T)0) >> bits); std::cout << std::hex << (std::uint64_t)test2 << std::endl; </code></pre> <p>in this case the output is as expected</p> <pre><code>ffffffff 7fffffff </code></pre> <p>but when I uncomment the first line and I use uint8_t the output is</p> <pre><code>ff ff </code></pre> <p>This behaviour is causing me troubles.</p> <p>Thank you for your help.</p> <p>Marek</p> |
27,851,680 | 0 | <p>Writing portable OpenGL code isn't as straightforward as you might like.</p> <ol> <li><p><strong>nVidia drivers are permissive.</strong> You can get away with a lot of things on nVidia drivers that you can't get away with on other systems.</p></li> <li><p><strong>It's easy to accidentally use extra features.</strong> For example, I wrote a program targeting the 3.2 core profile, but used <code>GL_INT_2_10_10_10_REV</code> as a vertex format. The <code>GL_INT_2_10_10_10_REV</code> symbol is defined in 3.2, but it's not allowed as a vertex format until 3.3, and you won't get any error messages for using it by accident.</p></li> <li><p><strong>Lots of people run old drivers.</strong> According to the Steam survey, in 2013, 38% of customers with OpenGL 3.x drivers didn't have 3.3 support, even though hardware which supports 3.0 should support 3.3.</p></li> <li><p><strong>You will always have to test.</strong> This is the unfortunate reality.</p></li> </ol> <p>My recommendations are:</p> <ul> <li><p>Always target the core profile.</p></li> <li><p>Always specify shader language version.</p></li> <li><p>Check the driver version and abort if it is too old.</p></li> <li><p>If you can, use OpenGL headers/bindings that only expose symbols in the version you are targeting.</p></li> <li><p>Get a copy of the spec for the target version, and use that as a reference instead of the OpenGL man pages.</p></li> <li><p>Write your code so that it can also run on OpenGL ES, if that's feasible.</p></li> <li><p><strong>Test on different systems.</strong> One PC is probably not going to cut it. If you can dig up a second PC with a graphics card from a different vendor (don't forget Intel's integrated graphics), that would be better. You can probably get an OpenGL 3.x desktop for a couple hundred dollars, or if you want to save the money, ask to use a friend's computer for some quick testing. You could also buy a second video card (think under $40 for a low-end card with OpenGL 4.x support), just be careful when swapping them out.</p></li> </ul> <p>The main reason that commercial games run on a variety of systems is that they have a QA budget. If you can afford a QA team, do it! If you don't have a QA team, then you're going to have to do both QA and development -- two jobs is more work, but that's the price you pay for quashing bugs.</p> |
32,673,025 | 0 | c and java arithmetic expression and parenthesis <p>can anyone help me to understand how are translated this 2 expression:</p> <p>FIRST</p> <pre><code>double val = 1/(b-1)/t*log(x1/x2); </code></pre> <p>I have broke it with some c in many parts, but I have 2 different results:</p> <pre><code>double val2 = ( 1/(b-1) ) / ( t*log(x1/x2) ); double b,t,x1,x2; b= 0.1; t= 0.2; x1 = 0.3; x2=0.4; double val = 1/(b-1)/t*log(x1/x2); printf ("%1.4e",val); double val2 = ( 1/(b-1) ) / ( t*log(x1/x2) ); printf ("%1.4e",val2); if(val!=val2){ printf("different!"); }else printf("its ok"); return 0; </code></pre> <p>SECOND QUESTION: Are there many differences of precision from double in c and java for very low order numbers? </p> <p>Thank you.</p> |
1,114,690 | 0 | How to get user input in Clojure? <p>I'm currently learning clojure, but I was wondering how to get and store user input in a clojure program. I was looking at the clojure api and I found a function called read-line, however I'm not sure how to use it if it's the right function to use...</p> <p>Anyhow, how do you get user input in clojure ?</p> |
1,460,144 | 0 | <p>Being the author of <a href="http://code.google.com/p/cibyl/wiki/Cibyl" rel="nofollow noreferrer">Cibyl</a>, I might be biased here. Anyway, I've looked at the java bytecode generated by the axiomatic C compiler, and it is not efficient. NestedVM and Cibyl both works by compiling MIPS binaries and then translating the binary into Java bytecode. It's surprisingly efficient, with the main problem being memory access of 8- and 16-byte values (which needs to be done in multiple steps).</p> <p>NestedVM and Cibyl have slightly different performance characteristics, with Cibyl typically being faster for integer-heavy workloads whereas NestedVM handles floats and doubles better. This is because Cibyl uses GCC soft-float support (though using "real" Java bytecode floating point instructions) while NestedVM translates MIPS FPU instructions.</p> <p>Cibyl is also more targeted to J2ME environments, although it's definately useable on other platforms as well. My guess is that you would have more luck with either of them than with the Axiomatic C compiler.</p> |
26,434,777 | 0 | <p>Not mentioned (at least in explicitly) is the fact that RSE (and for what I've seen, Eclipse in general) only seems to work with 1024 bit keys <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=404714" rel="nofollow">https://bugs.eclipse.org/bugs/show_bug.cgi?id=404714</a></p> <p>I also had issues, because my privatekey was 2048, but I added a new key to authorized hosts and then I could connect.</p> |
39,841,358 | 0 | <p>Take a step back. <strong>You should not be implementing this interface at all</strong>, so whether the implementation goes in a base class or whatever is completely beside the point. Simply don't go there in the first place.</p> <p>This interface has been deprecated since 2003. See:</p> <p><a href="http://stackoverflow.com/questions/699210/why-should-i-implement-icloneable-in-c">Why should I implement ICloneable in c#?</a></p> <p>for details.</p> |
34,425,307 | 0 | Finding label-value pairs and capturing value Jquery <p>I need to find values associated with labels that partly match a string. The block of source looks like this:</p> <pre><code> <dt> Loose Ones </dt> <dd> 8.00 </dd> <dt> Loose Fives </dt> <dd> 15.00 </dd> <dt> Envelope Ones </dt> <dd> 0.00 </dd> <dt> Envelope Fives </dt> 25.00 <dd> </code></pre> <p>I want to find all labels that contain 'Loose' and capture the associated value then total it into a value. Jquery must have a way to do this.</p> |
37,408,378 | 0 | <p>//Use printf to print your variable </p> <p>printf("float pi = %f", pi);</p> <p>printf("char my_char = \'%c\'", my_char);</p> <p>printf("double big_pi=%f", big_pi);</p> |
16,399,587 | 0 | Remote post to webpage from windows service <p>NOTE: <em>This question has been edited what was originally asked</em> </p> <p>I'm developing a windows service that, daily, queries a web service for data, compares that to currently existing data and then posts it to the client's webpage.</p> <p>The code for the remote post executes fine, but updates never happen on the client's web page...</p> <pre><code>Imports Microsoft.VisualBasic Imports System.Collections.Specialized Public Class RemotePost Public Property Inputs As New NameValueCollection() Public Property URL As String Public Property Method As String = "post" Public Property FormName As String = "_xclick" Public Sub Add(ByVal name As String, ByVal value As String) _Inputs.Add(name, value) End Sub Public Sub Post() Dim client as New WebClient() client.Headers.Add("Content-Type", "application/x-www-form-urlencoded") Dim responseArray = client.UploadValues(URL, Method, Inputs) End Sub End Class </code></pre> <p>I believe the reason for this is that the post generated by the above code is different to what the form itself posts manually.</p> <p>Here's an example of a post generated by the above code:</p> <pre><code>POST http://www.thisdomain.com/add-event/ HTTP/1.1 Content-Type: application/x-www-form-urlencoded Host: thisdomain.com Content-Length: 116 Expect: 100-continue Connection: Keep-Alive no_location=0&event_name=Cycle-Fix+MTB+Tour+-+3+Days+ABC&event_start_date=2013%2f04%2f06&location_state=Eastern+Cape </code></pre> <p>And here's an example of a post generated on the page itself:</p> <pre><code>POST http://www.thisdomain.com/add-event/ HTTP/1.1 Host: thisdomain.com Connection: keep-alive Content-Length: 2844 Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Origin: http://thisdomain.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary8u14QB8zBLGQeIwu Referer: http://thisdomain.com/add-event/ Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: UTF-8,*;q=0.5 Cookie: wp-settings-1=m5%3Do%26editor%3Dtinymce%26libraryContent%3Dbrowse%26align%3Dleft%26urlbutton%3Dnone%26imgsize%3Dfull%26hidetb%3D1%26widgets_access%3Doff; wp-settings-time-1=1367827995; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_8d8e9e110894b9cf877af3233b3a007b=admin%7C1368089227%7C69a33748ee5bbf638a315143aba81313; devicePixelRatio=1 ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="event_name" test event ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="event_start_date" 2013-05-07 ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="event_start_time" 01:00 AM ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="event_end_time" 02:15 AM ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="recurrence_freq" daily ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="recurrence_interval" ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="recurrence_byweekno" 1 ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="recurrence_byday" 0 ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="recurrence_days" 0 ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="location_latitude" 38.0333333 ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="location_longitude" -117.23333330000003 ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="location_name" test ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="location_address" test ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="location_town" test ------WebKitFormBoundary8u14QB8zBLGQeIwu Content-Disposition: form-data; name="location_state" Georgia </code></pre> <p>Clearly there's a lot more happening with the form's post than is the case with mine. Unfortunately, I'm afraid I don't understand all of it.</p> <p>I have the following concerns about these differences:</p> <ul> <li>That my (apparently) querystring data is not being read because it's not being sent correctly ($_GET as opposed to $_POST)</li> <li>That there is possibly validation code in the PHP that saves the data after this post that is blocking it somewhere</li> </ul> <p>Can anyone explain what exactly the differences here are and how I can emulate the form's post as per my requirement?</p> |
37,220,726 | 0 | Get the product of a list using java Lambdas <p>How do you get the product of a array using java Lambdas. I know in C# it is like this:</p> <p><code>result = array.Aggregate((a, b) => b * a);</code></p> <p>edit: made the question more clear.</p> |
5,799,449 | 0 | <p>Regarding to FB policies, I do not think you are breaking them. At most, you will need to add it to your privacy policies:</p> <blockquote> <p>3 . You will have a privacy policy that tells users what user data you are going to use and how you will use, display, share, or transfer that data and you will include your privacy policy URL in the Developer Application.</p> <p>4 . A user's friends' data can only be used in the context of the user's experience on your application.</p> <p>(...)</p> <p>7 . You will not use Facebook User IDs for any purpose outside your application (e.g., your infrastructure, code, or services necessary to build and run your application). Facebook User IDs may be used with external services that you use to build and run your application, such as a web infrastructure service or a distributed computing platform, but only if those services are necessary to running your application and the service has a contractual obligation with you to keep Facebook User IDs confidential.</p> </blockquote> <p>But, looking at that library, it seems that they're using the old REST API that is being deprecated, (i.e.., URL <code>https://api.facebook.com/restserver.php?method=fql.query...</code> instead of <code>https://api.facebook.com/method/fql.query?...</code>)</p> <p>I would either (1) contact them to see if they will update the library soon or (2) use another library (such as the <a href="https://github.com/facebook/facebook-android-sdk" rel="nofollow">android-facebook-sdk</a>).</p> |
38,233,222 | 0 | <p>If your code uses linear algebra, check it. Generally, roundoff errors are not deterministic, and if you have badly conditioned matrices, it can be it.</p> |
40,726,718 | 0 | Passing Javascript (HTML Table Contents) array to php file <p>Im very confused, I have been looking for a solution to pass HTML table contents via a javascript array (if this is indeed the best way of capturing HTML Table data) to a php file so I can then do whatever I like with the data.</p> <p>I have simplified the table shown in my example code in order to make it easier, the table i will be using live will have a lot of rows with more complicated data etc.</p> <p>The current code in get_table_data_php is:-</p> <pre><code><script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <div id ="results_table"> <table id="stats_table"> <tr> <td>Car</td><td>Engine</td><td>Color</td><td>Price</td> </tr> <tr> <td>Ford</td><td>2 Litre</td><td>Blue</td><td>22,000</td> </tr> <tr> <td>Audi</td><td>2.5 Litre</td><td>White</td><td>25,000</td> </tr> </table> </div> <script> var myTableArray = []; $("table#stats_table tr").each(function() { var arrayOfThisRow = []; var tableData = $(this).find('td'); if (tableData.length > 0) { tableData.each(function() { arrayOfThisRow.push($(this).text()); }); myTableArray.push(arrayOfThisRow); } }); alert(myTableArray); // alerts the entire array alert(myTableArray[0][0]); // Alerts the first tabledata of the first tablerow $.ajax({ type: "POST", data: {myTableArray:myTableArray}, url: "stats.php", success: function(msg){ $('.answer').html(msg); } }); </script> </code></pre> <p>The code in the stats.php file being called is as follows:-</p> <pre><code><?php var_dump($_POST); ?> </code></pre> <p>The code in the calling php file runs as expected and shows (via the alert(s) which are there for my sanity) the table data as expected.</p> <p>The file called (stats.php) however does not do anything and as such I do not know if its working and what the issue is as to why it isn't.</p> <p>I am pretty new to the Javascript and Ajax side of things so any help would be appreciated.</p> <p>Regards</p> <p>Alan</p> |
7,299,400 | 0 | Interpolate missing values in a MySQL table <p>I have some intraday stock data saved into a MySQL table which looks like this:</p> <pre><code>+----------+-------+ | tick | quote | +----------+-------+ | 08:00:10 | 5778 | | 08:00:11 | 5776 | | 08:00:12 | 5778 | | 08:00:13 | 5778 | | 08:00:14 | NULL | | 08:00:15 | NULL | | 08:00:16 | 5779 | | 08:00:17 | 5778 | | 08:00:18 | 5780 | | 08:00:19 | NULL | | 08:00:20 | 5781 | | 08:00:21 | 5779 | | 08:00:22 | 5779 | | 08:00:23 | 5779 | | 08:00:24 | 5778 | | 08:00:25 | 5779 | | 08:00:26 | 5777 | | 08:00:27 | NULL | | 08:00:28 | NULL | | 08:00:29 | 5776 | +----------+-------+ </code></pre> <p>As you can see, there are some points where no data is available (quote is <code>NULL</code>). What I would like to do is a simple step interpolation. This means each <code>NULL</code> value should be updated with the last value available. The only way I managed to do this is with cursors, which is pretty slow due to the large amount of data. I'm basically searching something like this:</p> <pre><code>UPDATE table AS t1 SET quote = (SELECT quote FROM table AS t2 WHERE t2.tick < t1.tick AND t2.quote IS NOT NULL ORDER BY t2.tick DESC LIMIT 1) WHERE quote IS NULL </code></pre> <p>Of course this query will not work, but this is how it should look like.</p> <p>I would appreciate any ideas on how this can be solved without cursors and temp tables.</p> |
1,939,909 | 0 | <p>Try signing up here: <a href="https://www.epsonexpert.com/login" rel="nofollow noreferrer">https://www.epsonexpert.com/login</a></p> <p>That seems to be the place to get technical info about Epson POS products. I can't say if they specifically have what you want. I signed up just now, but now I have to wait for them to get back to me:</p> <blockquote> <p>Thank you for registering with EpsonExpert. We have received your registration information and will be contacting you shortly, once your request has been reviewed.</p> </blockquote> |
33,923,044 | 0 | Variation with variable count of possibilities <p>I have programmed a game where the player has 30 days to build city. I like to know all the possible approaches the player could take so that i know which is the best one.</p> <p>Basicly with 30 days and 9 projects which can be bought and upgraded the mathematical formula would be n^k. Which in our case woud be 9^30 = 42.391.158.275.216.203.514.294.433.201 But because it is a game the projects the player can buy per round depend on variabels like for examples coins. So its something like 4*1*5*3*2...</p> <p>My problem is that GameStats, which simulates the game environment, does not get reset when a new buildpath is added.</p> <p>Example</p> <p>The player starts with 15 coins and an income of 5. First day he build houses for 10 coins</p> <ul> <li>day 0: buildpath{house}; coins 15 -> bought house -10 coins</li> <li>day 1: buildpath{house, empty}; coins 5 -> no coins to buy anything</li> <li>day 2: buildpath{house, empty, house}; coins 10 -> player can buy house, street or cycletrack</li> </ul> <p>now for the next possible buildpath we start at day 2 where could also have bougth the street or the cycletrack and had 10 coins but GameStats which holds the coins is now by 15coins.</p> <p>How do I keep the GameStats unique for every possible buildpath?</p> <pre><code>public string[] GetPermutation(int days, List<BaseProject> projects) { ArrayList output = new ArrayList(); GameStats game = new GameStats(); GetPermutationPerRef(days, projects, ref output, ref game); return output.ToArray(typeof(string)) as string[]; } private void GetPermutationPerRef(int days, List<BaseProject> projects, ref ArrayList output, ref GameStats game, string outputPart = "") { if (days == 0) { outputPart += " points: " ; output.Add(outputPart); } else { if(projects.Count > 0) { foreach (BaseProject p in projects) { // construct the current project game.BuyProject(p); // move on to the next day game.nextDay(); // find all the projects the player could buy the next day projects = game.GetBuyAbleBaseProjects(); GetPermutationPerRef(days - 1, projects, ref output, ref game, outputPart + p.projectName +" "); } } else { // dont buy or upgrade any project game.nextDay(); projects = game.GetBuyAbleBaseProjects(); GetPermutationPerRef(days - 1, projects, ref output, ref game, outputPart + "empty "); } } } </code></pre> |
27,240,096 | 0 | <p>If you have load balance server before your cxf services, it makes sense that you define the publishedEndpointUrl to the load balance address.</p> <p>For you case, it looks like you want to SOAP UI to access other address which has on listener there.</p> |
39,748,401 | 0 | <p>According to the <a href="https://docs.python.org/3/library/socket.html#socket.socket.connect" rel="nofollow">documentation</a>, <code>connect</code> expects a tuple <code>(string, int)</code>, with the string being the ip address and the int being the port. You can modify your code this way to fix it :</p> <pre><code>s.connect((ip, int(port))) </code></pre> <p>Hope it'll be helpful.</p> |
10,856,333 | 0 | <p>You have</p> <pre><code><input type="hidden" value="1" name="id"> <input type="hidden" value="2" name="id"> </code></pre> <p>etc.</p> <p>You're going to only get number 5 because it is the last one, and is overwriting the one before it.</p> <p>Same with the input texts, the <code>name</code> attribute should be different.</p> <p>Do a <code>var_dump($_POST);</code> to see all that is being POST'ed. </p> |
843,713 | 0 | <p>See the <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/setAutoresizingMask:" rel="nofollow noreferrer">setAutoresizingMask:</a> method of NSView and the associated <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/constant_group/Resizing_masks" rel="nofollow noreferrer">resizing masks</a>.</p> |
14,199,281 | 0 | <p>Piston loads a http status response via <code>utils.rc</code>, no errors are raised.</p> <p>from the documentation:</p> <pre><code>Configuration variables Piston is configurable in a couple of ways, which allows more granular control of some areas without editing the code. Setting Meaning settings.PISTON_EMAIL_ERRORS If (when) Piston crashes, it will email the administrators a backtrace (like the Django one you see during DEBUG = True) settings.PISTON_DISPLAY_ERRORS Upon crashing, will display a small backtrace to the client, including the method signature expected. settings.PISTON_STREAM_OUTPUT When enabled, Piston will instruct Django to stream the output to the client, but please read streaming before enabling it. </code></pre> <p>I'd recommend to setup a logger, <a href="http://sentry.readthedocs.org/en/latest/" rel="nofollow">sentry</a> together with <a href="http://raven.readthedocs.org/en/latest/config/django.html" rel="nofollow">raven</a> is rather convenient and you get to configure your own log level and handler.</p> |
17,622,297 | 0 | How do you make buttons re sizable at run time? <p>I want to make it so that my buttons change size based on the text inside them. Kind of like a Label with it's height and width set to "Auto", but I would like to start with a pre-determined dimension. </p> <p>Is there a way to place a button, size it, and allow for re-sizing based on run-time text changes? If so, how do I do this?</p> <p>I've looked at this example: <a href="http://social.msdn.microsoft.com/Forums/vstudio/en-US/188c196e-90d8-4584-bc62-38d7e008cf5c/how-do-i-resize-button-text-upon-button-resize" rel="nofollow">http://social.msdn.microsoft.com/Forums/vstudio/en-US/188c196e-90d8-4584-bc62-38d7e008cf5c/how-do-i-resize-button-text-upon-button-resize</a></p> <p>It has to do with inserting a textblock on top of the button, but when the text adjusts sometimes the new text becomes too small because the text does not wrap for some reason...</p> <p>Thank you.</p> |
17,491,417 | 0 | PrimeFaces PickList : two String fields filter <p>I was wondering if it's possible to have a two fields filter with a picklist of primefaces. I tried this but it's not working. I would like to filter on firstname and name but they are in two different fields.</p> <pre><code><p:pickList value="#{bean.usersDualModel}" var="user" itemValue="#{user}" itemLabel="#{user.firstname} #{user.name}" converter="user" showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" > <p:column> <h:outputText value="#{user.firstname} #{user.name}" /> </p:column> </p:pickList> </code></pre> <p>Thanks</p> |
39,744,557 | 0 | Can a server ignore an SQL request when sending several requests in the same WHILE? <p>Same as the title says: Can my sql server ignore some of my requests just because it is busy?</p> <p>I think it's possible, and I asked because it happened to me a few hours ago (before i find a better way to send my data in one time instead of sending it in a while), I was sending my data in a loop, but when I checked if the DATA was stored properly a little part of my 10 requests were just ignored...</p> <p>Of course I've done some basic check to know if my data was set before sending it, and it seems that it was.</p> <p>Sorry for the grammar, i'am not english, thanks to you who will correct me, good job.</p> |
33,760,834 | 0 | <p>Try this:</p> <pre><code>Provider=MSDAORA.1;Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = SERVER0123)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = PRODDB)));User Id=USER_ID;Password=USER_ID_PASSWORD </code></pre> <p>Obviously you need to replace the server, User ID and Password.</p> |
6,339,367 | 0 | <p>Thanks for the reply..</p> <p>I got below command working to meet my scenario for now.. but trying to see if there is any direct command to find the latest ID of a file on remote server...</p> <blockquote> <p>git log 'branch-name' -- 'file-name'</p> </blockquote> <p>which displaying log messages with ID, Author and Date.. I am fetching the top first line with unix pipe head command.</p> <blockquote> <p>git log 'branch-name' -- 'file-name' | head -1</p> </blockquote> |
21,369,663 | 0 | <p>See my answer to another similar question just posted this morning:</p> <p><a href="http://stackoverflow.com/questions/21366896/makefile-error-that-works-fine-in-console">Makefile error that works fine in console</a></p> <p>The error you see does <em>not</em> mean an error in the makefile. If there were, <code>make</code> would give information on what was wrong with your makefile and the linenumber in the makefile where it happened.</p> <p>The problem you have in both the above examples is you're trying to compile code that requires some development libraries (alsa in the first one, GTK in the second one) and you don't have them. You'll need to use your package manager to install them; exactly what commands you need and what package names you need depends entirely on which distribution of Linux (if you're using Linux) you have, and you don't give this information.</p> <p>Once your compile operations work, then you won't get this error from make.</p> |
7,185,714 | 0 | Basic Authentication in REST WCF <p>I have developed one REST WCF and would like to client will use it with basic Authentication, I have hosted this service in IIS 7.0 and disabled all authentication except Basic Authentication.</p> <p>Now problem is that when call this service from any other application (in my case i am calling this from ruby command prompt) with Header "Basic bXlhZGRvbjpDcFplcUc5MzlHdDZQMEtD" although i was not able to authenticate this service.</p> <p>Make it more simple , when i will access this service (.svc) from browser due to basic Authentication it will prompt to enter username & password , so which residential i need to pass here and to which credential i need to compare (weather i need to set in web.config or IIS)??</p> <p>Thanks in Advance Arun.</p> |
5,592,334 | 0 | <p>You have to use css property</p> <pre><code>resize: none; </code></pre> <p>here is the Demo <a href="http://jsfiddle.net/2hPzW/" rel="nofollow">Jsfiddle</a></p> |
36,755,909 | 0 | <p>Just from what you have provided, I can't tell you why it won't work. I do not have a screensaver to test that with (that I know of). But I'm able to do all four of these with Notepad opening a text file:</p> <p><strong>Separate ProcessStartInfo</strong></p> <pre><code> ProcessStartInfo procInfo = new ProcessStartInfo("notepad.exe", "c:\\test.txt"); Process proc = Process.Start(procInfo); proc.WaitForExit(); </code></pre> <p><strong>Separate ProcessStartInfo with Properties</strong></p> <pre><code> ProcessStartInfo procInfo = new ProcessStartInfo(); procInfo.Arguments = "c:\\test.txt"; procInfo.FileName = "notepad.exe"; Process proc = Process.Start(procInfo); proc.WaitForExit(); </code></pre> <p><strong>Inline ProcessStartInfo</strong></p> <pre><code> Process proc = Process.Start(new ProcessStartInfo("notepad.exe", "c:\\test.txt")); proc.WaitForExit(); </code></pre> <p><strong>No PSI, Just Process</strong></p> <pre><code> Process proc = Process.Start("notepad.exe", "c:\\test.txt"); proc.WaitForExit(); </code></pre> <p>You may want to go with the first one so that you can breakpoint on the "Process proc..." line and examine the properties of <code>procInfo</code>. The <code>Arguments</code> property should show the 2nd value (in my case, <code>c:\\test.txt</code>), and the <code>FileName</code> property should be the path to what you are executing (mine is <code>notepad.exe</code>).</p> <p><em>EDIT: I added the separate one with properties so you can really see explicit setting.</em></p> <h2>CONFIGURE A SCREENSAVER</h2> <p>I have worked out an example using the 3D Text screensaver:</p> <pre><code> string scrPath = @"C:\Windows\System32\ssText3d.scr"; ProcessStartInfo procInfo = new ProcessStartInfo(); procInfo.FileName = scrPath; procInfo.Verb = "config"; procInfo.UseShellExecute = false; Process proc = Process.Start(procInfo); proc.WaitForExit(); </code></pre> <p>I didn't use the <code>Arguments</code>. Instead, I used the <code>Verb</code>. This requires <code>UseShellExecute</code> to be set to <code>false</code>. I got the expected configuration dialog instead of the screensaver running.</p> <p><strong>More About Verbs</strong></p> <p>This is where the verbs are for screen savers. <a href="https://i.stack.imgur.com/rw7q6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rw7q6.png" alt="enter image description here"></a></p> <p>You can also define custom verbs: <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/cc144175(v=vs.85).aspx#register_application_arbitrary" rel="nofollow noreferrer">Register an Application to Handle Arbitrary File Types</a></p> |
33,583,762 | 0 | <p>This</p> <pre><code>System.out.printf("\n%-5s%-5s%-15s%-15s%-6s%-15s%-5d\n", "Sno.","B.No.","BOOK-NAME","AUTHOR-NAME","COPIES","PUBLISHER","PRICE"); </code></pre> <p>will not work because the last is a number and you pass it the string "PRICE".</p> <p>You should use different format string for the columns names.</p> <p>Column names : <code>"\n%-5s%-5s%-15s%-15s%-6s%-15s%-5s\n"</code></p> |
36,152,534 | 0 | <p>You can bind mousedown\mouseup events to <code>document</code>and mouseenter event on canvas.</p> <p>I'd suggest to use capturing phase instead (which jQuery doesn't support) to avoid any propagation event stopped in some way.</p> <p>See an example:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code> document.addEventListener('mousedown', function(e) { $(this).data('mouseHold', e.which); }, true); document.addEventListener('mouseup', function(e) { $(this).data('mouseHold', false); }, true); $('canvas').on('mouseenter', function() { if ($(document).data('mouseHold')) { console.log('holding mouse button ' + $(document).data('mouseHold')); } });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>canvas { background: blue; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <canvas></canvas></code></pre> </div> </div> </p> |
14,741,320 | 0 | <p>Today I found an event in the Entity Framework that seems to be what I am looking for. <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.objectmaterialized.aspx">ObjectContext.ObjectMaterialized Event</a>. Apparently, DbContext implements IObjectContextAdapter which in-turn exposes the ObjectContext. From there I can subscribe to the ObjectMaterialized event.</p> <blockquote> <p><em>MSDN Reads</em>: Occurs when a new entity object is created from data in the data source as part of a query or load operation.</p> </blockquote> <p>The following code demonstrates how I used the ObjectMaterialized event to solve my problem in which one of my preferences was to have a central point to place the WCF client access logic.</p> <pre><code>// seperate assembly - does not use Domain.Repositories assembly namespace Domain.Models { // the data contract [DataContract] public class ProductInventoryState { [DataMember] public int StockStatus { get; set; } [DataMember] public IEnumerable<String> SerialNumbers { get; set; } // etc.... } // the entity public class Product { public Guid Key { get; set; } public string ProductCode { get; set; } public ProductInventoryState InventoryState { get; set; } // etc.... } } // seperate assembly - uses Domain.Models assembly namespace Domain.Repositories { public class MainRepository : DbContext { public MainRepository() { ((IObjectContextAdapter)this).ObjectContext.ObjectMaterialized += ObjectContext_ObjectMaterialized; } protected void ObjectContext_ObjectMaterialized(object sender, ObjectMaterializedEventArgs e) { if (e.Entity == null) return; if (e.Entity is Product) { Product product = (Product)e.Entity; // retrieve ProductInventoryState from 3rd party SOAP API using (ThirdPartyInventorySystemClient client = new ThirdPartyInventorySystemClient()) { // use ProductCode to retrieve the data contract product.InventoryState = client.GetInventoryState(product.ProductCode); } } } } } </code></pre> |
15,248,876 | 0 | <p>From the following somewhat arbitrarily found man page for atoi....</p> <p><a href="http://linux.die.net/man/3/atoi" rel="nofollow">http://linux.die.net/man/3/atoi</a></p> <p>*<em>The atoi() function converts the initial portion of the string pointed to by nptr to int. *</em></p> <p>In short, the function is working exactly as it is defined.</p> |
8,066,121 | 0 | Guid in Querystring is being transformed somehow <p>I am not sure why this is occuring but here are a few details that may help to find a solution:</p> <ul> <li>It seems to work correctly on most computers firefox and IE</li> <li>It occurs to certain Guids as others work</li> <li>We put the firewall in monitor mode and still occurs</li> </ul> <p>This is the line in PageModify.aspx building the query string: </p> <pre><code>Response.Redirect(string.Format("Editor.aspx?id={0}", pageId, CultureInfo.CurrentCulture)); </code></pre> <p>This is the output of the query string when all goes correctly: </p> <pre><code>https://example.com/Editor.aspx?id=1dfz342b-3a4d-4255-8054-93916324afs6 </code></pre> <p>This is what is viewed in the browser when redirected to Editor.aspx: </p> <pre><code>https://example.com/Editor.aspx?id=1dfz342b-3a4d-xxxxxxxxxxxxxxx324afs6 </code></pre> <p>Of course we get an invalid guid error when this line runs: </p> <pre><code>_PageEditId= new Guid(Request.QueryString["id"]); </code></pre> <p>Has anyone seen this? Could it be IIS settings? Nothing special is being done here and everyone's systems has the same baseline. It occurs to inside and outside customers.</p> |
25,897,629 | 0 | <p>Directly, you need AJAX. </p> <p>Without AJAX, you can split the logic in two parts. Make a function of the logic that you want to run in back ground. And when the page gets loaded, do a postback to that function via JS.</p> |
22,151,834 | 0 | <p>There has been no significant change in this area from C90 to C99, or from C99 to C11.</p> <p>C90 6.1.2.5 (there are no paragraph numbers, but it's the first paragraph on page 23 of the PDF) says:</p> <blockquote> <p>A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting unsigned integer type.</p> </blockquote> <p>Nearly the same wording (with the phrase "resulting unsigned integer type" changed to "resulting type" appears in 6.2.5 paragraph 9 in the C99 and C11 standards.</p> <p>The only significant change (that I'm aware of) is an addition in C99 regarding signed conversion. In C90, if a signed or unsigned value is converted to a signed integer type, and the result cannot be represented in the target type, the result is implementation-defined. In C99 and C11, either the result is implementation-defined or an implementation-defined signal is raised. (I don't know of any compiler that takes advantage of the permission to raise a signal.)</p> <p>As supercat points out in a comment, multiplication of two <code>unsigned short</code> values <em>can</em> overflow. Suppose <code>short</code> is 16 bits, <code>int</code> is 32 bits, and integer representations are typical (2's-complement for signed types, no padding bits). Then given:</p> <pre><code>unsigned short US = USHRT_MAX; // 65536 </code></pre> <p>both operands in the expression</p> <pre><code>us * us </code></pre> <p>are promoted from <code>unsigned short</code> to <code>int</code> (because <code>int</code> can hold all possible values of type <code>unsigned short</code>) -- but the product, which is nearly 2<sup>32</sup>, cannot fit in a 32-bit <em>signed</em> <code>int</code>.</p> <p>(During the C standardization process in the late 1980s, the committee had to choose between "value-preserving" and "unsigned-preserving" integer promotions. They chose the former. With unsigned-preserving semantics, the <code>unsigned short</code> operands would be promoted to <code>unsigned int</code>, and this problem would not occur.)</p> |
28,200,365 | 0 | Trying to figure out what this line of code means <p>This code is from a program I use to enter and track information. Numbers are entered as work orders (WO) to track clients. But one of the tables is duplicating the WO information. So I was trying to figure out a general outline of what this code is saying so that the problem can be fixed. </p> <p>Here is the original line:</p> <pre><code>wc.dll?x3~emproc~datarecord~&ACTION=DISPLAY&TABLE+WORK&KEYVALUE=<%work.wo%&KEYFIELD=WO </code></pre> <p>What I think I understand of it so far, and I could be very wrong, is:</p> <pre><code>wc.dll?x3~emproc~datarecord~&ACTION //No clue because don't know ~ means or using & (connects?Action) =DISPLAY&TABLE+WORK&KEYVALUE //Display of contents(what makes it pretty) and the value inside the table at that slot =<work.wo%&KEYFIELD //Calling the work from the WO object =WO //is Assigning whatever was placed into the WO field into the left side of the statement </code></pre> |
373,228 | 0 | <p>I think this is a reasonable way:</p> <pre><code>find . -maxdepth 1 \! -name . -print0 | xargs -0 rm -rf </code></pre> <p>and it will also take care of hidden files and directories. The slash isn't required after the dot and this then will also eliminate the possible accident of typing <code>. /</code>. </p> <p>Now if you are worried what it will delete, just change it into</p> <pre><code>find . -maxdepth 1 \! -name . -print | less </code></pre> <p>And look at the list. Now you can put it into a function:</p> <pre><code>function enum_files { find . -maxdepth 1 \! -name . "$@"; } </code></pre> <p>And now your remove is safe:</p> <pre><code>enum_files | less # view the files enum_files -print0 | xargs -0 rm -rf # remove the files </code></pre> <p>If you are not in the habit of having embedded new-lines in filenames, you can omit the <code>-print0</code> and <code>-0</code> parameters. But i would use them, just in case :)</p> |
40,784,620 | 0 | Symfony3: set Custom FormType "name"/"blockPrefix" <p>I have a <code>Formtype</code>. In this <code>Formtype</code> I get over the <code>options</code>-Array in the <code>buildForm</code> function a key <code>additionalName</code>. I want to add this value to the <code>FormType</code> Name (in Symfony3 BlockPrefix). But how can I set this?</p> <pre><code>class AdultType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $additionalName = $options['additionalName']; $builder ->add('account', TextType::class,array( 'label' => 'account', 'required' => false, )) ; } /** * @param OptionsResolver $resolver */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'My\Bundle\WebsiteBundle\Model\Adult', 'csrf_protection' => true, 'cascade_validation' => true, 'name' => "" )); } /** * @return string */ public function getBlockPrefix() { //Here I need the $options['additionalName'] return 'my_bundle_websitebundle_adult_'.$options['additionalName']; } </code></pre> <p>I tried allready to set a variable private <code>$additionalName;</code> on the top of the class, set it in the <code>buildForm</code> function and get access to it with <code>$this->additionalName</code> in the <code>getBlockPrefix</code> Function. But the value in <code>getBlockPrefix</code> is empty. SO I think the <code>getBlockPrefix</code> is called before the <code>buildForm</code>.</p> <p>The Type is beeing called from another form:</p> <pre><code>$builder->add('adult', AdultType::class, array( 'additionalName' => $options['name'] )); </code></pre> <p>Thanks for any help!</p> |
25,760,125 | 0 | App is getting crash when i integrated and login through Gigya in social media <p>Terminating app due to uncaught exception 'com.gigya.GigyaSDK:InvalidOperationException', reason: 'Already logged in, log out before attempting to login again' <em>*</em> First throw call stack:</p> <p>Even I used [Gigya logout] prior to login statement in ios SDK, This issue happens when i try to login with facebook and Google plus</p> |
20,189,582 | 0 | How do i set the color for ics event? <p>From my application i want to send email with ICS event attachment to my customers. I have successfully send mail with .ics file. Now my customers want to display .ics event with some color. Is there any way to add color attribute into .ics file.Please refer my .ics file which was i send</p> <pre><code>BEGIN:VCALENDAR PRODID:-//Events Calendar//iCal4j 1.0//EN VERSION:2.0 CALSCALE:GREGORIAN BEGIN:VEVENT DTSTAMP:20131125T062336Z DTSTART:20131125T143000 DTEND:20131125T150000 SUMMARY:Pro-Lakshman Pro-Single Lesson 30 mins TZID:Asia/Kolkata UID:20131125T062337Z-uidGen@Lakshmanan ORGANIZER;ROLE=REQ-PARTICIPANT;CN=Lakshman:mailto:[email protected] ATTENDEE;ROLE=REQ-PARTICIPANT;CN=Karthik:mailto:[email protected] END:VEVENT END:VCALENDAR </code></pre> |
7,970,072 | 0 | <p>Bundler offers this feature with <a href="http://gembundler.com/man/bundle-package.1.html" rel="nofollow">bundle package</a>.</p> <p>Note that this doesn't include gems with sources included via <code>:git</code> or <code>:path</code> options.</p> |
27,966,745 | 0 | backtrack on virtualbox not getting ip address <p>i am trying to use backtrack5 on my virtualbox and set my adapter to bridged so that backtrack can have connection to the internet. But its not getting an ip even though its requesting for one when ever it boots. I read on other forums that some dhcp servers are configured not to give more than one ip to one mac addrees.so I used ipconfig / release to release the host ip so that my guest can obtain an ip but still its not working.when I set the adapter to NAT, it picks up an IP address from VB no problem but that does not connect me to the internet. Can anybody help me?</p> |
9,037,232 | 0 | Problems running Eclipse 64 bit on 64 bit LInux RHEL5 <p>I have a fresh install of the latest Eclipse Helios for Java EE development installed on my computer for 64 bit linux. Usually I can launch Eclipse but after about 5 minutes of use it usually crashes. Here is an error I get from the command line:</p> <pre><code># # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (constantPoolOop.hpp:244), pid=21791, tid=1090197824 # Error: guarantee(tag_at(which).is_klass(),"Corrupted constant pool") # # JRE version: 6.0_18-b07 # Java VM: Java HotSpot(TM) 64-Bit Server VM (16.0-b13 mixed mode linux-amd64 ) # An error report file with more information is saved as: # /home/bob/Desktop/Eclipse 64/eclipse/hs_err_pid21791.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp </code></pre> <p><strong>Edit: from hs_err:</strong> </p> <pre><code># # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (constantPoolOop.hpp:244), pid=21791, tid=1090197824 # Error: guarantee(tag_at(which).is_klass(),"Corrupted constant pool") # # JRE version: 6.0_18-b07 # Java VM: Java HotSpot(TM) 64-Bit Server VM (16.0-b13 mixed mode linux-amd64 ) # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # --------------- T H R E A D --------------- Current thread (0x000000004fa99800): JavaThread "main" [_thread_in_vm, id=21792, stack(0x0000000040eb1000,0x0000000040fb2000)] Stack: [0x0000000040eb1000,0x0000000040fb2000], sp=0x0000000040faec80, free space=3f70000000000000018k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x70e5f0] V [libjvm.so+0x2e3e26] V [libjvm.so+0x2de7da] V [libjvm.so+0x2dfc8e] V [libjvm.so+0x53b41b] V [libjvm.so+0x53f29f] V [libjvm.so+0x53f4c5] V [libjvm.so+0x53f23d] V [libjvm.so+0x3ce1e1] j java.lang.NoClassDefFoundError.<init>(Ljava/lang/String;)V+2 v ~StubRoutines::call_stub V [libjvm.so+0x3d5e8d] V [libjvm.so+0x5d9129] V [libjvm.so+0x3d5986] V [libjvm.so+0x33257e] V [libjvm.so+0x332734] V [libjvm.so+0x331e7e] V [libjvm.so+0x331fa0] V [libjvm.so+0x3a5766] V [libjvm.so+0x3a4c9a] V [libjvm.so+0x53d422] V [libjvm.so+0x53cc27] V [libjvm.so+0x3ccef7] j org.eclipse.core.runtime.adaptor.EclipseStarter.run([Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object;+546 v ~StubRoutines::call_stub V [libjvm.so+0x3d5e8d] V [libjvm.so+0x5d9129] V [libjvm.so+0x3d5cc5] V [libjvm.so+0x62ecc1] V [libjvm.so+0x632a32] V [libjvm.so+0x45fefb] C [libjava.so+0x19715] Java_sun_reflect_NativeMethodAccessorImpl_invoke0+0x15 j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87 j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+161 j org.eclipse.equinox.launcher.Main.invokeFramework([Ljava/lang/String;[Ljava/net/URL;)V+211 j org.eclipse.equinox.launcher.Main.basicRun([Ljava/lang/String;)V+126 j org.eclipse.equinox.launcher.Main.run([Ljava/lang/String;)I+4 j org.eclipse.equinox.launcher.Main.main([Ljava/lang/String;)V+10 v ~StubRoutines::call_stub V [libjvm.so+0x3d5e8d] V [libjvm.so+0x5d9129] V [libjvm.so+0x3d5cc5] V [libjvm.so+0x40f0c1] V [libjvm.so+0x3fd540] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j java.lang.NoClassDefFoundError.<init>(Ljava/lang/String;)V+2 v ~StubRoutines::call_stub j org.eclipse.core.runtime.adaptor.EclipseStarter.run([Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object;+546 v ~StubRoutines::call_stub j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87 j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+161 j org.eclipse.equinox.launcher.Main.invokeFramework([Ljava/lang/String;[Ljava/net/URL;)V+211 j org.eclipse.equinox.launcher.Main.basicRun([Ljava/lang/String;)V+126 j org.eclipse.equinox.launcher.Main.run([Ljava/lang/String;)I+4 j org.eclipse.equinox.launcher.Main.main([Ljava/lang/String;)V+10 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x00002aabdc072000 JavaThread "Worker-16" [_thread_blocked, id=23010, stack(0x0000000041771000,0x0000000041872000)] 0x00002aabdc003800 JavaThread "Worker-15" [_thread_blocked, id=22952, stack(0x00000000418fc000,0x00000000419fd000)] 0x00002aabd0526800 JavaThread "Worker-11" [_thread_blocked, id=22613, stack(0x0000000042891000,0x0000000042992000)] 0x000000005126d000 JavaThread "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon [_thread_blocked, id=21868, stack(0x0000000041d70000,0x0000000041e71000)] Other Threads: 0x000000004fb24000 VMThread [stack: 0x0000000040c5a000,0x0000000040d5b000] [id=21801] 0x00002aabd0009800 WatcherThread [stack: 0x000000004156f000,0x0000000041670000] [id=21808] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap PSYoungGen total 1539136K, used 20477K [0x00002aab6f360000, 0x00002aabcd2b0000, 0x00002aabcd2b0000) eden space 1538880K, 1% used [0x00002aab6f360000,0x00002aab7075f4f0,0x00002aabcd230000) from space 256K, 0% used [0x00002aabcd230000,0x00002aabcd230000,0x00002aabcd270000) to space 256K, 0% used [0x00002aabcd270000,0x00002aabcd270000,0x00002aabcd2b0000) PSOldGen total 3078848K, used 50204K [0x00002aaab34b0000, 0x00002aab6f360000, 0x00002aab6f360000) object space 3078848K, 1% used [0x00002aaab34b0000,0x00002aaab65b7238,0x00002aab6f360000) PSPermGen total 86016K, used 86015K [0x00002aaaae0b0000, 0x00002aaab34b0000, 0x00002aaab34b0000) object space 86016K, 99% used [0x00002aaaae0b0000,0x00002aaab34aff40,0x00002aaab34b0000) Dynamic libraries: 40000000-40009000 r-xp 00000000 fd:00 48434050 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/bin/java 40108000-4010b000 rwxp 00008000 fd:00 48434050 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/bin/java 4010b000-4010e000 ---p 4010b000 00:00 0 4010e000-4020c000 rwxp 4010e000 00:00 0 40243000-40246000 ---p 40243000 00:00 0 40246000-40344000 rwxp 40246000 00:00 0 40344000-40347000 ---p 40344000 00:00 0 40347000-40445000 rwxp 40347000 00:00 0 40445000-40448000 ---p 40445000 00:00 0 40448000-40546000 rwxp 40448000 00:00 0 40764000-40767000 ---p 40764000 00:00 0 40767000-40865000 rwxp 40767000 00:00 0 40865000-40868000 ---p 40865000 00:00 0 40868000-40966000 rwxp 40868000 00:00 0 40966000-40969000 ---p 40966000 00:00 0 40969000-40a67000 rwxp 40969000 00:00 0 40aa1000-40aa4000 ---p 40aa1000 00:00 0 40aa4000-40ba2000 rwxp 40aa4000 00:00 0 40c5a000-40c5b000 ---p 40c5a000 00:00 0 40c5b000-40d5b000 rwxp 40c5b000 00:00 0 40d5b000-40d5e000 ---p 40d5b000 00:00 0 40d5e000-40e5c000 rwxp 40d5e000 00:00 0 40eb1000-40eb4000 ---p 40eb1000 00:00 0 40eb4000-40fb2000 rwxp 40eb4000 00:00 0 40fb2000-40fb5000 ---p 40fb2000 00:00 0 40fb5000-410b3000 rwxp 40fb5000 00:00 0 4116b000-4116e000 ---p 4116b000 00:00 0 4116e00 417710 42690000-42790000 rwxp 42690000 00:00 0 42790 [heap] 3f2e400000-3f2e41c000 r-xp 00000000 fd:00 32571713 /lib64/ld-2.5.so 3f2e61b000-3f2e61c000 r-xp 0001b000 fd:00 32571713 /lib64/ld-2.5.so 3f2e61c000-3f2e61d000 rwxp 0001c000 fd:00 32571713 /lib64/ld-2.5.so 3f2e800000-3f2e807000 r-xp 00000000 fd:00 48434033 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/jli/libjli.so 3f2e807000-3f2e908000 ---p 00007000 fd:00 48434033 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/jli/libjli.so 3f2e908000-3f2e90a000 rwxp 00008000 fd:00 48434033 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/jli/libjli.so 3f2f400000-3f2f54e000 r-xp 00000000 fd:00 32571714 /lib64/libc-2.5.so /lib64/libm-2.5.so 3f2fc00000-3f2fc02000 r-xp 00000000 fd:00 32571716 /lib64/libdl-2.5.so 3f2fc02000-3f2fe02000 ---p 00002000 fd:00 32571716 /lib64/libdl-2.5.so 3f2fe020 /usr/lib64/libz.so.1.2.3 3f30800000-3f30802000 r-xp 00000000 fd:00 52658194 /usr/lib64/libXau.so.6.0.0 3f30802000-3f30a01000 ---p 00002000 fd:00 52658194 /usr/lib64/libXau.so.6.0.0 3f30a/libX11.so.6.2.0 3f31400000-3f31410000 r-xp 00000000 fd:00 52658198 /usr/lib64/libXext.so.6.4.0 3f31410000-3f31610000 ---p 00010000 fd:00 52658198 /usr/lib64/libXext.so.6.4.0 3f31610000-3f31611000 rwxp 00010000 fd:00 52658198 /usr/lib64/libXext.so.6.4.0 3f31800000-3f3187f000 r-xp 00000000 fd:00 52658203 /usr/lib64/libfreetype.so.6.3.10 3f3187f000-3f31a7f000 ---p 0007f000 fd:00 52658203 /usr/lib64/libfreetype.so.6.3.10 3f31a7f000-3f31a84000 rwxp 0007f000 fd:00 52658203 /usr/lib64/libfreetype.so.6.3.10 3f31c00000-3f31c20000 r-xp 00000000 fd:00 32571717 /lib64/libexpat.so.0.5.0 3f31c20000-3f31e1f000 ---p 00020000 fd:00 32571717 /lib64/libexpat.so.0.5.0 3f31e1f000-3f31e22000 rwxp 0001f000 fd:00 32571717 /lib64/libexpat.so.0.5.0 3f32000000-3f32029000 r-xp 00000000 fd:00 52658204 /usr/lib64/libfontconfig.so.1.1.0 3f32029000-3f32229000 ---p 00029000 fd:00 52658204 /usr/lib64/libfontconfig.so.1.1.0 3f322290 3f32809000-3f32a08000 ---p 00009000 fd:00 52658197 /usr/lib64/libXrender.so.1.3.0 3f32a08000-3f32a09000 rwxp 00008000 fd:00 52658197 /usr/lib64/libXrender.so.1.3.0 3f32c00000-3f32c02000 r-xp 00000000 fd:00 52658202 /usr/lib64/libXinerama.so.1.0.0 3f32c02000-3f32e01000 ---p 00002000 fd:00 52658202 /usr/lib64/libXinerama.so.1.0.0 3f32e01000-3f32e02000 rwxp 00001000 fd:00 52658202 /usr/lib64/libXinerama.so.1.0.0 3f330 3f33602000-3f33603000 rwxp 00002000 fd:00 52658199 /usr/lib64/libXrandr.so.2.0.0 3f33800000-3f33805000 r-xp 00000000 fd:00 52658200 /usr/lib64/libXfixes.so.3.1.0 3f33805000-3f33a04000 ---p 00005000 fd:00 52658200 /usr/lib64/libXfixes.so.3.1.0 3f33a04000-3f33a05000 rwxp 00004000 fd:00 52658200 /usr/lib64/libXfixes.so.3.1.0 3f33c00000-3f33c07000 r-xp 00000000 fd:00 32571722 /lib64/librt-2.5.so 3f33c07000-3f33e07000 ---p 00007000 fd:00 32571722 /lib64/librt-2.5.so 3f33e07000-3f33e08000 r-xp 00007000 fd:00 32571722 /lib64/librt-2.5.so 3f33e08000-3f33e09000 rwxp 00008000 fd:00 32571722 /lib64/librt-2.5.so 3f34c00000-3f34c9d000 r-xp 00000000 fd:00 32571723 /lib64/libglib-2.0.so.0.1200.3 3f34c9d000-3f34e9c000 ---p 0009d000 fd:00 32571723 /lib64/libglib-2.0.so.0.1200.3 3f34e9c000-3f34e9e000 rwxp 0009c000 fd:00 32571723 /lib64/libglib-2.0.so.0.1200.3 3f35400000-3f3543e000 r-xp 3f35c03000-3f35e02000 ---p 00003000 fd:00 32571725 /lib64/libgmodule-2.0.so.0.1200.3 3f35e02000-3f35e03000 rwxp 00002000 fd:00 32571725 /lib64/libgmodule-2.0.so.0.1200.3 3f36000000-3f36067000 r-xp 00000000 fd:00 47268159 /usr/lib64 /usr/lib64/libatk-1.0.so.0.1212.0 3f36800000-3f3682d000 r-xp 00000000 fd:00 47264771 /usr/lib64/libpangoft2-1.0.so.0.1400.9 3f3682d000-3f36a2d000 ---p 0002d000 fd:00 47264771 /usr/lib64/libpangoft2-1.0.so.0.1400.9 3f36a2d000-3f36a2e000 rwxp 0002d000 fd:00 47264771 /usr/lib64/libpangoft2-1.0.so.0.1400.9 3f37017000-3f37216000 ---p 00017000 fd:00 47268909 /usr/lib64/libgdk_pixbuf-2.0.so.0.1000.4 3f37216000-3f37217000 rwxp 00016000 fd:00 47268909 /usr/lib64/libgdk_pixbuf-2.0.so.0.1000.4 3f37400000-3f37774000 r-xp 00000000 fd:00 47258024 /usr/lib64/libgtk-x11-2.0.so.0.1000.4 3f37774000-3f37973000 ---p 00374000 fd:00 47258024 /usr/lib64/libgtk-x11-2.0.so.0.1000.4 3f37973000-3f3797d000 rwxp 00373000 fd:00 47258024 /usr/lib64/libgtk-x11-2.0.so.0.1000 3f3808e000-3f38093000 rwxp 0008e000 fd:00 47261608 /usr/lib64/libgdk-x11-2.0.so.0.1000.4 3f38200000-3f38208000 r-xp 00000000 fd:00 47268161 /usr/lib64/libXi.so.6.0.0 3f38208000-3f38407000 ---p 00008000 fd:00 47268161 /usr/lib64/libXi.so.6.0.0 3f38407000-3f38408000 rwxp 00007000 fd:00 47268161 /usr/lib64/libXi.so.6.0.0 3f38a00000-3f38a15000 r-xp 00000000 fd:00 32571734 /lib64/libnsl-2.5.so 3f38a15000-3f38c14000 ---p 00015000 fd:00 32571734 /lib64/libnsl-2.5.so 3f38c14000-3f38c15000 r-xp 00014000 fd:00 32571734 /lib64/libnsl-2.5.so 3f38c15000-3f38c16000 rwxp 00015000 fd:00 32571734 /lib64/libnsl-2.5.so 3f38c16000-3f38c18000 rwxp 3f38c16000 00:00 0 3f3be00000-3f3be04000 r-xp 00000000 fd:00 32571736 /lib64/libgthrea/libXtst.so.6.1.0 3f41c05000-3f41c06000 rwxp 00005000 fd:00 47266927 /usr/lib64/libXtst.so.6.1.0 2aaaaaaab000-2aaaaaaac000 r-xs 0000b000 fd:00 33883834 /home/bob/Desktop/Eclipse 64/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar 2 2aaaaaad6000-2aaaaaad8000 r-xs 00 2aaaaabea000-2aaaaac13000 r-xp 00000000 fd:00 48434066 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/libjava.so 2aaaaac13000-2aaaaad12000 ---p 00029000 fd:00 48434066 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/libjava.so 2aaaaad12000-2aaaaad19000 rwxp 00028000 fd:00 48434066 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/libjava.so 2aaaaad19000-2aaaaad1a000 r-xp 2aaaaad19000 00:00 0 2aaaaad1a000-2aaaaad1b000 rwxp 2aaaaad1a000 00:00 0 2aaaaad1b000-2aaaaad22000 r-xp 00000000 fd:00 48434091 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/native_threads/libhpi.so 2aaaaad22000-2aaaaae23000 ---p 00007000 fd:00 48434091 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/native_threads/libhpi.so 2aaaaae23000-2aaaaae25000 rwxp 00008000 fd:00 48434091 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/native_threads/libhpi.so 2aaaaae25000-2aaaaae26000 rwxp 2aaaaae25000 00:00 0 2aaaaae26000-2aaaaaed2000 r-xs 00000 2aabcd8b9000-2aabcdba9000 rwxp 2aabcd8b9000 00:00 0 2aabcdba9000-2aabce18a000 rwonv/ISO8859-1.so 2aabcefa0000-2aabcefa2000 rwxp 00001000 fd:00 47383053 /usr/lib64/gconv/ISO8859-1.so 2aabcefa2000-2aabcefb3000 r-xp 00000000 fd:00 48169239 /usr/lib64/gtk-2.0/2.10.0/engines/libclearlooks.so 2aabcefb3000-2aabcf1b3000 ---p 00011000 fd:00 48169239 /usr/lib64/gtk-2.0/2.10.0/engines/libclearlooks.so 2aabcf1b3000-2aabcf1b4000 rwxp 00011000 fd:00 48169239 /usr/lib64/gtk-2.0/2.10.0/engines/libclearlooks.so 2aabcf1b5000-2aabcf1b8000 r-xp 00000000 fd:00 48169144 /usr/lib64/gtk-2.0/2.10.0/loaders/libpixbufloader-bmp.so 2aabcf1b8000-2aabcf3b7000 ---p 00003000 fd:00 48169144 /usr/lib64/gtk-2.0/2.10.0/loaders/libpixbufloader-bmp.so 2aabcf3b7000-2aabcf3b8000 rwxp 00002000 fd:00 48169144 /usr/lib64/gtk-2.0/2.10.0/loaders/libpixbufloader-bmp.so 2aabcf3b8000-2aabcf41b000 rwxp 2aabcf3b8000 00:00 0 2aabcf41b000-2aa /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/libnio.so 2aabcf64b000-2aabcf64d000 rwxp 00006000 fd:00 48434079 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib 2aabd33f6000-2aabd4000000 ---p 2aabd33f6000 00:00 0 2aabd4000000-2aabd75db000 r-xp 00000000 fd:00 47254619 /usr/lib/locale/locale-archive 2aabd75db000-2aabd75df000 r-xp 00000000 fd:00 48169149 /usr/lib64/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so 2aabd75df000-2aabd77de000 ---p 00004000 fd:00 48169149 /usr/lib64/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so 2aabd77de000-2aabd77df000 rwxp 00003000 fd:00 48169149 /usr/lib64/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so 2aabd77df000-2aabd77e1000 r-xp 00000000 fd:00 48104477 /usr/lib64/pango/1.5.0/modules/pango-basic-fc.so 2aabd77e1000-2aabd79e1000 ---p 00002000 fd:00 48104477 /usr/lib64/pango/1.5.0/modules/pango-basic-fc.so 2aabd79e1000-2aabd79e2000 rwxp 00002000 fd:00 48104477 /usr/lib64/pango/1.5.0/modules/pango-basic-fc.so 2aabd79e2000-2aabd79ed000 r-xp gins/Desktop/Eclipse 6op/Eclipse 64/eclipse/plugins/org.eclipse.wst.jsdt.ui_1.1.101.v201108151912.j 2aabd7fbe000-2aabd8028000 r-xp 00000000 fd:00 48333110 /usr/share/fonts/dejavu-lgc/DejaVuLGCSans-BoldOblique.ttf 2aabd8028000-2aabd8062000 r-xp 00000000 fd:00 48333121 /usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono.ttf 2aabd8062000-2aabd809b000 r-xp 00000000 fd:00 48333118 /usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-Bold.ttf 2aabd809b000-2aabd80c9000 r-xp 00000000 fd:00 48333120 /usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-Oblique.ttf 2aabd80c9000-2aabd80f5000 r-xp 00000000 fd:00 48333119 /usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-BoldOblique.ttf 2aabd80f5000-2aabd8116000 r-xs 00175000s/Bluecurve/icon-theme.cache 2aabd8ec8000-2aabd94b9000 r-xp 00000000 fd:00 48373836 /usr/share/icons/gnome/icon-theme.cache 2aabd94b9000-2aabdaed5000 r-xp 00000000 fd:00 49027191 /usr/share/icons /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/ext/sunjce_provider.jar 2aabdb589000-2aabdb5d2000 r-xs 003c3000 fd:00 33883908 /home/bob/Desktop/Eclipse 64/eclipse/plugins/org.eclipse.pde.ui_3.6.100.v20110603.jar 2aabdc000000-2aabdd638000 rwxp 2aabdc000000 00:00 0 2aabdd638000-2aabe0000000 ---p 2aabdd638000 00:00 0 2b4e7ca8a000-2b4e7ca8b000 rwxp 2b4e7ca8a000 00:00 0 2b4e7caba000-2b4e7cabd000 rwxp 2b4e7caba000 00:00 0 2b4e7cabd000-2b4e7d271000 r-xp 00000000 fd:00 48434095 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/server/libjvm.so 2b4e7d271000-2b4e7d371000 ---p 007b4000 fd:00 48434095 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/server/libjvm.so 2b4e7d371000-2b4e7d4fb000 rwxp 007b4000 fd:00 48434095 /usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/server/libjvm.so 2b4e7d4fb000-2b4e7d534000 rwxp 2b4e7d4fb000 00:00 0 7fff17af8000-7fff17b0d000 rwxp 7ffffffea000 00:00 0 [stack] ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0 [vdso] VM Arguments: java_command: /home/bob/Desktop/Eclipse 64/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -os linux -ws gtk -arch x86_64 -showsplash -launcher /home/bob/Desktop/Eclipse 64/eclipse/eclipse64 -name Eclipse64 --launcher.library /home/bob/Desktop/Eclipse 64/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/eclipse_1407.so -startup /home/bob/Desktop/Eclipse 64/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.overrideVmargs -exitdata e7000c -vm /usr/bin/java -vmargs -jar /home/bob/Desktop/Eclipse 64/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar Launcher Type: SUN_STANDARD Environment Variables: PATH=/usr/local/apache-maven/apache-maven-3.0.3/bin:/usr/local/apache-maven/apache-maven-3.0.3/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin:/usr/games:/home/bob/bin:JAVA_HOME=/usr/java/jdk1.6.0_30/bin:NATIVE_LIBRARY_PATH=/usr/lib64/: LD_LIBRARY_PATH=/usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-sun-1.6.0.18.x86_64/jre/../lib/amd64 SHELL=/bin/bash DISPLAY=:0.0 Signal Handlers: SIGSEGV: [libjvm.so+0x70f1a0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGBUS: [libjvm.so+0x70f1a0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGFPE: [libjvm.so+0x5d7f70], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGPIPE: [libjvm.so+0x5d7f70], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGXFSZ: [libjvm.so+0x5d7f70], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGILL: [libjvm.so+0x5d7f70], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGUSR2: [libjvm.so+0x5da790], sa_mask[0]=0x00000000, sa_flags=0x10000004 SIGHUP: [libjvm.so+0x5da4e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGINT: [libjvm.so+0x5da4e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGTERM: [libjvm.so+0x5da4e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGQUIT: [libjvm.so+0x5da4e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 --------------- S Y S T E M --------------- OS:Red Hat Enterprise Linux Client release 5.5 (Tikanga) uname:Linux 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 libc:glibc 2.5 NPTL 2.5 rlimit: STACK 10240k, CORE 0k, NPROC 155648, NOFILE 1024, AS infinity load average:1.00 1.01 0.94 CPU:total 8 (8 cores per cpu, 2 threads per core) family 6 model 26 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht Memory: 4k page, physical 18471776k(13695872k free), swap 2097144k(2097144k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (16.0-b13) for linux-amd64 JRE (1.6.0_18-b07), built on Dec 17 2009 13:42:22 by "java_re" with gcc 3.2.2 (SuSE Linux) time: Thu Jan 26 13:50:25 2012 elapsed time: 3266 seconds </code></pre> |
10,207,317 | 0 | Set the Read-only property of a File <p>I am trying to set the read-only property of a File, but it doesn't seem to work. Could someone please help me to understand why.</p> <p>Here is my code...</p> <pre><code>public class Main { public static void main(String[] args) { File f = new File("c:/ulala.txt"); if (!f.setReadOnly()) { System.out.println("Grrr! Can't set file read-only."); return; } } } </code></pre> |
12,611,710 | 0 | <pre><code>String ss = "i love you"; String sss=""; String temp=""; String[] ssArr = ss.split("\\s"); for(int i=0; i<ssArr.length; i++) { if(i==0) { temp = ssArr[i]; } else { sss+=ssArr[i]+" "; } if(i==ssArr.length-1) { sss+=temp; } } System.out.println(sss); </code></pre> <p>output: love you i</p> |
37,208,839 | 0 | <p>This sort of initialization is not allowed in C, but it was allowed in C++98 . </p> <p>Your compiler predates 1998 by several years so it is not surprising that it does not allow some things that did become part of the C++ Standard. </p> <p>You'll have to write <code>{'a', 1}</code> instead of <code>a[0]</code> etc. , or use a macro. The macro solution might look like:</p> <pre><code>#define A0 {'a', 1} #define A1 {'c', 2} #define A2 {'b', 3} first a[3]={A0, A1, A2}; second c={{A0, A1}, 12 }; </code></pre> <p>Alternatively you could initialize <code>a</code> and then set up <code>c</code> at runtime.</p> |
29,401,705 | 0 | <p>You can do it by this XSLT function ddwrt:IfHasRights(XX) where XX is permission mask. Like this:</p> <pre><code><xsl:if test="ddwrt:IfHasRights(16)"><tr> <td width="190px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Entry Status</nobr></H3></td> <td width="400px" valign="top" class="ms-formbody"><SharePoint:FormField runat="server" id="ff8{$Pos}" ControlMode="New" FieldName="Entry_x0020_Status" __designer:bind="{ddwrt:DataBind('i',concat('ff8',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Entry_x0020_Status')}" /><SharePoint:FieldDescription runat="server" id="ff8description{$Pos}" FieldName="Entry_x0020_Status" ControlMode="New" /></td> </tr> </xsl:if> </code></pre> <p>More detailed description can you find e.g. <a href="http://www.dreamsharepoint.com/sharepoint-2010-ifhasrightspermissionmask/" rel="nofollow">here</a>. But be aware that it works fine for SP2010, SP2013 but not in SP Online.</p> |
33,620,015 | 0 | <p>Replace your jquery code with code below as you are creating the anchor tags with ajax and for the code those does not exists so just load the <code>anchor click event</code> inside <code>success function of your ajax call</code> and it will work :</p> <pre><code> $(function() { $.ajax({ url: "http://linktoapi&callback=myMethod", timeout: 2000, jsonpCallback: "myMethod", jsonp: false, dataType: "jsonp", success: function(data) { var newContent = ''; for (var i = 0; i < data.listing.length; i++) { newContent += '<p class="property-details">' + '<a href="' + data.listing[i].listing_id + '">' + data.listing[i].displayable_address + '</a></p>'; } $('#content').html(newContent).hide().fadeIn(400); $('.property-details a').on('click', function(e) { e.preventDefault(); $('#content').html("test").hide().fadeIn(400); }); }, error: function() { $content.html('<div class="container">Please try again soon.</div>'); } }); }); </code></pre> |
2,816,378 | 0 | <p>This has been effectively resolved by using MSDeploy.</p> |
4,123,614 | 0 | <p>It means you tried treating an integer as an array. For example:</p> <pre><code>a = 1337 b = [1,3,3,7] print b[0] # prints 1 print a[0] # raises your exception </code></pre> |
22,602,656 | 0 | <p>I think you have started multiple thread on the same object</p> <p>you should use synchronized block to run thread-safe code,</p> <pre><code>synchronized(this){ long currentTime = System.nanoTime(); long targetFPS = 1000; long delta; while(GameConstants.running) { delta = System.nanoTime() - currentTime; if(delta/1000000000 >= 1) { System.out.println(delta); currentTime = System.nanoTime(); } } } </code></pre> <p><strong>After Updating Source Code</strong></p> <p>Yeah! here, you are calling run() method and start both...</p> <pre><code>game.start(); game.run(); </code></pre> <p>remove calling run method explicitly, you will get desired result :)</p> |
39,560,247 | 0 | <p>From the C++ standard:</p> <blockquote> <p><strong>3.8 Object lifetime</strong> </p> <p><sup>4</sup> A program may end the lifetime of any object by reusing the storage which the object occupies or by explicitly calling the destructor for an object of a class type with a non-trivial destructor. For an object of a class type with a non-trivial destructor, the program is not required to call the destructor explicitly before the storage which the object occupies is reused or released; however, if there is no explicit call to the destructor or if a delete-expression (5.3.5) is not used to release the storage, the destructor shall not be implicitly called and any program that depends on the side effects produced by the destructor has undefined behavior.</p> </blockquote> <p>It depends on whether the <code>std::vector</code> destructor is non-trivial and has side effects on which the program depends. Because it is a library class, it would be advisable to call the destructor to be safe. Else you would have to check the <code>std::vector</code> implementations now and in the future for all standard libraries you want your code to be compatible with.<br> If the vector class was your own, you would be in control of the destructor implementation and you could omit calling it if it was either trivial, or had no side-effects on which the program depends, as described above.<br> <sup>(But personally I would also call it in this case.)</sup></p> |
31,088,785 | 0 | <p>I'm just doing this off the cuff, but could have another class that holds that variable statically e.g.</p> <pre><code>public class StaticContainer { public static int incrementor { get; set; } } </code></pre> <p>then in your student class increment the variable in the constructor</p> <pre><code>public class Student { public Student() { StaticContainer.incrementor++; } } </code></pre> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.