INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Are there any good tar compression algorithms for huge directories (1 - 10TB) of random content? I want to backup and compress all of my data on my Linux PC. The size of all this files adds up to about 3.4 TB. I want to compress them with tar and some compression algorithm. I already tried some algorithms like xz but they only yielded a marginal 10% of compression (lost between 100 to 300 gigs). Are there any algorithms which yield 20% to 40% of compression for such huge amounts of data? Neither RAM nor processing power are a concern for me in regards of the algorithm (32 gigs of ram and a 4790k).
xz is already a very good compressor. It seems that your data is simply not very compressible. There is no magic compressor that will do two to four times better. You might get a little gain from a PPM-based compressor, maybe, but much. Your only hope would be to perhaps recognize compression already applied to your data, decompress it, and then recompress it with something better than the original compressor.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "compression, tar" }
Convert a Collection of Strings into Collection of GUID I am reading a `collection of strings (of GUID format)` from `excel` and want to store them in database as `collection of GUIDs`. I am just wondering is there any clean way to convert `List<string>` to `List<Guid>` using `Linq`. I am not interested in looping through.
Either LINQ: List<Guid> guids = guidStrings.Select(Guid.Parse).ToList(); or `List.ConvertAll` which is a little bit more efficient because it knows the size: List<Guid> guids = guidStrings.ConvertAll(Guid.Parse);
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": -2, "tags": "c#, excel, linq, guid" }
Event Driven Future<V> - Thread Pool We use `callable<V>` and `Future<V>` to receive the result of a terminated thread from a thread pool. We should call `get()` to receive the returned result. My problem is: it is not event driven. Is there any framework to get result like `SIGCHLD` for child processes in C? I want something like this:(the thread pool will call this function when each thread in the pool finished the job) public void fetchResult(Thread t, Runnable r, Future<Integer> result) { Integer x = result.get(); /* handle x */ /* also we have Thread and Runnable object that has terminated */ }
you might want to check out the ThreadPoolExecutor.afterExecute() method. it's called after each task completes. you could create a custom subclass of ThreadPoolExecutor which has the event based callback behavior you desire.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "java, multithreading, callable" }
Normal transformation in cube mapping I'm currently learning about cube mapping, I found this tutorial: < He transform normal vector by multiplies with inverse of transposed `Model` matrix. I wonder why don't he multiplies by inverse of transposed `ModelView` matrix but `Model` matrix?
cube map is defined in word space, it seems that the author wants to have texture coords in word space as well. note that one normal is transformed to view space - for lighting, and the second is used only to lookup in cubemap. two links for reference: * < * <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "opengl" }
Cannot use bash variable for tar's exclude I have to build excludes for tar command dynamically. List of excludes will be wery short (if any), so much better approach is build a list of --exclude= parameters for command line than use a temporary file with --exclude-from. But using bash variable doesn't work. Look at this examle: ~/test$ EXCLUDES=" --exclude='./do-not-backup'" ~/test$ echo $EXCLUDES --exclude='./do-not-backup' ~/test$ tar czf backup.tgz $EXCLUDES ./ ~/test$ tar tzf backup.tgz ./ ./dir1/ ./dir1/file1 ./do-not-backup/ <=== wrong ./do-not-backup/nofile <=== wrong ./dir2/ ./dir2/file2 ./backup.tgz ~/test$ rm backup.tgz ~/test$ tar czf backup.tgz --exclude='./do-not-backup' ./ # Same command without bash variable ~/test$ tar tzf backup.tgz ./ ./dir1/ ./dir1/file1 ./dir2/ ./dir2/file2 ./backup.tgz What I miss?
The best way to store arguments that may contain spaces is in an array. Each argument can be a separate array entry, with or without spaces. $ excludes=(--exclude='./do-not-backup') $ printf '%q\n' "${excludes[@]}" --exclude=./do-not-backup $ tar -czf backup.tgz "${excludes[@]}" ./ The single quotes here are optional, exactly as they would be if you typed the `--exclude` argument normally. As you can see, Bash parses the quotes when the array is created and they're not actually stored in the array value.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "bash, tar" }
Find all $c$ for which a set of vectors is linearly independent set of vectors in $R^3$ Find all $c$ that belongs to $R$ for which $S = \\{ (c^2,0,1), (0,c,0), (1,2,1) \\}$ is a linearly independent set of vectors in $R^3$. I tried to solve this problem by setting the determinant of these vectors equal to $0$, and then solve it, but I couldn't. the det is $c^2$ ((c)-0)-0(0-2)+1(0-c) by simplifying it is $c^3$+c
You are almost at the goal! First things first, you have a small error. Note that $1(0-c) = -c$, so the determinant becomes $c^3-c$. $c^3-c = 0$ is actually one of the easier cubic equations to solve. Note that we can factor $$ c^3 - c = c(c^2-1) = c(c-1)(c+1) $$ If we want this to be $0$, then one of the three factors has to be $0$. So we get the three solutions $c = 0$ (which is actually obvious just looking at the vectors), $c = 1$ and $c = -1$ (which, in retrospect, are obvious as they make it easy to write the third vector as a linear combination of the first two). The determinant also makes it clear that there can be no other solutions (which is _not_ immediately obvious just from looking at the vectors). So the three vectors are linearly dependent iff $c$ is either $0$ or $\pm 1$, and thus any other value will make the vectors linearly independent.
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "linear algebra, determinant" }
What could cause an iOS App to quit unexpectedly? I am developing an iOS app and testing its stability. There are no memory leak issues when I check it using XCode Analyze. I simulated on my iPhone 5 and iPad 2 and tried clicking buttons and flipping the `UIScrollView` continuously as fast as I could. The debug log did show a "received memory warning" message several times but still no message about memory leaks. I keep doing the crazy testing and the app quits unexpectedly. I can still find the app running in background when I double click the "home" button. After I click back to the app, it can still run normally. Therefore, here I would like to know what possible reasons would cause the app to quit unexpectedly. How might I trace the reason for the app quitting, using any tools or tactics? PS: I am a new iOS developer and I really have no ideas about this issue. I need some help. Thank you!
There is a difference between leaked memory - which is memory you've allocated that you cannot give back to the system because you've lost the pointer to the memory and you can't release it. And then there is poorly using memory - which is where you allocate memory. It's not "leaked" because you can give it back, but you don't give it back. Consider the example of creating 100 of images. If you create 100 image views even though they are not all visible, but you keep references to the image views, then you don't have a leak, but you haven't managed you memory properly. The static analyser helps you find leaks - it doesn't tell you where you are using memory badly. Try running your app under Instruments with the allocations tool to see where all the memory is being created and used.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "ios, memory management, crash" }
How to use OkHttp's HttpUrl with a request? I have an http url: HttpUrl httpurl = new HttpUrl.Builder() .scheme("https") .host("www.google.com") .addPathSegment("search") .addQueryParameter("q", "polar bears") .build(); How do I use that with a request? That is, how do I send a request to the url constructed by `httpurl`?
Use `Request.Builder#url(HttpUrl)`: Request r = new Request.Builder() .url(httpurl).build(); Then follow here.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 5, "tags": "java, okhttp" }
Summing groups in pandas groupby object - AttributeError I have a groupby object called `groups`. There are 29 groups and I am trying to sum all of the rows for each group and create a new dataframe with all of the summed groups. summed = [i.sum for i in groups] AttributeError: 'tuple' object has no attribute 'sum'
**NOTE** : _this question was formulated in another way when this was answered. Now it includes the solution posted here._ You have to do `sum(i)` instead of `i.sum()` as `i` is a tuple. Example: >>> a=(1,2,3,5,6) >>> sum(a) 17
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, pandas" }
PowerShell send-mailmessage How do I terminate cmdlet prompts for To[] address? It keeps asking for more! this is what I see: send-mailmessage cmdlet Send-MailMessage at command pipeline position 1 Supply values for the following parameters: From: [email protected] Subject: test To[0]: [email protected] To[1]: [email protected] To[2]:???????
You have to at least include the SMTP server argument in the command because you won't get a prompt for it: Send-MailMessage -SmtpServer "yoursmtpserver" Once you've done that, enter your 'to' addresses as normal, and when you're done, press enter once more to escape from the final prompt and send the email. Better yet, just enter the entire command with parameters included: Send-MailMessage -From "[email protected]" -To @("[email protected]", "[email protected]") -Subject "test" -Body "Testing PS Email" -SmtpServer "yoursmtpserver"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "powershell, mailmessage" }
Vue fallback to asset images I have a bunch of entities I want to display on a page in a Vue 3 application. Each entity should have an image URL. If an entity does not have such a URL, I want to display a default image that's stored in `/src/assets/images/default.png` So I've created a computed property that returns the image URL, either `entity.url` or the URL above. Unfortunately, this doesn't work, instead of getting the default image I'm getting no image, and the Vue dev webserver returns `index.html`. This is because Vue's handling of static assets doesn't work when the static asset URL is returned in runtime. The image is shown properly if I hard-code the URL `@/assets/images/default.png`, but not if I return this as a string (dropping the `@` makes no difference). How can I make Vue handle static assets that are referenced dynamically?
I'd use `v-if`/`v-else` to show the appropriate image based on whether `entity.url` exists .. <img v-if="entity.url" :src="entity.url" /> <img v-else src="@/assets/images/default.png" />
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 0, "tags": "vue.js" }
show details about first chance exceptions without breaking Using WindDbg I would like to print details about first chance CLR exceptions (`!ClrStack, !PrintException`) when they occur but keep the debugee running normally. How can I set this up? This was my best bet, but it doesn't do anything: sx- -c "!CLRStack" sxe CLR "!CLRStack;g"
Try this: sxe -c "!pe;!clrstack;gc" clr
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "exception, windbg" }
Validation on textbox numeric using jquery There is one field in table which is float and i have to insert only the float value in that but on submit i used the function for inserting the data into table and i want this numeric validation is happened on client side using jquery Can anyone suggest me the clue??
Try this code and make it some modifications according your proper requirement <script type="text/javascript"> $(document).ready(function () { $('input[numeric]').keyup(function () { var d = $(this).attr('numeric'); var val = $(this).val(); var orignalValue = val; val = val.replace(/[0-9]*/g, ""); var msg = "Only Integer Values allowed."; if (val != '') { orignalValue = orignalValue.replace(/([^0-9].*)/g, "") $(this).val(orignalValue); alert(msg); } }); }); </script>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "jquery, validation, jquery validate" }
Rails Model.select(attribute * attribute AS new_attribute) - new_attribute not in hash? I was wondering if there was any way in rails to return a `new_attribute` in a select as statement in rails. For simplified example `Books.select("'tuds' as new_attribute").first` where new_attribute isn't in the DB, just returns a bunch of empty active record objects. Seems like this should work, but I'm not having any luck. Any thoughts!? Thanks! -Mario ` UPDATE: I'm a goof. I wasn't actually looking at the actual object and was just looking at the log in my console.
Works for me using Rails 3.2: irb(main):001:0: User.select('full_name as whatever').first.whatever User Load (0.5ms) SELECT id, full_name as whatever FROM `users` LIMIT 1 => "Zap Brannigan" Is this what you want to achieve?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ruby on rails, activerecord" }
Indexing form the end of a generator Say I have a generator in Python and I want to iterate over everything in it except the first 10 iterations and the last 10 iterations. itertools.islice supports the first part of this slicing operation, but not the second. Is there a simple way to accomplish this?
Not only is there not a simple way, there is not a way at all, if you want to allow any generator (or any iterable). In general, there is no way to know when you are 10 items from the end of a generator, or even whether the generator has an end. Generators only give you one item at a time, and tell you nothing about how many items are "left". You would have to iterate through the entire generator, keeping a temporary cache of the most recent 10 items, and then yield those when (or if!) the generator terminates. Note the "or if". A generator need not be finite. For an infinite generator, there is no such thing as the "last" 10 elements.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, generator, python itertools" }
Wake phone on incoming call in Android I have created a custom incoming call screen with Answer, cancel and other things to the activity it is working fine, but when the phone is on sleep mode it doesn't wake up on incoming call. How to fix this wake up on the incoming call part? Also the same case with when the phone is locked I have to unlock and accept the call? Can somebody guide me to fix this too? Let me know! Thanks!
Use Window flags when you start your activity to turn/keep the screen on and dismiss the keyguard. For example, call this code on the onCreate() of your call screen: WindowManager wm= (WindowManager) getSystemService(WINDOW_SERVICE); Window window=getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); Try the different flags and choose the ones that better suit the behaviour of your App.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "android" }
Where can I find the complete list of attributes for a control? Where can I find the complete list of attributes for a control? If I wanted to use textbox control on my asp.net application, where can I find the complete list of attributes associated with it? I know some of the them can be found in the properties area in the IDE. But the properties area did not have the "OnTextChanged" attribute listed.
When you click on a web control, if you have the properties window open, then you will see it's properties, which contain the attributes of a web control. Another way is to click on the control and the right click and select properties. By the way the OnTextChanged is an event, which you can associate it with a method, when this event happens. OnTextChange="TextBoxText_Changed" The TextBoxText_Changed would be a server side method, which will reside in your code behind class. In this method you will declare, what you want to happen, when this event is triggered,
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net" }
In java how to get substring from a string till a character c? I have a string (which is basically a file name following a naming convention) `abc.def.ghi` I would like to extract the substring before the first `.` (ie a dot) In java doc api, I can't seem to find a method in String which does that. Am I missing something? How to do it?
look at `String.indexOf` and `String.substring`. Make sure you check for -1 for `indexOf`.
stackexchange-stackoverflow
{ "answer_score": 86, "question_score": 143, "tags": "java" }
Get Value Key pair from Firebase with Node.js function Ok, I am using Algolia for handling search within my app. The following code adds whatever is in my database to my Algolia Index. However, whenever the data is imported, all of the values in a firebase node get placed under "text" in the Algolia Index. How can make it to where it is stored as the key value pair found in Firebase. **i.e.** address: 1234 Main St. **_VS. / (Instead of)_** text: address: 1234 Main St. * * * My Code: exports.indexentry = functions.database .ref('/blog-posts/{blogid}/text') .onWrite(event => { const index = client.initIndex(ALGOLIA_POSTS_INDEX_NAME); const firebaseObject = { text: event.data.val(), objectID: event.params.blogid, }; }); ![enter image description here](
So what you are missing here, is the pushing of the data to Algolia. What you can do if you want to have all the firebase data in an object, is assigning it to a new object, as well as the `objectID` exports.indexentry = functions.database .ref('/blog-posts/{blogid}/text') .onWrite(event => { const index = client.initIndex(ALGOLIA_POSTS_INDEX_NAME); const firebaseObject = Object.assign({}, event.data.val(), { objectID: event.params.blogid, }); index.saveObject(firebaseObject); // .then or .catch as well }); Does that make sense?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "node.js, firebase, firebase realtime database, algolia" }
How do I make rows in Zurb Foundation 4/5 full screen? By default, rows in Zurb Foundation 4 and 5 run at a max width of 1000px, even on very large monitors, which creates margins on either side of the content. How do I make it run at full screen without affecting the responsiveness of the design?
Add the following code to the CSS file: .row {min-width:100% !important;}
stackexchange-stackoverflow
{ "answer_score": 20, "question_score": 9, "tags": "css, web, responsive design, zurb foundation, boilerplate" }
XML Array Serialization I'm using client methods for soap web service. On one of the methods it has a parameter as string[] list, so i create... string[] myList = { "12345678" }; and i send off the request via the client method but i get an error saying SAXException Found character data inside an array element while deserializing. I know the client method sends this inside the envelope. <List>12345678</List> Which is supposed to be like this... <List><string>12345678</string></List> I've tried the following and still do not get the result which i need. [XmlArrayItem("m")] public string[] list { get; set; } i did this to use the class above, string[] a = new string[] { "12345678" }; list = a; and the result is the same, <List>12345678</List>
I had to modify the wsdl in the type it had maxOccurs="Unbounded" type="xsd:string" i changed it to minOccurs="0" maxOccurs="1" type="xsd:ArrayOfString" and regenerate the client code. And it worked. Thanks for the suggestions.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, xml, soap" }
Short table name for SQL Query with Codeigniter database library I'm using CodeIgniter, I want to using short table name for my SQL Query like that: select pr.name from product pr where pr.id=12; by using `db` class, I supposed to do: $this->db->select('pr.name')->from('product pr')->where('pr.id', 12)->get();
This works perfect on CI 2.1.3. Don't forget to use `result()`. Example works for me: function test(){ $this->load->database(); $sql = $this->db->select('pr.order_id')->from('items_table pr')->where('pr.order_id', 2)->get(); foreach($sql->result() as $item){ echo $item->order_id; } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "codeigniter" }
DevExpress GridControl ColumnAutoWidth The question is probably silly, but I spent half of the day looking for the answer with no luck. I have a WPF view with DevExpress GridControl included (not developed by me). The problem is that when I click "Auto fit" option - it gets too wide with a horizontal scroll. The reason is long header titles, but it's Ok if they are wrapped into 2 lines. After some searching, I thought that what I need is ColumnAutoWidth property. The problem (here goes the silly part) is that I can't find out how to set it! Because of this I can't check if it works at least! There are no examples in documentation, and code autocomplete doesn't show it's presence anywhere. I had some assumptions but they appeared to be wrong. Can somebody please share XAML (or at least code-behind) example about how to access this property?
you just have to remove width element from your columns, and to set the autowidth element of the tableview. the link you posted is related xtraGrid control and it is a windows form not a WPF one, you have to control the width from the TableView.AutoWidth property. Try to read the following documentation
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "wpf, devexpress" }
How to calculate the branching fraction for a decay with a given Cabibbo angle Lets suppose I know the branching fraction of a decay. How can I calculate the branching fraction in a different final state with the Cabibbo angle? For example: $$D^+ \rightarrow \bar K^0 + e^+ + \nu_e$$ The branching fraction would be 9%. What would be the branching fraction in a $\pi^0$ final state if the corresponding Cabibbo angle is 0.2?
This is actually a nice problem, steering you to do these estimates _in your mind_ , Fermi-style, aggressively ignoring the inessential, a crucial skill. You realize that, compared to the mass of the mother particle, the D, ~1.87 GeV, the masses of the two mesons , K ~ 0.5 GeV and π ~ 0.14 GeV are similar, so no phase-space disparities should matter, and the ratio of the respective branching fractions should _only_ be controlled by the squares of the respective amplitudes! The respective amplitudes are the same c-decay diagrams, one to d, and the other to s, whose ratio goes as $$ |V_{cd}/V_{cs}|\approx \tan\theta_c\approx 0.2, $$ consequently $$ \frac{\Gamma(D\to \pi e \nu)}{\Gamma(D\to \bar K e \nu)}\sim 0.04, $$ amounting to a branching fraction for the π mode of $\sim 4\cdot 10^{-3}$, quite close to what you see in the PDG.
stackexchange-physics
{ "answer_score": 3, "question_score": 0, "tags": "homework and exercises, particle physics, standard model" }
are android actions done in order as written in onCreate? I want to know if these actions are done in order or not inside on create mWebView.loadUrl("file:///android_asset/game.swf"); AdView adView = (AdView)this.findViewById(R.id.adView); adView.loadAd(new AdRequest());
Yes. Statements within the body of a Java method will execute sequentially.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, oncreate" }
Hardened app frameworks that actively TDD/unit test against OWASP top 10? Are there any open source web frameworks that actively protect against the OWASP Top 10 Security Vulnerabilities? ### A framework that satisfies this requirement should include the following * Can pass penetrations testing tools like OWASP Zap Core * Supports standard authentication flows such as create new account, forgot password, login, etc? * Is open source The intent being to build an application that is secure from the ground up, with best practices already applied. To me, the programming language is less important here than having these important lessons applied.
Electrode, opensourced by Walmart as the backend app framework they use for walmart.com
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "security, tdd, owasp" }
Is there a way to change cart product thumbnails? I'm using the following code to add cart products manually. The following code works fine, except that I would like to change the cart product thumbnails. Can some one help me with the thumbnail part? Here is my code. $session = Mage::getSingleton('customer/session'); // Get cart instance $cart = Mage::getSingleton('checkout/cart'); $cart->init(); // Add a product with custom options $productId = 3; $productInstance = Mage::getModel('catalog/product')->load($productId); $param = array( 'product' => $productInstance->getId(), 'qty' => 1 ); $request = new Varien_Object(); $request->setData($param); $cart->addProduct($productInstance, $request); // update session $session->setCartWasUpdated(true); // save the cart $cart->save();
You can try like this: $product->getMediaUrl( $product->getImage() ); //getSmallImage(), getThumbnail() Sometimes though you have only one image and want to set all sizes to that same image like so: if (!$product->hasImage()) continue; if (!$product->hasSmallImage()) $product->setSmallImage($product->getImage()); if (!$product->hasThumbnail()) $product->setThumbnail($product->getImage()); $product->save(); And if you want to see which data you can access in the array: var_dump(array_keys($product->getData()));
stackexchange-magento
{ "answer_score": 0, "question_score": 1, "tags": "magento 1.9, cart, addtocart, thumbnail" }
ReactJs: Group data by today, current week, current year I have data in the following format [ 0:{ address:n/a booking_status:null commission_total:"65000.00" created_at;"Tue, Jun, 2020" }, 1:{ address:n/a booking_status:null commission_total:"68000.00" created_at;"Thur, Jun, 2020" } ] I am looking to group the set of data as described the subject line in ReactJs. Will anyone assist please
The easiest way is to use some sort of library for handling dates, like `date-fns` which have some builtin functions like `isSameWeek` and `isSameYear` < Then it will be easy as filtering the array and extracting the ones that match const today = new Date(); const todayGroup = data.filter(item => isSameDay(new Date(item.created_at), today)); const weekGroup = data.filter(item => isSameWeek(new Date(item.created_at), today)); const yearGroup = data.filter(item => isSameYear(new Date(item.created_at), today));
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "reactjs" }
How to solve this limit with trigonometric functions?. Should I use the Squeeze Theorem? Given $$\lim_{r \rightarrow- \infty} \frac{(r^2(\cos^3(r)+\sin(r))}{((r^2+1)(r-3))}$$ Determine its value. So, I'm just wondering I could apply the Squeeze theorem because it contains $\cos$ and $\sin$. I can separate $$\lim_{r \rightarrow -\infty}\frac{1}{(r-3)}=0$$ And the remaining expression would move between $-1$ and $1$. Suggestions will be welcome. Thanks in advance.
For all real values of $r$: $$|\cos^3 r+\sin r|\le 2,$$ therefore $$\left|\frac{r^2(\cos^3 r+\sin r)}{(r^2+1)(r-3)}\right|\le \frac{2r^2}{|r^3-3r^2+r-3|}.$$ Let $r\to\infty$, then the leading terms in the numerator and the denominator are ${2r^2}/{r^3}$. So, ${2r^2}/{r^3}=2/r\to 0$ as $r$ becomes sufficiently large.
stackexchange-math
{ "answer_score": 2, "question_score": 3, "tags": "calculus" }
Basics of Bonsai? Could we grow bonsai with normal seeds and techniques to grow it? Which bonsai is best for indoor and acts as an air purifier? Instead of buying it, I want to grow my own bonsai. Please suggest some tips.
Bonsai are normal plants or trees, that we find in large in nature. The art of bonsai is to recreate the real tree in a miniature form in a pot. So any (real) tree can be used for bonsai. However, trees with large leaves are more difficult to downsize in good proportion, so starting with a tree species that has small leaves is a smart choice. Growing bonsai indoors, is tricky. You can use tropical species for this, like _Ficus_. I like the Bonsai Empire website where they guide you for proper maintenance.
stackexchange-gardening
{ "answer_score": 4, "question_score": 3, "tags": "pruning, bonsai" }
Unusable function arguments Is there a syntax for user-inaccessible arguments in Python functions. Or is that even possible? For example, I would like to define a function that takes _only_ a single argument from the user but there is a need for another argument where the function needs to call itself in a different setting, such as: def function(userEntry, key1 = 0): if key1 == 0: #setting 1 ##SOME INITIAL OPERATIONS ## key1 += 1 function(userEntry, key1) if key1 == 1: #setting 2 ##FINAL OPERATIONS## print('Some function of ' userEntry) If done as above, user can still access key1 and initialize the program as they wish, however, I do not want user to be able to do this. I want the user to enter userEntry only while the function requires to call itself depending on the conditions on user-input and key1, operations will change.
I agree that having a separate function that the user calls would be a good idea. I have made some code that works for that here: key = 0 def userFunc(input): # Do stuff function(input, key) def function(userEntry, key1 = 0): if key1 == 0: #setting 1 ##SOME INITIAL OPERATIONS ## print('initial operation') print key1 key1 += 1 return ##to make the function not instantly repeat itself if key1 == 1: #setting 2 ##FINAL OPERATIONS## print('final operation') print key1 userFunc('inValue') This would do the initial operations the first time userFunc() is called, then the final operations the next time it is called.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "python, function, lambda, functional programming" }
How to query a website from Arduino I'm building a website, and I want my Arduino Uno (that is hooked up by USB to my local machine) to execute every time a certain page is reached on the site. (For example, blink the light when somebody signs up for our service.) I don't have an Ethernet shield. Is there an alternative? The only thing that I've come up with is to repeatedly download a log file from the website to my local machine, and run a loop querying the contents of that log file on my Arduino, but the constant requests will put too much stress on the server. Is there any easier way to do this?
Eventually figured it out, with help from here: < You need to use Processing to ping the website, and send the acquired data through the serial port to the Arduino. Since both are using the same port, make sure to load the code over to the Arduino first before you start running the processing code.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "arduino" }
Play 2 reverse routing, get route from controller method Using the Play 2.2.3 framework, given I have a route like this one in my routes file : GET /event controllers.Event.events How can I programatically get the "/event" knowing the method I am trying to reach, in this case 'controllers.Authentication.authenticate' ? I need it for test purpose, because I would like to have better test waiting not for the route itself but for the controllers method really called. So maybe there is another solution than getting the route and test it this way like I do for now : //Login with good password and login val Some(loginResult) = route(FakeRequest(POST, "/login").withFormUrlEncodedBody( ("email", email) , ("password", password))) status(loginResult)(10.seconds) mustBe 303 redirectLocation(loginResult).get mustBe "/event"
You construct the reverse route in this way: [full package name].routes.[controller].[method] In your example: controllers.routes.Authentication.authenticate controllers.routes.Events.events But say you broke your packages out like `controllers.auth` and `controllers.content`, then they would be: controllers.auth.routes.Authentication.authenticate controllers.content.routes.Events.events The reverse routes return a `Call`, which contains an HTTP method and URI. In your tests you can construct a `FakeRequest` with a `Call`: FakeRequest(controllers.routes.Authentication.authenticate) And you can also use it to test the redirect URI: val call: Call = controllers.routes.Events.events redirectLocation(loginResult) must beSome(call.url)
stackexchange-stackoverflow
{ "answer_score": 25, "question_score": 6, "tags": "scala, playframework, playframework 2.0" }
What happens to power ups after death In Hero Academy, if I lose one of my units and step over him in the next turn (so I save him), do I also save any equipment he's carrying? Or, is the equipment lost, but the hero is saved?
Both the unit and the equipment are lost when you stomp your own unit. If you want to save the unit and equipment you'll need to revive them with a healer or an item that has that ability.
stackexchange-gaming
{ "answer_score": 3, "question_score": 3, "tags": "hero academy" }
String formatting of a Double I can't seem to find a way to format a Double limiting the precision to just a couple of positions after the decimal point when presenting that in a label. Maybe I'm missing something major, but I couldn't find anything in the official documentation. Thanks in advance for the help!
There's no way to do this using `String` interpolation. You can find a good discussion about this on this Apple Dev Forum post. You can use `NSNumberFormatter` or `NSDateFormatter` to format the output. Alternatively, to use `printf`-like syntax, you can still use `NSString`: var str = NSString(format: "Hello, world %.2f", 42.12312312313)
stackexchange-stackoverflow
{ "answer_score": 46, "question_score": 45, "tags": "string formatting, swift" }
Setting null terminated string in environment variables via ProcessBuilder As the caption states I'm trying to set an environment variable with multiple null terminated filenames. My code looks like this: ProcessBuilder pb = new ProcessBuilder(execCmd); Map<String, String> env = pb.environment(); env.clear(); String storedFiles = ""; Iterator<Attributes> storedSequence = info.getSequence().iterator(); while (storedSequence.hasNext()) { storedFiles += storedSOPSequence.next().getFilename() + "\0"; } env.put("StoredFiles", storedFiles); try { pb.start(); } catch (Exception e) { } But I run into the following excepion: Exception in thread "pool-1-thread-2" java.lang.IllegalArgumentException: Invalid environment variable value: "/tmp/tmp.DXrJMdJmbW/53cd50f9" Is there a way to achieve this?
You should not use nulls as separators in strings, especially when passing the strings to the operating system. The O/S interprets null as an end-of-string marker and may not copy anything after that. Use another control character instead (e.g. '\r').
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, environment variables, processbuilder" }
Why are interrupts needed for MMIO on pcie? This blog post talks about the difficulties in bringing pci passtrhough support for ARM devices: < It cies GICv2/GICv3 which are ARM's interrupt controllers. You can write to it via MMIO and make it deliver interrupts to CPUs. However, why interrupts are needed? Shouldn't the PCIe driver talk with the PCIe device through MMIO. That is, writing/reading from memory?
It is necessary because otherwise the operating-system doesn't have any way of knowing an event happened. Operating-systems are not polling memory constantly. They still need to know that an event happened and when. That's where interrupts come in. Imagine you have an hard-disk PCIe controller. How does the operating-system know when the disk is done writing its data to RAM?
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "linux, arm, kernel, driver, interrupt" }
meson cross-file for different platforms In meson you specify a cross-compiler in a cross-file like: [binaries] c = '/opt/yada-yada/gcc/bin/powerpc-yada-yada-gcc' This is great if you know exactly where your compiler is going to live. If I want to specify the same compiler for Windows, I need a different cross-file like: [binaries] c = 'c:\Program Files (x86)\yada-yada\gcc\bin\powerpc-yada-yada-gcc' Is there a way of using only a single cross-file for both platforms? I thought `find_program` might help, but I just get an error about a Malformed value in cross file variable c.
No, the entire point of cross-files is to target a specific platform. Just make a directory to keep cross-files in.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "meson build" }
How can I include a specific library into Robot Framework My robot framework installation did not include DateTime library. But i want to use it now. How can i do it with current installation intact ? >pybot --version Robot Framework 2.8.4 (Python 2.7.7 on win32)
The simplest solution is to upgrade to robot framework 2.8.5 or greater. I don't think there's any reason to be concerned about an upgrade from 2.8.4 to 2.8.5. Your other choice is to opy the DateTime library into somewhere in your PATH. You can get the latest version of the library here: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "robotframework" }
Don't get the content copied of a sharepoint list item I have this code: connect-pnponline -url xxxxx -Credential $credential $item = Get-PnPListItem -List "FirstList" -Id "1" -Fields "Description" <=====NOT GOOD Set-PnPListItem -List "SecondList" -Identity "78" -Values @{"Description"=$item} -SystemUpdate I can not get the content of the first row of the column Description of the first list. P.
You could try the below command: Set-PnPListItem -List "SecondList" -Identity "78" -Values @{"Description"=$item["Description"]} -SystemUpdate
stackexchange-sharepoint
{ "answer_score": 1, "question_score": 0, "tags": "sharepoint online, pnp powershell" }
Dummy Request Response for Servlet testing How to Create a Dummy Request and Response for Servlet Testing.I read about the Apache Jkarta Cactus Project but do not want to go in that much details. Can we just construct a dummy request response and pass it to doGet() method (Ofcourse the request constructed would have a URL and request parameters, but how to construct such dummy request)? and also want no dependency of junit on Apache(should run independent of it).
Look into MockHTTPServletRequest(), I think its going to work. Here is the link which you can read.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "unit testing, servlets" }
Kibana 5.4.0 - Vertical Bar Data Visualization Issue I am able to create index and in discovery tab all the data is being populated shown properly. { "_index": "deal-expense", "_type": "kafka-connect", "_id": "deal-expense+0+63", "_version": 2, "_score": 1, "_source": { "EXPENSE_CODE": "NL**20", "EXPENSE_CODE_DESCRIPTION": "DO NOT USE ****** ****** - ADAM", "NO_OF_DEALS": 17 } } Data Visualization Requirement: 1. There might be multiple indexed documents for every `EXPENSE_CODE` 2. On Y Axis I need to display Max Of `NO_OF_DEALS` and On X Axis I need to display `EXPENSE_CODE` 3. Max Of `NO_OF_DEALS` are not being populated but `EXPENSE_CODE` is being populated. My Configurations as shown below. ![enter image description here](
We need to create the elastic search index and map it to existing index mentioned in the question. PUT /reindexed-deal-expense { "mappings": { "doc": { "properties": { "geo": { "properties": { "EXPENSE_CODE": { "type": "keyword" }, "NO_OF_DEALS": { "type": "integer" } } } } } } } and map it like this POST _reindex { "source": { "index": "deal-expense" }, "dest": { "index": "reindexed-deal-expense" } } ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "elasticsearch, kibana" }
Best cubing algorithm to learn after beginner's I'm a new fan of cubing. I've recently bought a speed cube and for now I have only mastered the beginner's method and solve it in barely a minute and a half (which is way over what a speedcuber is supposed to do). So I'm wondering, is there any recommended method to learn after the beginner's method in order to improve my time ?
I agree with @mchoy25 that you can bring your time down much more. Things like single finger turning, properly lubricating the cube, and knowing what the back of the cube looks like without rotating the cube will improve your time much more than switching algorithms. That said, if you want to switch to more complicated methods then I'd look up F2L. Basically, from beginner to master you'll just be reducing the number of steps taken while massively increasing the number of possible algorithms to perform/memorize for any given step
stackexchange-puzzling
{ "answer_score": 5, "question_score": 6, "tags": "rubiks cube, speedsolving" }
Batteries and amps in parralel So, i am about to buy a brushless motor a ESC and a 18650 batteries for my arduino. The batteries "specs" is 3.7v and 20a, if i would to put 2 and more in parallel would i get 7.4v 20a or 7.4v 40a? Thanks.
In parallel you'd get 3.7V 40A What I think you mean is in **series**. That way you get 7.4V 20A.
stackexchange-arduino
{ "answer_score": 1, "question_score": -1, "tags": "voltage" }
How to select the new element just added dynamically in a select directive I am building a directive with a select list in order to add dynamically elements. The following doesn't work : I'm adding an element to the array model used in the ng-model-options binding of my directive. The element is nicely added to the list **but it's not being selected**. Instead I keep getting the empty line. I can't find a way to set the ng-model to the newly added element. I have tried a scope.$watch on my item list inside the directive but strangely nothing is fired when the item list is increased by one new element. And I don't understand why : if the list is being updated so should scope.items, which should trigger the scope.$watch... scope.$watch('items', function(){ scope.ngModel = scope.items[0]; }); I have made a plunker to illustrate this : plunker Thanks for your help on this!
This will work (documentation) scope.$watch('items', function(){ scope.ngModel = scope.items[0]; }, true); // Add third parameter true, this will make sure you check if the list // has changed and not only if a new list was added // Without the third parameter: var list = []; list.push('test'); // won't call watch var list = ['test']; list = ['new array']; //will call watch
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "angularjs, select, data binding, angularjs directive" }
PHP - access function from a class I have a class like: class bla_bla extends WP_Widget { function boo(){ return 'something'; } ... } (it's a WordPress widget) How can I access the `boo()` function from outside the class? I want to assign the value returned by that function to a variable, like `$var = boo();`
You can either access it directly or by instantiating the class: $blah = new bla_bla(); $var = $blah->boo(); or $var = bla_bla::boo();
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 6, "tags": "php, class, function" }
Arduino Uno: Pullup Resistor I have been reading a bit about the internal pullup resistor. I know from past projects in school that resistor themselves are fragile (burnt one by accident due to higher current than was made for). I have two different Arduino models. One by Intel and rest are standard Arduino Uno. So I was wondering about safely using the internal pullup resistor on the Arduino Uno. Hence my question is about the internal pullup resistor pinmode; How many pin can you connect to it safely and not overload it?
Each pin has its own, separate, pullup resistor. I don't believe you can damage it by drawing current from the port, because the pullup resistor is only active when the port is in high impedance (hi-Z, input) mode. The pullup resistor can be damaged by overvoltage, static discharge, and the like. The Uno has 20 kOhm pullup resistors according to this tutorial. If you feed it a 0V signal while the Atmega is running at 5V, the current will be a quarter of a milliamp, which is miniscule.
stackexchange-arduino
{ "answer_score": 4, "question_score": 2, "tags": "arduino uno" }
Simplest way to add table headers background color in Latex I am using this below code to generate a table, \begin{center} \begin{tabular}{|p{3cm} | p{3cm} |} \hline Title1 & Title2 \\ \hline Item1 & Item2 \\ \hline \end{tabular} \end{center} The output is like, ![enter image description here]( But I want to add background color for header row, like gray like, ![enter image description here]( What is the simplest way to add header background color for a table?
For coloring table rows you need to load `xcolor` package with option `table` (which use `colortbl` package) and than use command `\rowcolor{<color>}`: \documentclass{article} \usepackage[table]{xcolor} % <--- \begin{document} \begin{center} \begin{tabular}{|p{3cm} | p{3cm} |} \hline \rowcolor{gray!30} Title1 & Title2 \\ \hline Item1 & Item2 \\ \hline \end{tabular} \end{center} \end{document} ![enter image description here](
stackexchange-tex
{ "answer_score": 4, "question_score": 0, "tags": "tables, header footer, color, backgrounds" }
Using UIAlertController buttons to add custom cells to a tableView I have created a `UITableView` and created some cells and given them identifiers. I have also created a `UIAlertController` to display a popup when a button is pressed on the same `View Controller`. I would like to be able to insert new rows into the table with the appropriate cells depending on which button the user taps in the Alert popup. help?
You can try like this way let alert = UIAlertController(title:"Test", message: "Message", preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "Add Row", style: UIAlertActionStyle.default, handler: { (action) -> Void in tblView.insertRows(at: [IndexPath], with: UITableViewRowAnimation.left) And update your data Sourse })) alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil)) self.presentViewController(alert, animated: true, completion: nil) i hope it will help you
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "ios, swift, uitableview, uialertcontroller" }
Preventing from accessing process memory I made an example that writes into process memory using task_for_pid() and mach_vm_write(). task_for_pid(mach_task_self(), pid, &target_task); mach_vm_write(target_task, address, '?', local_size); Is there a way to block to access memory of the specific process from another processes like cheat engine on OS X. How do I prevent another process from calling task_for_pid? Not that many others come to mind except hooking.
In OS X, the calls to task_for_pid are regulated by taskgated. Basically, unless it's your task , or you're root (or, in older systems, member of procview group), you won't get that elusive task port. But if you are allowed, then you have the port, and can do basically anything you want. Hooking won't help, since task_for_pid is a mach trap - people can call it directly using the system call interface. iOS has much tighter controls on it (thanks to AppleMobileFileIntegrity.kext). If you want to control the trap, effectively the only way of doing so is writing a small kext to do the trick for you.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "macos, kernel, anti cheat" }
How to Reboot Programmatically? How can I reboot in c++? Is there any provision in WinSDK? What kind of rights should my program(process) have to do so?
There is the ExitWindowsEx Function that can do this. You need to pass the **EWX_REBOOT** (0x00000002) flag to restart the system. Important note here (quote from **MSDN** ): > The **ExitWindowsEx** function returns as soon as it has initiated the shutdown process. The shutdown or logoff then proceeds asynchronously. The function is designed to stop all processes in the caller's logon session. Therefore, if you are not the interactive user, the function can succeed without actually shutting down the computer. If you are not the interactive user, use the **InitiateSystemShutdown** or **InitiateSystemShutdownEx** function. You can choose between the appropriate function depending on your situation.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 9, "tags": "c++, windows, winapi" }
Samsung 860 pro / evo - do they report deterministic trim? Regardless of the kind - DRAT or RZAT. While all the modern ssds should behave in RZAT fashion, quite a few of them don't bother reporting such feature. And some controllers (in my case - old LSI2308 in IT mode) are sensitive in this regard. In the past, 840 pro reported the feature just fine, 850 pro for whatever reason didn't. Evo line - afaik - never did (even if technically it was(?) supported since at least 850, but I'm not sure). Thus my question regarding 860 series, as I haven't had any of those under my hands.
See the Samsung 860 EVO (mSATA) specs retrieved by `hdparm -I /dev/sda`: ATA device, with non-removable media Model Number: Samsung SSD 860 EVO mSATA 500GB Serial Number: S41NNW0K814351T Firmware Revision: RVT41B6Q Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0 Commands/features: Enabled Supported: * SMART feature set .... * Data Set Management TRIM supported (limit 8 blocks) * Deterministic read ZEROs after TRIM
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "linux, ssd, trim" }
Problem rendering image inside the amp-truncate-text tag I am having a problem with **AMP**. I'm trying to implement a read more button, but when there are images, videos, advertisements in the **amp-truncate-text** tag, it **doesn't load the images** , it gets a loading icon, but without showing the image. I made an example using the AMP playground using the following code as an example. Has anyone faced this problem and has any idea how I can solve it?
amp-trunkcate-text ist still in the experimental status. DO you have enable the experimental status?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, html, amp html" }
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) ![введите сюда описание изображения]( Как решить эту ошибку? Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:16:5-324:19 to override.
У вас конфликтуют библиотеки com.android.support:support-compat:28.0.0 и androidx.core:core:1.0.0 Библиотеки androidx пришли на смену support. Они содержат одни и теже классы, потому нельзя в одном проекте использовать одновременно android x и support. Вскоре support перестанет обновляться, потому рекомендую все перевести на androidx. Это можно сделать автоматически, в меню Refactoring в нижней части найдите кнопку Migrate to AndroidX. Сделайте бэкап, который вам предложит студия, т.к. иногда миграция проходит не без проблем и приходится еще что-то руками править
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "java, android, android studio" }
vectorized sum of array according to indices of second array I have an empty array: empty = np.array([0, 0, 0, 0, 0]) an array of indices corresponding to positions in my array empty ind = np.array([2, 3, 1, 2, 4, 2, 4, 2, 1, 1, 1, 2]) and an array of values val = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) I want to add the values in 'val' into 'empty' according to position given by 'ind'. The non-vectorized solution is: for i, v in zip(ind, val): maps[i] += v >>> maps [ 0. 4. 5. 1. 2.] My actual arrays are multidimensional and loooong so i've got a **NEED FOR SPEED** I really want a vectorized solution, or a solution that is very fast. Note this does not work: maps[ind] += val >>> maps array([ 0., 1., 1., 1., 1.]) I'd be extra grateful for a solution that works in python 2.7, 3.5, 3.6 with no hiccups
You can make use of `np.add.at` which operates equivalent to `empty[ind] += val`, except that results are accumulated for elements that are indexed more than once giving you a cumulated outcome for those indices. >>> np.add.at(empty, ind, val) >>> empty array([0, 4, 5, 1, 2])
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "python, performance, python 2.7, numpy, vectorization" }
Rails: Screenshot a div then share via twitter? I have a highcharts chart in a div. I want to make it easy for users to tweet it out. How could I do this? I was thinking of a screenshot gem then integrate the twitter API. Is this possible? Or is there a better way? Thank you.
You could render the image server side, and then share it out via some client side JS tools such as Share This. Render HighCharts on the server: < Once you have the image, use it for sharing by including it in your HTML. Share This docs: < This may be a slightly different approach than what you were looking for, but it works.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": -1, "tags": "ruby on rails, twitter, highcharts, screenshot" }
QPixmap xAxis Rotation I want to rotate a pixmap from its xAxis, but it just rotates from top left corner.(I want it to be rotated from the center) here is my code: QTransform *X = new QTransform(); X->translate(pixmap().size().width() / 2, pixmap().size().height() / 2); X->rotate(rtn, Qt::XAxis); //rtn is an angle setTransform(*X); It seems that the translate method does not change the origin point to the center of my pixmap. Now I want some help to solve this problem.
ok, the problem was that I didn't translate back my transformation after rotate method, this is the appropriate rotation from center on xAxis: setTransform(QTransform().translate(pixmap().size().width() / 2, pixmap().size().height() / 2).rotate(rtn, Qt::XAxis).translate(-pixmap().size().width() / 2, -pixmap().size().height() / 2));
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "qt, rotation, qpixmap, qtranslate" }
Is there a default/core File Manager provided by X11 or Debian? I recently installed Debian without a desktop environment. Currently, I'm using OpenBox in X11 and have yet to install a File Manager. I've found that in, seemingly all, programs capable of opening or saving files, there is a very GTK looking (to me) file manager/dialog that appears. The dialog appears to be consistent across programs and has got me wondering if and what "program" is being utilized here. Is the dialog packaged with the programs using it, or is there a "universal" file manager that either X11 or Debian (or any Linux distro for that matter) will revert to in the event there is no File Manager installed?
> there is a very GTK looking (to me) file manager/dialog that appears. What you're looking at is a default/standard GTK file open/save dialog (GTK2/GTK3), however > is there a "universal" file manager that either X11 or Debian (or any Linux distro for that matter) will revert to in the event there is no File Manager installed? No, there's no universal GTK file manager to speak of. Each major GTK based desktop environment offers its own file manager. In terms of the number and size of dependencies the lightest is probably Thunar (which is the default file manager for XFCE).
stackexchange-unix
{ "answer_score": 2, "question_score": 0, "tags": "debian, x11, file manager" }
Where does MVC do it's URL/Route pattern matching? Does anyone know the class(s) and method(s) within the Microsoft MVC framwork (any version, 3,4,5 etc) that actually does the pattern matching exercise on the URL to establish which route to use? I'm interested to look at the actual mechanics of URL parsing but can't find the code using ILSpy.
Take a look under `System.Web.Mvc.Routing`. Specifically, `RouteBuilder` may contain what you're looking for. Here's the source.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net mvc, asp.net mvc routing" }
http://localhost/GS doesn't work on the browser of Android Emulator i follow official documentation of Sencha touch at this link < ,i downloaded Sencha Touch 2 SDK and SDK Tools, i have generate app GS ../GS command and it works fine.then i taped http:/localhost/GS/ in the Browser of Android emulator but it shows error.it does not display default sencha app. Can anyone tel me why? is there another solution? thanks.
find your local ip of the pc you're working on - go to the command line and type 'ipconfig' to get this. use your local ip for your android device to connect to your localhost. ex: 192.168.1.x/GS .. instead of the "localhost" it worked for me.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "android, browser, sencha touch 2" }
Is copying numbers from published scientific articles considered plagiarism/copyright infringement? Considering that proper reference is provided (journal, author name, date etc.), is copying **exact numbers** from published scientific articles could be considered plagiarism or copyright infringement? For example, there is a research called "Dancing can reverse the signs of aging in the brain". I need **to cite in my own research** some data from it, including how many there were participants, their gender (how many men/women), age and BMI. There are some tables as well, from which I intend to take some baseline numbers. As a result, I'm making my own conclusions (words or sentences are not copied, only numbers). Thanks.
No, it's neither: * It's **not plagiarism** because you cite the original source and you don't try to put others' results as your own. * It's **not a copyright infringement** because there's no copyright on data.
stackexchange-academia
{ "answer_score": 8, "question_score": 2, "tags": "publications, research process, citations, plagiarism, copyright" }
opencart 3.0.2.0 remove model required restriction How can i remove the "model required" from the model field in admin product page in opencart v 3.0.2.0, and make it an optional field like the rest of the fields in the data tab? model required screenshot
its not correct to not insert model no, still i show you. **admin\controller\catalog\product.php** go to line no 1193 - approximate find this code in **protected function validateForm() {** if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) { $this->error['model'] = $this->language->get('error_model'); } after comment /*if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) { $this->error['model'] = $this->language->get('error_model'); } */ you have to comment this code or you can remove it, but i think you need this code in future so do only comment this code don't remove it.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "opencart" }
Lost formatting in custom Display Form I have a custom list with a rich text column, I created my own display form for the items so I could style them up a bit. I noticed that the rich text column loses all it's formatting on the display form. Is there anything I can do to fix this?
The **rich text field** will contain html markup, which by default may be displayed "as-is" on the xslt view. A solution for this problem - should this be the case - is to **render** the value of that field **as html** and not as plain text, which will cause the following example: <div class="ExternalClass13B6DE041BA246688B35022ED990042A"> <strong>test markup</strong> </div> To be rendered as **test markup** Using the following code, which takes advantage of the disable-output-escaping attribute <xsl:value-of select="@Body" disable-output-escaping="yes" />
stackexchange-sharepoint
{ "answer_score": 0, "question_score": 0, "tags": "custom list" }
React | Package.Json | "proxy" Not Working in Google App Engine I created a basic React app with 'create-react-app' and a simple Express service. In the react application I added 'proxy' to the Package.json file which points to the Express service url. "proxy": <EXPRESS URL HERE> When testing locally React calls Express through the proxy and everything works. When I deploy to Google App Engine the proxy isn't working. I tested Express service(on App Engine) with my local React instance and things work as expected. When I deploy the React app to App Engine(after running NPM RUN BUILD), the proxy is not working. Video i watched on getting React/Express working together with 'proxy': <
That setting is for development only as per < For production you'll need express to serve up both the express API and the React build. You can do this with something like this in your express code: app.use(express.static(`${__dirname}/../build`)) // serves the react build app.use('/api', apiRouter) // your api code Now when you start up your express server it will serve up your API and your build code at once.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "node.js, reactjs, express, google app engine" }
Emacs talking to XCode I use emacs on my mac to program in Xcode. It works really well for the most part. I double click on a file in xcode, and it pulls it up in an existing emacs window. I compile, and get syntax errors, double click, and they come up in the active emacs window. great. This is all XCode talking to emacs. Does anyone know of a way to get emacs to talk to XCode? For example, I want to be able to set a breakpoint in emacs and have the XCode version of gdb acknowledge it.
You can actually use AppleScript to set breakpoints in XCode from within Emacs by embedding the AppleScript inside of elisp. This page contains the code you need. It's in Korean, but there's actually not much Korean to understand. The first code block is just a straight AppleScript example that was used to develop the breakpoint code. The second block is the one you want. It embeds the first example in an elisp snippet that you can add to your .emacs file. Other communication can be done using the same trick. Just figure out how to do what you want in AppleScript and then embed that AppleScript in elisp within Emacs. BTW, here is the documentation for do-applescript, the lisp function, available on the Mac, that lets you call AppleScript.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 8, "tags": "xcode, debugging, emacs, applescript, elisp" }
SQL alter column datatype from nvarchar to int Can the datatype of a field be changed to int from nvarchar?? alter table employee alter column designation int is this valid?? If not can it be done in some other way?? P.S: I am using `MS SQL Server`
You can try doing an alter table. If it fails do this: 1. Create a new column that's an integer: `ALTER TABLE tableName ADD newCol int;` 2. Select the data from the old column into the new one: `UPDATE tableName SET newCol = CAST(oldCol AS int)`; 3. Drop the old column
stackexchange-stackoverflow
{ "answer_score": 23, "question_score": 18, "tags": "sql server, type conversion, alter table" }
Close modal form in Access and access module code I've inherited a Access database that is used to import some data in SQL. The MDB opens with a form, in a modal mode: no Access menubar or buttons are visible. I can view the tables with content by using the Visual Studio 'Data Connection' tool, but I cannot see the module's code. I've looked at this question here, but the answers there aren't really what I need. Is there a way to either force the form to close (and access the modules) or to extract the VBA code ? [EDIT] I am using Access 2007, not sure what the original developer used.
Hold down the shift key when you open the database. This will prevent it from loading the automatic script it's running and allow you to gain access to the tables, queries, and VBA scripts.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "vba, ms access, extract" }
i++ animation for javascript function I'm stuck animate the same first frame, when I want to call out to i++ but for whatever reason I'm not able to load in the next variable. My setTimeout function fires every 3 seconds and should load in the next li in the view. //set animation function animate() { var set = $(".1,.2,.3,.4"); var i = 0; $(set).find('li:nth-child('+(i+1)+')').removeClass().find('li:nth-child('+(i+1)+')').addClass("active"); //$(set).find("li:first").addClass('active'); }; setTimeout(function(){ animate(); }, 3000);
`setTimeout` waits for _n_ milliseconds (in your case, 3000) and then calls your function once. Look into `setInterval` instead. You also need to move `i` outside of `animate`. In your current implementation, you declare a variable `i = 0` each time you call `animate()`. Good luck!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript" }
too many initializers for 'int [0]' c++ First: int k[] ={1,2,3,4,5}; Second: struct slk { int k[] ={1,2,3,4,5}; }; for those two statements, why does the first one pass the compilation but the second one give me > error:too many initializers for 'int [0]'. the compilation would passed if I set k[5]; What does this error message means? Note: code tested on GNU GCC version 4.7.2
In C++11, in-class member initializers are allowed, but basically act the same as initializing in a member initialization list. Therefore, the size of the array must be explicitly stated. Stroustrup has a short explanation on his website here. The error message means that you are providing too many items for an array of length 0, which is what `int []` evaluates to in that context.
stackexchange-stackoverflow
{ "answer_score": 38, "question_score": 30, "tags": "c++, arrays, c++11, struct, initialization" }
The set $I$ as indices, e.g. $\{U_i | i \in I\}$ I have seen this a few times now, expressions of the form e.g. $\\{U_i | i \in I\\}$. For example in these MSE questions: 1 2 3. My question is: What is $I$ been used to represent?
$I$ is an indexing set. For example, if your family of sets is countable, one can use $I$ to be the set of natural numbers. Since $I$ is not necessarily countable, the general indexing set is expressed as a set $I$.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "elementary set theory, terminology" }
only one cell color should be change in row i am working with datagridview in win forms now i have to change the color of cell when any user click on that cell i have to change that cell color to red for which i have use this code DataGridViewCellStyle CellStyle = new DataGridViewCellStyle(); CellStyle.BackColor = Color.Red; dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = CellStyle; but now if user has selected any other cell in same row then its color should be change to red and previous selected should make white again as non selected.
You need to maintain a reference to the previously selected cell so you can change it back. DataGridViewCell _currentCell = null; // class level variable ... // inside your event, set the current cell back to white if(_currentCell != null) _currentCell.Style.BackColor = Color.White; // now set the current cell to the selected cell _currentCell = dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex]; _currentCell.Style.BackColor = Color.Red;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, winforms, datagridview" }
Problem extracting values from an array of objects in TypeScript How can I only extract the property values from this array of object arrays and store them in a new object arrangement? I have this: resp: [[{"property1":10}],[{"property2":20}],[{"property3":30}]]; but I want this so I can do an iteration of the values in a table. resp: [{"property1":10,"property2":20,"property3":30}]; I've tried something like this but it doesn't work for me: let test1 = success.resp[0]; let test2 = success.resp[1]; let test3 = success.resp[2]; let array: any = [{property1:test1,property2:test2,property3:test3}]; thank you very much in advance
I resolved it in the following way, it's just a matter of seeing how I'm getting an answer, in my case it was a matrix. let test1 = success.resp[0][0].property1; let test2 = success.resp[1][0].property2; let test3 = success.resp[2][0].property3; let array: any[] = [{property1:test1,property1:test2,property3:test3}]; console.log("array: ",array);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "typescript" }
how to calculate bitwise operation back i want to crypt some informations with bitwise operations. For example two numbers with bitwise or: 8 and 1 to 9. But how can i encrypt it it to get my root nombers? greetz
You can use a bitwise xor to achieve this, it's known as a xor cipher.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "bitwise operators, bitwise or" }
How to enable HiDPI support on Zoom.us linux client? Screen elements are too small to click or read on my 4K laptop screen. How do I make it obey Gnome scaling, which is set to 200%? I'm on Fedora 29, but this should be the same issue on Ubuntu 18.04 LTS This issue also affects macbook retina display screens.
An answer that does not require changing common files that may be changed by future installs: Zoom currently creates a file named `zoomus.conf` under your `.config` folder in the user's home folder. One of the settings is `ScaleFactor`, set to 1 by default. Set this to 2, and next time you start the application it will have appropriate-sized visuals.
stackexchange-superuser
{ "answer_score": 122, "question_score": 87, "tags": "conferencing" }
How do I deduplicate -exec expressions in a find command? I have a `find` command that searches multiple file types using `grep`. For example, if want to search `.js` and `.jsx` files for the string `foo`, while excluding the `dist` directory, I'd type: find . -path "./dist" -prune -or -iname "*.js" -exec grep "foo" {} + -or -iname "*.jsx" -exec grep "foo" {} + Is there a way to rewrite this command so that the `-exec` isn't duplicated for each file type? I tried find . -path "./dist" -prune -or -iname "*.js" -or -iname "*.jsx" -exec grep "foo" {} + but all that searched just the `.jsx` files, not both `.js` and `.jsx`.
`-or` has lower precedence than `-and` (which is the default connector), so you need to explicitly increase your disjunction’s “priority”: find . -path "./dist" -prune -or \( -iname "*.js" -or -iname "*.jsx" \) -exec grep "foo" {} +
stackexchange-unix
{ "answer_score": 3, "question_score": 0, "tags": "shell script, grep, find" }
Pure HTML + JavaScript client side templating I want to have achieve something similar to Java Tiles framework using only client side technologies (no server side includes). I would like to have one page, eg **layout.html** which will contain layout definition. Content placeholder in that page would be empty #content div tag. I would like to have different content injected on that page based on url. Something like **layout.html?content=main** or **layout.html?content=edit** will display page with content replaced with main.html or edit.html. The goal is to avoid duplicating code, even for layout, and to compose pages without server-side templating. What approach would you suggest? EDIT: I don't need a full templating library, just a way to compose a pages, similar for what tiles do.
JavaScriptMVC has a view templating system that supports different engines, including a pure JavaScript based one called EJS. You might also want to look into Mustache especially Mustache for JavaScript.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 8, "tags": "javascript, html, templates, client side, tiles" }
Generic constructor from integer input for a Rational Number object I am implementing a rational number library for personal use, and would like a construction option to be from_integer, where the method takes any data type capable of being cast as an i32. I tried the following pub fn from_integer<T: Into<i32>>(input: T) -> Result<Self, String> { Ok(Rational{ numerator: input as i32, denominator: 1 }) } but get this error non-primitive cast: `T` as `i32` an `as` expression can only be used to convert between primitive types or to coerce to a specific trait objectrustc(E0605) lib.rs(97, 24): an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object Have I got the wrong trait, or is there a different way I should express that I want the input cast this way?
`as` is always useless with generics. You're already correct in having a `Into<i32>` bound on `T`, but you're not actually using the trait: Replace `input as i32` with `input.into()`. pub fn from_integer<T: Into<i32>>(input: T) -> Result<Self, String> { Ok(Rational{ numerator: input.into(), denominator: 1 }) }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "generics, rust, casting, traits" }
Difference between ++*argv, *argv++, *(argv++) and *(++argv) Currently I am learning C and trying to get my head around these instructions. Are they actually different? ++*argv *argv++ *(++argv) *(argv++) Thanks!
It's the postfix increment operator that has higher precedence than the pointer de-reference operator, not the prefix increment. So these two are equivalent: *p++ *(p++) The prefix increment has the same precedence as *, so *++p increments the pointer, and is the same as *(++p). Also, ++*p is the same as ++(*p).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "c, arrays, pointers, command line arguments" }
How to identify rarely played music files in Rhythmbox? Is there any way to identify the least played music files in Rhythmbox? This would be useful to do a clean up of those music files in my library that I rarely play.
![Rhythmbox preferences]( Rhythmbox has a play count column which can be enabled from the preferences dialog. Try Edit > Preferences and select the play count option. Then in the main Rhythmbox window click on the play count column heading to sort (or click again to reverse-sort) by play count.
stackexchange-askubuntu
{ "answer_score": 3, "question_score": 3, "tags": "rhythmbox" }
force output param to not be tinyint? I just inherited a stored procedure as part of a system for inserting a new user. At the top, `@user_id` is declared as `INT OUTPUT` and at the bottom `SET @user_id = @@IDENTITY`, which always returns zero for some reason. If I do: select @@IDENTITY ...I get something around '1872040' If I do: SET @user_id = 187300 ...I get: > Error converting data type int to smallint I also get the same if I do: SET @user_id = CAST(@@IDENITY as INT)... It needs to be `SET @user_id = CAST(@@IDENITY as TINYINT)` or just`@user_id = @@IDENITY` for it to not give me errors. However, then it just returns null / 0. So, I was googling around and couldn't really find an answer, is there a better way to force the output param to not be tinyint? this is in ms sql.
I have reproduced a scenario that can cause this problem. I think it could be not the sproc itself, but the way you're calling the sproc - specifically, the data type being specified for @user_id by the calling code. e.g. DECLARE @user_id SMALLINT -- THIS IS WRONG, SHOULD BE INT EXECUTE YourSproc 'ValueA', @user_id OUTPUT Once the IDENTITY value on the table exceeds the capacity of a SMALLINT, this would give you the conversion error. So make sure you're specifying the correct datatype in the calling code. Also, as per my comment, you probably want to be using SCOPE_IDENTITY() instead of @@IDENTITY.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "sql server" }
Who is responsible for providing ATC in a TMA? I know that `TWR`, `APP`, and `ACC` control **ATZ** , **CTR** , and **en-route** ; but I'm not sure about the control service which is responsible for monitoring `TMA` (`APP` or `ACC`?!). Could you please clear the case (preferably by a European reference)?
It depends. Air traffic control service in a TMA can be provided by either an air traffic control tower (TWR), an approach control unit (APP), or an area control unit (ACC) - or any combination of those. A TMA is _typically_ considered to be APP airspace, but there is no rule preventing a TWR or ACC from covering a TMA, and there are many examples of this happening throughout the world. The typical division, if you need a simple answer, is: * TWR provides service in a control zone (CTR) * APP provides service in a TMA * ACC provides service in a control area (CTA)
stackexchange-aviation
{ "answer_score": 2, "question_score": 1, "tags": "air traffic control" }
What does a DNS query look like? I'd like to make a simple DNS server using Go. I know how DNS works but I'm not 100% sure as to how a DNS query actually looks. For example, a HTTP GET request looks like this: GET /index.html HTTP/1.1 So my question is, does a DNS query look something like this: QUERY google.com A Or do DNS servers interpret the binary representation the domain name being queried?
You could check out the `miekg/dns` project. It builds Msg compose of a `MsgHdr` which includes the QUERY code (amongst other OpCodes). That follows the Message Header you can see in "Chapter 15 DNS Messages".
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "http, go, dns, server" }
Old movie where young astronaut returns to Earth very aged It was about an astronaut who went into space, young guy, and came back. In the hospital, the doctors are looking at him in shock after he came back. We don’t see his face yet, then there is a sudden close up of him. He is a grizzled old man. It's possibly from the 50s or 60s. It was definitely a movie and the astronaut wasn't in space for very long. It would have been in the theatre in the early 60's but that's all I can recall, unfortunately.
_Beyond the Time Barrier_ (1960). ![enter image description here]( In 1960, U.S. Air Force Major Bill Allison pilots an experimental aircraft on a sub-orbital spaceflight, during which he loses radio contact with Earth. When he returns to Earth, the base he launched from is decrepit and deserted, and there's a futuristic city on the horizon. It transpires that he's now in the year 2024, and humanity has not fared well in the intervening period. Near the end of the film, he returns to his own time via another sub-orbital flight, and is taken to hospital, where he's revealed to have aged drastically. ![enter image description here]( The whole film is up on YouTube.
stackexchange-scifi
{ "answer_score": 8, "question_score": 9, "tags": "story identification, movie" }
Cannot ask questions on SO because tags disappear on submit I tried to ask a question today on Stack Overflow. The site told me that I did not include any tags, but I did. I used the tags jquery and jscrollpane. I saw them there, then clicked the button. They vanished and the site said I did not add tags. I tried this in multiple browsers, all of which gave the same result. On Mac OS X, I used Firefox 3.6.20, Safari and Chrome; on Linux, I used Chrome and Firefox; and on Windows I used IE8. The interface I see here on Meta -- the window with potential tags appearing as I type -- does not show up on the primary site at the moment, so I can ask questions here but not there.
Turns out removing code from anonymous users means they don't have access to it. Who'd have thunk it? Fix deployed.
stackexchange-meta
{ "answer_score": 8, "question_score": 6, "tags": "bug, status completed, stack overflow, tags, user interface" }
How to change ViewPort3D background color in WPF? i have viewport3d and i want to change its background color. i am very new to Wpf. i didnt understand what to do from other posts. so i ask here. i changed brush property for viewport3d but it does nothing <Window x:Class="W3DTinker.MainWindow" xmlns=" xmlns:x=" Title="MainWindow" Height="800" Width="1200"> <Grid HorizontalAlignment="Left" Height="780" Margin="10,10,0,-21" VerticalAlignment="Top" Width="1180"> <Viewport3D Grid.Row="0" Grid.Column="0" x:Name="Viewport" Margin="350,10,10,10" OpacityMask="{DynamicResource {x:Static SystemColors.AppWorkspaceBrushKey}}" /> </Grid>
`Viewport3D` is a control that creates a 3D scene for you to render things into. It does not display anything by itself. If you want a background color behind it, then set the background color on its parent control, which in your case is the `Grid` that contains it.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "c#, wpf, colors, background, viewport3d" }
Automatic null assert in scala I would like to use `!` symbol to automatically generate non-null assert in Scala. I mean that in a situation like this: class Person(val name:String) { assert(name != null) } all other integrity checks can be solved by having custom argument type, but null check is always required to be written again and again. Could I have just something like this? class Person(val name:String!) // note the bang (!) and have that assert be generated? Are there any simple macros?
You can get something sort of similar via an implicit class. implicit class StringCheck(str :String) { def ! :String = {assert(str != null); str} } With this the null test syntax is reduced... import scala.language.postfixOps class Person(val name:String) {name!} ...or perhaps inserted in other code. class Person(val name:String) { if (name.!.length > 10) ... else ... } * * * A more generalized version as suggested by @simpadjo. implicit class NotNullSupportT extends AnyVal { def ! : T = {assert(obj != null); obj} }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "scala, macros" }
In US universities, are the sport coaches typically considered tenured professors? The title says it all. In many universities you see coaches for a team in some popular sport hanging around for many decades. I was wondering if in general those people had a status of tenured professor or equivalent, or if on the contrary they can be "fired at will", if for example the performance of the teams they are in charge of are considered disappointing? If the answer is really "it depends, there is no rule", then let me say I would like to know what status the Basketball Coach of Brandeis University who has just been fired had (see this Boston Globe article).
No, athletic coaches are generally not considered faculty and do not have tenure. I've never heard of any place where they are. The conditions of their employment would be based on whatever contract they negotiate with the university. Typically the university would have the right to fire them for any reason, including poor performance of the team, but the contract might call for a severance payment in some cases. (There could be small schools where someone is a professor and _also_ an athletic coach. In such cases I'd expect they would have tenure protections in their capacity as professor, but could be removed from the position of athletic coach at the university's discretion.)
stackexchange-academia
{ "answer_score": 53, "question_score": 26, "tags": "united states, tenure track, non tenure, college athletics" }
How to create more columns easier? So I'm new to iOS Prgramming and I am trying to create an app that will list the activities for the day, although I would like to easily create more columns with 2 images and some text as shown in the picture: ![enter image description here]( How would I do that? I've created a class where I can generate both the images and the text for each element, but I don't know how to make it so it's automatically placed in 2 UIImages and a label just below the other columns. How would I do this?
I would suggest going with UITableView with a UITableViewCell which contains: 2 UIImages and 1 Label. Try finding a simple tutorial for UITableView, for example, here or here. Then you may have other question while implementing but those are more certain. Currently, your question is very broad so I hope my answer helps you to get started.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "ios, swift" }
How do I find the solution to this equation? $$ z^3=-1 $$ How do I find all of the solutions to this equation? I get so confused when they use $$z$$ instead of writing the complex number like this $$a+bi$$
Euler's identity is your friend. Euler's identity says that $e^{i \theta} = \cos(\theta) + i \sin(\theta)$ After some experimentation with different values of $\theta$, one can see that $e^{i\pi} = -1$, and so it becomes clear that we need is for our answer cubed to give us an angle of $\theta = \pi$. Thus, $\theta = \dfrac{\pi}{3}$ and $\theta = \dfrac{5\pi}{3}$ are the other complex angles that you're looking for, as multiplying either of them by $3$ results in an angle that is co-terminal to $\pi$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "polynomials, complex numbers, roots" }
Core Data Entity Boolean property does not get saved on Table Cell delete I have Core Data set up with help of RestKit 0.20 so Data is stored on the device, not in memory. Saving new entities from responses works as well as setting and saving properties in success blocks. However, when I try to set Bool property and save it in - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {... Issue *issue = [self.fetchedResultsController objectAtIndexPath:indexPath]; issue.toDelete = YES; [issue setHasBeenDeleted:[NSNumber numberWithBool:YES]]; [self.managedObjectContext saveToPersistentStore:nil]; ... } it does not get flushed to the disk. It does when I close the app. I tried to use both main and child managedObjectContext, but result is the same. What could have gone wrong?
I have solved a problem by introducing new Bool property called "deletedFromLibrary". Just using this variable everywhere "hasBeenDeleted" is used. "hasBeenDeleted" still does not get updated.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ios, core data, restkit, nsfetchedresultscontroller" }
Form all possible strings in 2 level lists I have a two-level list like this : [['Demonstrative-Pronoun', 'Personal-Pronoun', 'Adjective', 'Noun', 'Noun', 'Indefinite-Pronouns'], ['Verb', 'Adjective', 'Adverb', 'Noun', 'Noun'], ['Verb', 'Verb', 'Verb', 'Verb', 'Adjective', 'Noun', 'Noun', 'Verb'], ['Verb', 'Verb', 'Verb', 'Verb', 'Verb', 'Verb', 'Noun']] I want to form all possible strings from these lists like : 1. Demonstrative-Pronoun Verb Verb Verb 2. Demonstrative-Pronoun Adjective Verb Verb and so on Is there a quicker way in python to do this or any quick way to? This list is hard-coded but it may actually contain any number of elements and sub-elements Thanks!
Use `itertools.product` to basically make a bunch of nested `for` loops: import itertools items = [...] for grouping in itertools.product(*items): print ' '.join(grouping) This'll give you all 1680 combinations. _From Comments_ : "You could replace items with map(set, items) and it'll remove the duplicates. That drops the count to 120."
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "python" }
iPhone ignoring media query I'm working on a responsive, Bootstrap 3-based design. When I resize the browser window on my desktop, everything behaves as expected, but when I went to look at it on my iPhone it doesn't collapse the menu as it should, among other things. <
You need to add the viewport tag to your header: **HTML** <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "css, twitter bootstrap, media queries" }
Display custom icon image [html] on each xAxis category label with highcharts.js I have this chart graph I am working on, basically is a set of 10 rows [series], I have to dinamically add a custom Icon (image) to the start of each bar, I am able to ad an image but is displaying the same mew element on all the rows, would really appreciate any help on this. Here is a jsFiddle < I created. and this is the js code I need to make work labels: { color: '#fff', x: 5, useHTML: true, formatter: function () { return '<img class="" src=" } } Hope I can get some help.
See < Just replace the random word placeholders with whatever images you want. formatter: function () { return { 'Awesome': 'blah', 'Awesome Previous': 'yadda', 'Good': 'dabba', 'Good Previous': 'doo', 'Okay': 'word', 'Okay Previous':'up', 'Awful': 'blah', 'Awfull Previous': 'blah2' }[this.value]; }
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "javascript, jquery, html, jquery ui" }
How can I embed \lvert and \rvert into the numerator ? How can I embed `\lvert` and `\rvert` into the numerator? $1 - \frac{ \lvert 1 - t_2 \rvert}{y}$ The above line gives _Undefined control sequence_ error.
\usepackage{amsmath} is missing.
stackexchange-tex
{ "answer_score": 6, "question_score": 1, "tags": "math mode, fractions" }
Bootstrap 3 nav without pills I want to have a nav in my header. The HTML currently looks like this: <ul class="nav nav-pills navbar-right logon-nav"> <li><a href="/Profile">Username</a></li> <li><a href="/Settings">Settings</a></li> <li><a href="/Account/LogOff">Sign out</a></li> </ul> Using Bootstrap this looks like this: < Now I want to achieve a similar result but without the pills (i.e. just underline). I know I could do this in CSS but I was hoping for a cleaner solution. Does anyone know of one?
Don't use .nav or .nav-pills. Instead, drop a .list-inline on the `ul`: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, css, twitter bootstrap" }
Buffered/batch serialization in Python? I have an algorithm that iteratively creates a very large, highly nested dictionary. I would like to buffer parts of this dictionary and then periodically stream the buffer to disk so that I can re-create the whole dictionary at another time. It seems like pickle is intended for one-pass serialization. Is there a way to serialize a dictionary in batches to a single output stream?
Ok, it looks like the following will partially solve the problem: with open('file','ab') as f: while <stopping condition>: <generate (key,value) pair 'k'> pickle.dump(k,f) Now, to reconstruct the whole dictionary, you just do the following: with open('file','rb') as f: fullMapping = {} hasNext = True while hasNext: try: fullMapping.update(pickle.load(f)) except: f.close() hasNext = False This will reconstitute the full dictionary when run.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, python 2.7, serialization, pickle" }
Achieving complex objects without sculpting I am following a tutorial video titled Fantasy Elven House - Speed Modeling In Blender, but since a couple of days I've been stuck at 5:05. I understand that he is using Mirror and Subdivision modifiers, but how is he doing that? Does he Extrude? And if he does, how? How he is able to achieve fluid manipulation with objects using Extrude? When I tried to do the same thing with the Extrude tool I do not get that control over my object, and my shape looks unnatural. And although the keys he uses are displayed, I still can't figure it out.
He's extruding, either with `E` or select an edge and `Ctrl``Alt``right click` ( _Extrude to 3D Cursor_ ): ![enter image description here](
stackexchange-blender
{ "answer_score": 5, "question_score": 4, "tags": "modeling, objects, extrude" }
Can I override a module's A method on a module B? I have the module A which is a dependency for many other modules. It cannot be changed at anyway. In this module the method `getCellValue()` is declared. Module A is a dependency for module B. The latter module is changeable. Important note is that the aforementioned method is not being called from module B. Below is my question: Can I override `getCellValue()` method in module B? Tech Stack: Spring 4.1.6 - Java 8.
If the class enclosing the method is not `final` you can extend it and `@Override` the method. Inject the extended class in all places where the original class is injected and your overridden behavior will be called.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "java, spring" }
Convert text data to a numeric value to use in a multiplication I'm trying to calculate the product of three cells but one of the cells is a dropdown which contains text: `B2*C2*D2` (D2 is text) I would like `D2` to be converted as follows: `SELECT` → `0` `NO` → `0` `YES` → `1` So I tried =SUM(COUNTIF(B2:D2,{"SELECT","NO","YES"})*{B2*C2*0,B2*C2*0,B2*C2*1}) but this formula is not working. How could this be done?
The absolutely, positively, definitely, shortest way of doing so is: =B2*C2*(D2="YES") There's no more to say.
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "microsoft excel, worksheet function, microsoft excel 2010" }
How to preg_match for a specific pattern in a url? I would like to use preg_match in PHP to test the format of a URL. The URL looks like this: /2013/09/05/item-01.html I'm trying to get this to work : if (preg_match("/([0-9]{4})\/([0-9]{2})\/([0-9]{2})/[.]+[.html]$", $_SERVER['REQUEST_URI'])) : echo "match"; endif; But something's not quite right. Any ideas?
Try: if (preg_match('!\d{4}/\d{2}/\d{2}/.*\.html$!', $_SERVER['REQUEST_URI'])) { echo 'match'; } `\d` is short for `[0-9]` and you can use different start/end delimiters (I use ! in this case) to make the regexp more readable when you're trying to match slashes.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, regex, url, preg match, segments" }